BEPUphysics.CollisionTests.CollisionAlgorithms.MinkowskiToolbox.ExpandMinkowskiSum C# (CSharp) Метод

ExpandMinkowskiSum() публичный статический Метод

Computes the expansion of the minkowski sum due to margins in a given direction.
public static ExpandMinkowskiSum ( float marginA, float marginB, System.Vector3 direction, System.Vector3 &toExpandA, System.Vector3 &toExpandB ) : void
marginA float First margin.
marginB float Second margin.
direction System.Vector3 Extreme point direction.
toExpandA System.Vector3 Margin contribution to the shapeA.
toExpandB System.Vector3 Margin contribution to the shapeB.
Результат void
        public static void ExpandMinkowskiSum(float marginA, float marginB, Vector3 direction, ref Vector3 toExpandA, ref Vector3 toExpandB)
        {
            float lengthSquared = direction.LengthSquared();
            if (lengthSquared > Toolbox.Epsilon)
            {
                lengthSquared = 1 / (float)Math.Sqrt(lengthSquared);   
                //The contribution to the minkowski sum by the margin is:
                //direction * marginA - (-direction) * marginB. 
                Vector3 contribution;
                Vector3.Multiply(ref direction, marginA * lengthSquared, out contribution);
                Vector3.Add(ref toExpandA, ref contribution, out toExpandA);
                Vector3.Multiply(ref direction, marginB * lengthSquared, out contribution);
                Vector3.Subtract(ref toExpandB, ref contribution, out toExpandB);
            }
            //If the direction is too small, then the expansion values are left unchanged.

        }
    }

Same methods

MinkowskiToolbox::ExpandMinkowskiSum ( float marginA, float marginB, System.Vector3 &direction, System.Vector3 &contribution ) : void