SRect
| 函数 | Contains | Returns true if the x and y components of point is a point inside this rectangle. |
| 函数 | Overlaps | Returns true if the other rectangle overlaps this one. |
| 函数 | Equals | Returns true if the rectangles are the same. |
| 函数 | ToString | Returns string for this Rect. |
| 函数 | New | Constructs a new SRect |
| 属性 | X | – |
| 属性 | Y | – |
| 属性 | Width | – |
| 属性 | Height | – |
| 属性 | Position | The X and Y position of the rectangle. |
| 属性 | Center | The position of the center of the rectangle. |
| 属性 | Min | The position of the minimum corner of the rectangle. |
| 属性 | Max | The position of the maximum corner of the rectangle. |
| 属性 | Size | The width and height of the rectangle. |
| 属性 | XMin | The minimum X coordinate of the rectangle. |
| 属性 | YMin | The minimum Y coordinate of the rectangle. |
| 属性 | XMax | The maximum Y coordinate of the rectangle. |
| 属性 | YMax | The maximum Y coordinate of the rectangle. |
| 属性 | Left | – |
| 属性 | Right | – |
| 属性 | Top | – |
| 属性 | Bottom | – |
函数
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.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| point | SVector | – |
| allowInverse | bool | – |
返回值
bool
示例
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.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| other | SRect | – |
| allowInverse | bool | – |
返回值
bool
示例
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.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| other | SRect | – |
返回值
bool
示例
newRect=Rect.New(0,0,150,150)
otherRect = Rect.New(0,0,150,150)
AreEqual = newRect.Equals(otherRect)
ToString
Returns string for this Rect.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| format | string | – |
返回值
string
示例
newRect=Rect.New(0,0,150,150)
otherRect = Rect.New(0,0,150,150)
AreEqual = newRect.Equals(otherRect)
New
Constructs a new SRect
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| x | float | – |
| y | float | – |
| width | float | – |
| height | float | – |
返回值
SRect
示例
newRect=Rect.New(0,0,150,150)
属性
X
示例
newRect=Rect.New(0,0,150,150)
newRect.X = 10.0
Y
示例
newRect=Rect.New(0,0,150,150)
newRect.Y = 10.0
Width
示例
newRect=Rect.New(0,0,150,150)
newRect.Width = 10.0
Height
示例
newRect=Rect.New(0,0,150,150)
newRect.Height = 10.0
Position只读
The X and Y position of the rectangle.
示例
newRect=Rect.New(50,50,150,150)
positionVector = newRect.position
Center只读
The position of the center of the rectangle.
示例
newRect = Rect.New(50,50,150,150)
VectorCenter = newRect.Center
Min只读
The position of the minimum corner of the rectangle.
示例
newRect=Rect.New(0,0,150,150)
vectorMin = newRect.Min
Max只读
The position of the maximum corner of the rectangle.
示例
newRect=Rect.New(0,0,150,150)
vectorMax = newRect.Max
Size只读
The width and height of the rectangle.
示例
newRect=Rect.New(0,0,150,150)
vectorSize = newRect.Size
XMin只读
The minimum X coordinate of the rectangle.
示例
newRect=Rect.New(0,0,150,150)
floatXMin = newRect.XMin
YMin只读
The minimum Y coordinate of the rectangle.
示例
newRect=Rect.New(0,0,150,150)
floatYMin = newRect.YMin
XMax只读
The maximum Y coordinate of the rectangle.
示例
newRect=Rect.New(0,0,150,150)
floatXMax = newRect.XMax
YMax只读
The maximum Y coordinate of the rectangle.
示例
newRect=Rect.New(0,0,150,150)
floatYMax = newRect.YMax
Left只读
示例
newRect=Rect.New(0,0,150,150)
floatLeft = newRect.Left
Right只读
示例
newRect=Rect.New(0,0,150,150)
floatRight = newRect.Right
Top只读
示例
newRect=Rect.New(0,0,150,150)
floatTop = newRect.Top
Bottom只读
示例
newRect=Rect.New(0,0,150,150)
floatBottom = newRect.Bottom



