A representation of a cone. More...
#include <gz/math/Cone.hh>
Public Member Functions | |
| Cone ()=default | |
| Default constructor. The default radius and length are both zero. The default rotational offset is Quaternion<Precision>::Identity. | |
| Cone (const Precision _length, const Precision _radius, const Material &_mat, const Quaternion< Precision > &_rotOffset=Quaternion< Precision >::Identity) | |
| Construct a cone with a length, radius, material and optionally a rotational offset. | |
| Cone (const Precision _length, const Precision _radius, const Quaternion< Precision > &_rotOffset=Quaternion< Precision >::Identity) | |
| Construct a cone with a length, radius, and optionally a rotational offset. | |
| std::optional< Vector3< Precision > > | CenterOfVolumeBelow (const Plane< Precision > &_plane) const |
| Center of volume below the plane. This is useful for example when calculating where buoyancy should be applied. | |
| Vector3< Precision > | Centroid () const |
| Get the centroid of the cone in its reference frame (defined in the class description): on the axis of symmetry, a quarter of the length from the base toward the vertex, i.e. (0, 0, -length/4) rotated by the rotational offset. This is the standard solid cone centroid; see for example the centroid tables in the CRC Standard Mathematical Tables and Formulae. | |
| Precision | DensityFromMass (const Precision _mass) const |
| Compute the cone's density given a mass value. The cone is assumed to be solid with uniform density. This function requires the cone's radius and length to be set to values greater than zero. The Material of the cone is ignored. | |
| Precision | Length () const |
| Get the length in meters. | |
| std::optional< MassMatrix3< Precision > > | MassMatrix () const |
| Get the mass matrix for this cone. This function is only meaningful if the cone's radius, length, and material have been set. Optionally, set the rotational offset. | |
| bool | MassMatrix (MassMatrix3d &_massMat) const |
| Get the mass matrix for this cone. This function is only meaningful if the cone's radius, length, and material have been set. Optionally, set the rotational offset. | |
| const Material & | Mat () const |
| Get the material associated with this cone. | |
| bool | operator== (const Cone &_cone) const |
| Check if this cone is equal to the provided cone. Radius, length, and material properties will be checked. | |
| Precision | Radius () const |
| Get the radius in meters. | |
| Quaternion< Precision > | RotationalOffset () const |
| Get the rotational offset. By default, a cone's length is aligned with the Z axis. The rotational offset encodes a rotation from the z axis. | |
| bool | SetDensityFromMass (const Precision _mass) |
| Set the density of this cone based on a mass value. Density is computed using Precision DensityFromMass(const Precision _mass) const. The cone is assumed to be solid with uniform density. This function requires the cone's radius and length to be set to values greater than zero. The existing Material density value is overwritten only if the return value from this true. | |
| void | SetLength (const Precision _length) |
| Set the length in meters. | |
| void | SetMat (const Material &_mat) |
| Set the material associated with this cone. | |
| void | SetRadius (const Precision _radius) |
| Set the radius in meters. | |
| void | SetRotationalOffset (const Quaternion< Precision > &_rotOffset) |
| Set the rotation offset. | |
| Precision | Volume () const |
| Get the volume of the cone in m^3. | |
| Precision | VolumeBelow (const Plane< Precision > &_plane) const |
| Get the volume of the cone below a given plane in m^3. It is assumed that the center of the cone is on the origin. | |
Detailed Description
A representation of a cone.
The cone class supports defining a cone with a radius, length, rotational offset, and material properties. Radius and length are in meters. See Material for more on material properties.
A reference frame is defined with an origin on the axis of symmetry equidistant from the vertex and the circular base, with XYZ coordinate axes defined with the Z axis parallel to the axis of symmetry and pointing toward the vertex of the cone. This frame is consistent with the SDFormat cone shape. The rotational offset encodes an additional rotation of the cone relative to this frame.
Constructor & Destructor Documentation
◆ Cone() [1/3]
Default constructor. The default radius and length are both zero. The default rotational offset is Quaternion<Precision>::Identity.
◆ Cone() [2/3]
| Cone | ( | const Precision | _length, |
| const Precision | _radius, | ||
| const Quaternion< Precision > & | _rotOffset = Quaternion< Precision >::Identity |
||
| ) |
Construct a cone with a length, radius, and optionally a rotational offset.
- Parameters
-
[in] _length Length of the cone. [in] _radius Radius of the cone. [in] _rotOffset Rotational offset of the cone.
◆ Cone() [3/3]
| Cone | ( | const Precision | _length, |
| const Precision | _radius, | ||
| const Material & | _mat, | ||
| const Quaternion< Precision > & | _rotOffset = Quaternion< Precision >::Identity |
||
| ) |
Construct a cone with a length, radius, material and optionally a rotational offset.
- Parameters
-
[in] _length Length of the cone. [in] _radius Radius of the cone. [in] _mat Material property for the cone. [in] _rotOffset Rotational offset of the cone.
Member Function Documentation
◆ CenterOfVolumeBelow()
| std::optional< Vector3< Precision > > CenterOfVolumeBelow | ( | const Plane< Precision > & | _plane | ) | const |
Center of volume below the plane. This is useful for example when calculating where buoyancy should be applied.
- Parameters
-
[in] _plane The plane which slices this cone, expressed in the cone's reference frame.
- Returns
- The center of volume if there is anything below the plane, otherwise return a std::nullopt. Expressed in the cone's reference frame.
◆ Centroid()
Get the centroid of the cone in its reference frame (defined in the class description): on the axis of symmetry, a quarter of the length from the base toward the vertex, i.e. (0, 0, -length/4) rotated by the rotational offset. This is the standard solid cone centroid; see for example the centroid tables in the CRC Standard Mathematical Tables and Formulae.
- Returns
- The centroid, expressed in the cone's reference frame.
◆ DensityFromMass()
Compute the cone's density given a mass value. The cone is assumed to be solid with uniform density. This function requires the cone's radius and length to be set to values greater than zero. The Material of the cone is ignored.
- Parameters
-
[in] _mass Mass of the cone, in kg. This value should be greater than zero.
- Returns
- Density of the cone in kg/m^3. A negative value is returned if radius, length or _mass is <= 0.
◆ Length()
Get the length in meters.
- Returns
- The length of the cone in meters.
◆ MassMatrix() [1/2]
| std::optional< MassMatrix3< Precision > > MassMatrix | ( | ) | const |
Get the mass matrix for this cone. This function is only meaningful if the cone's radius, length, and material have been set. Optionally, set the rotational offset.
- Returns
- The computed mass matrix if parameters are valid (radius > 0), (length > 0) and (density > 0). Otherwise std::nullopt is returned.
◆ MassMatrix() [2/2]
| bool MassMatrix | ( | MassMatrix3d & | _massMat | ) | const |
Get the mass matrix for this cone. This function is only meaningful if the cone's radius, length, and material have been set. Optionally, set the rotational offset.
- 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 radius (<=0), length (<=0), or density (<=0).
◆ Mat()
Get the material associated with this cone.
- Returns
- The material assigned to this cone
◆ operator==()
Check if this cone is equal to the provided cone. Radius, length, and material properties will be checked.
◆ Radius()
Get the radius in meters.
- Returns
- The radius of the cone in meters.
◆ RotationalOffset()
| Quaternion< Precision > RotationalOffset | ( | ) | const |
Get the rotational offset. By default, a cone's length is aligned with the Z axis. The rotational offset encodes a rotation from the z axis.
- Returns
- The cone's rotational offset.
◆ SetDensityFromMass()
Set the density of this cone based on a mass value. Density is computed using Precision DensityFromMass(const Precision _mass) const. The cone is assumed to be solid with uniform density. This function requires the cone's radius and length 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 cone, in kg. This value should be greater than zero.
- Returns
- True if the density was set. False is returned if the cone's radius, length, or the _mass value are <= 0.
- See also
- Precision DensityFromMass(const Precision _mass) const
◆ SetLength()
Set the length in meters.
- Parameters
-
[in] _length The length of the cone in meters.
◆ SetMat()
Set the material associated with this cone.
- Parameters
-
[in] _mat The material assigned to this cone
◆ SetRadius()
Set the radius in meters.
- Parameters
-
[in] _radius The radius of the cone in meters.
◆ SetRotationalOffset()
| void SetRotationalOffset | ( | const Quaternion< Precision > & | _rotOffset | ) |
Set the rotation offset.
- Parameters
-
[in] _rotOffset rotational offset quaternion. See Quaternion<Precision> RotationalOffset() for details on the rotational offset.
◆ Volume()
Get the volume of the cone in m^3.
- Returns
- Volume of the cone in m^3.
◆ VolumeBelow()
Get the volume of the cone below a given plane in m^3. It is assumed that the center of the cone is on the origin.
- Parameters
-
[in] _plane The plane which slices this cone, expressed in the cone's reference frame.
- Returns
- Volume below the plane in m^3.
The documentation for this class was generated from the following file: