Struct Rect
Syntax
Constructors
Rect(Single, Single, Single, Single)
Declaration
public Rect(float x, float y, float width, float height)
Parameters
Fields
height
Declaration
Field Value
width
Declaration
Field Value
x
Declaration
Field Value
y
Declaration
Field Value
Properties
Center
The position of the center of the rectangle.
Declaration
public float2 Center { get; set; }
Property Value
Default
Declaration
public static Rect Default { get; }
Property Value
Size
The width and height of the rectangle.
Declaration
public float2 Size { get; set; }
Property Value
Methods
Clamp(Rect)
Declaration
public void Clamp(Rect r)
Parameters
Type |
Name |
Description |
Rect |
r |
|
Contains(float2)
Returns true if pos
is inside this rectangle.
Declaration
public bool Contains(float2 pos)
Parameters
Type |
Name |
Description |
float2 |
pos |
|
Returns
ContainsInclusive(float2)
Declaration
public bool ContainsInclusive(float2 pos)
Parameters
Type |
Name |
Description |
float2 |
pos |
|
Returns
ContainsInclusive(Rect)
Returns true if other
is inside this rectangle.
Declaration
public bool ContainsInclusive(Rect other)
Parameters
Type |
Name |
Description |
Rect |
other |
|
Returns
Disjoint(Rect)
Returns true if other
is not overlapping with this rectangle.
Declaration
public bool Disjoint(Rect other)
Parameters
Type |
Name |
Description |
Rect |
other |
|
Returns
IsEmpty()
Declaration
Returns
Region(Rect)
Returns a new rectangle translated and scaled by relative
.
Declaration
public Rect Region(in Rect relative)
Parameters
Type |
Name |
Description |
Rect |
relative |
|
Returns
RemoveFrom(Rect, Rect*)
Remove this rect from the other rect and return the up to four remaining pieces
destRects must have enough space for four rectangles
Returns the number of pieces other was broken up into.
Declaration
public int RemoveFrom(Rect other, Rect*destRects)
Parameters
Type |
Name |
Description |
Rect |
other |
|
Rect* |
destRects |
|
Returns