Rectangle Struct Reference

rectangle More...

List of all members.

Public Member Functions

 Rectangle (float x, float y, float width, float height)
 constructor taking 4 floats
 Rectangle (Vector2 position, Vector2 size)
 constructor taking a two Vector2s
 Rectangle (Vector4 v)
 constructor taking a Vector4
Rectangle Inverse ()
 rectangle inverse
void Inverse (out Rectangle result)
 rectangle inverse
Rectangle Lerp (Rectangle r, float f)
 lerp between 2 rectangles
void Lerp (ref Rectangle r, float f, out Rectangle result)
 lerp between 2 rectangles
Vector2 TransformPoint (Vector2 v)
 return this * v (X,Y,0,1)
void TransformPoint (ref Vector2 v, out Vector2 result)
 result = this * v (X,Y,0,1)
Vector2 TransformVector (Vector2 v)
 return this * v (X,Y,0,0)
void TransformVector (ref Vector2 v, out Vector2 result)
 result = this * v (X,Y,0,0)
Rectangle Add (Rectangle r)
 return this + r
void Add (ref Rectangle r, out Rectangle result)
 result = this + r
Rectangle Subtract (Rectangle r)
 return this - r
void Subtract (ref Rectangle r, out Rectangle result)
 result = this - r
Rectangle Multiply (Rectangle r)
 return this * r
void Multiply (ref Rectangle r, out Rectangle result)
 result = this * r
Rectangle Multiply (float f)
 return this * f
void Multiply (float f, out Rectangle result)
 result = this * f
Rectangle Divide (float f)
 return this / f
void Divide (float f, out Rectangle result)
 result = this / f
Rectangle Negate ()
 return -this
void Negate (out Rectangle result)
 result = -this
Vector4 ToVector4 ()
 return the rectangle as a Vector4
void ToVector4 (out Vector4 result)
 return the rectangle as a Vector4
Matrix4 ToMatrix4 ()
 convert this rectangle to a Matrix4
void ToMatrix4 (out Matrix4 result)
 convert this rectangle to a Matrix4
bool IsIdentity ()
 test if this is an identity rectangle
bool IsInfinity ()
 test if any elements of this are Infinity
bool IsNaN ()
 test if any elements of this are NaN
bool Equals (Rectangle r, float epsilon)
 equality test with an epsilon
bool Equals (Rectangle r)
 equality test
override bool Equals (Object o)
 equality test
override string ToString ()
 get the string representation of this rectangle
override int GetHashCode ()
 gets the hash code for this vector

Static Public Member Functions

static Rectangle FromMatrix4 (Matrix4 m)
 return a rectangle representing a 2D translation/scale matrix
static void FromMatrix4 (ref Matrix4 m, out Rectangle result)
 return a rectangle representing a 2D translation/scale matrix
static Rectangle Inverse (Rectangle r)
 static function equivalent to Inverse()
static void Inverse (ref Rectangle r, out Rectangle result)
 static function equivalent to Inverse(out Rectangle)
static Rectangle Lerp (Rectangle r1, Rectangle r2, float f)
 static function equivalent to Lerp(Rectangle, float)
static void Lerp (ref Rectangle r1, ref Rectangle r2, float f, out Rectangle result)
 static function equivalent to Lerp(ref Rectangle, float, out Rectangle)
static Vector2 TransformPoint (Rectangle r, Vector2 v)
 static function equivalent to TransformPoint(Vector2)
static void TransformPoint (ref Rectangle r, ref Vector2 v, out Vector2 result)
 static function equivalent to TransformPoint(ref Vector2, out Vector2)
static Vector2 TransformVector (Rectangle r, Vector2 v)
 static function equivalent to TransformVector(Vector2)
static void TransformVector (ref Rectangle r, ref Vector2 v, out Vector2 result)
 static function equivalent to TransformVector(ref Vector2, out Vector2)
static Rectangle Add (Rectangle r1, Rectangle r2)
 static function equivalent to Add(Rectangle)
static void Add (ref Rectangle r1, ref Rectangle r2, out Rectangle result)
 static function equivalent to Add(ref Rectangle, out Rectangle)
static Rectangle Subtract (Rectangle r1, Rectangle r2)
 static function equivalent to Subtract(Rectangle)
static void Subtract (ref Rectangle r1, ref Rectangle r2, out Rectangle result)
 static function equivalent to Subtract(ref Rectangle, out Rectangle)
static Rectangle Multiply (Rectangle r1, Rectangle r2)
 static function equivalent to Multiply(Rectangle)
static void Multiply (ref Rectangle r1, ref Rectangle r2, out Rectangle result)
 static function equivalent to Multiply(ref Rectangle, out Rectangle)
