Catlike Coding
Unity Code Documentation
|
A 2D bounding box. More...
Public Member Functions | |
Bounds2D (float centerX, float centerY, float extendsX, float extendsY) | |
Create a CatlikeCoding.Clipping.Bounds2D struct instance. More... | |
bool | Contains (Vector2 point) |
Return whether a point is contained by the bounds. More... | |
bool | Equals (Bounds2D other) |
Determines whether this bounds exactly matches another bounds. More... | |
Bounds2D | GetIntersectionWith (Bounds2D other) |
Gets the intersection of this and another bounds. More... | |
Bounds2D | GetUnionWith (Bounds2D other) |
Get the union of this and another bounds. More... | |
override string | ToString () |
Return a string representation of a CatlikeCoding.Clipping.Bounds2D. More... | |
Static Public Member Functions | |
static Bounds2D | CreateFromMinMax (Vector2 min, Vector2 max) |
Create new bounds from minimum and maximum point. More... | |
Public Attributes | |
Vector2 | center |
Center of the bounds. More... | |
Vector2 | extends |
Extends of the bounds. They should not be negative. More... | |
Static Public Attributes | |
static readonly Bounds2D | Zero |
Predefined bounds with both a center and extends of zero. More... | |
Properties | |
Bounds | AsBounds [get] |
Get the bounds converted to a 3D Bounds. More... | |
Vector4 | AsVector4 [get] |
Get the bounds converted to a Vector4. More... | |
Vector2 | BottomLeft [get] |
Get the bottom left corner. This is minimum X and Y. More... | |
Vector2 | BottomRight [get] |
Get the bottom right corner. This is maximum X and minimum Y. More... | |
Vector2 | Size [get] |
Get the size. This is double the extends. More... | |
Vector2 | TopLeft [get] |
Get the top left corner. This is minimum X and maximum Y. More... | |
Vector2 | TopRight [get] |
Get the top right corner. This is maximum X and Y. More... | |
A 2D bounding box.
A cousin of Unity's 3D Bounds struct, it has a 2D center and extends vector.
The default interpretation is that the X-axis goes from left to right and the Y-axis goes from bottom to top.
CatlikeCoding.Clipping.Bounds2D.Bounds2D | ( | float | centerX, |
float | centerY, | ||
float | extendsX, | ||
float | extendsY | ||
) |
Create a CatlikeCoding.Clipping.Bounds2D struct instance.
centerX | Center x. |
centerY | Center y. |
extendsX | Extends x. |
extendsY | Extends y. |
bool CatlikeCoding.Clipping.Bounds2D.Contains | ( | Vector2 | point | ) |
Return whether a point is contained by the bounds.
point | A 2D point. |
|
static |
Create new bounds from minimum and maximum point.
min | Minimum point, corresponding to the bottom left corner of the bounds. |
max | Maximum point, corresponding to the top right corner of the bounds. |
bool CatlikeCoding.Clipping.Bounds2D.Equals | ( | Bounds2D | other | ) |
Determines whether this bounds exactly matches another bounds.
Only exact matches are equal, so it's only really useful for checking if cached bounds are still valid.
other | The bounds to compare with. |
Gets the intersection of this and another bounds.
Get the union of this and another bounds.
override string CatlikeCoding.Clipping.Bounds2D.ToString | ( | ) |
Return a string representation of a CatlikeCoding.Clipping.Bounds2D.
Useful for debugging.
Vector2 CatlikeCoding.Clipping.Bounds2D.center |
Center of the bounds.
Vector2 CatlikeCoding.Clipping.Bounds2D.extends |
Extends of the bounds. They should not be negative.
|
static |
Predefined bounds with both a center and extends of zero.
|
get |
Get the bounds converted to a 3D Bounds.
Both the Z-position and Z-extends are zero.
|
get |
Get the bounds converted to a Vector4.
The center is stored in XY and the extends is stored in ZW.
|
get |
Get the bottom left corner. This is minimum X and Y.
|
get |
Get the bottom right corner. This is maximum X and minimum Y.
|
get |
Get the size. This is double the extends.
|
get |
Get the top left corner. This is minimum X and maximum Y.
|
get |
Get the top right corner. This is maximum X and Y.