FarseerPhysics.Common.Decomposition.FlipcodeDecomposer.Snip C# (CSharp) Method

Snip() private static method

Cut a the contour and add a triangle into V to describe the location of the cut
private static Snip ( Vertices contour, int u, int v, int w, int n, int V ) : bool
contour Vertices The list of points defining the polygon
u int The index of the first point
v int The index of the second point
w int The index of the third point
n int The number of elements in the array.
V int The array to populate with indicies of triangles.
return bool
        private static bool Snip(Vertices contour, int u, int v, int w, int n, int[] V)
        {
            if (Settings.epsilon > MathUtils.area(ref _tmpA, ref _tmpB, ref _tmpC))
                return false;

            for (int p = 0; p < n; p++)
            {
                if ((p == u) || (p == v) || (p == w))
                    continue;

                Vector2 point = contour[V[p]];

                if (InsideTriangle(ref _tmpA, ref _tmpB, ref _tmpC, ref point))
                    return false;
            }

            return true;
        }
    }