44 return 8.0 * m_halfExtents.x * m_halfExtents.y * m_halfExtents.z;
48 double lx2 = 4.0 * m_halfExtents.
x * m_halfExtents.x;
49 double ly2 = 4.0 * m_halfExtents.y * m_halfExtents.y;
50 double lz2 = 4.0 * m_halfExtents.z * m_halfExtents.z;
51 double factor = mass / 12.0;
52 return Vector3(factor * (ly2 + lz2), factor * (lx2 + lz2), factor * (lx2 + ly2));
Box(const Vector3 &halfExtents)
Constructs a new Box centered at the local origin.
Definition box.hpp:39
const Vector3 & GetHalfExtents() const
Gets the half extents of the box.
Definition box.hpp:55
double CalculateVolume() const override
Calculates the volume of the specific shape.
Definition box.hpp:43
ShapeType GetType() const override
Gets the exact type of this shape.
Definition box.hpp:41
Vector3 CalculateLocalInertia(double mass) const override
Computes the diagonal of the local inertia tensor for this shape given a mass.
Definition box.hpp:47
Base class for all collision geometries in the physics engine.
Definition shape.hpp:28
ShapeType
Enum identifying the specific types of collision shapes available.
Definition shape.hpp:14
@ BOX
Definition shape.hpp:15
3D vector utility used throughout JSim physics.
Definition vector.hpp:22
double x
X component.
Definition vector.hpp:24