File size: 745 Bytes
bc20498 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
function PointD(x, y) {
if (x == null && y == null) {
this.x = 0;
this.y = 0;
} else {
this.x = x;
this.y = y;
}
}
PointD.prototype.getX = function ()
{
return this.x;
};
PointD.prototype.getY = function ()
{
return this.y;
};
PointD.prototype.setX = function (x)
{
this.x = x;
};
PointD.prototype.setY = function (y)
{
this.y = y;
};
PointD.prototype.getDifference = function (pt)
{
return new DimensionD(this.x - pt.x, this.y - pt.y);
};
PointD.prototype.getCopy = function ()
{
return new PointD(this.x, this.y);
};
PointD.prototype.translate = function (dim)
{
this.x += dim.width;
this.y += dim.height;
return this;
};
module.exports = PointD;
|