BEPUphysics.CollisionShapes.ConvexShapes.BoxShape.ComputeVolumeDistribution C# (CSharp) Метод

ComputeVolumeDistribution() публичный Метод

Computes the volume distribution of the shape as well as its volume. The volume distribution can be used to compute inertia tensors when paired with mass and other tuning factors.
public ComputeVolumeDistribution ( float &volume ) : Matrix3x3
volume float Volume of the shape.
Результат BEPUutilities.Matrix3x3
        public override Matrix3x3 ComputeVolumeDistribution(out float volume)
        {
            var volumeDistribution = new Matrix3x3();
            float halfWidthSquared = halfWidth * halfWidth;
            float halfHeightSquared = halfHeight * halfHeight;
            float halfLengthSquared = halfLength * halfLength;
            const float inv3 = 1 / 3f;

            volumeDistribution.M11 = (halfHeightSquared + halfLengthSquared) * inv3;
            volumeDistribution.M22 = (halfWidthSquared + halfLengthSquared) * inv3;
            volumeDistribution.M33 = (halfWidthSquared + halfHeightSquared) * inv3;
            volume = ComputeVolume();
            return volumeDistribution;
        }