DOTS Geometry
 
Loading...
Searching...
No Matches
RectExtensions Class Reference

Static Public Member Functions

static float Area (this Rect rect)
 
static Rect CombineWith (this Rect rect, Rect other)
 Returns the rectangle that encloses both this rectangle and another one.
 
static bool Contains (this Rect rect, Rect other)
 Returns true if the other-rect is completely contained in the this-rect.
 
static void Expand (ref this Rect rect, float amount)
 Extends the rectangle by the specified amount to each side.
 
static Vector2[] GetCorners (this Rect rect)
 
static bool IsDegenerate (ref this Rect rect)
 
static float OverlapArea (this Rect rect0, Rect rect1)
 
static Rect[] Subdivide (this Rect rect)
 Divides the rectangle into four smaller boundaries (like in a quadtree). The results are ordered in a Z-Curve.
 
static void Subdivide (this Rect rect, ref NativeList< Rect > subdividedRectangles)
 Divides the rectangle into four smaller boundaries (like in a quadtree). The results are ordered in a Z-Curve.
 
static Vector4 ToVector4 (this Rect rect)
 

Member Function Documentation

◆ Area()

static float Area ( this Rect rect)
static
Parameters
rect
Returns
The area of the rectangle

◆ CombineWith()

static Rect CombineWith ( this Rect rect,
Rect other )
static

Returns the rectangle that encloses both this rectangle and another one.

Parameters
rect
other
Returns

◆ Contains()

static bool Contains ( this Rect rect,
Rect other )
static

Returns true if the other-rect is completely contained in the this-rect.

Parameters
rect
other
Returns

◆ Expand()

static void Expand ( ref this Rect rect,
float amount )
static

Extends the rectangle by the specified amount to each side.

Parameters
rect
amount

◆ GetCorners()

static Vector2[] GetCorners ( this Rect rect)
static
Parameters
rect
Returns
The corners as positions from the rectangle

◆ IsDegenerate()

static bool IsDegenerate ( ref this Rect rect)
static
Parameters
rect
Returns
True if the rectangle has zeros, infinite numbers or contains NaNs. Otherwise, false is returned

◆ OverlapArea()

static float OverlapArea ( this Rect rect0,
Rect rect1 )
static
Parameters
rect0
rect1
Returns
The overlapping area between the two rectangles. If the rectangles do not overlap, 0 is returned

◆ Subdivide() [1/2]

static Rect[] Subdivide ( this Rect rect)
static

Divides the rectangle into four smaller boundaries (like in a quadtree). The results are ordered in a Z-Curve.

Parameters
bounds
Returns

◆ Subdivide() [2/2]

static void Subdivide ( this Rect rect,
ref NativeList< Rect > subdividedRectangles )
static

Divides the rectangle into four smaller boundaries (like in a quadtree). The results are ordered in a Z-Curve.

Parameters
bounds
Returns

◆ ToVector4()

static Vector4 ToVector4 ( this Rect rect)
static
Parameters
rect
Returns
A Vector4 of the format (minX, minY, maxX, maxY), with the values retrieved from the rectangle