Arcade
|
An axis-aligned rectangle, using signed integers for each component. More...
Public Member Functions | |
RectI (Vector2I origin, Vector2I size) | |
Constructs a rectangle with the given lower-left corner and size. More... | |
RectI (int left, int bottom, int right, int top) | |
Constructs a rectangle with the given left, bottom, right and top positions along their corresponding axes. More... | |
bool | Intersects (RectI other) |
Returns true if this rectangle shares a non-zero intersection area with the given rectangle. More... | |
bool | Intersects (Vector2I vec) |
Returns true if the given vector lies within the bounds of this rectangle, excluding the edges. More... | |
bool | Touches (RectI other) |
Returns true if either the given rectangle shares an edge with this one, or if they intersect. More... | |
RectI | Intersection (RectI other) |
Finds a rectangle representing the overlap between this and the given rectangle. More... | |
RectI | Union (RectI other) |
Finds the smallest rectangle that surrounds both this and the given rectangle. More... | |
bool | IntersectsLine (Vector2I start, Vector2I end) |
Returns true if the line between the given start and end vectors intersects with this rectangle. More... | |
bool | IntersectsLine (ref Vector2I start, ref Vector2I 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... | |
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... | |
override int | GetHashCode () |
override string | ToString () |
Gets a string representing this rect in (Center, Size) format. More... | |
Static Public Member Functions | |
static RectI | GetBounds (params Vector2I[] points) |
Returns the smallest rectangle that encloses all of the given points. More... | |
static RectI | GetBounds (IEnumerable< Vector2I > points) |
Returns the smallest rectangle that encloses all of the given points. More... | |
static implicit | operator RectF (RectI bounds) |
static RectI | operator& (RectI a, RectI b) |
Syntactic sugar for finding the intersection of two rectangles. More... | |
static RectI | operator| (RectI a, RectI b) |
Syntactic sugar for finding the union of two rectangles. More... | |
static RectI | operator+ (RectI bounds, Vector2I offset) |
Offsets the rectangle by the given amount. More... | |
static RectI | operator- (RectI bounds, Vector2I offset) |
Offsets the rectangle by the negation of the given amount. More... | |
static RectI | operator* (RectI bounds, int scale) |
Scales the rectangle by the given scalar. More... | |
static RectI | operator* (RectI bounds, Vector2I scale) |
Scales the rectangle by the given vector. More... | |
static RectI | operator/ (RectI bounds, int scale) |
Scales the rectangle by the inverse of the given scalar. More... | |
static RectI | operator/ (RectI bounds, Vector2I scale) |
Scales the rectangle by the inverse of the given vector. More... | |
Public Attributes | |
int | Left |
Horizontal position of the left-most edge. More... | |
int | Bottom |
Vertical position of the lower-most edge. More... | |
int | Right |
Horizontal position of the right-most edge. More... | |
int | Top |
Vertical position of the upper-most edge. More... | |
Static Public Attributes | |
static readonly RectI | Zero = new RectI(0, 0, 0, 0) |
A rectangle with zero width and height positioned at the origin. More... | |
static readonly RectI | UnitSquare = new RectI(0, 0, 1, 1) |
A rectangle with unit width and height centered at (0.5, 0.5). More... | |
Properties | |
int | Width [get, set] |
Difference between the right and left edges. Only modifies the right edge when set. More... | |
int | Height [get, set] |
Difference between the top and bottom edges. Only modifies the top edge when set. More... | |
Vector2I | TopLeft [get, set] |
Vector representing the top left corner. More... | |
Vector2I | TopRight [get, set] |
Vector representing the top right corner. More... | |
Vector2I | BottomLeft [get, set] |
Vector representing the lower left corner. More... | |
Vector2I | BottomRight [get, set] |
Vector representing the lower right corner. More... | |
Vector2I | Size [get, set] |
Vector representing the combined width and height. More... | |
Vector2I | Center [get, set] |
Vector representing the approximate center of the rectangle. More... | |
int | Area [get] |
Product of the width and height. More... | |
An axis-aligned rectangle, using signed integers 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 |
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. |
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.
Finds the smallest rectangle that surrounds both this and the given rectangle.
int GameAPI.RectI.Bottom |
Vertical position of the lower-most edge.
int GameAPI.RectI.Left |
Horizontal position of the left-most edge.
int GameAPI.RectI.Right |
Horizontal position of the right-most edge.
int GameAPI.RectI.Top |
Vertical position of the upper-most edge.
A rectangle with unit width and height centered at (0.5, 0.5).
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 approximate 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.