calculateMassInfo method

  1. @override
void calculateMassInfo(
  1. MassInfo out
)
override

Calculate the mass information of the shape.

Implementation

@override
void calculateMassInfo(MassInfo out){
  double rsq = radius * radius;
  double sphereMass = volume() * radius * radius * density;
  double mass = pi * rsq * height * density + sphereMass;

  double sphereInertia = mass * radius * radius * 0.4;
  double inertiaXZ = ((0.25 * rsq) + (0.0833 * height * height)) * mass + sphereInertia;
  double inertiaY = 0.5 * rsq;

		out.mass = sphereMass + mass;
  out.inertia.setValues( inertiaXZ, 0, 0,  0, inertiaY, 0,  0, 0, inertiaXZ );
}