static Rectangle Multiply (Rectangle r, float f)
 static function equivalent to Multiply(float)
static void Multiply (ref Rectangle r, float f, out Rectangle result)
 static function equivalent to Multiply(float, out Rectangle)
static Rectangle Divide (Rectangle r, float f)
 static function equivalent to Divide(float)
static void Divide (ref Rectangle r, float f, out Rectangle result)
 static function equivalent to Divide(float, out Rectangle)
static Rectangle Negate (Rectangle r)
 static function equivalent to Negate()
static void Negate (ref Rectangle r, out Rectangle result)
 static function equivalent to Negate(out Rectangle)
static bool operator== (Rectangle r1, Rectangle r2)
 equality operator
static bool operator!= (Rectangle r1, Rectangle r2)
 not equals operator
static Rectangle operator+ (Rectangle r1, Rectangle r2)
 addition operator
static Rectangle operator- (Rectangle r1, Rectangle r2)
 subtraction operator
static Rectangle operator- (Rectangle r)
 unary minus operator
static Rectangle operator* (Rectangle r1, Rectangle r2)
 multiplication operator
static Rectangle operator* (Rectangle r, float f)
 multiply a rectangle by a scalar float
static Rectangle operator* (float f, Rectangle r)
 multiply a rectangle by a scalar float
static Rectangle operator/ (Rectangle r, float f)
 division operator

Public Attributes

float X
 X.
float Y
 Y.
float Width
 Width.
float Height
 Height.

Static Public Attributes

static readonly Rectangle Zero = new Rectangle(0.0f, 0.0f, 0.0f, 0.0f)
 a rectangle of all zeroes
static readonly Rectangle Identity = new Rectangle(0.0f, 0.0f, 1.0f, 1.0f)
 identity rectangle

Properties

Vector2 Position [get, set]
 the base position of the rectangle
Vector2 Size [get, set]
 the size dimensions of the rectangle

Detailed Description

rectangle


Constructor & Destructor Documentation

Rectangle ( float  x,
float  y,
float  width,
float  height 
)

constructor taking 4 floats

Parameters:
xx value to init with
yy value to init with
widthwidth value to init with
heightheight value to init with
Rectangle ( Vector2  position,
Vector2  size 
)

constructor taking a two Vector2s

Parameters:
positionthe x, y values to init with
sizethe width, height value to init with

constructor taking a Vector4

Parameters:
vthe vector to init with

Member Function Documentation

Rectangle Add ( Rectangle  r)

return this + r

Parameters:
rrectangle
Returns:
this + r
void Add ( ref Rectangle  r,
out Rectangle  result 
)

result = this + r

Parameters:
rrectangle
resultthis + r
static Rectangle Add ( Rectangle  r1,
Rectangle  r2 
) [static]

static function equivalent to Add(Rectangle)

Parameters:
r1rectangle 1
r2rectangle 2
Returns:
r1 + r2
static void Add ( ref Rectangle  r1,
ref Rectangle  r2,
out Rectangle  result 
) [static]

static function equivalent to Add(ref Rectangle, out Rectangle)

Parameters:
r1rectangle 1
r2rectangle 2
resultr1 + r2
Rectangle Divide ( float  f)

return this / f

Parameters:
fscalar
Returns:
this / f
void Divide ( float  f,
out Rectangle  result 
)

result = this / f

Parameters:
fscalar
resultthis / f
static Rectangle Divide ( Rectangle  r,
float  f 
) [static]

static function equivalent to Divide(float)

Parameters:
rrectangle
fscalar
Returns:
r / f
static void Divide ( ref Rectangle  r,
float  f,
out Rectangle  result 
) [static]

static function equivalent to Divide(float, out Rectangle)

Parameters:
rrectangle
fscalar
resultr / f
bool Equals ( Rectangle  r,
float  epsilon 
)

equality test with an epsilon

Parameters:
rthe rectangle to compare this to
epsilonthe epsilon to use in comparison
Returns:
true if for every element n, abs(this[n] - r[n]) <= epsilon, false otherwise
bool Equals ( Rectangle  r)

equality test

Parameters:
rthe rectangle to compare this to
Returns:
true if this == r, false otherwise
override bool Equals ( Object  o)

equality test

Parameters:
othe object to compare this to
Returns:
true if this == o, false otherwise
static Rectangle FromMatrix4 ( Matrix4  m) [static]

return a rectangle representing a 2D translation/scale matrix

Parameters:
mmatrix to form the rectangle out of
Returns:
a rectangle representing a rectangle matrix
static void FromMatrix4 ( ref Matrix4  m,
out Rectangle  result 
) [static]

