A* Pathfinding Project
3.8
The A* Pathfinding Project for Unity 3D
|
Integer Rectangle. More...
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) |
void | DebugDraw (Matrix4x4 matrix, Color col) |
Draws some debug lines representing the rect. | |
override bool | Equals (System.Object _b) |
IntRect | Expand (int range) |
Returns a new rect which is expanded by range in all directions. | |
IntRect | ExpandToContain (int x, int y) |
Returns a new IntRect which is expanded to contain the point. | |
override int | GetHashCode () |
bool | IsValid () |
Returns if this rectangle is valid. | |
IntRect | Offset (Int2 offset) |
Returns a new rect which is offset by the specified amount. | |
IntRect | Offset (int x, int y) |
Returns a new rect which is offset by the specified amount. | |
IntRect | Rotate (int r) |
Returns a new rect rotated around the origin 90*r degrees. | |
override string | ToString () |
Static Public Member Functions | |
static IntRect | Intersection (IntRect a, IntRect b) |
Returns the intersection rect between the two rects. | |
static bool | Intersects (IntRect a, IntRect b) |
Returns if the two rectangles intersect each other. | |
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. | |
Public Attributes | |
int | xmax |
int | xmin |
int | ymax |
int | ymin |
Properties | |
int | Height [get] |
int | Width [get] |
Static Private Attributes | |
static readonly int[] | Rotations |
Matrices for rotation. | |
IntRect | ( | int | xmin, |
int | ymin, | ||
int | xmax, | ||
int | ymax | ||
) |
bool Contains | ( | int | x, |
int | y | ||
) |
void DebugDraw | ( | Matrix4x4 | matrix, |
Color | col | ||
) |
Draws some debug lines representing the rect.
override bool Equals | ( | System.Object | _b | ) |
IntRect Expand | ( | int | range | ) |
Returns a new rect which is expanded by range in all directions.
range | How far to expand. Negative values are permitted. |
IntRect ExpandToContain | ( | int | x, |
int | y | ||
) |
Returns a new IntRect which is expanded to contain the point.
override int GetHashCode | ( | ) |
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.
Returns if the two rectangles intersect each other.
bool IsValid | ( | ) |
Returns if this rectangle is valid.
An invalid rect could have e.g xmin > xmax. Rectamgles with a zero area area invalid.
IntRect Offset | ( | int | x, |
int | y | ||
) |
Returns a new rect which is offset by the specified amount.
IntRect Rotate | ( | int | r | ) |
Returns a new rect rotated around the origin 90*r degrees.
Ensures that a valid rect is returned.
override string ToString | ( | ) |
Returns a new rect which contains both input rects.
This rectangle may contain areas outside both input rects as well in some cases.
|
staticprivate |
Matrices for rotation.
Each group of 4 elements is a 2x2 matrix. The XZ position is multiplied by this. So
int xmax |
int xmin |
int ymax |
int ymin |
|
get |
|
get |