In file include/csgeom/math2d.h:

class csBox

A bounding box in 2D space

Public Methods

void AddBoundingVertex(const csVector2& v)
Add a new vertex and recalculate the bounding box.
void AddBoundingVertex(float x, float y)
Add a new vertex and recalculate the bounding box.
void AddBoundingVertexSmart(float x, float y)
Add a new vertex and recalculate the bounding box
void AddBoundingVertexSmart(const csVector2& v)
Add a new vertex and recalculate the bounding box.
csBox(float x1, float y1, float x2, float y2)
Initialize this box with the given values.
csBox()
Initialize this box to empty.
csBox(const csVector2& v)
Initialize this box with one point.
bool Empty()
Test if this box is empty.
bool In(float x, float y)
Test if the given coordinate is in this box.
float MaxX()
float MaxY()
float MinX()
float MinY()
friend bool operator!= (const csBox& box1, const csBox& box2)
Tests if two bounding boxes are unequal.
friend csBox operator* (const csBox& box1, const csBox& box2)
Compute the intersection of two bounding boxes.
csBox& operator*= (const csBox& box)
Compute the intersection of two bounding boxes.
friend csBox operator+ (const csBox& box1, const csBox& box2)
Compute the union of two bounding boxes.
friend csBox operator+ (const csBox& box, const csVector2& point)
Compute the union of a bounding box and a point.
csBox& operator+= (const csBox& box)
Compute the union of two bounding boxes.
csBox& operator+= (const csVector2& point)
Compute the union of a point with this bounding box.
friend bool operator< (const csVector2& point, const csBox& box)
Tests if a point is contained in a box.
friend bool operator< (const csBox& box1, const csBox& box2)
Tests if box1 is a subset of box2.
friend bool operator== (const csBox& box1, const csBox& box2)
Tests if two bounding boxes are equal.
friend bool operator> (const csBox& box1, const csBox& box2)
Tests if box1 is a superset of box2.
bool Overlap(const csBox& box)
Test if this box overlaps with the given box.
void Set(float x1, float y1, float x2, float y2)
Sets the bounds of the box with the given values.
void StartBoundingBox(csVector2& v)
Initialize this box to one vertex.
void StartBoundingBox()
Initialize this box to empty.

Public

constructors were listed at the top of the file, rather than here, the
-----
Maintenance Note: The csBox constructors and Set() appear at this point
in the file, rather than earlier, in order to appease the OpenStep 4.2
compiler. Specifically, the problem is that the compiler botches code
generation if an unseen method (which is later declared inline) is
called from within another inline method. For instance, if the
-----
compiler would see calls to Empty() and StartBoundingBox() before seeing
declarations for them. In such a situation, the buggy compiler
generated a broken object file. The simple work-around of textually
reorganizing the file ensures that the declarations for Empty() and
StartBoundingBox() are seen before they are called.

Protected Fields

float maxx
The bottom-right x coordinate of the bounding box.
float maxy
The bottom-right y coordinate of the bounding box.
float minx
The top-left x coordinate of the bounding box.
float miny
The top-left y coordinate of the bounding box.

Documentation

A bounding box in 2D space. 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.
float minx
The top-left x coordinate of the bounding box.

float miny
The top-left y coordinate of the bounding box.

float maxx
The bottom-right x coordinate of the bounding box.

float maxy
The bottom-right y coordinate of the bounding box.

float MinX()

float MinY()

float MaxX()

float MaxY()

bool In(float x, float y)
Test if the given coordinate is in this box.

bool Overlap(const csBox& box)
Test if this box overlaps with the given box.

bool Empty()
Test if this box is empty.

void StartBoundingBox()
Initialize this box to empty.

void StartBoundingBox(csVector2& v)
Initialize this box to one vertex.

void AddBoundingVertex(float x, float y)
Add a new vertex and recalculate the bounding box.

void AddBoundingVertexSmart(float x, float y)
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.

void AddBoundingVertex(const csVector2& v)
Add a new vertex and recalculate the bounding box.

void AddBoundingVertexSmart(const csVector2& v)
Add a new vertex and recalculate the bounding box.

-----

Maintenance Note: The csBox constructors and Set() appear at this point

in the file, rather than earlier, in order to appease the OpenStep 4.2

compiler. Specifically, the problem is that the compiler botches code

generation if an unseen method (which is later declared inline) is

called from within another inline method. For instance, if the

constructors were listed at the top of the file, rather than here, the

compiler would see calls to Empty() and StartBoundingBox() before seeing

declarations for them. In such a situation, the buggy compiler

generated a broken object file. The simple work-around of textually

reorganizing the file ensures that the declarations for Empty() and

StartBoundingBox() are seen before they are called.

-----

csBox()
Initialize this box to empty.

csBox(const csVector2& v)
Initialize this box with one point.

csBox(float x1, float y1, float x2, float y2)
Initialize this 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.

csBox& operator+= (const csBox& box)
Compute the union of two bounding boxes.

csBox& operator+= (const csVector2& point)
Compute the union of a point with this bounding box.

csBox& operator*= (const csBox& box)
Compute the intersection of two bounding boxes.

friend csBox operator+ (const csBox& box1, const csBox& box2)
Compute the union of two bounding boxes.

friend csBox operator+ (const csBox& box, const csVector2& point)
Compute the union of a bounding box and a point.

friend csBox operator* (const csBox& box1, const csBox& box2)
Compute the intersection of two bounding boxes.

friend bool operator== (const csBox& box1, const csBox& box2)
Tests if two bounding boxes are equal.

friend bool operator!= (const csBox& box1, const csBox& box2)
Tests if two bounding boxes are unequal.

friend bool operator< (const csBox& box1, const csBox& box2)
Tests if box1 is a subset of box2.

friend bool operator> (const csBox& box1, const csBox& box2)
Tests if box1 is a superset of box2.

friend bool operator< (const csVector2& point, const csBox& box)
Tests if a point is contained in a box.


This class has no child classes.

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de