Beispiel #1
0
        // Return true if the three points form an ear.
        private static bool FormsEar(List <Vector2> vertices, int A, int B, int C)
        {
            if (GetAngle(vertices[A], vertices[B], vertices[C]) > 0)
            {
                return(false);
            }

            var triangleVertexA = vertices[A];
            var triangleVertexB = vertices[B];
            var triangleVertexC = vertices[C];

            for (var i = 0; i < vertices.Count; i++)
            {
                if (i != A && i != B && i != C)
                {
                    if (FixedMath.PointInTriangle(vertices[i], triangleVertexA, triangleVertexB, triangleVertexC))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }