"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SLine = void 0; var SPoint_1 = require("./SPoint"); var SLine = (function () { function SLine(x1, y1, x2, y2) { if (x1 == undefined) { this.p1 = new SPoint_1.SPoint(0, 0); this.p2 = new SPoint_1.SPoint(0, 0); } else if (x1 instanceof SLine) { this.p1 = new SPoint_1.SPoint(x1.p1.x, x1.p1.y); this.p2 = new SPoint_1.SPoint(x1.p2.x, x1.p2.y); } else if (x1 instanceof SPoint_1.SPoint && y1 instanceof SPoint_1.SPoint) { this.p1 = new SPoint_1.SPoint(x1.x, x1.y); this.p2 = new SPoint_1.SPoint(y1.x, y1.y); } else { this.p1 = new SPoint_1.SPoint(x1, y1); this.p2 = new SPoint_1.SPoint(x2, y2); } } Object.defineProperty(SLine.prototype, "x1", { get: function () { return this.p1.x; }, set: function (value) { this.p1.x = value; }, enumerable: false, configurable: true }); Object.defineProperty(SLine.prototype, "y1", { get: function () { return this.p1.y; }, set: function (value) { this.p1.y = value; }, enumerable: false, configurable: true }); Object.defineProperty(SLine.prototype, "x2", { get: function () { return this.p2.x; }, set: function (v) { this.p2.x = v; }, enumerable: false, configurable: true }); Object.defineProperty(SLine.prototype, "y2", { get: function () { return this.p2.y; }, set: function (value) { this.p2.y = value; }, enumerable: false, configurable: true }); Object.defineProperty(SLine.prototype, "dx", { get: function () { return this.p2.x - this.p1.x; }, enumerable: false, configurable: true }); Object.defineProperty(SLine.prototype, "dy", { get: function () { return this.p2.y - this.p1.y; }, enumerable: false, configurable: true }); SLine.prototype.isNull = function () { return (Math.abs(this.p1.x - this.p2.x) + Math.abs(this.p1.y - this.p2.y) < 0.000001); }; SLine.prototype.center = function () { return new SPoint_1.SPoint((this.p1.x + this.p2.x) / 2, (this.p1.y + this.p2.y) / 2); }; SLine.prototype.translate = function (dx, dy) { this.p1.x += dx; this.p2.x += dx; this.p1.y += dy; this.p2.y += dy; }; SLine.prototype.translated = function (dx, dy) { return new SLine(this.p1.x + dx, this.p1.y + dy, this.p2.x + dx, this.p2.y + dy); }; return SLine; }()); exports.SLine = SLine;