Gazebo Math

API Reference

8.0.0
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::math
27{
28 // Inline bracket to help doxygen filtering.
29 inline namespace GZ_MATH_VERSION_NAMESPACE {
30 //
37 template<typename Precision>
38 class Sphere
39 {
41 public: Sphere() = default;
42
45 public: explicit Sphere(const Precision _radius);
46
50 public: Sphere(const Precision _radius, const Material &_mat);
51
54 public: Precision Radius() const;
55
58 public: void SetRadius(const Precision _radius);
59
62 public: const gz::math::Material &Material() const;
63
66 public: void SetMaterial(const gz::math::Material &_mat);
67
74 public: bool MassMatrix(MassMatrix3d &_massMat) const;
75
81 public: std::optional< MassMatrix3<Precision> > MassMatrix() const;
82
85 public: bool operator==(const Sphere &_sphere) const;
86
89 public: bool operator!=(const Sphere &_sphere) const;
90
93 public: Precision Volume() const;
94
101
109 public: std::optional<Vector3<Precision>>
111
121
134 public: bool SetDensityFromMass(const Precision _mass);
135
137 private: Precision radius = 0.0;
138
140 private: gz::math::Material material;
141 };
142
146
150
154 } // namespace GZ_MATH_VERSION_NAMESPACE
155} // namespace gz::math
156#include "gz/math/detail/Sphere.hh"
157#endif // GZ_MATH_SPHERE_HH_