Integral Points and Rectangles
This module provides integral point and rectangle classes.
Point
Objects of this class typically represent two-dimensional raster locations and sizes. Values may range over all 32-bit integers.
This class has the following construction methods:
Point ()
Constructs a new integral 2D point with uninitialized values.
Returns the new point.
Point (point)
point -> s3d.vec.Point
Constructs a new integral 2D point by copying the given 2D point.
Returns the new point.
Point (h, v)
h -> integer
v -> integer
Constructs a new integral 2D point with the given values.
Returns the new point.
Every instance of this class has the following member methods:
Point:Clone () -> s3d.vec.Point
Returns a newly allocated copy of this object.
Every instance of this class has the following member values, accessible both by numeric indices and the following keys:
1 | "h" -> the horizontal coordinate value
2 | "v" -> the vertical coordinate value
Rectangle
Objects of this class typically represent two-dimensional raster areas. Values may range over all 32-bit integers.
This class has the following construction methods:
Rectangle ()
Constructs a new integral 2D rectangle with uninitialized values.
Returns the new rectangle.
Rectangle (rect)
rect -> s3d.vec.Rectangle
Constructs a new integral 2D rectangle by copying the given 2D rectangle.
Returns the new rectangle.
Rectangle (topLeft, bottomRight)
topLeft -> Point
bottomRight -> Point
Constructs a new integral 2D rectangle from the top left and bottom right points.
Returns the new rectangle.
Rectangle (left, top, right, bottom)
left -> integer
top -> integer
right -> integer
bottom -> integer
Constructs a new integral 2D rectangle with the given values.
Returns the new rectangle.
Every instance of this class has the following member methods:
Rectangle:Clone () -> s3d.vec.Rectangle
Returns a newly allocated copy of this object.
Rectangle:GetHeight () -> integer
Returns the height of this rectangle.
Rectangle:GetWidth () -> integer
Returns the width of this rectangle.
Every instance of this class has the following member values, accessible both by numeric indices and the following keys:
1 | "left" -> the left coordinate value
2 | "top" -> the top coordinate value
3 | "right" -> the right coordinate value
4 | "bottom" -> the bottom coordinate value
along with the following convenience keys:
"topLeft" -> the top left coordinate values as a Point
"bottomRight" -> the bottom right coordinate values as a Point