return a rectangle representing a 2D translation/scale matrix

Parameters:
mmatrix to form the rectangle out of
resulta rectangle representing a rotation matrix
override int GetHashCode ( )

gets the hash code for this vector

Returns:
integer hash code
void Inverse ( out Rectangle  result)

rectangle inverse

Parameters:
resultrectangle inverse
static Rectangle Inverse ( Rectangle  r) [static]

static function equivalent to Inverse()

Parameters:
rrectangle
Returns:
rectangle inverse
static void Inverse ( ref Rectangle  r,
out Rectangle  result 
) [static]

static function equivalent to Inverse(out Rectangle)

Parameters:
rrectangle
resultrectangle inverse
Rectangle Inverse ( )

rectangle inverse

Returns:
rectangle inverse
bool IsIdentity ( )

test if this is an identity rectangle

Returns:
true if this is an identity rectangle, false otherwise
bool IsInfinity ( )

test if any elements of this are Infinity

Returns:
true if any elements of this are Infinity, false otherwise
bool IsNaN ( )

test if any elements of this are NaN

Returns:
true if any elements of this are NaN, false otherwise
void Lerp ( ref Rectangle  r,
float  f,
out Rectangle  result 
)

lerp between 2 rectangles

Parameters:
rsecond rectangle
flerp amount
resultlerp between this and r
static Rectangle Lerp ( Rectangle  r1,
Rectangle  r2,
float  f 
) [static]

static function equivalent to Lerp(Rectangle, float)

Parameters:
r1rectangle 1
r2rectangle 2
flerp amount
Returns:
lerp between r1 and r2
static void Lerp ( ref Rectangle  r1,
ref Rectangle  r2,
float  f,
out Rectangle  result 
) [static]

static function equivalent to Lerp(ref Rectangle, float, out Rectangle)

Parameters:
r1rectangle 1
r2rectangle 2
flerp amount
resultlerp between r1 and r2
Rectangle Lerp ( Rectangle  r,
float  f 
)

lerp between 2 rectangles

Parameters:
rsecond rectangle
flerp amount
Returns:
lerp between this and r
static void Multiply ( ref Rectangle  r,
float  f,
out Rectangle  result 
) [static]

static function equivalent to Multiply(float, out Rectangle)

Parameters:
rrectangle
fscalar
resultr * f
void Multiply ( float  f,
out Rectangle  result 
)

result = this * f

Parameters:
fscalar
resultthis * f
static Rectangle Multiply ( Rectangle  r1,
Rectangle  r2 
) [static]

static function equivalent to Multiply(Rectangle)

Parameters:
r1rectangle 1
r2rectangle 2
Returns:
r1 * r2
static void Multiply ( ref Rectangle  r1,
ref Rectangle  r2,
out Rectangle  result 
) [static]

static function equivalent to Multiply(ref Rectangle, out Rectangle)

Parameters:
r1rectangle 1
r2rectangle 2
resultr1 * r2
static Rectangle Multiply ( Rectangle  r,
float  f 
) [static]

static function equivalent to Multiply(float)

Parameters:
rrectangle
fscalar
Returns:
r * f
Rectangle Multiply ( Rectangle  r)

return this * r

Parameters:
rrectangle
Returns:
this * r
void Multiply ( ref Rectangle  r,
out Rectangle  result 
)

result = this * r

Parameters:
rrectangle
resultthis * r
Rectangle Multiply ( float  f)

return this * f

Parameters:
fscalar
Returns:
this * f
Rectangle Negate ( )

return -this

Returns:
-this
void Negate ( out Rectangle  result)

result = -this

Parameters:
result-this
static Rectangle Negate ( Rectangle  r) [static]

static function equivalent to Negate()

Parameters:
rrectangle
Returns:
-r
static void Negate ( ref Rectangle  r,
out Rectangle  result 
) [static]

static function equivalent to Negate(out Rectangle)

Parameters:
rrectangle
result-r
static bool operator!= ( Rectangle  r1,
Rectangle  r2 
) [static]

not equals operator

Parameters:
r1first rectangle to compare
r2second rectangle to compare
Returns:
true if r1 != r2, false otherwise
static Rectangle operator* ( Rectangle  r1,
Rectangle  r2 
) [static]

multiplication operator

Parameters:
r1first value to multiply
r2second value to multiply
Returns:
r1 * r2
static Rectangle operator* ( Rectangle  r,
float  f 
) [static]

multiply a rectangle by a scalar float

Parameters:
rrectangle to multiply
ffloat to multiply by
Returns:
r * f
static Rectangle operator* ( float  f,
Rectangle  r 
) [static]

