BEPUutilities.Toolbox.IsPointWithinFaceExtrusion C# (CSharp) Method

IsPointWithinFaceExtrusion() public static method

Determines if a point is within a set of planes defined by the edges of a triangle.
public static IsPointWithinFaceExtrusion ( System.Vector3 point, List planes, System.Vector3 centroid ) : bool
point System.Vector3 Point for comparison.
planes List Edge planes.
centroid System.Vector3 A point known to be inside of the planes.
return bool
        public static bool IsPointWithinFaceExtrusion(Vector3 point, List<Plane> planes, Vector3 centroid)
        {
            foreach (Plane plane in planes)
            {
                float centroidPlaneDot;
                plane.DotCoordinate(ref centroid, out centroidPlaneDot);
                float pointPlaneDot;
                plane.DotCoordinate(ref point, out pointPlaneDot);
                if (!((centroidPlaneDot <= Epsilon && pointPlaneDot <= Epsilon) || (centroidPlaneDot >= -Epsilon && pointPlaneDot >= -Epsilon)))
                {
                    //Point's NOT the same side of the centroid, so it's 'outside.'
                    return false;
                }
            }
            return true;
        }