public static Vector3 ComputeCenter(ConvexShape shape, out float volume) { var pointContributions = CommonResources.GetVectorList(); GetPoints(shape, out volume, pointContributions); Vector3 center = AveragePoints(pointContributions); CommonResources.GiveBack(pointContributions); MathChecker.Validate(center); return center; }
/// <summary> /// Computes the center of the shape. This can be considered its /// center of mass. This calculation is often associated with the /// volume calculation, which is given by this method as well. /// </summary> /// <param name="volume">Volume of the shape.</param> /// <returns>Center of the shape.</returns> public override Vector3 ComputeCenter(out float volume) { return(InertiaHelper.ComputeCenter(this, out volume)); }