Public Methods |
float | MinX () const |
| Get the minimum X value of the box.
|
float | MinY () const |
| Get the minimum Y value of the box.
|
float | MaxX () const |
| Get the maximum X value of the box.
|
float | MaxY () const |
| Get the maximum Y value of the box.
|
float | Min (int idx) const |
| Get Min component for 0 (x) or 1 (y).
|
float | Max (int idx) const |
| Get Max component for 0 (x) or 1 (y).
|
const csVector2& | Min () const |
| Get the 2d vector of minimum (x, y) values.
|
const csVector2& | Max () const |
| Get the 2d vector of maximum (x, y) values.
|
csVector2 | GetCorner (int corner) const |
| Return every corner of this bounding box from 0 to 3. More...
|
csVector2 | GetCenter () const |
| Get the center of this box.
|
void | SetCenter (const csVector2 &c) |
| Set the center of this box. More...
|
void | SetSize (const csVector2 &s) |
| Set the size of the box but keep the center intact.
|
void | GetEdgeInfo (int edge, int &v1, int &v2) const |
| Given an edge index (CS_BOX_EDGE_???) return the two vertices (index CS_BOX_CORNER_???).
|
csSegment2 | GetEdge (int edge) const |
| Return every edge (segment) of this bounding box from 0 to 7 (CS_BOX_EDGE_???).
|
void | GetEdge (int edge, csSegment2 &e) const |
| Return every edge (segment) of this bounding box from 0 to 7 (CS_BOX_EDGE_???).
|
bool | Intersect (csVector2 *poly, int num_poly) const |
| Test if a polygon if visible in the box. More...
|
bool | In (float x, float y) const |
| Test if the given coordinate is in this box.
|
bool | In (const csVector2 &v) const |
| Test if the given coordinate is in this box.
|
bool | Overlap (const csBox2 &box) const |
| Test if this box overlaps with the given box.
|
bool | Contains (const csBox2 &box) const |
| Test if this box contains the other box.
|
bool | Empty () const |
| Test if this box is empty.
|
float | SquaredOriginDist () const |
| Calculate the squared distance between (0,0) and the box This routine is extremely efficient.
|
float | SquaredOriginMaxDist () const |
| Calculate the squared distance between (0,0) and the point on the box which is furthest away from (0,0). More...
|
void | StartBoundingBox () |
| Initialize this box to empty.
|
void | StartBoundingBox (const csVector2 &v) |
| Initialize this box to one vertex.
|
void | StartBoundingBox (float x, float y) |
| Same but given some coordinates.
|
void | AddBoundingVertex (float x, float y) |
| Add a new vertex and recalculate the bounding box.
|
void | AddBoundingVertex (const csVector2 &v) |
| Add a new vertex and recalculate the bounding box.
|
void | AddBoundingVertexSmart (float x, float y) |
| Add a new vertex and recalculate the bounding box. More...
|
void | AddBoundingVertexSmart (const csVector2 &v) |
| Add a new vertex and recalculate the bounding box. More...
|
| csBox2 () |
| Initialize this box to empty.
|
| csBox2 (const csVector2 &v) |
| Initialize this box with one point.
|
| csBox2 (float x1, float y1, float x2, float y2) |
| Initialize this box with the given values.
|
void | Set (const csVector2 &bmin, const csVector2 &bmax) |
| Sets the bounds of the box with the given values.
|
void | Set (float x1, float y1, float x2, float y2) |
| Sets the bounds of the box with the given values.
|
csBox2& | operator+= (const csBox2 &box) |
| Compute the union of two bounding boxes.
|
csBox2& | operator+= (const csVector2 &point) |
| Compute the union of a point with this bounding box.
|
csBox2& | operator *= (const csBox2 &box) |
| Compute the intersection of two bounding boxes.
|
Static Public Methods |
bool | Intersect (float minx, float miny, float maxx, float maxy, csVector2 *poly, int num_poly) |
| Test if a polygon if visible in the box. More...
|
bool | Intersect (const csVector2 &minbox, const csVector2 &maxbox, csVector2 *poly, int num_poly) |
| Test if a polygon if visible in the box. More...
|
Protected Attributes |
csVector2 | minbox |
| The top-left coordinate of the bounding box.
|
csVector2 | maxbox |
| The bottom-right coordinate of the bounding box.
|
Friends |
csBox2 | operator+ (const csBox2 &box1, const csBox2 &box2) |
| Compute the union of two bounding boxes.
|
csBox2 | operator+ (const csBox2 &box, const csVector2 &point) |
| Compute the union of a bounding box and a point.
|
csBox2 | operator * (const csBox2 &box1, const csBox2 &box2) |
| Compute the intersection of two bounding boxes.
|
bool | operator== (const csBox2 &box1, const csBox2 &box2) |
| Tests if two bounding boxes are equal.
|
bool | operator!= (const csBox2 &box1, const csBox2 &box2) |
| Tests if two bounding boxes are unequal.
|
bool | operator< (const csBox2 &box1, const csBox2 &box2) |
| Tests if box1 is a subset of box2.
|
bool | operator> (const csBox2 &box1, const csBox2 &box2) |
| Tests if box1 is a superset of box2.
|
bool | operator< (const csVector2 &point, const csBox2 &box) |
| Tests if a point is contained in a box.
|
In order to operate correctly, this bounding box assumes that all values entered or compared against lie within the range (-CS_BOUNDINGBOX_MAXVALUE, CS_BOUNDINGBOX_MAXVALUE). It is not recommended to use points outside of this range.