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; | |