Arcade
|
An axis-aligned rectangle, using single precision floating-point numbers for each component. More...
Public Member Functions | |
RectF (Vector2F origin, Vector2F size) | |
Constructs a rectangle with the given lower-left corner and size. More... | |
RectF (float left, float bottom, float right, float top) | |
Constructs a rectangle with the given left, bottom, right and top positions along their corresponding axes. More... | |
bool | Intersects (RectF other) |
Returns true if this rectangle shares a non-zero intersection area with the given rectangle. More... | |
bool | Intersects (Vector2F vec) |
Returns true if the given vector lies within the bounds of this rectangle, excluding the edges. More... | |
bool | Touches (RectF other) |
Returns true if either the given rectangle shares an edge with this one, or if they intersect. More... | |
bool | Touches (Vector2F vec) |
Returns true if the given vector lies within the bounds of this rectangle, including the edges. More... | |
RectF | Intersection (RectF other) |
Finds a rectangle representing the overlap between this and the given rectangle. More... | |
RectF | Union (RectF other) |
Finds the smallest rectangle that surrounds both this and the given rectangle. More... | |
bool | IntersectsLine (Vector2F start, Vector2F end) |
Returns true if the line between the given start and end vectors intersects with this rectangle. More... | |
bool | IntersectsLine (ref Vector2F start, ref Vector2F end) |
Returns true if the line between the given start and end vectors intersects with this rectangle. If it does intersect, start and end are modified to be the start and end of the intersecting part of the line. More... | |
bool | IntersectsLine (Transform transform, Vector2F start, Vector2F end) |
Returns true if the line between the given start and end vectors intersects with this rectangle. More... | |
bool | IntersectsLine (Transform transform, ref Vector2F start, ref Vector2F end) |
Returns true if the line between the given start and end vectors intersects with this rectangle. If it does intersect, start and end are modified to be the start and end of the intersecting part of the line. More... | |
Vector2F | Map (Vector2F vec) |
Maps a vector with each component in the range [0, 1] to a corresponding position within this rectangle. More... | |
RectF | TransformedBounds (Transform trans) |
Finds the smallest bounding rectangle that encloses this one after the given transformation is applied. More... | |
override bool | Equals (object obj) |
bool | Equals (RectI obj) |
Tests for equality with another rectangle. More... | |
bool | Equals (RectF obj) |
Tests for equality with another rectangle. More... | |
IEnumerable< Vector2F > | GetCorners () |
Gets an enumeration over each of the corners of this rectangle. Ordered BottomLeft, BottomRight, TopRight, TopLeft. More... | |
void | GetCorners (Vector2F[] dest) |
IEnumerable< Vector2F > | GetCorners (Transform transform) |
Gets an enumeration over each of the corners of this rectangle. Ordered BottomLeft, BottomRight, TopRight, TopLeft. More... | |
void | GetCorners (Transform transform, Vector2F[] dest) |
override int | GetHashCode () |
override string | ToString () |
Gets a string representing this rect in (Center, Size) format. More... | |
Static Public Member Functions | |
static RectF | GetBounds (params Vector2F[] points) |
Returns the smallest rectangle that encloses all of the given points. More... | |
static RectF | GetBounds (IEnumerable< Vector2F > points) |
Returns the smallest rectangle that encloses all of the given points. More... | |
static | operator RectI (RectF bounds) |
static RectF | operator& (RectF a, RectF b) |
Syntactic sugar for finding the intersection of two rectangles. More... | |
static RectF | operator| (RectF a, RectF b) |
Syntactic sugar for finding the union of two rectangles. More... | |
static RectF | operator+ (RectF bounds, Vector2F offset) |
Offsets the rectangle by the given amount. More... | |
static RectF | operator- (RectF bounds, Vector2F offset) |
Offsets the rectangle by the negation of the given amount. More... | |
static RectF | operator* (RectF bounds, float scale) |
Scales the rectangle by the given scalar. More... | |
static RectF | operator* (RectF bounds, Vector2F scale) |
Scales the rectangle by the given vector. More... | |
static RectF | operator/ (RectF bounds, float scale) |
Scales the rectangle by the inverse of the given scalar. More... | |
static RectF | operator/ (RectF bounds, Vector2F scale) |
Scales the rectangle by the inverse of the given vector. More... | |
Public Attributes | |
float | Left |
Horizontal position of the left-most edge. More... | |
float | Bottom |
Vertical position of the lower-most edge. More... | |
float | Right |
Horizontal position of the right-most edge. More... | |
float | Top |
Vertical position of the upper-most edge. More... | |
Static Public Attributes | |
static readonly RectF | Zero = new RectF(0, 0, 0, 0) |
A rectangle with zero width and height positioned at the origin. More... | |
static readonly RectF | UnitSquare = new RectF(0, 0, 1, 1) |
A rectangle with unit width and height centered at (0.5, 0.5). More... | |
static readonly RectF | UnitSquareCentered = UnitSquare - new Vector2F(.5f, .5f) |
A rectangle with unit width and height centered at the origin. More... | |
Properties | |
float | Width [get, set] |
Difference between the right and left edges. Only modifies the right edge when set. More... | |
float | Height [get, set] |
Difference between the top and bottom edges. Only modifies the top edge when set. More... | |
Vector2F | TopLeft [get, set] |
Vector representing the top left corner. More... | |
Vector2F | TopRight [get, set] |
Vector representing the top right corner. More... | |
Vector2F | BottomLeft [get, set] |
Vector representing the lower left corner. More... | |
Vector2F | BottomRight [get, set] |
Vector representing the lower right corner. More... | |
Vector2F | Size [get, set] |
Vector representing the combined width and height. More... | |
Vector2F | Center [get, set] |
Vector representing the exact center of the rectangle. More... | |
float | Area [get] |
Product of the width and height. More... | |
An axis-aligned rectangle, using single precision floating-point numbers for each component.
Constructs a rectangle with the given lower-left corner and size.
|
inline |
Constructs a rectangle with the given left, bottom, right and top positions along their corresponding axes.
|
inline |
|
inline |
Tests for equality with another rectangle.
|
inline |
Tests for equality with another rectangle.
Returns the smallest rectangle that encloses all of the given points.
points | Collection of points to find the bounding rectangle of. |
Returns the smallest rectangle that encloses all of the given points.
points | Collection of points to find the bounding rectangle of. |
|
inline |
Gets an enumeration over each of the corners of this rectangle. Ordered BottomLeft, BottomRight, TopRight, TopLeft.
|
inline |
Gets an enumeration over each of the corners of this rectangle. Ordered BottomLeft, BottomRight, TopRight, TopLeft.
transform | Transformation to apply to the rectangle before getting its corner positions. |
|
inline |
Finds a rectangle representing the overlap between this and the given rectangle.
|
inline |
Returns true if this rectangle shares a non-zero intersection area with the given rectangle.
|
inline |
Returns true if the given vector lies within the bounds of this rectangle, excluding the edges.
Returns true if the line between the given start and end vectors intersects with this rectangle.
start | Start vector of the line. |
end | End vector of the line. |
Returns true if the line between the given start and end vectors intersects with this rectangle. If it does intersect, start and end are modified to be the start and end of the intersecting part of the line.
start | Start vector of the line. |
end | End vector of the line. |
Returns true if the line between the given start and end vectors intersects with this rectangle.
transform | Transformation to apply to this rectangle before testing for intersections. |
start | Start vector of the line. |
end | End vector of the line. |
|
inline |
Returns true if the line between the given start and end vectors intersects with this rectangle. If it does intersect, start and end are modified to be the start and end of the intersecting part of the line.
transform | Transformation to apply to this rectangle before testing for intersections. |
start | Start vector of the line. |
end | End vector of the line. |
Maps a vector with each component in the range [0, 1] to a corresponding position within this rectangle.
Syntactic sugar for finding the intersection of two rectangles.
Scales the rectangle by the given scalar.
Scales the rectangle by the given vector.
Offsets the rectangle by the given amount.
Offsets the rectangle by the negation of the given amount.
Scales the rectangle by the inverse of the given scalar.
Scales the rectangle by the inverse of the given vector.
Syntactic sugar for finding the union of two rectangles.
|
inline |
Gets a string representing this rect in (Center, Size) format.
|
inline |
Returns true if either the given rectangle shares an edge with this one, or if they intersect.
|
inline |
Returns true if the given vector lies within the bounds of this rectangle, including the edges.
Finds the smallest bounding rectangle that encloses this one after the given transformation is applied.
trans | Transform to apply before finding a bounding rectangle. |
Finds the smallest rectangle that surrounds both this and the given rectangle.
float GameAPI.RectF.Bottom |
Vertical position of the lower-most edge.
float GameAPI.RectF.Left |
Horizontal position of the left-most edge.
float GameAPI.RectF.Right |
Horizontal position of the right-most edge.
float GameAPI.RectF.Top |
Vertical position of the upper-most edge.
A rectangle with unit width and height centered at (0.5, 0.5).
|
static |
A rectangle with unit width and height centered at the origin.
A rectangle with zero width and height positioned at the origin.
|
get |
Product of the width and height.
|
getset |
Vector representing the lower left corner.
|
getset |
Vector representing the lower right corner.
|
getset |
Vector representing the exact center of the rectangle.
|
getset |
Difference between the top and bottom edges. Only modifies the top edge when set.
|
getset |
Vector representing the combined width and height.
|
getset |
Vector representing the top left corner.
|
getset |
Vector representing the top right corner.
|
getset |
Difference between the right and left edges. Only modifies the right edge when set.