BEPUutilities.Toolbox.GetPointProjectedOnPlane C# (CSharp) Method

GetPointProjectedOnPlane() public static method

Determines the location of the point when projected onto the plane defined by the normal and a point on the plane.
public static GetPointProjectedOnPlane ( System.Vector3 &point, System.Vector3 &normal, System.Vector3 &pointOnPlane, System.Vector3 &projectedPoint ) : void
point System.Vector3 Point to project onto plane.
normal System.Vector3 Normal of the plane.
pointOnPlane System.Vector3 Point located on the plane.
projectedPoint System.Vector3 Projected location of point onto plane.
return void
        public static void GetPointProjectedOnPlane(ref Vector3 point, ref Vector3 normal, ref Vector3 pointOnPlane, out Vector3 projectedPoint)
        {
            float dot;
            Vector3.Dot(ref normal, ref point, out dot);
            float dot2;
            Vector3.Dot(ref pointOnPlane, ref normal, out dot2);
            float t = (dot - dot2) / normal.LengthSquared();
            Vector3 multiply;
            Vector3.Multiply(ref normal, t, out multiply);
            Vector3.Subtract(ref point, ref multiply, out projectedPoint);
        }