SRect
| Function | Contains | Returns true if the x and y components of point is a point inside this rectangle. |
| Function | Overlaps | Returns true if the other rectangle overlaps this one. |
| Function | Equals | Returns true if the rectangles are the same. |
| Function | ToString | Returns string for this Rect. |
| Function | New | Constructs a new SRect |
| Property | X | – |
| Property | Y | – |
| Property | Width | – |
| Property | Height | – |
| Property | Position | The X and Y position of the rectangle. |
| Property | Center | The position of the center of the rectangle. |
| Property | Min | The position of the minimum corner of the rectangle. |
| Property | Max | The position of the maximum corner of the rectangle. |
| Property | Size | The width and height of the rectangle. |
| Property | XMin | The minimum X coordinate of the rectangle. |
| Property | YMin | The minimum Y coordinate of the rectangle. |
| Property | XMax | The maximum Y coordinate of the rectangle. |
| Property | YMax | The maximum Y coordinate of the rectangle. |
| Property | Left | – |
| Property | Right | – |
| Property | Top | – |
| Property | Bottom | – |
Functions
Contains
Returns true if the x and y components of point is a point inside this rectangle. If allowInverse is present and true, the width and height of the Rect are allowed to take negative values (ie, the min value is greater than the max), and the test will still work.
Parameters
| Name | Type | Default |
|---|---|---|
| point | SVector | – |
| allowInverse | bool | – |
Returns
bool
Example
newRect=Rect.New(0,0,150,150)
otherRect = Rect.New(0,0,150,150)
isContains = newRect.Contains(otherRect)
--or
isContains = newRect.Contains(otherRect , true)
Overlaps
Returns true if the other rectangle overlaps this one. If allowInverse is present and true, the widths and heights of the Rects are allowed to take negative values (ie, the min value is greater than the max), and the test will still work.
Parameters
| Name | Type | Default |
|---|---|---|
| other | SRect | – |
| allowInverse | bool | – |
Returns
bool
Example
newRect=Rect.New(0,0,150,150)
otherRect = Rect.New(0,0,150,150)
isOverlapping = newRect.Overlaps(otherRect)
--or
isOverlapping = newRect.Overlaps(otherRect , true)
Equals
Returns true if the rectangles are the same.
Parameters
| Name | Type | Default |
|---|---|---|
| other | SRect | – |
Returns
bool
Example
newRect=Rect.New(0,0,150,150)
otherRect = Rect.New(0,0,150,150)
AreEqual = newRect.Equals(otherRect)
ToString
Returns string for this Rect.
Parameters
| Name | Type | Default |
|---|---|---|
| format | string | – |
Returns
string
Example
newRect=Rect.New(0,0,150,150)
otherRect = Rect.New(0,0,150,150)
AreEqual = newRect.Equals(otherRect)
New
Constructs a new SRect
Parameters
| Name | Type | Default |
|---|---|---|
| x | float | – |
| y | float | – |
| width | float | – |
| height | float | – |
Returns
SRect
Example
newRect=Rect.New(0,0,150,150)
Properties
X
Example
newRect=Rect.New(0,0,150,150)
newRect.X = 10.0
Y
Example
newRect=Rect.New(0,0,150,150)
newRect.Y = 10.0
Width
Example
newRect=Rect.New(0,0,150,150)
newRect.Width = 10.0
Height
Example
newRect=Rect.New(0,0,150,150)
newRect.Height = 10.0
PositionRead only
The X and Y position of the rectangle.
Example
newRect=Rect.New(50,50,150,150)
positionVector = newRect.position
CenterRead only
The position of the center of the rectangle.
Example
newRect = Rect.New(50,50,150,150)
VectorCenter = newRect.Center
MinRead only
The position of the minimum corner of the rectangle.
Example
newRect=Rect.New(0,0,150,150)
vectorMin = newRect.Min
MaxRead only
The position of the maximum corner of the rectangle.
Example
newRect=Rect.New(0,0,150,150)
vectorMax = newRect.Max
SizeRead only
The width and height of the rectangle.
Example
newRect=Rect.New(0,0,150,150)
vectorSize = newRect.Size
XMinRead only
The minimum X coordinate of the rectangle.
Example
newRect=Rect.New(0,0,150,150)
floatXMin = newRect.XMin
YMinRead only
The minimum Y coordinate of the rectangle.
Example
newRect=Rect.New(0,0,150,150)
floatYMin = newRect.YMin
XMaxRead only
The maximum Y coordinate of the rectangle.
Example
newRect=Rect.New(0,0,150,150)
floatXMax = newRect.XMax
YMaxRead only
The maximum Y coordinate of the rectangle.
Example
newRect=Rect.New(0,0,150,150)
floatYMax = newRect.YMax
LeftRead only
Example
newRect=Rect.New(0,0,150,150)
floatLeft = newRect.Left
RightRead only
Example
newRect=Rect.New(0,0,150,150)
floatRight = newRect.Right
TopRead only
Example
newRect=Rect.New(0,0,150,150)
floatTop = newRect.Top
BottomRead only
Example
newRect=Rect.New(0,0,150,150)
floatBottom = newRect.Bottom



