Gazebo Math

API Reference

7.4.0
gz/math/Sphere.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_SPHERE_HH_
18#define GZ_MATH_SPHERE_HH_
19
20#include <optional>
22#include "gz/math/Material.hh"
23#include "gz/math/Quaternion.hh"
24#include "gz/math/Plane.hh"
25
26namespace gz
27{
28 namespace math
29 {
30 // Foward declarations
31 class SpherePrivate;
32
33 // Inline bracket to help doxygen filtering.
34 inline namespace GZ_MATH_VERSION_NAMESPACE {
35 //
42 template<typename Precision>
43 class Sphere
44 {
46 public: Sphere() = default;
47
50 public: explicit Sphere(const Precision _radius);
51
55 public: Sphere(const Precision _radius, const Material &_mat);
56
59 public: Precision Radius() const;
60
63 public: void SetRadius(const Precision _radius);
64
67 public: const gz::math::Material &Material() const;
68
71 public: void SetMaterial(const gz::math::Material &_mat);
72
79 public: bool MassMatrix(MassMatrix3d &_massMat) const;
80
86 public: std::optional< MassMatrix3<Precision> > MassMatrix() const;
87
90 public: bool operator==(const Sphere &_sphere) const;
91
94 public: bool operator!=(const Sphere &_sphere) const;
95
98 public: Precision Volume() const;
99
105 public: Precision VolumeBelow(const Plane<Precision> &_plane) const;
106
114 public: std::optional<Vector3<Precision>>
116
125 public: Precision DensityFromMass(const Precision _mass) const;
126
139 public: bool SetDensityFromMass(const Precision _mass);
140
142 private: Precision radius = 0.0;
143
145 private: gz::math::Material material;
146 };
147
151
155
159 }
160 }
161}
162#include "gz/math/detail/Sphere.hh"
163
164#endif