Breakroom is now Sinewave Campus. Book a meeting

SRect

客户端类型
在此类中Contains
  1. 函数
  2. Contains
  3. Overlaps
  4. Equals
  5. ToString
  6. New
  7. 属性
  8. X
  9. Y
  10. Width
  11. Height
  12. Position
  13. Center
  14. Min
  15. Max
  16. Size
  17. XMin
  18. YMin
  19. XMax
  20. YMax
  21. Left
  22. Right
  23. Top
  24. Bottom
成员 22
函数ContainsReturns true if the x and y components of point is a point inside this rectangle.
函数OverlapsReturns true if the other rectangle overlaps this one.
函数EqualsReturns true if the rectangles are the same.
函数ToStringReturns string for this Rect.
函数NewConstructs a new SRect
属性X–
属性Y–
属性Width–
属性Height–
属性PositionThe X and Y position of the rectangle.
属性CenterThe position of the center of the rectangle.
属性MinThe position of the minimum corner of the rectangle.
属性MaxThe position of the maximum corner of the rectangle.
属性SizeThe width and height of the rectangle.
属性XMinThe minimum X coordinate of the rectangle.
属性YMinThe minimum Y coordinate of the rectangle.
属性XMaxThe maximum Y coordinate of the rectangle.
属性YMaxThe maximum Y coordinate of the rectangle.
属性Left–
属性Right–
属性Top–
属性Bottom–

函数​

Contains​

bool Contains(SVector point)
bool Contains(SVector point, bool allowInverse)

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.

参数

名称类型默认值
pointSVector–
allowInversebool–

返回值

bool

示例

Lua
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​

bool Overlaps(SRect other)
bool Overlaps(SRect other, bool allowInverse)

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.

参数

名称类型默认值
otherSRect–
allowInversebool–

返回值

bool

示例

Lua
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​

bool Equals(SRect other)

Returns true if the rectangles are the same.

参数

名称类型默认值
otherSRect–

返回值

bool

示例

Lua
newRect=Rect.New(0,0,150,150)
otherRect = Rect.New(0,0,150,150)
AreEqual = newRect.Equals(otherRect)

ToString​

string ToString(string format)
string ToString()

Returns string for this Rect.

参数

名称类型默认值
formatstring–

返回值

string

示例

Lua
newRect=Rect.New(0,0,150,150)
otherRect = Rect.New(0,0,150,150)
AreEqual = newRect.Equals(otherRect)

New​

static SRect New(float x, float y, float width, float height)

Constructs a new SRect

参数

名称类型默认值
xfloat–
yfloat–
widthfloat–
heightfloat–

返回值

SRect

示例

Lua
newRect=Rect.New(0,0,150,150)

属性​

X​

float X {get; set; }

示例

Lua
newRect=Rect.New(0,0,150,150)
newRect.X = 10.0

Y​

float Y {get; set; }

示例

Lua
newRect=Rect.New(0,0,150,150)
newRect.Y = 10.0

Width​

float Width {get; set; }

示例

Lua
newRect=Rect.New(0,0,150,150)
newRect.Width = 10.0

Height​

float Height {get; set; }

示例

Lua
newRect=Rect.New(0,0,150,150)
newRect.Height = 10.0

Position只读​

SVector Position {get; }

The X and Y position of the rectangle.

示例

Lua
newRect=Rect.New(50,50,150,150)
positionVector = newRect.position

Center只读​

SVector Center {get; }

The position of the center of the rectangle.

示例

Lua
newRect = Rect.New(50,50,150,150)
VectorCenter = newRect.Center

Min只读​

SVector Min {get; }

The position of the minimum corner of the rectangle.

示例

Lua
newRect=Rect.New(0,0,150,150)
vectorMin = newRect.Min

Max只读​

SVector Max {get; }

The position of the maximum corner of the rectangle.

示例

Lua
newRect=Rect.New(0,0,150,150)
vectorMax = newRect.Max

Size只读​

SVector Size {get; }

The width and height of the rectangle.

示例

Lua
newRect=Rect.New(0,0,150,150)
vectorSize = newRect.Size

XMin只读​

float XMin {get; }

The minimum X coordinate of the rectangle.

示例

Lua
newRect=Rect.New(0,0,150,150)
floatXMin = newRect.XMin

YMin只读​

float YMin {get; }

The minimum Y coordinate of the rectangle.

示例

Lua
newRect=Rect.New(0,0,150,150)
floatYMin = newRect.YMin

XMax只读​

float XMax {get; }

The maximum Y coordinate of the rectangle.

示例

Lua
newRect=Rect.New(0,0,150,150)
floatXMax = newRect.XMax

YMax只读​

float YMax {get; }

The maximum Y coordinate of the rectangle.

示例

Lua
newRect=Rect.New(0,0,150,150)
floatYMax = newRect.YMax

Left只读​

float Left {get; }

示例

Lua
newRect=Rect.New(0,0,150,150)
floatLeft = newRect.Left
float Right {get; }

示例

Lua
newRect=Rect.New(0,0,150,150)
floatRight = newRect.Right

Top只读​

float Top {get; }

示例

Lua
newRect=Rect.New(0,0,150,150)
floatTop = newRect.Top

Bottom只读​

float Bottom {get; }

示例

Lua
newRect=Rect.New(0,0,150,150)
floatBottom = newRect.Bottom