Ignition Math

API Reference

6.10.0
Capsule.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 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 IGNITION_MATH_CAPSULE_HH_
18 #define IGNITION_MATH_CAPSULE_HH_
19 
20 #include <optional>
23 
24 namespace ignition
25 {
26  namespace math
27  {
28  // Foward declarations
29  class CapsulePrivate;
30 
31  // Inline bracket to help doxygen filtering.
32  inline namespace IGNITION_MATH_VERSION_NAMESPACE {
33  //
42  template<typename Precision>
43  class Capsule
44  {
47  public: Capsule() = default;
48 
52  public: Capsule(const Precision _length, const Precision _radius);
53 
58  public: Capsule(const Precision _length, const Precision _radius,
59  const Material &_mat);
60 
63  public: Precision Radius() const;
64 
67  public: void SetRadius(const Precision _radius);
68 
71  public: Precision Length() const;
72 
75  public: void SetLength(const Precision _length);
76 
79  public: const Material &Mat() const;
80 
83  public: void SetMat(const Material &_mat);
84 
91  public: std::optional< MassMatrix3<Precision> > MassMatrix() const;
92 
95  public: bool operator==(const Capsule &_capsule) const;
96 
99  public: Precision Volume() const;
100 
109  public: Precision DensityFromMass(const Precision _mass) const;
110 
123  public: bool SetDensityFromMass(const Precision _mass);
124 
126  private: Precision radius = 0.0;
127 
129  private: Precision length = 0.0;
130 
132  private: Material material;
133  };
134 
138 
142 
146  }
147  }
148 }
149 #include "ignition/math/detail/Capsule.hh"
150 
151 #endif
A representation of a capsule or sphere-capped cylinder.
Definition: Capsule.hh:43
Capsule< double > Capsuled
Capsule with double precision.
Definition: Capsule.hh:141
Contains information about a single material.
Definition: Material.hh:65
Capsule< int > Capsulei
Capsule with integer precision.
Definition: Capsule.hh:137
Definition: Angle.hh:42
Capsule< float > Capsulef
Capsule with float precision.
Definition: Capsule.hh:145