Gazebo Math

API Reference

7.4.0
gz/math/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 GZ_MATH_CAPSULE_HH_
18#define GZ_MATH_CAPSULE_HH_
19
20#include <optional>
22#include "gz/math/Material.hh"
23
24namespace gz
25{
26 namespace math
27 {
28 // Foward declarations
29 class CapsulePrivate;
30
31 // Inline bracket to help doxygen filtering.
32 inline namespace GZ_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 "gz/math/detail/Capsule.hh"
150
151#endif