BEPUutilities.Toolbox.ArePointsOnOppositeSidesOfPlane C# (CSharp) Method

ArePointsOnOppositeSidesOfPlane() public static method

Determines if vectors o and p are on opposite sides of the plane defined by a, b, and c.
public static ArePointsOnOppositeSidesOfPlane ( System.Vector3 &o, System.Vector3 &p, System.Vector3 &a, System.Vector3 &b, System.Vector3 &c ) : bool
o System.Vector3 First point for comparison.
p System.Vector3 Second point for comparison.
a System.Vector3 First vertex of the plane.
b System.Vector3 Second vertex of plane.
c System.Vector3 Third vertex of plane.
return bool
        public static bool ArePointsOnOppositeSidesOfPlane(ref Vector3 o, ref Vector3 p, ref Vector3 a, ref Vector3 b, ref Vector3 c)
        {
            Vector3 ab, ac, ap, ao;
            Vector3.Subtract(ref b, ref a, out ab);
            Vector3.Subtract(ref c, ref a, out ac);
            Vector3.Subtract(ref p, ref a, out ap);
            Vector3.Subtract(ref o, ref a, out ao);
            Vector3 q;
            Vector3.Cross(ref ab, ref ac, out q);
            float signp;
            Vector3.Dot(ref ap, ref q, out signp);
            float signo;
            Vector3.Dot(ref ao, ref q, out signo);
            if (signp * signo <= 0)
                return true;
            return false;
        }