multiply a rectangle by a scalar float

Parameters:
ffloat to multiply by
rrectangle to multiply
Returns:
f * r
static Rectangle operator+ ( Rectangle  r1,
Rectangle  r2 
) [static]

addition operator

Parameters:
r1first rectangle to add
r2second rectangle to add
Returns:
r1 + r2
static Rectangle operator- ( Rectangle  r1,
Rectangle  r2 
) [static]

subtraction operator

Parameters:
r1value to subtract from
r2value to subtract
Returns:
r1 - r2
static Rectangle operator- ( Rectangle  r) [static]

unary minus operator

Parameters:
rrectangle to negate
Returns:
unary minus applied to each member of r
static Rectangle operator/ ( Rectangle  r,
float  f 
) [static]

division operator

Parameters:
rrectangle to divide
fscalar float value to divide by
Returns:
r / f
static bool operator== ( Rectangle  r1,
Rectangle  r2 
) [static]

equality operator

Parameters:
r1first rectangle to compare
r2second rectangle to compare
Returns:
true if r1 == r2, false otherwise
static void Subtract ( ref Rectangle  r1,
ref Rectangle  r2,
out Rectangle  result 
) [static]

static function equivalent to Subtract(ref Rectangle, out Rectangle)

Parameters:
r1rectangle 1
r2rectangle 2
resultr1 - r2
void Subtract ( ref Rectangle  r,
out Rectangle  result 
)

result = this - r

Parameters:
rrectangle
resultthis - r
Rectangle Subtract ( Rectangle  r)

return this - r

Parameters:
rrectangle
Returns:
this - r
static Rectangle Subtract ( Rectangle  r1,
Rectangle  r2 
) [static]

static function equivalent to Subtract(Rectangle)

Parameters:
r1rectangle 1
r2rectangle 2
Returns:
r1 - r2
Matrix4 ToMatrix4 ( )

convert this rectangle to a Matrix4

Returns:
Matrix4 representation of this rectangle
void ToMatrix4 ( out Matrix4  result)

convert this rectangle to a Matrix4

Parameters:
resultMatrix4 representation of this rectangle
override string ToString ( )

get the string representation of this rectangle

Returns:
the string representation of this rectangle
Vector4 ToVector4 ( )

return the rectangle as a Vector4

Returns:
the rectangle as a Vector4
void ToVector4 ( out Vector4  result)

return the rectangle as a Vector4

Parameters:
resultthe rectangle as a Vector4
void TransformPoint ( ref Vector2  v,
out Vector2  result 
)

result = this * v (X,Y,0,1)

Parameters:
vvector
resultthis * v (X,Y,0,1)
Vector2 TransformPoint ( Vector2  v)

return this * v (X,Y,0,1)

Parameters:
vvector
Returns:
this * v (X,Y,0,1)
static void TransformPoint ( ref Rectangle  r,
ref Vector2  v,
out Vector2  result 
) [static]

static function equivalent to TransformPoint(ref Vector2, out Vector2)

Parameters:
rrectangle
vvector
resultr * v (X,Y,0,1)
static Vector2 TransformPoint ( Rectangle  r,
Vector2  v 
) [static]

static function equivalent to TransformPoint(Vector2)

Parameters:
rrectangle
vvector
Returns:
r * v (X,Y,0,1)
static void TransformVector ( ref Rectangle  r,
ref Vector2  v,
out Vector2  result 
) [static]

static function equivalent to TransformVector(ref Vector2, out Vector2)

Parameters:
rrectangle
vvector
resultr * v (X,Y,0,0)
Vector2 TransformVector ( Vector2  v)

return this * v (X,Y,0,0)

Parameters:
vvector
Returns:
this * v (X,Y,0,0)
static Vector2 TransformVector ( Rectangle  r,
Vector2  v 
) [static]

static function equivalent to TransformVector(Vector2)

Parameters:
rrectangle
vvector
Returns:
r * v (X,Y,0,0)
void TransformVector ( ref Vector2  v,
out Vector2  result 
)

result = this * v (X,Y,0,0)

Parameters:
vvector
resultthis * v (X,Y,0,0)

Member Data Documentation

float Height

Height.

readonly Rectangle Identity = new Rectangle(0.0f, 0.0f, 1.0f, 1.0f) [static]

identity rectangle

float Width

Width.

float X

X.

float Y

Y.

readonly Rectangle Zero = new Rectangle(0.0f, 0.0f, 0.0f, 0.0f) [static]

a rectangle of all zeroes


Property Documentation

Vector2 Position [get, set]

the base position of the rectangle

Vector2 Size [get, set]

the size dimensions of the rectangle