![]() |
Murl Engine Lua Addon API
Version 1.0 beta
|
A rectangle class with 2D coordinates.
The default constructor. Create an empty rectangle with the following properties:
This allowes to Include() a point in an empty rectangle which sets the lower and higher coordinates to the included point.
Murl.Math.Rectangle new()
Constructor to initialize a rectangle with given coordinates. Takes care of setting the lower and higher coordinates correctly.
Murl.Math.Rectangle new(Number x1, Number y1, Number x2, Number y2)
x1 | The X coordinate of the first point. |
y1 | The Y coordinate of the first point. |
x2 | The X coordinate of the second point. |
y2 | The Y coordinate of the second point. |
Set all coordinates of the rectangle instance to a set of given coordinates. Takes care of setting the lower and higher coordinates correctly.
Set(Number x1, Number y1, Number x2, Number y2)
x1 | The X coordinate of the first point. |
y1 | The Y coordinate of the first point. |
x2 | The X coordinate of the second point. |
y2 | The Y coordinate of the second point. |
Copy the content of a source rectangle to the rectangle instance.
Set(Murl.Math.Rectangle other)
other | The rectangle to copy from. |
Set the horizontal start coordinate. This sets the coordinate without taking care about lower and higher coordinates.
SetX1(Number x1)
x1 | The X coordinate of the first point. |
Set the vertical start coordinate. This sets the coordinate without taking care about lower and higher coordinates.
SetY1(Number y1)
y1 | The Y coordinate of the first point. |
Set the horizontal end coordinate. This sets the coordinate without taking care about lower and higher coordinates.
SetX2(Number x2)
x2 | The X coordinate of the second point. |
Set the vertical end coordinate. This sets the coordinate without taking care about lower and higher coordinates.
SetY2(Number y2)
y2 | The Y coordinate of the second point. |
Set the x / y coordinate and the horizontal / vertical size of the rectangle.
SetPositionAndSize(Number x, Number y, Number sizeX, Number sizeY)
x | The X coordinate of the first point. |
y | The Y coordinate of the first point. |
sizeX | The horizontal size of the rectangle. |
sizeY | The vertical size of the rectangle. |
Set the horizontal and vertical size of the rectangle.
SetSize(Number sizeX, Number sizeY)
sizeX | The horizontal size of the rectangle. |
sizeY | The vertical size of the rectangle. |
Set the horizontal size of the rectangle.
SetSizeX(Number size)
size | The horizontal size of the rectangle. |
Set the vertical size of the rectangle.
SetSizeY(Number size)
size | The vertical size of the rectangle. |
Get the lower X coordinate.
Number GetX1()
Get the lower Y coordinate.
Number GetY1()
Get the higher X coordinate.
Number GetX2()
Get the higher Y coordinate.
Number GetY2()
Get the horizontal size of the rectangle.
Number GetSizeX()
Get the vertical size of the rectangle.
Number GetSizeY()
Get the area occupied by the rectangle.
Number GetArea()
Unite this rectangle with another rectangle.
Unite(Murl.Math.Rectangle other)
other | The other rectangle to unite. |
Intersect this rectangle with another rectangle.
Intersect(Murl.Math.Rectangle other)
other | The other rectangle to intersect. |
Include a point in this rectangle. Sets the lower and higher coordinates to the included point if the rectangle is empty, see default constructor Rectangle().
x | The x-position of the point to include. |
y | The y-position of the point to include. |
Check if a given rectangle is intersecting this rectangle.
Boolean IsIntersecting(Murl.Math.Rectangle other)
other | The other rectangle to check. |
Check if a given rectangle is empty, i.e. its area is zero.
Boolean IsEmpty()
Check if the rectangle instance is equal to a given second rectangle. Compares all values within the default epsilon range Limits::Epsilon().
Boolean IsEqual(Murl.Math.Rectangle r)
r | The rectangle to compare. |
Check if the rectangle instance is equal to a given second rectangle. Compares all values within a given epsilon range.
Boolean IsEqual(Murl.Math.Rectangle r, Number epsilon)
r | The rectangle to compare. |
epsilon | The epsilon to compare. |
Get the string representation of the object.
String ToString()
Converts the object content to a string in a reasonable format.
Equal to comparison operator. Performs a test without an epsilon range, which can be used for detecting changes i.e. DoubleBuffer<Rectangle> class. To compare within an epsilon range use Rectangle::IsEqual().