#include <simpleBox3.h>
Public Member Functions |
|
Constructors and Destructors
|
|
TSimpleBox3 () | |
Default constructor. |
|
TSimpleBox3 (const TSimpleBox3 &box) | |
Copy constructor. |
|
TSimpleBox3 (const TVector3< T > &a, const TVector3< T > &b) | |
Detailed constructor. |
|
TSimpleBox3 (const T &ax, const T &ay, const T &az, const T &bx, const T &by, const T &bz) | |
Detailed constructor. |
|
virtual | ~TSimpleBox3 () |
Destructor. |
|
virtual void | clear () |
Clear method. |
|
Assignment
|
|
void | set (const TSimpleBox3 &box) |
Assign from another instance of
TSimpleBox3. |
|
void | set (const TVector3< T > &lower, const TVector3< T > &upper) |
Assign from two points. |
|
void | set (const T &ax, const T &ay, const T &az, const T &bx, const T &by, const T &bz) |
Assign from six values of type
T . |
|
const TSimpleBox3 & | operator= (const TSimpleBox3 &box) |
Assignment operator. |
|
void | get (TSimpleBox3 &box) const |
Assign to another instance of
TSimpleBox3. |
|
void | get (TVector3< T > &lower, TVector3< T > &upper) const |
Assign to two variables of type
TVector3
. |
|
void | get (T &ax, T &ay, T &az, T &bx, T &by, T &bz) const |
Assign to six variables of type
T . |
|
void | swap (TSimpleBox3 &box) |
Swap the contents of two instances.
|
|
Accessors
|
|
T | getSurface () const |
Calculate the surface area. |
|
T | getVolume () const |
Calculate the volume. |
|
T | getWidth () const |
Return the width of the box.
|
|
T | getHeight () const |
Return the height of the box.
|
|
T | getDepth () const |
Return the depth of the box.
|
|
void | join (const TSimpleBox3 &box) |
Join the box with an other. |
|
Predicates
|
|
bool | operator== (const TSimpleBox3 &box) const |
Equality operator. |
|
bool | operator!= (const TSimpleBox3 &box) const |
Inequality operator. |
|
bool | has (const TVector3< T > &point, bool on_surface=false) const |
Test if a given point is a member of
the box. |
|
bool | isIntersecting (const TSimpleBox3 &box) const |
Test if two boxes intersect.
|
|
Debugging and Diagnostics
|
|
bool | isValid () const |
Test whether instance is valid.
|
|
void | dump (std::ostream &s=std::cout, Size depth=0) const |
Internal state dump. |
|
Public Attributes |
|
Public members
|
|
TVector3< T > | a |
First point of the box. |
|
TVector3< T > | b |
Second point of the box. |
This class describes a three-dimensional box with edges parallel to the coordinate system. Hence, a box is given by the coordinates of the lower left front corner and ther upper right back corner.\
BALL::TSimpleBox3< T >::TSimpleBox3 | ( | ) |
Default constructor.
This method creates a new TSimpleBox3 object. The three components of the two TVector3 are initialized to { (T)0}.
BALL::TSimpleBox3< T >::TSimpleBox3 | ( | const TSimpleBox3< T > & | box | ) |
Copy constructor.
Create a new TSimpleBox3 object from another.
box | the TSimpleBox3 object to be copied |
BALL::TSimpleBox3< T >::TSimpleBox3 | ( | const TVector3< T > & | a, | |
const TVector3< T > & | b | |||
) |
Detailed constructor.
Create a new TSimpleBox3 object from two instances of TVector3.
a | assigned to a |
|
b | assigned to b |
BALL::TSimpleBox3< T >::TSimpleBox3 | ( | const T & | ax, | |
const T & | ay, | |||
const T & | az, | |||
const T & | bx, | |||
const T & | by, | |||
const T & | bz | |||
) |
Detailed constructor.
Create a new TSimpleBox3 object
from six variables of type T
.
ax | assigned to a.x |
|
ay | assigned to a.y |
|
az | assigned to a.z |
|
bx | assigned to b.x |
|
by | assigned to b.y |
|
bz | assigned to b.z |
virtual BALL::TSimpleBox3< T >::~TSimpleBox3 | ( | ) | [virtual] |
Destructor.
Destructs the TSimpleBox3 object. As there are no dynamic data structures, nothing happens.
void BALL::TSimpleBox3< T >::clear | ( | ) | [virtual] |
Clear method.
The values are set to 0.
Reimplemented in BALL::VIEW::SimpleBox.
References BALL::TSimpleBox3< T >::a, and BALL::TSimpleBox3< T >::b.
void BALL::TSimpleBox3< T >::dump | ( | std::ostream & | s =
std::cout , |
|
Size | depth =
0 |
|||
) | const |
Internal state dump.
Dump the current internal state of {*this} to the output ostream s with dumping depth depth .
s | - output stream where to output the internal state of {*this} | |
depth | - the dumping depth |
Reimplemented in BALL::VIEW::SimpleBox.
References BALL::TSimpleBox3< T >::a, and BALL::TSimpleBox3< T >::b.
void BALL::TSimpleBox3< T >::get | ( | T & | ax, | |
T & | ay, | |||
T & | az, | |||
T & | bx, | |||
T & | by, | |||
T & | bz | |||
) | const |
Assign to six variables of type T
.
ax | is assigned a.x |
|
ay | is assigned a.y |
|
az | is assigned a.z |
|
bx | is assigned b.x |
|
by | is assigned b.y |
|
bz | is assigned b.z |
References BALL::TSimpleBox3< T >::a, and BALL::TSimpleBox3< T >::b.
void BALL::TSimpleBox3< T >::get | ( | TVector3< T > & | lower, | |
TVector3< T > & | upper | |||
) | const |
Assign to two variables of type TVector3
.
lower | the lower corner of the box | |
upper | the upper corner of the box |
References BALL::TSimpleBox3< T >::a, BALL::TSimpleBox3< T >::b, and BALL::TVector3< T >::set().
void BALL::TSimpleBox3< T >::get | ( | TSimpleBox3< T > & | box | ) | const |
Assign to another instance of TSimpleBox3.
Assigns the box components to another box.
box | the box to be assigned to |
References BALL::TSimpleBox3< T >::set().
T BALL::TSimpleBox3< T >::getDepth | ( | ) | const |
Return the depth of the box.
References BALL::TSimpleBox3< T >::a, BALL::Maths::abs(), and BALL::TSimpleBox3< T >::b.
T BALL::TSimpleBox3< T >::getHeight | ( | ) | const |
Return the height of the box.
References BALL::TSimpleBox3< T >::a, BALL::Maths::abs(), and BALL::TSimpleBox3< T >::b.
T BALL::TSimpleBox3< T >::getSurface | ( | ) | const |
Calculate the surface area.
References BALL::TSimpleBox3< T >::a, BALL::Maths::abs(), and BALL::TSimpleBox3< T >::b.
T BALL::TSimpleBox3< T >::getVolume | ( | ) | const |
Calculate the volume.
References BALL::TSimpleBox3< T >::a, BALL::Maths::abs(), and BALL::TSimpleBox3< T >::b.
T BALL::TSimpleBox3< T >::getWidth | ( | ) | const |
Return the width of the box.
References BALL::TSimpleBox3< T >::a, BALL::Maths::abs(), and BALL::TSimpleBox3< T >::b.
bool BALL::TSimpleBox3< T >::has | ( | const TVector3< T > & | point, | |
bool | on_surface =
false |
|||
) | const |
Test if a given point is a member of the box.
Optional it can be testet, if the point lies on the surface.
point | the point to be tested | |
on_surface | true to test the surface (default = false) |
References BALL::TSimpleBox3< T >::a, BALL::TSimpleBox3< T >::b, BALL::Maths::isEqual(), and BALL::Maths::isLess().
bool BALL::TSimpleBox3< T >::isIntersecting | ( | const TSimpleBox3< T > & | box | ) | const |
Test if two boxes intersect.
box | the box to be tested |
References BALL::TSimpleBox3< T >::a, BALL::TSimpleBox3< T >::b, and BALL::Maths::isLess().
bool BALL::TSimpleBox3< T >::isValid | ( | ) | const |
Test whether instance is valid.
Always returns true.
Reimplemented in BALL::VIEW::SimpleBox.
References BALL::TSimpleBox3< T >::a, and BALL::TSimpleBox3< T >::b.
void BALL::TSimpleBox3< T >::join | ( | const TSimpleBox3< T > & | box | ) |
Join the box with an other.
Instance is set to the box containing both, this box and a given box.
box | the box to join with |
References BALL::TSimpleBox3< T >::a, BALL::TSimpleBox3< T >::b, BALL::Maths::max(), and BALL::Maths::min().
bool BALL::TSimpleBox3< T >::operator!= | ( | const TSimpleBox3< T > & | box | ) | const |
Inequality operator.
const TSimpleBox3< T > & BALL::TSimpleBox3< T >::operator= | ( | const TSimpleBox3< T > & | box | ) |
Assignment operator.
Assign the box components from another instance of TSimpleBox3.
box | the TSimpleBox3 to assign from |
bool BALL::TSimpleBox3< T >::operator== | ( | const TSimpleBox3< T > & | box | ) | const |
Equality operator.
References BALL::TSimpleBox3< T >::a, and BALL::TSimpleBox3< T >::b.
void BALL::TSimpleBox3< T >::set | ( | const T & | ax, | |
const T & | ay, | |||
const T & | az, | |||
const T & | bx, | |||
const T & | by, | |||
const T & | bz | |||
) |
Assign from six values of type T
.
ax | assigned to a.x |
|
ay | assigned to a.y |
|
az | assigned to a.z |
|
bx | assigned to b.x |
|
by | assigned to b.y |
|
bz | assigned to b.z |
References BALL::TSimpleBox3< T >::a, and BALL::TSimpleBox3< T >::b.
void BALL::TSimpleBox3< T >::set | ( | const TVector3< T > & | lower, | |
const TVector3< T > & | upper | |||
) |
Assign from two points.
lower | the lower corner of the box | |
upper | the upper corner of the box |
References BALL::TSimpleBox3< T >::a, and BALL::TSimpleBox3< T >::b.
void BALL::TSimpleBox3< T >::set | ( | const TSimpleBox3< T > & | box | ) |
Assign from another instance of TSimpleBox3.
box | the TSimpleBox3 object to assign from |
References BALL::TSimpleBox3< T >::a, and BALL::TSimpleBox3< T >::b.
Referenced by BALL::TSimpleBox3< T >::get().
void BALL::TSimpleBox3< T >::swap | ( | TSimpleBox3< T > & | box | ) |
Swap the contents of two instances.
box | the box to swap contents with |
References BALL::TSimpleBox3< T >::a, and BALL::TSimpleBox3< T >::b.