A* Pathfinding Project  4.3.8
The A* Pathfinding Project for Unity 3D
IntRect Struct Reference

Integer Rectangle. More...

Detailed Description

Integer Rectangle.

Works almost like UnityEngine.Rect but with integer coordinates

Public Member Functions

 IntRect (int xmin, int ymin, int xmax, int ymax)
 
bool Contains (int x, int y)
 
bool Contains (IntRect other)
 
void DebugDraw (GraphTransform transform, Color color)
 Draws some debug lines representing the rect. More...
 
override bool Equals (System.Object obj)
 
IntRect Expand (int range)
 Returns a new rect which is expanded by range in all directions. More...
 
IntRect ExpandToContain (int x, int y)
 Returns a new IntRect which is expanded to contain the point. More...
 
override int GetHashCode ()
 
bool IsValid ()
 Returns if this rectangle is valid. More...
 
IntRect Offset (Int2 offset)
 Returns a new IntRect which has been moved by an offset. More...
 
override string ToString ()
 

Static Public Member Functions

static IntRect Intersection (IntRect a, IntRect b)
 Returns the intersection rect between the two rects. More...
 
static bool Intersects (IntRect a, IntRect b)
 Returns if the two rectangles intersect each other. More...
 
static bool operator!= (IntRect a, IntRect b)
 
static bool operator== (IntRect a, IntRect b)
 
static IntRect Union (IntRect a, IntRect b)
 Returns a new rect which contains both input rects. More...
 

Public Attributes

int xmax
 
int xmin
 
int ymax
 
int ymin
 

Properties

int Height [get]
 
int Width [get]
 

Constructor & Destructor Documentation

◆ IntRect()

IntRect ( int  xmin,
int  ymin,
int  xmax,
int  ymax 
)

Member Function Documentation

◆ Contains() [1/2]

bool Contains ( int  x,
int  y 
)

◆ Contains() [2/2]

bool Contains ( IntRect  other)

◆ DebugDraw()

void DebugDraw ( GraphTransform  transform,
Color  color 
)

Draws some debug lines representing the rect.

◆ Equals()

override bool Equals ( System.Object  obj)

◆ Expand()

IntRect Expand ( int  range)

Returns a new rect which is expanded by range in all directions.

Parameters
rangeHow far to expand. Negative values are permitted.

◆ ExpandToContain()

IntRect ExpandToContain ( int  x,
int  y 
)

Returns a new IntRect which is expanded to contain the point.

◆ GetHashCode()

override int GetHashCode ( )

◆ Intersection()

static IntRect Intersection ( IntRect  a,
IntRect  b 
)
static

Returns the intersection rect between the two rects.

The intersection rect is the area which is inside both rects. If the rects do not have an intersection, an invalid rect is returned.

See also
IsValid

◆ Intersects()

static bool Intersects ( IntRect  a,
IntRect  b 
)
static

Returns if the two rectangles intersect each other.

◆ IsValid()

bool IsValid ( )

Returns if this rectangle is valid.

An invalid rect could have e.g xmin > xmax. Rectamgles with a zero area area invalid.

◆ Offset()

IntRect Offset ( Int2  offset)

Returns a new IntRect which has been moved by an offset.

◆ operator!=()

static bool operator!= ( IntRect  a,
IntRect  b 
)
static

◆ operator==()

static bool operator== ( IntRect  a,
IntRect  b 
)
static

◆ ToString()

override string ToString ( )

◆ Union()

static IntRect Union ( IntRect  a,
IntRect  b 
)
static

Returns a new rect which contains both input rects.

This rectangle may contain areas outside both input rects as well in some cases.

Member Data Documentation

◆ xmax

int xmax

◆ xmin

int xmin

◆ ymax

int ymax

◆ ymin

int ymin

Property Documentation

◆ Height

int Height
get

◆ Width

int Width
get

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