9#define M_PI 3.14159265358979323846
24 explicit Sphere(
double radius);
47 return (4.0 / 3.0) *
M_PI * m_radius * m_radius * m_radius;
51 double i = 0.4 * mass * m_radius * m_radius;
Base class for all collision geometries in the physics engine.
Definition shape.hpp:28
double GetRadius() const
Gets the radius of the sphere.
Definition sphere.hpp:55
Sphere(double radius)
Constructs a new Sphere centered at the local origin.
Definition sphere.hpp:42
virtual ~Sphere()=default
Vector3 CalculateLocalInertia(double mass) const override
Computes the diagonal of the local inertia tensor for this shape given a mass.
Definition sphere.hpp:50
double CalculateVolume() const override
Calculates the volume of the specific shape.
Definition sphere.hpp:46
ShapeType GetType() const override
Gets the exact type of this shape.
Definition sphere.hpp:44
ShapeType
Enum identifying the specific types of collision shapes available.
Definition shape.hpp:14
@ SPHERE
Definition shape.hpp:16
#define M_PI
Definition sphere.hpp:9
3D vector utility used throughout JSim physics.
Definition vector.hpp:22