Gazebo Math

API Reference

9.0.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 GZ_MATH_CAPSULE_HH_
18#define GZ_MATH_CAPSULE_HH_
19
20#include <optional>
22#include "gz/math/Material.hh"
23#include "gz/math/Plane.hh"
24
25namespace gz::math
26{
27 // Inline bracket to help doxygen filtering.
28 inline namespace GZ_MATH_VERSION_NAMESPACE {
29 //
38 template<typename Precision>
39 class Capsule
40 {
43 public: Capsule() = default;
44
48 public: Capsule(const Precision _length, const Precision _radius);
49
55 const Material &_mat);
56
59 public: Precision Radius() const;
60
63 public: void SetRadius(const Precision _radius);
64
67 public: Precision Length() const;
68
71 public: void SetLength(const Precision _length);
72
75 public: const Material &Mat() const;
76
79 public: void SetMat(const Material &_mat);
80
87 public: std::optional< MassMatrix3<Precision> > MassMatrix() const;
88
91 public: bool operator==(const Capsule &_capsule) const;
92
95 public: Precision Volume() const;
96
103
111 public: std::optional<Vector3<Precision>>
113
123
136 public: bool SetDensityFromMass(const Precision _mass);
137
139 private: Precision radius = 0.0;
140
142 private: Precision length = 0.0;
143
145 private: Material material;
146 };
147
151
155
159 } // namespace GZ_MATH_VERSION_NAMESPACE
160} // namespace gz::math
161#include "gz/math/detail/Capsule.hh"
162#endif // GZ_MATH_CAPSULE_HH_