All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
Public Member Functions | Friends | List of all members
ignition::math::Box Class Reference

Mathematical representation of a box and related functions. More...

#include <ignition/math/Box.hh>

Public Member Functions

 Box ()
 Default constructor. More...
 
 Box (const Vector3d &_vec1, const Vector3d &_vec2)
 Constructor. More...
 
 Box (double _vec1X, double _vec1Y, double _vec1Z, double _vec2X, double _vec2Y, double _vec2Z)
 Constructor. More...
 
 Box (const Box &_b)
 Copy Constructor. More...
 
virtual ~Box ()
 Destructor. More...
 
math::Vector3d Center () const
 Get the box center. More...
 
bool Intersects (const Box &_box) const
 Test box intersection. More...
 
const Vector3dMax () const
 Get the maximum corner. More...
 
Vector3dMax ()
 Get a mutable version of the maximum corner. More...
 
void Merge (const Box &_box)
 Merge a box with this box. More...
 
const Vector3dMin () const
 Get the minimum corner. More...
 
Vector3dMin ()
 Get a mutable version of the minimum corner. More...
 
bool operator!= (const Box &_b) const
 Inequality test operatoer. More...
 
Box operator+ (const Box &_b) const
 Addition operator. More...
 
const Boxoperator+= (const Box &_b)
 Addition set operator. More...
 
Box operator- (const Vector3d &_v)
 Subtract a vector from the min and max values. More...
 
Boxoperator= (const Box &_b)
 Assignment operator. More...
 
bool operator== (const Box &_b) const
 Equality test operatoer. More...
 
math::Vector3d Size () const
 Get the size of the box. More...
 
double XLength () const
 Get the length along the x dimension. More...
 
double YLength () const
 Get the length along the y dimension. More...
 
double ZLength () const
 Get the length along the z dimension. More...
 

Friends

std::ostream & operator<< (std::ostream &_out, const ignition::math::Box &_b)
 Output operator. More...
 

Detailed Description

Mathematical representation of a box and related functions.

Constructor & Destructor Documentation

ignition::math::Box::Box ( )

Default constructor.

ignition::math::Box::Box ( const Vector3d _vec1,
const Vector3d _vec2 
)

Constructor.

This constructor will compute the box's minimum and maximum corners based on the two arguments.

Parameters
[in]_vec1One corner of the box
[in]_vec2Another corner of the box
ignition::math::Box::Box ( double  _vec1X,
double  _vec1Y,
double  _vec1Z,
double  _vec2X,
double  _vec2Y,
double  _vec2Z 
)

Constructor.

This constructor will compute the box's minimum and maximum corners based on the arguments.

Parameters
[in]_vec1XOne corner's X position
[in]_vec1YOne corner's Y position
[in]_vec1ZOne corner's Z position
[in]_vec2XOther corner's X position
[in]_vec2YOther corner's Y position
[in]_vec2ZOther corner's Z position
ignition::math::Box::Box ( const Box _b)

Copy Constructor.

Parameters
[in]_bBox to copy
virtual ignition::math::Box::~Box ( )
virtual

Destructor.

Member Function Documentation

math::Vector3d ignition::math::Box::Center ( ) const

Get the box center.

Returns
The center position of the box
bool ignition::math::Box::Intersects ( const Box _box) const

Test box intersection.

This test will only work if both box's minimum corner is less than or equal to their maximum corner.

Parameters
[in]_boxBox to check for intersection with this box.
Returns
True if this box intersects _box.
const Vector3d& ignition::math::Box::Max ( ) const
inline

Get the maximum corner.

Returns
The Vector3d that is the maximum corner of the box.

References ignition::math::max().

Vector3d& ignition::math::Box::Max ( )
inline

Get a mutable version of the maximum corner.

Returns
The Vector3d that is the maximum corner of the box.

References ignition::math::max().

void ignition::math::Box::Merge ( const Box _box)

Merge a box with this box.

Parameters
[in]_boxBox to add to this box
const Vector3d& ignition::math::Box::Min ( ) const
inline

Get the minimum corner.

Returns
The Vector3d that is the minimum corner of the box.

References ignition::math::min().

Vector3d& ignition::math::Box::Min ( )
inline

Get a mutable version of the minimum corner.

Returns
The Vector3d that is the minimum corner of the box.

References ignition::math::min().

bool ignition::math::Box::operator!= ( const Box _b) const

Inequality test operatoer.

Parameters
[in]_bBox to test
Returns
True if not equal
Box ignition::math::Box::operator+ ( const Box _b) const

Addition operator.

result = this + _b

Parameters
[in]_bBox to add
Returns
The new box
const Box& ignition::math::Box::operator+= ( const Box _b)

Addition set operator.

this = this + _b

Parameters
[in]_bBox to add
Returns
This new box
Box ignition::math::Box::operator- ( const Vector3d _v)

Subtract a vector from the min and max values.

Parameters
_vThe vector to use during subtraction
Returns
The new box
Box& ignition::math::Box::operator= ( const Box _b)

Assignment operator.

Set this box to the parameter

Parameters
[in]_bBox to copy
Returns
The new box.
bool ignition::math::Box::operator== ( const Box _b) const

Equality test operatoer.

Parameters
[in]_bBox to test
Returns
True if equal
math::Vector3d ignition::math::Box::Size ( ) const

Get the size of the box.

Returns
Size of the box
double ignition::math::Box::XLength ( ) const

Get the length along the x dimension.

Returns
Double value of the length in the x dimension
double ignition::math::Box::YLength ( ) const

Get the length along the y dimension.

Returns
Double value of the length in the y dimension
double ignition::math::Box::ZLength ( ) const

Get the length along the z dimension.

Returns
Double value of the length in the z dimension

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  _out,
const ignition::math::Box _b 
)
friend

Output operator.

Parameters
[in]_outOutput stream
[in]_bBox to output to the stream
Returns
The stream

The documentation for this class was generated from the following file: