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

Represents a rectangular prism collision shape. More...

#include <box.hpp>

Inheritance diagram for frcsim::Box:
frcsim::Shape

Public Member Functions

 Box (const Vector3 &halfExtents)
 Constructs a new Box centered at the local origin.
virtual ~Box ()=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.
const Vector3GetHalfExtents () const
 Gets the half extents of the box.
Public Member Functions inherited from frcsim::Shape
virtual ~Shape ()=default

Detailed Description

Represents a rectangular prism collision shape.

Constructor & Destructor Documentation

◆ Box()

frcsim::Box::Box ( const Vector3 & halfExtents)
inlineexplicit

Constructs a new Box centered at the local origin.

Parameters
halfExtentsA Vector3 where x, y, and z are half the width, height, and depth respectively.

◆ ~Box()

virtual frcsim::Box::~Box ( )
virtualdefault

Member Function Documentation

◆ CalculateLocalInertia()

Vector3 frcsim::Box::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::Box::CalculateVolume ( ) const
inlineoverridevirtual

Calculates the volume of the specific shape.

Returns
The geometric volume in cubic meters.

Implements frcsim::Shape.

◆ GetHalfExtents()

const Vector3 & frcsim::Box::GetHalfExtents ( ) const
inline

Gets the half extents of the box.

Returns
The dimensions of the box from the center to its edges.

◆ GetType()

ShapeType frcsim::Box::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/box.hpp