First commit.

Signed-off-by: Chen Xiao <abigwc@gmail.com>
This commit is contained in:
Chen Xiao
2026-05-08 14:43:16 +08:00
commit 0b64e2de94
10989 changed files with 2253791 additions and 0 deletions
+130
View File
@@ -0,0 +1,130 @@
function RectangleD(x, y, width, height) {
this.x = 0;
this.y = 0;
this.width = 0;
this.height = 0;
if (x != null && y != null && width != null && height != null) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
}
RectangleD.prototype.getX = function ()
{
return this.x;
};
RectangleD.prototype.setX = function (x)
{
this.x = x;
};
RectangleD.prototype.getY = function ()
{
return this.y;
};
RectangleD.prototype.setY = function (y)
{
this.y = y;
};
RectangleD.prototype.getWidth = function ()
{
return this.width;
};
RectangleD.prototype.setWidth = function (width)
{
this.width = width;
};
RectangleD.prototype.getHeight = function ()
{
return this.height;
};
RectangleD.prototype.setHeight = function (height)
{
this.height = height;
};
RectangleD.prototype.getRight = function ()
{
return this.x + this.width;
};
RectangleD.prototype.getBottom = function ()
{
return this.y + this.height;
};
RectangleD.prototype.intersects = function (a)
{
if (this.getRight() < a.x)
{
return false;
}
if (this.getBottom() < a.y)
{
return false;
}
if (a.getRight() < this.x)
{
return false;
}
if (a.getBottom() < this.y)
{
return false;
}
return true;
};
RectangleD.prototype.getCenterX = function ()
{
return this.x + this.width / 2;
};
RectangleD.prototype.getMinX = function ()
{
return this.getX();
};
RectangleD.prototype.getMaxX = function ()
{
return this.getX() + this.width;
};
RectangleD.prototype.getCenterY = function ()
{
return this.y + this.height / 2;
};
RectangleD.prototype.getMinY = function ()
{
return this.getY();
};
RectangleD.prototype.getMaxY = function ()
{
return this.getY() + this.height;
};
RectangleD.prototype.getWidthHalf = function ()
{
return this.width / 2;
};
RectangleD.prototype.getHeightHalf = function ()
{
return this.height / 2;
};
module.exports = RectangleD;