Gazebo Math

API Reference

6.15.1
AxisAlignedBox Class Reference

Mathematical representation of a box that is aligned along an X,Y,Z axis. More...

#include <ignition/math/AxisAlignedBox.hh>

Public Member Functions

 AxisAlignedBox ()
 Default constructor. This constructor will set the box's minimum and maximum corners to the highest (max) and lowest floating point values available to indicate that it is uninitialized. The default box does not intersect any other boxes or contain any points since it has no extent. Its center is the origin and its side lengths are 0. More...
 
 AxisAlignedBox (const AxisAlignedBox &_b)
 Copy Constructor. More...
 
 AxisAlignedBox (const Vector3d &_vec1, const Vector3d &_vec2)
 Constructor. This constructor will compute the box's minimum and maximum corners based on the two arguments. More...
 
 AxisAlignedBox (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. More...
 
virtual ~AxisAlignedBox ()
 Destructor. More...
 
math::Vector3d Center () const
 Get the box center. More...
 
bool Contains (const Vector3d &_p) const
 Check if a point lies inside the box. More...
 
double DensityFromMass (const double _mass) const
 Compute the cylinder's density given a mass value. The cylinder is assumed to be solid with uniform density. This function requires the cylinder's radius and length to be set to values greater than zero. The Material of the cylinder is ignored. More...
 
std::tuple< bool, double, Vector3dIntersect (const Line3d &_line) const
 Check if a line intersects the box. More...
 
std::tuple< bool, double, Vector3dIntersect (const Vector3d &_origin, const Vector3d &_dir, const double _min, const double _max) const
 Check if a ray (origin, direction) intersects the box. More...
 
bool IntersectCheck (const Vector3d &_origin, const Vector3d &_dir, const double _min, const double _max) const
 Check if a ray (origin, direction) intersects the box. More...
 
std::tuple< bool, double > IntersectDist (const Vector3d &_origin, const Vector3d &_dir, const double _min, const double _max) const
 Check if a ray (origin, direction) intersects the box. More...
 
bool Intersects (const AxisAlignedBox &_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. More...
 
bool MassMatrix (MassMatrix3d &_massMat) const
 Get the mass matrix for this box. This function is only meaningful if the box's size and material have been set. More...
 
const MaterialMaterial () const
 Get the material associated with this box. More...
 
Vector3dMax ()
 Get a mutable version of the maximum corner. More...
 
const Vector3dMax () const
 Get the maximum corner. More...
 
void Merge (const AxisAlignedBox &_box)
 Merge a box with this box. More...
 
Vector3dMin ()
 Get a mutable version of the minimum corner. More...
 
const Vector3dMin () const
 Get the minimum corner. More...
 
bool operator!= (const AxisAlignedBox &_b) const
 Inequality test operator. More...
 
AxisAlignedBox operator+ (const AxisAlignedBox &_b) const
 Addition operator. result = this + _b. More...
 
AxisAlignedBox operator+ (const Vector3d &_v)
 Add a vector to the min and max values. More...
 
AxisAlignedBox operator+ (const Vector3d &_v) const
 Add a vector to the min and max values. More...
 
const AxisAlignedBoxoperator+= (const AxisAlignedBox &_b)
 Addition set operator. this = this + _b. More...
 
AxisAlignedBox operator- (const Vector3d &_v)
 Subtract a vector from the min and max values. More...
 
AxisAlignedBox operator- (const Vector3d &_v) const
 Subtract a vector from the min and max values. More...
 
AxisAlignedBoxoperator= (const AxisAlignedBox &_b)
 Assignment operator. Set this box to the parameter. More...
 
bool operator== (const AxisAlignedBox &_b) const
 Equality test operator. More...
 
bool SetDensityFromMass (const double _mass)
 Set the density of this box based on a mass value. Density is computed using double DensityFromMass(const double _mass) const. The box is assumed to be solid with uniform density. This function requires the box's size to be set to values greater than zero. The existing Material density value is overwritten only if the return value from this true. More...
 
void SetMaterial (const Material &_mat)
 Set the material associated with this box. More...
 
math::Vector3d Size () const
 Get the size of the box. More...
 
double Volume () const
 Get the volume of the box in m^3. 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...
 

Detailed Description

Mathematical representation of a box that is aligned along an X,Y,Z axis.

Constructor & Destructor Documentation

◆ AxisAlignedBox() [1/4]

Default constructor. This constructor will set the box's minimum and maximum corners to the highest (max) and lowest floating point values available to indicate that it is uninitialized. The default box does not intersect any other boxes or contain any points since it has no extent. Its center is the origin and its side lengths are 0.

◆ AxisAlignedBox() [2/4]

AxisAlignedBox ( 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

◆ AxisAlignedBox() [3/4]

AxisAlignedBox ( 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

◆ AxisAlignedBox() [4/4]

AxisAlignedBox ( const AxisAlignedBox _b)

Copy Constructor.

Parameters
[in]_bAxisAlignedBox to copy

◆ ~AxisAlignedBox()

virtual ~AxisAlignedBox ( )
virtual

Destructor.

Member Function Documentation

◆ Center()

math::Vector3d Center ( ) const

Get the box center.

Returns
The center position of the box

Referenced by Plane< T >::Side().

◆ Contains()

bool Contains ( const Vector3d _p) const

Check if a point lies inside the box.

Parameters
[in]_pPoint to check.
Returns
True if the point is inside the box.

◆ DensityFromMass()

double DensityFromMass ( const double  _mass) const

Compute the cylinder's density given a mass value. The cylinder is assumed to be solid with uniform density. This function requires the cylinder's radius and length to be set to values greater than zero. The Material of the cylinder is ignored.

Parameters
[in]_massMass of the cylinder, in kg. This value should be greater than zero.
Returns
Density of the cylinder in kg/m^3. A negative value is returned if radius, length or _mass is <= 0.
Deprecated:
Unimplemented

◆ Intersect() [1/2]

std::tuple<bool, double, Vector3d> Intersect ( const Line3d _line) const

Check if a line intersects the box.

Parameters
[in]_lineThe line to check against this box.
Returns
A boolean, double, Vector3d tuple. The boolean value is true if the line intersects the box. The double is the distance from the line's start to the closest intersection point on the box. The double value is zero when the boolean value is false. The Vector3d is the intersection point on the box. The Vector3d value is zero if the boolean value is false.

◆ Intersect() [2/2]

std::tuple<bool, double, Vector3d> Intersect ( const Vector3d _origin,
const Vector3d _dir,
const double  _min,
const double  _max 
) const

Check if a ray (origin, direction) intersects the box.

Parameters
[in]_originOrigin of the ray.
[in]_dirDirection of the ray. This ray will be normalized.
[in]_minMinimum allowed distance.
[in]_maxMaximum allowed distance.
Returns
A boolean, double, Vector3d tuple. The boolean value is true if the line intersects the box.

The double is the distance from the ray's start to the closest intersection point on the box, minus the _min distance. For example, if _min == 0.5 and the intersection happens at a distance of 2.0 from _origin then returned distance is 1.5. The double value is zero when the boolean value is false. The

Vector3d is the intersection point on the box. The Vector3d value is zero if the boolean value is false.

◆ IntersectCheck()

bool IntersectCheck ( const Vector3d _origin,
const Vector3d _dir,
const double  _min,
const double  _max 
) const

Check if a ray (origin, direction) intersects the box.

Parameters
[in]_originOrigin of the ray.
[in]_dirDirection of the ray. This ray will be normalized.
[in]_minMinimum allowed distance.
[in]_maxMaximum allowed distance.
Returns
A boolean

◆ IntersectDist()

std::tuple<bool, double> IntersectDist ( const Vector3d _origin,
const Vector3d _dir,
const double  _min,
const double  _max 
) const

Check if a ray (origin, direction) intersects the box.

Parameters
[in]_originOrigin of the ray.
[in]_dirDirection of the ray. This ray will be normalized.
[in]_minMinimum allowed distance.
[in]_maxMaximum allowed distance.
Returns
A boolean and double tuple. The boolean value is true if the line intersects the box.

The double is the distance from the ray's start to the closest intersection point on the box, minus the _min distance. For example, if _min == 0.5 and the intersection happens at a distance of 2.0 from _origin then returned distance is 1.5.

The double value is zero when the boolean value is false.

◆ Intersects()

bool Intersects ( const AxisAlignedBox _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]_boxAxisAlignedBox to check for intersection with this box.
Returns
True if this box intersects _box.

◆ MassMatrix()

bool MassMatrix ( MassMatrix3d _massMat) const

Get the mass matrix for this box. This function is only meaningful if the box's size and material have been set.

Parameters
[out]_massMatThe computed mass matrix will be stored here.
Returns
False if computation of the mass matrix failed, which could be due to an invalid size (<=0) or density (<=0).
Deprecated:
Unimplemented

◆ Material()

const Material& Material ( ) const

Get the material associated with this box.

Returns
The material assigned to this box.
Deprecated:
Unimplemented

◆ Max() [1/2]

Vector3d& Max ( )

Get a mutable version of the maximum corner.

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

◆ Max() [2/2]

const Vector3d& Max ( ) const

Get the maximum corner.

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

Referenced by ignition::math::eigen3::convert().

◆ Merge()

void Merge ( const AxisAlignedBox _box)

Merge a box with this box.

Parameters
[in]_boxAxisAlignedBox to add to this box

◆ Min() [1/2]

Vector3d& Min ( )

Get a mutable version of the minimum corner.

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

◆ Min() [2/2]

const Vector3d& Min ( ) const

Get the minimum corner.

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

Referenced by ignition::math::eigen3::convert().

◆ operator!=()

bool operator!= ( const AxisAlignedBox _b) const

Inequality test operator.

Parameters
[in]_bAxisAlignedBox to test
Returns
True if not equal

◆ operator+() [1/3]

AxisAlignedBox operator+ ( const AxisAlignedBox _b) const

Addition operator. result = this + _b.

Parameters
[in]_bAxisAlignedBox to add
Returns
The new box

◆ operator+() [2/3]

AxisAlignedBox operator+ ( const Vector3d _v)

Add a vector to the min and max values.

Parameters
_vThe vector to use during addition
Returns
The new box

◆ operator+() [3/3]

AxisAlignedBox operator+ ( const Vector3d _v) const

Add a vector to the min and max values.

Parameters
_vThe vector to use during addition
Returns
The new box

◆ operator+=()

const AxisAlignedBox& operator+= ( const AxisAlignedBox _b)

Addition set operator. this = this + _b.

Parameters
[in]_bAxisAlignedBox to add
Returns
This new box

◆ operator-() [1/2]

AxisAlignedBox operator- ( const Vector3d _v)

Subtract a vector from the min and max values.

Parameters
_vThe vector to use during subtraction
Returns
The new box

◆ operator-() [2/2]

AxisAlignedBox operator- ( const Vector3d _v) const

Subtract a vector from the min and max values.

Parameters
_vThe vector to use during subtraction
Returns
The new box

◆ operator=()

AxisAlignedBox& operator= ( const AxisAlignedBox _b)

Assignment operator. Set this box to the parameter.

Parameters
[in]_bAxisAlignedBox to copy
Returns
The new box.

◆ operator==()

bool operator== ( const AxisAlignedBox _b) const

Equality test operator.

Parameters
[in]_bAxisAlignedBox to test
Returns
True if equal

◆ SetDensityFromMass()

bool SetDensityFromMass ( const double  _mass)

Set the density of this box based on a mass value. Density is computed using double DensityFromMass(const double _mass) const. The box is assumed to be solid with uniform density. This function requires the box's size to be set to values greater than zero. The existing Material density value is overwritten only if the return value from this true.

Parameters
[in]_massMass of the box, in kg. This value should be greater than zero.
Returns
True if the density was set. False is returned if the box's size or the _mass value are <= 0.
See also
double DensityFromMass(const double _mass) const
Deprecated:
Unimplemented

◆ SetMaterial()

void SetMaterial ( const Material _mat)

Set the material associated with this box.

Parameters
[in]_matThe material assigned to this box
Deprecated:
Unimplemented

◆ Size()

math::Vector3d Size ( ) const

Get the size of the box.

Returns
Size of the box

Referenced by Plane< T >::Side().

◆ Volume()

double Volume ( ) const

Get the volume of the box in m^3.

Returns
Volume of the box in m^3.

◆ XLength()

double XLength ( ) const

Get the length along the x dimension.

Returns
Double value of the length in the x dimension

◆ YLength()

double YLength ( ) const

Get the length along the y dimension.

Returns
Double value of the length in the y dimension

◆ ZLength()

double ZLength ( ) const

Get the length along the z dimension.

Returns
Double value of the length in the z dimension

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