A representation of a box. All units are in meters. More...
#include <ignition/math/Box.hh>
Public Member Functions | |
Box ()=default | |
Default constructor. More... | |
Box (const Precision _length, const Precision _width, const Precision _height) | |
Construct a box with specified dimensions. More... | |
Box (const Precision _length, const Precision _width, const Precision _height, const Material &_mat) | |
Construct a box with specified dimensions and a material. More... | |
Box (const Vector3< Precision > &_size) | |
Construct a box with specified dimensions, in vector form. More... | |
Box (const Vector3< Precision > &_size, const Material &_mat) | |
Construct a box with specified dimensions, in vector form and a material. More... | |
virtual | ~Box ()=default |
Destructor. More... | |
std::optional< Vector3< Precision > > | CenterOfVolumeBelow (const Plane< Precision > &_plane) const |
Center of volume below the plane. This is useful when calculating where buoyancy should be applied, for example. More... | |
Precision | DensityFromMass (const Precision _mass) const |
Compute the box's density given a mass value. 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 Material of the box is ignored. More... | |
IntersectionPoints< Precision > | Intersections (const Plane< Precision > &_plane) const |
Get intersection between a plane and the box's edges. Edges contained on the plane are ignored. More... | |
bool | MassMatrix (MassMatrix3< Precision > &_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 Material & | Material () const |
Get the material associated with this box. More... | |
bool | operator!= (const Box< Precision > &_b) const |
Inequality test operator. More... | |
bool | operator== (const Box< Precision > &_b) const |
Equality test operator. More... | |
bool | SetDensityFromMass (const Precision _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... | |
void | SetSize (const math::Vector3< Precision > &_size) |
Set the size of the box. More... | |
void | SetSize (const Precision _length, const Precision _width, const Precision _height) |
Set the size of the box. More... | |
math::Vector3< Precision > | Size () const |
Get the size of the box. More... | |
IntersectionPoints< Precision > | VerticesBelow (const Plane< Precision > &_plane) const |
All the vertices which are on or below the plane. More... | |
Precision | Volume () const |
Get the volume of the box in m^3. More... | |
Precision | VolumeBelow (const Plane< Precision > &_plane) const |
Get the volume of the box below a plane. More... | |
Detailed Description
template<typename Precision>
class ignition::math::Box< Precision >
A representation of a box. All units are in meters.
The box class supports defining a size and material properties. See Material for more on material properties.
By default, a box's size (length, width, and height) is zero.
See AxisAlignedBox for an axis aligned box implementation.
Constructor & Destructor Documentation
◆ Box() [1/5]
|
default |
Default constructor.
◆ Box() [2/5]
Box | ( | const Precision | _length, |
const Precision | _width, | ||
const Precision | _height | ||
) |
Construct a box with specified dimensions.
- Parameters
-
[in] _length Length of the box in meters. [in] _width Width of the box in meters. [in] _height Height of the box in meters.
◆ Box() [3/5]
Box | ( | const Precision | _length, |
const Precision | _width, | ||
const Precision | _height, | ||
const Material & | _mat | ||
) |
Construct a box with specified dimensions and a material.
- Parameters
-
[in] _length Length of the box in meters. [in] _width Width of the box in meters. [in] _height Height of the box. [in] _mat Material property for the box.
◆ Box() [4/5]
Construct a box with specified dimensions, in vector form.
- Parameters
-
[in] _size Size of the box. The vector _size has the following mapping:
- _size[0] == length in meters
- _size[1] == width in meters
- _size[2] == height in meters
◆ Box() [5/5]
Construct a box with specified dimensions, in vector form and a material.
- Parameters
-
[in] _size Size of the box. The vector _size has the following mapping:
- _size[0] == length in meters
- _size[1] == width in meters
- _size[2] == height in meters
- Parameters
-
[in] _mat Material property for the box.
◆ ~Box()
|
virtualdefault |
Destructor.
Member Function Documentation
◆ CenterOfVolumeBelow()
Center of volume below the plane. This is useful when calculating where buoyancy should be applied, for example.
- Parameters
-
[in] _plane The plane which cuts the box, expressed in the box's frame.
- Returns
- Center of volume, in box's frame.
◆ DensityFromMass()
Precision DensityFromMass | ( | const Precision | _mass | ) | const |
Compute the box's density given a mass value. 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 Material of the box is ignored.
- Parameters
-
[in] _mass Mass of the box, in kg. This value should be greater than zero.
- Returns
- Density of the box in kg/m^3. A negative value is returned if the size or _mass is <= 0.
◆ Intersections()
IntersectionPoints<Precision> Intersections | ( | const Plane< Precision > & | _plane | ) | const |
Get intersection between a plane and the box's edges. Edges contained on the plane are ignored.
- Parameters
-
[in] _plane The plane against which we are testing intersection.
- Returns
- A list of points along the edges of the box where the intersection occurs.
◆ MassMatrix()
bool MassMatrix | ( | MassMatrix3< Precision > & | _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] _massMat The 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).
◆ Material()
Get the material associated with this box.
- Returns
- The material assigned to this box.
◆ operator!=()
bool operator!= | ( | const Box< Precision > & | _b | ) | const |
◆ operator==()
bool operator== | ( | const Box< Precision > & | _b | ) | const |
◆ SetDensityFromMass()
bool SetDensityFromMass | ( | const Precision | _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] _mass Mass 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
◆ SetMaterial()
void SetMaterial | ( | const Material & | _mat | ) |
Set the material associated with this box.
- Parameters
-
[in] _mat The material assigned to this box.
◆ SetSize() [1/2]
void SetSize | ( | const math::Vector3< Precision > & | _size | ) |
Set the size of the box.
- Parameters
-
[in] _size Size of the box. The vector _size has the following mapping:
- _size[0] == lengt in metersh
- _size[1] == widt in metersh
- _size[2] == heigh in meterst
◆ SetSize() [2/2]
void SetSize | ( | const Precision | _length, |
const Precision | _width, | ||
const Precision | _height | ||
) |
Set the size of the box.
- Parameters
-
[in] _length Length of the box in meters. [in] _width Width of the box in meters. [in] _height Height of the box in meters.
◆ Size()
math::Vector3<Precision> Size | ( | ) | const |
Get the size of the box.
- Returns
- Size of the box in meters.
◆ VerticesBelow()
IntersectionPoints<Precision> VerticesBelow | ( | const Plane< Precision > & | _plane | ) | const |
All the vertices which are on or below the plane.
- Parameters
-
[in] _plane The plane which cuts the box, expressed in the box's frame.
- Returns
- Box vertices which are below the plane, expressed in the box's frame.
◆ Volume()
Precision Volume | ( | ) | const |
Get the volume of the box in m^3.
- Returns
- Volume of the box in m^3.
◆ VolumeBelow()
Precision VolumeBelow | ( | const Plane< Precision > & | _plane | ) | const |
Get the volume of the box below a plane.
- Parameters
-
[in] _plane The plane which cuts the box, expressed in the box's frame.
- Returns
- Volume below the plane in m^3.
The documentation for this class was generated from the following file: