Falco Engine 3.9.0.1 (beta)
FalcoEngine.Rect Struct Reference

Public Member Functions

 Rect (float x, float y, float width, float height)
 
 Rect (Vector2 position, Vector2 size)
 
 Rect (Rect source)
 
void Set (float x, float y, float width, float height)
 
bool Contains (Vector2 point)
 
bool Contains (Vector3 point)
 
bool Contains (Vector3 point, bool allowInverse)
 
bool Overlaps (Rect other)
 
bool Overlaps (Rect other, bool allowInverse)
 
override int GetHashCode ()
 
override bool Equals (object other)
 
bool Equals (Rect other)
 
override string ToString ()
 
string ToString (string format)
 

Static Public Member Functions

static Rect MinMaxRect (float xmin, float ymin, float xmax, float ymax)
 
static Vector2 NormalizedToPoint (Rect rectangle, Vector2 normalizedRectCoordinates)
 
static Vector2 PointToNormalized (Rect rectangle, Vector2 point)
 
static bool operator!= (Rect lhs, Rect rhs)
 
static bool operator== (Rect lhs, Rect rhs)
 

Properties

static Rect zero [get]
 
float x [getset]
 
float y [getset]
 
Vector2 position [getset]
 
Vector2 center [getset]
 
Vector2 min [getset]
 
Vector2 max [getset]
 
float width [getset]
 
float height [getset]
 
Vector2 size [getset]
 
float xMin [getset]
 
float yMin [getset]
 
float xMax [getset]
 
float yMax [getset]
 

Detailed Description

Definition at line 9 of file Rect.cs.

Constructor & Destructor Documentation

◆ Rect() [1/3]

FalcoEngine.Rect.Rect ( float  x,
float  y,
float  width,
float  height 
)

Creates a new rectangle.

Parameters
xThe X value the rect is measured from.
yThe Y value the rect is measured from.
widthThe width of the rectangle.
heightThe height of the rectangle.

Definition at line 232 of file Rect.cs.

◆ Rect() [2/3]

FalcoEngine.Rect.Rect ( Vector2  position,
Vector2  size 
)

Creates a rectangle given a size and position.

Parameters
positionThe position of the minimum corner of the rect.
sizeThe width and height of the rect.

Definition at line 245 of file Rect.cs.

◆ Rect() [3/3]

FalcoEngine.Rect.Rect ( Rect  source)

Parameters
source

Definition at line 257 of file Rect.cs.

Member Function Documentation

◆ Contains() [1/3]

bool FalcoEngine.Rect.Contains ( Vector2  point)

Returns true if the x and y components of point is a point inside this rectangle. If allowInverse is present and true, the width and height of the Rect are allowed to take negative values (ie, the min value is greater than the max), and the test will still work.

Parameters
pointPoint to test.
allowInverseDoes the test allow the Rect's width and height to be negative?
Returns
True if the point lies within the specified rectangle.

Definition at line 303 of file Rect.cs.

◆ Contains() [2/3]

bool FalcoEngine.Rect.Contains ( Vector3  point)

Returns true if the x and y components of point is a point inside this rectangle. If allowInverse is present and true, the width and height of the Rect are allowed to take negative values (ie, the min value is greater than the max), and the test will still work.

Parameters
pointPoint to test.
allowInverseDoes the test allow the Rect's width and height to be negative?
Returns
True if the point lies within the specified rectangle.

Definition at line 316 of file Rect.cs.

◆ Contains() [3/3]

bool FalcoEngine.Rect.Contains ( Vector3  point,
bool  allowInverse 
)

Returns true if the x and y components of point is a point inside this rectangle. If allowInverse is present and true, the width and height of the Rect are allowed to take negative values (ie, the min value is greater than the max), and the test will still work.

Parameters
pointPoint to test.
allowInverseDoes the test allow the Rect's width and height to be negative?
Returns
True if the point lies within the specified rectangle.

Definition at line 329 of file Rect.cs.

◆ Equals() [1/2]

override bool FalcoEngine.Rect.Equals ( object  other)

Definition at line 425 of file Rect.cs.

◆ Equals() [2/2]

bool FalcoEngine.Rect.Equals ( Rect  other)

Definition at line 434 of file Rect.cs.

◆ GetHashCode()

override int FalcoEngine.Rect.GetHashCode ( )

Definition at line 420 of file Rect.cs.

◆ MinMaxRect()

static Rect FalcoEngine.Rect.MinMaxRect ( float  xmin,
float  ymin,
float  xmax,
float  ymax 
)
static

Creates a rectangle from min/max coordinate values.

Parameters
xminThe minimum X coordinate.
yminThe minimum Y coordinate.
xmaxThe maximum X coordinate.
ymaxThe maximum Y coordinate.
Returns
A rectangle matching the specified coordinates.

Definition at line 275 of file Rect.cs.

◆ NormalizedToPoint()

