Arcade
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
GameAPI.RectF Struct Reference

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< Vector2FGetCorners ()
 Gets an enumeration over each of the corners of this rectangle. Ordered BottomLeft, BottomRight, TopRight, TopLeft. More...
 
void GetCorners (Vector2F[] dest)
 
IEnumerable< Vector2FGetCorners (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...
 

Detailed Description

An axis-aligned rectangle, using single precision floating-point numbers for each component.

Constructor & Destructor Documentation

GameAPI.RectF.RectF ( Vector2F  origin,
Vector2F  size 
)
inline

Constructs a rectangle with the given lower-left corner and size.

GameAPI.RectF.RectF ( float  left,
float  bottom,
float  right,
float  top 
)
inline

Constructs a rectangle with the given left, bottom, right and top positions along their corresponding axes.

Member Function Documentation

override bool GameAPI.RectF.Equals ( object  obj)
inline
bool GameAPI.RectF.Equals ( RectI  obj)
inline

Tests for equality with another rectangle.

bool GameAPI.RectF.Equals ( RectF  obj)
inline

Tests for equality with another rectangle.

static RectF GameAPI.RectF.GetBounds ( params Vector2F[]  points)
inlinestatic

Returns the smallest rectangle that encloses all of the given points.

Parameters
pointsCollection of points to find the bounding rectangle of.
static RectF GameAPI.RectF.GetBounds ( IEnumerable< Vector2F points)
inlinestatic

Returns the smallest rectangle that encloses all of the given points.

Parameters
pointsCollection of points to find the bounding rectangle of.
IEnumerable<Vector2F> GameAPI.RectF.GetCorners ( )
inline

Gets an enumeration over each of the corners of this rectangle. Ordered BottomLeft, BottomRight, TopRight, TopLeft.

void GameAPI.RectF.GetCorners ( Vector2F[]  dest)
inline
IEnumerable<Vector2F> GameAPI.RectF.GetCorners ( Transform  transform)
inline

Gets an enumeration over each of the corners of this rectangle. Ordered BottomLeft, BottomRight, TopRight, TopLeft.

Parameters
transformTransformation to apply to the rectangle before getting its corner positions.
void GameAPI.RectF.GetCorners ( Transform  transform,
Vector2F[]  dest 
)
inline
override int GameAPI.RectF.GetHashCode ( )
inline
RectF GameAPI.RectF.Intersection ( RectF  other)
inline

Finds a rectangle representing the overlap between this and the given rectangle.

bool GameAPI.RectF.Intersects ( RectF  other)
inline

Returns true if this rectangle shares a non-zero intersection area with the given rectangle.

bool GameAPI.RectF.Intersects ( Vector2F  vec)
inline

Returns true if the given vector lies within the bounds of this rectangle, excluding the edges.

bool GameAPI.RectF.IntersectsLine ( Vector2F  start,
Vector2F  end 
)
inline

Returns true if the line between the given start and end vectors intersects with this rectangle.

Parameters
startStart vector of the line.
endEnd vector of the line.
bool GameAPI.RectF.IntersectsLine ( ref Vector2F  start,
ref Vector2F  end 
)
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.

Parameters
startStart vector of the line.
endEnd vector of the line.
bool GameAPI.RectF.IntersectsLine ( Transform  transform,
Vector2F  start,
Vector2F  end 
)
inline

Returns true if the line between the given start and end vectors intersects with this rectangle.

Parameters
transformTransformation to apply to this rectangle before testing for intersections.
startStart vector of the line.
endEnd vector of the line.
bool GameAPI.RectF.IntersectsLine ( Transform  transform,
ref Vector2F  start,
ref Vector2F  end 
)
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.

Parameters
transformTransformation to apply to this rectangle before testing for intersections.
startStart vector of the line.
endEnd vector of the line.
Vector2F GameAPI.RectF.Map ( Vector2F  vec)
inline

Maps a vector with each component in the range [0, 1] to a corresponding position within this rectangle.

static GameAPI.RectF.operator RectI ( RectF  bounds)
inlineexplicitstatic
static RectF GameAPI.RectF.operator& ( RectF  a,
RectF  b 
)
inlinestatic

Syntactic sugar for finding the intersection of two rectangles.

static RectF GameAPI.RectF.operator* ( RectF  bounds,
float  scale 
)
inlinestatic

Scales the rectangle by the given scalar.

static RectF GameAPI.RectF.operator* ( RectF  bounds,
Vector2F  scale 
)
inlinestatic

Scales the rectangle by the given vector.

static RectF GameAPI.RectF.operator+ ( RectF  bounds,
Vector2F  offset 
)
inlinestatic

Offsets the rectangle by the given amount.

static RectF GameAPI.RectF.operator- ( RectF  bounds,
Vector2F  offset 
)
inlinestatic

Offsets the rectangle by the negation of the given amount.

static RectF GameAPI.RectF.operator/ ( RectF  bounds,
float  scale 
)
inlinestatic

Scales the rectangle by the inverse of the given scalar.

static RectF GameAPI.RectF.operator/ ( RectF  bounds,
Vector2F  scale 
)
inlinestatic

Scales the rectangle by the inverse of the given vector.

static RectF GameAPI.RectF.operator| ( RectF  a,
RectF  b 
)
inlinestatic

Syntactic sugar for finding the union of two rectangles.

override string GameAPI.RectF.ToString ( )
inline

Gets a string representing this rect in (Center, Size) format.

bool GameAPI.RectF.Touches ( RectF  other)
inline

Returns true if either the given rectangle shares an edge with this one, or if they intersect.

bool GameAPI.RectF.Touches ( Vector2F  vec)
inline

Returns true if the given vector lies within the bounds of this rectangle, including the edges.

RectF GameAPI.RectF.TransformedBounds ( Transform  trans)
inline

Finds the smallest bounding rectangle that encloses this one after the given transformation is applied.

Parameters
transTransform to apply before finding a bounding rectangle.
RectF GameAPI.RectF.Union ( RectF  other)
inline

Finds the smallest rectangle that surrounds both this and the given rectangle.

Member Data Documentation

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.

readonly RectF GameAPI.RectF.UnitSquare = new RectF(0, 0, 1, 1)
static

A rectangle with unit width and height centered at (0.5, 0.5).

readonly RectF GameAPI.RectF.UnitSquareCentered = UnitSquare - new Vector2F(.5f, .5f)
static

A rectangle with unit width and height centered at the origin.

readonly RectF GameAPI.RectF.Zero = new RectF(0, 0, 0, 0)
static

A rectangle with zero width and height positioned at the origin.

Property Documentation

float GameAPI.RectF.Area
get

Product of the width and height.

Vector2F GameAPI.RectF.BottomLeft
getset

Vector representing the lower left corner.

Vector2F GameAPI.RectF.BottomRight
getset

Vector representing the lower right corner.

Vector2F GameAPI.RectF.Center
getset

Vector representing the exact center of the rectangle.

float GameAPI.RectF.Height
getset

Difference between the top and bottom edges. Only modifies the top edge when set.

Vector2F GameAPI.RectF.Size
getset

Vector representing the combined width and height.

Vector2F GameAPI.RectF.TopLeft
getset

Vector representing the top left corner.

Vector2F GameAPI.RectF.TopRight
getset

Vector representing the top right corner.

float GameAPI.RectF.Width
getset

Difference between the right and left edges. Only modifies the right edge when set.