private static void ValidateAdjacentVertex(Vertex vertex) { if (reflexVertices.Contains(vertex)) { if (IsConvex(vertex)) { reflexVertices.Remove(vertex); convexVertices.Add(vertex); } } if (convexVertices.Contains(vertex)) { bool wasEar = earVertices.Contains(vertex); bool isEar = IsEar(vertex); if (wasEar && !isEar) { earVertices.Remove(vertex); } else if (!wasEar && isEar) { earVertices.AddFirst(vertex); } } }
private static void ValidateAdjacentVertex(Vertex vertex) { //Log("Validating: {0}...", vertex); if (reflexVertices.Contains(vertex)) { if (IsConvex(vertex)) { reflexVertices.Remove(vertex); convexVertices.Add(vertex); //Log("Vertex: {0} now convex", vertex); } else { //Log("Vertex: {0} still reflex", vertex); } } if (convexVertices.Contains(vertex)) { bool wasEar = earVertices.Contains(vertex); bool isEar = IsEar(vertex); if (wasEar && !isEar) { earVertices.Remove(vertex); //Log("Vertex: {0} no longer ear", vertex); } else if (!wasEar && isEar) { earVertices.AddFirst(vertex); //Log("Vertex: {0} now ear", vertex); } else { //Log("Vertex: {0} still ear", vertex); } } }