static Vector2 FalcoEngine.Rect.NormalizedToPoint ( Rect  rectangle,
Vector2  normalizedRectCoordinates 
)
static

Returns a point inside a rectangle, given normalized coordinates.

Parameters
rectangleRectangle to get a point inside.
normalizedRectCoordinatesNormalized coordinates to get a point for.

Definition at line 395 of file Rect.cs.

◆ operator!=()

static bool FalcoEngine.Rect.operator!= ( Rect  lhs,
Rect  rhs 
)
static

Definition at line 410 of file Rect.cs.

◆ operator==()

static bool FalcoEngine.Rect.operator== ( Rect  lhs,
Rect  rhs 
)
static

Definition at line 415 of file Rect.cs.

◆ Overlaps() [1/2]

bool FalcoEngine.Rect.Overlaps ( Rect  other)

Returns true if the other rectangle overlaps this one. If allowInverse is present and true, the widths and heights of the Rects are allowed to take negative values (ie, the min value is greater than the max), and the test will still work.

Parameters
otherOther rectangle to test overlapping with.
allowInverseDoes the test allow the widths and heights of the Rects to be negative?

Definition at line 369 of file Rect.cs.

◆ Overlaps() [2/2]

bool FalcoEngine.Rect.Overlaps ( Rect  other,
bool  allowInverse 
)

Returns true if the other rectangle overlaps this one. If allowInverse is present and true, the widths and heights of the Rects are allowed to take negative values (ie, the min value is greater than the max), and the test will still work.

Parameters
otherOther rectangle to test overlapping with.
allowInverseDoes the test allow the widths and heights of the Rects to be negative?

Definition at line 379 of file Rect.cs.

◆ PointToNormalized()

static Vector2 FalcoEngine.Rect.PointToNormalized ( Rect  rectangle,
Vector2  point 
)
static

Returns the normalized coordinates cooresponding the the point.

Parameters
rectangleRectangle to get normalized coordinates inside.
pointA point inside the rectangle to get normalized coordinates for.

Definition at line 405 of file Rect.cs.

◆ Set()

void FalcoEngine.Rect.Set ( float  x,
float  y,
float  width,
float  height 
)

Set components of an existing Rect.

Parameters
x
y
width
height

Definition at line 287 of file Rect.cs.

◆ ToString() [1/2]

override string FalcoEngine.Rect.ToString ( )

Returns a nicely formatted string for this Rect.

Parameters
format

Definition at line 443 of file Rect.cs.

◆ ToString() [2/2]

string FalcoEngine.Rect.ToString ( string  format)

Returns a nicely formatted string for this Rect.

Parameters
format

Definition at line 452 of file Rect.cs.

Property Documentation

◆ center

Vector2 FalcoEngine.Rect.center
getset

The position of the center of the rectangle.

Definition at line 70 of file Rect.cs.

◆ height

float FalcoEngine.Rect.height
getset

The height of the rectangle, measured from the Y position.

Definition at line 133 of file Rect.cs.

◆ max

Vector2 FalcoEngine.Rect.max
getset

The position of the maximum corner of the rectangle.

Definition at line 102 of file Rect.cs.

◆ min

Vector2 FalcoEngine.Rect.min
getset

The position of the minimum corner of the rectangle.

Definition at line 86 of file Rect.cs.

◆ position

Vector2 FalcoEngine.Rect.position
getset

The X and Y position of the rectangle.

Definition at line 54 of file Rect.cs.

◆ size

Vector2 FalcoEngine.Rect.size
getset

The width and height of the rectangle.

Definition at line 148 of file Rect.cs.

◆ width

float FalcoEngine.Rect.width
getset

The width of the rectangle, measured from the X position.

Definition at line 118 of file Rect.cs.

◆ x

float FalcoEngine.Rect.x
getset

The X coordinate of the rectangle.

Definition at line 24 of file Rect.cs.

◆ xMax

float FalcoEngine.Rect.xMax
getset

The maximum X coordinate of the rectangle.

Definition at line 198 of file Rect.cs.

◆ xMin

float FalcoEngine.Rect.xMin
getset

The minimum X coordinate of the rectangle.

Definition at line 164 of file Rect.cs.

◆ y

float FalcoEngine.Rect.y
getset

The Y coordinate of the rectangle.

Definition at line 39 of file Rect.cs.

◆ yMax

float FalcoEngine.Rect.yMax
getset

The maximum Y coordinate of the rectangle.

Definition at line 213 of file Rect.cs.

◆ yMin

float FalcoEngine.Rect.yMin
getset

The minimum Y coordinate of the rectangle.

Definition at line 181 of file Rect.cs.

◆ zero

Rect FalcoEngine.Rect.zero
staticget

Shorthand for writing new Rect(0,0,0,0).

Definition at line 19 of file Rect.cs.


The documentation for this struct was generated from the following file: