JSim 2026.06.01-p(1)
Loading...
Searching...
No Matches
frcsim::Sphere Class Reference

Represents a perfect sphere collision shape. More...

#include <sphere.hpp>

Inheritance diagram for frcsim::Sphere:
frcsim::Shape

Public Member Functions

 Sphere (double radius)
 Constructs a new Sphere centered at the local origin.
virtual ~Sphere ()=default
ShapeType GetType () const override
 Gets the exact type of this shape.
double CalculateVolume () const override
 Calculates the volume of the specific shape.
Vector3 CalculateLocalInertia (double mass) const override
 Computes the diagonal of the local inertia tensor for this shape given a mass.
double GetRadius () const
 Gets the radius of the sphere.
Public Member Functions inherited from frcsim::Shape
virtual ~Shape ()=default

Detailed Description

Represents a perfect sphere collision shape.

Constructor & Destructor Documentation

◆ Sphere()

frcsim::Sphere::Sphere ( double radius)
inlineexplicit

Constructs a new Sphere centered at the local origin.

Parameters
radiusThe radius of the sphere in meters.

◆ ~Sphere()

virtual frcsim::Sphere::~Sphere ( )
virtualdefault

Member Function Documentation

◆ CalculateLocalInertia()

Vector3 frcsim::Sphere::CalculateLocalInertia ( double mass) const
inlineoverridevirtual

Computes the diagonal of the local inertia tensor for this shape given a mass.

Parameters
massThe mass of the rigid body attached to this shape in kg.
Returns
A Vector3 representing the moments of inertia (Ixx, Iyy, Izz).

Implements frcsim::Shape.

◆ CalculateVolume()

double frcsim::Sphere::CalculateVolume ( ) const
inlineoverridevirtual

Calculates the volume of the specific shape.

Returns
The geometric volume in cubic meters.

Implements frcsim::Shape.

◆ GetRadius()

double frcsim::Sphere::GetRadius ( ) const
inline

Gets the radius of the sphere.

Returns
The radius in meters.

◆ GetType()

ShapeType frcsim::Sphere::GetType ( ) const
inlineoverridevirtual

Gets the exact type of this shape.

Returns
The ShapeType enum value corresponding to the derived class.

Implements frcsim::Shape.


The documentation for this class was generated from the following file:
  • src/main/driver/include/frcsim/collision_shapes/sphere.hpp