Ignition Math

API Reference

6.9.3~pre2
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 IGNITION_MATH_SPHERE_HH_
18 #define IGNITION_MATH_SPHERE_HH_
19 
23 #include "ignition/math/Plane.hh"
24 
25 namespace ignition
26 {
27  namespace math
28  {
29  // Foward declarations
30  class SpherePrivate;
31 
32  // Inline bracket to help doxygen filtering.
33  inline namespace IGNITION_MATH_VERSION_NAMESPACE {
34  //
41  template<typename Precision>
42  class Sphere
43  {
45  public: Sphere() = default;
46 
49  public: explicit Sphere(const Precision _radius);
50 
54  public: Sphere(const Precision _radius, const Material &_mat);
55 
57  public: ~Sphere() = default;
58 
61  public: Precision Radius() const;
62 
65  public: void SetRadius(const Precision _radius);
66 
69  public: const ignition::math::Material &Material() const;
70 
73  public: void SetMaterial(const ignition::math::Material &_mat);
74 
81  public: bool MassMatrix(MassMatrix3d &_massMat) 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 
100  public: Precision VolumeBelow(const Plane<Precision> &_plane) const;
101 
109  public: std::optional<Vector3<Precision>>
110  CenterOfVolumeBelow(const Plane<Precision> &_plane) const;
111 
120  public: Precision DensityFromMass(const Precision _mass) const;
121 
134  public: bool SetDensityFromMass(const Precision _mass);
135 
137  private: Precision radius = 0.0;
138 
140  private: ignition::math::Material material;
141  };
142 
146 
150 
154  }
155  }
156 }
157 #include "ignition/math/detail/Sphere.hh"
158 
159 #endif
Sphere< double > Sphered
Sphere with double precision.
Definition: Sphere.hh:149
A class for inertial information about a rigid body consisting of the scalar mass and a 3x3 symmetric...
Definition: MassMatrix3.hh:45
A plane and related functions.
Definition: Plane.hh:38
Contains information about a single material.
Definition: Material.hh:65
A representation of a sphere.
Definition: Sphere.hh:42
Sphere< float > Spheref
Sphere with float precision.
Definition: Sphere.hh:153
Sphere< int > Spherei
Sphere with integer precision.
Definition: Sphere.hh:145
Definition: Angle.hh:42