コード例 #1
0
        private static void MakeMonotone(Face face, IDictionary <int, VertexType> vertTypes)
        {
            var vertices       = new List <Vertex>(_geometry.GetFaceVertices(face.Handle));
            var sortedVertices = GetSortedVertices(_geometry, face, vertices.ToList());
            var faceHalfEdges  = _geometry.GetFaceHalfEdges(face.Handle).ToList();
            var newFaces       = new List <Face>();

            _triSweepLineStatus = new TriSweepLineStatus();

            while (sortedVertices.Count != 0)
            {
                var current = sortedVertices[0];
                _triSweepLineStatus.UpdateNodes(current);

                switch (vertTypes[current.Handle])
                {
                case VertexType.StartVertex:
                    HandleStartVertex(face, current, faceHalfEdges);
                    break;

                case VertexType.EndVertex:
                    HandleEndVertex(current, faceHalfEdges, newFaces);
                    break;

                case VertexType.SplitVertex:
                    HandleSplitVertex(face, current, faceHalfEdges, newFaces);
                    break;

                case VertexType.MergeVertex:
                    HandleMergeVertex(face, current, faceHalfEdges, newFaces);
                    break;

                case VertexType.RegularVertex:
                    HandleRegularVertex(face, current, faceHalfEdges, newFaces);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
                sortedVertices.RemoveAt(0);
            }
        }