#include <box.h>
Public Methods | |
float | MinX () const |
float | MinY () const |
float | MinZ () const |
float | MaxX () const |
float | MaxY () const |
float | MaxZ () const |
float | Min (int idx) const |
Get Min component for 0 (x), 1 (y), or 2 (z). | |
float | Max (int idx) const |
Get Max component for 0 (x), 1 (y), or 2 (z). | |
const csVector3& | Min () const |
const csVector3& | Max () const |
csVector3 | GetCorner (int corner) const |
Return every corner of this bounding box from 0 to 7. More... | |
void | GetEdgeInfo (int edge, int &v1, int &v2, int &fleft, int &fright) const |
Given an edge index (BOX_EDGE_???) return the two vertices (index BOX_CORNER_???) and left/right faces (BOX_SIDE_???). | |
UByte* | GetFaceEdges (int face) const |
Given a face index (BOX_SIDE_???) return the four edges oriented clockwise around this face (BOX_EDGE_???). | |
csVector3 | GetCenter () const |
Get the center of this box. | |
void | SetCenter (const csVector3 &c) |
Set the center of this box. More... | |
void | SetSize (const csVector3 &s) |
Set the size of the box but keep the center intact. | |
csBox2 | GetSide (int side) const |
Get a side of this box as a 2D box. More... | |
int | GetVisibleSides (const csVector3 &pos, int *visible_sides) const |
Fill the array (which should be three long at least) with all visible sides (BOX_SIDE_??? defines) as seen from the given point. More... | |
csSegment3 | GetEdge (int edge) const |
Return every edge (segment) of this bounding box from 0 to 23 (use one of the BOX_EDGE_??? indices). More... | |
void | GetEdge (int edge, csSegment3 &e) const |
Return every edge (segment) of this bounding box from 0 to 23 (use one of the BOX_EDGE_??? indices). More... | |
bool | In (float x, float y, float z) const |
Test if the given coordinate is in this box. | |
bool | In (const csVector3 &v) const |
Test if the given coordinate is in this box. | |
bool | Overlap (const csBox3 &box) const |
Test if this box overlaps with the given box. | |
bool | Contains (const csBox3 &box) const |
Test if this box contains the other box. | |
bool | Empty () const |
Test if this box is empty. | |
void | StartBoundingBox () |
Initialize this box to empty. | |
void | StartBoundingBox (const csVector3 &v) |
Initialize this box to one vertex. | |
void | AddBoundingVertex (float x, float y, float z) |
Add a new vertex and recalculate the bounding box. | |
void | AddBoundingVertex (const csVector3 &v) |
Add a new vertex and recalculate the bounding box. | |
void | AddBoundingVertexSmart (float x, float y, float z) |
Add a new vertex and recalculate the bounding box. More... | |
void | AddBoundingVertexSmart (const csVector3 &v) |
Add a new vertex and recalculate the bounding box. More... | |
csBox3 () | |
Initialize this box to empty. | |
csBox3 (const csVector3 &v) | |
Initialize this box with one point. | |
csBox3 (const csVector3 &v1, const csVector3 &v2) | |
Initialize this box with two points. | |
csBox3 (float x1, float y1, float z1, float x2, float y2, float z2) | |
Initialize this box with the given values. | |
void | Set (const csVector3 &bmin, const csVector3 &bmax) |
Sets the bounds of the box with the given values. | |
void | Set (float x1, float y1, float z1, float x2, float y2, float z2) |
Sets the bounds of the box with the given values. | |
bool | AdjacentX (const csBox3 &other) const |
Test if this box is adjacent to the other on the X side. | |
bool | AdjacentY (const csBox3 &other) const |
Test if this box is adjacent to the other on the Y side. | |
bool | AdjacentZ (const csBox3 &other) const |
Test if this box is adjacent to the other on the Z side. | |
int | Adjacent (const csBox3 &other) const |
Test if this box is adjacent to the other one. More... | |
void | GetConvexOutline (const csVector3 &pos, csVector3 *array, int &num_array, bool bVisible=false) const |
Get a convex outline (not a polygon unless projected to 2D) for for this box as seen from the given position. More... | |
bool | Between (const csBox3 &box1, const csBox3 &box2) const |
Test if this box is between two others. | |
void | ManhattanDistance (const csBox3 &other, csVector3 &dist) const |
Calculate the minimum manhattan distance between this box and another one. | |
float | SquaredOriginDist () const |
Calculate the squared distance between (0,0,0) and the box This routine is extremely efficient. | |
float | SquaredOriginMaxDist () const |
Calculate the squared distance between (0,0,0) and the point on the box which is furthest away from (0,0,0). More... | |
csBox3& | operator+= (const csBox3 &box) |
Compute the union of two bounding boxes. | |
csBox3& | operator+= (const csVector3 &point) |
Compute the union of a point with this bounding box. | |
csBox3& | operator *= (const csBox3 &box) |
Compute the intersection of two bounding boxes. | |
Static Public Methods | |
int | OtherSide (int side) |
Static function to get the 'other' side (i.e. More... | |
Protected Types | |
typedef uint8 | bFace [4] |
Protected Attributes | |
csVector3 | minbox |
The top-left of this bounding box. | |
csVector3 | maxbox |
The bottom-right. | |
Static Protected Attributes | |
bEdge | edges [24] |
bFace | faces [6] |
Friends | |
csBox3 | operator+ (const csBox3 &box1, const csBox3 &box2) |
Compute the union of two bounding boxes. | |
csBox3 | operator+ (const csBox3 &box, const csVector3 &point) |
Compute the union of a bounding box and a point. | |
csBox3 | operator * (const csBox3 &box1, const csBox3 &box2) |
Compute the intersection of two bounding boxes. | |
bool | operator== (const csBox3 &box1, const csBox3 &box2) |
Tests if two bounding boxes are equal. | |
bool | operator!= (const csBox3 &box1, const csBox3 &box2) |
Tests if two bounding boxes are unequal. | |
bool | operator< (const csBox3 &box1, const csBox3 &box2) |
Tests if box1 is a subset of box2. | |
bool | operator> (const csBox3 &box1, const csBox3 &box2) |
Tests if box1 is a superset of box2. | |
bool | operator< (const csVector3 &point, const csBox3 &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.
|
Add a new vertex and recalculate the bounding box. This version is a little more optimal. It assumes however that at least one point has been added to the bounding box. |
|
Add a new vertex and recalculate the bounding box. This version is a little more optimal. It assumes however that at least one point has been added to the bounding box. |
|
Test if this box is adjacent to the other one. Return -1 if not adjacent or else any of the BOX_SIDE_??? flags to indicate the side of this box that the other box is adjacent with. |
|
Get a convex outline (not a polygon unless projected to 2D) for for this box as seen from the given position. The coordinates returned are world space coordinates. Note that you need place for at least six vectors in the array. If you set bVisible true, you will get all visible corners - this could be up to 7. |
|
Return every corner of this bounding box from 0 to 7. This contrasts with Min() and Max() because those are only the min and max corners. Corner 0 = xyz, 1 = xyZ, 2 = xYz, 3 = xYZ, 4 = Xyz, 5 = XyZ, 6 = XYz, 7 = XYZ. Use BOX_CORNER_??? defines. |
|
Return every edge (segment) of this bounding box from 0 to 23 (use one of the BOX_EDGE_??? indices). The returned edge is undefined for any other index. |
|
Return every edge (segment) of this bounding box from 0 to 23 (use one of the BOX_EDGE_??? indices). The returned edge is undefined for any other index. |
|
Get a side of this box as a 2D box. Use BOX_SIDE_??? defines. |
|
Fill the array (which should be three long at least) with all visible sides (BOX_SIDE_??? defines) as seen from the given point. Returns the number of visible sides. |
|
Static function to get the 'other' side (i.e. BOX_SIDE_X to BOX_SIDE_x, ...). |
|
Set the center of this box. This will not change the size of the box but just relocate the center. |
|
Calculate the squared distance between (0,0,0) and the point on the box which is furthest away from (0,0,0). This routine is extremely efficient. |