Gazebo Math

API Reference

6.15.1
gz/math/Cylinder.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 #ifndef GZ_MATH_CYLINDER_HH_
18 #define GZ_MATH_CYLINDER_HH_
19 
20 #include "gz/math/MassMatrix3.hh"
21 #include "gz/math/Material.hh"
22 #include "gz/math/Quaternion.hh"
23 
24 namespace ignition
25 {
26  namespace math
27  {
28  // Foward declarations
29  class CylinderPrivate;
30 
31  // Inline bracket to help doxygen filtering.
32  inline namespace IGNITION_MATH_VERSION_NAMESPACE {
33  //
42  template<typename Precision>
43  class Cylinder
44  {
48  public: Cylinder() = default;
49 
55  public: Cylinder(const Precision _length, const Precision _radius,
56  const Quaternion<Precision> &_rotOffset =
58 
65  public: Cylinder(const Precision _length, const Precision _radius,
66  const Material &_mat,
67  const Quaternion<Precision> &_rotOffset =
69 
71  public: ~Cylinder() = default;
72 
75  public: Precision Radius() const;
76 
79  public: void SetRadius(const Precision _radius);
80 
83  public: Precision Length() const;
84 
87  public: void SetLength(const Precision _length);
88 
94  public: Quaternion<Precision> RotationalOffset() const;
95 
100  public: void SetRotationalOffset(
101  const Quaternion<Precision> &_rotOffset);
102 
105  public: const Material &Mat() const;
106 
109  public: void SetMat(const Material &_mat);
110 
119  public: bool MassMatrix(MassMatrix3d &_massMat) const;
120 
123  public: bool operator==(const Cylinder &_cylinder) const;
124 
127  public: Precision Volume() const;
128 
137  public: Precision DensityFromMass(const Precision _mass) const;
138 
151  public: bool SetDensityFromMass(const Precision _mass);
152 
154  private: Precision radius = 0.0;
155 
157  private: Precision length = 0.0;
158 
160  private: Material material;
161 
163  private: Quaternion<Precision> rotOffset =
165  };
166 
170 
174 
178  }
179  }
180 }
181 #include "gz/math/detail/Cylinder.hh"
182 
183 #endif
Cylinder< float > Cylinderf
Cylinder with float precision.
Definition: gz/math/Cylinder.hh:177
Definition: gz/math/AdditivelySeparableScalarField3.hh:27
Precision Volume() const
Get the volume of the cylinder in m^3.
~Cylinder()=default
Destructor.
Contains information about a single material.
Definition: gz/math/Material.hh:65
Cylinder< double > Cylinderd
Cylinder with double precision.
Definition: gz/math/Cylinder.hh:173
Precision Radius() const
Get the radius in meters.
const Material & Mat() const
Get the material associated with this cylinder.
Precision DensityFromMass(const Precision _mass) const
Compute the cylinder's density given a mass value. The cylinder is assumed to be solid with uniform d...
Cylinder< int > Cylinderi
Cylinder with integer precision.
Definition: gz/math/Cylinder.hh:169
Cylinder()=default
Default constructor. The default radius and length are both zero. The default rotational offset is Qu...
Precision Length() const
Get the length in meters.
void SetRadius(const Precision _radius)
Set the radius in meters.
bool operator==(const Cylinder &_cylinder) const
Check if this cylinder is equal to the provided cylinder. Radius, length, and material properties wil...
void SetLength(const Precision _length)
Set the length in meters.
Quaternion< Precision > RotationalOffset() const
Get the rotational offset. By default, a cylinder's length is aligned with the Z axis....
void SetMat(const Material &_mat)
Set the material associated with this cylinder.
bool MassMatrix(MassMatrix3d &_massMat) const
Get the mass matrix for this cylinder. This function is only meaningful if the cylinder's radius,...
A representation of a cylinder.
Definition: gz/math/Cylinder.hh:43
A class for inertial information about a rigid body consisting of the scalar mass and a 3x3 symmetric...
Definition: gz/math/MassMatrix3.hh:45
bool SetDensityFromMass(const Precision _mass)
Set the density of this cylinder based on a mass value. Density is computed using Precision DensityFr...
void SetRotationalOffset(const Quaternion< Precision > &_rotOffset)
Set the rotation offset. See Quaternion<Precision> RotationalOffset() for details on the rotational o...