Example #1
0
        private void HandleSplitVertex(TVertex vertex)
        {
#if DEBUG
            int hs = helpers.Count;
#endif
            Debug.Assert(GetVertexType(vertex) == VertexType.Split);
            // There are no sweep line status modification to be made from above-incident edges
            // Add a diagonal from vertex to the helper of the edge directly to the left
            EdgeBase rightmostEdge = RightmostEdge(vertex);
            KeyValuePair <EdgeBase, TVertex>?directlyLeft = DirectlyLeftOf(rightmostEdge);
            if (directlyLeft.HasValue)
            {
                TVertex helper = directlyLeft.Value.Value;
                DiagonalInserterDelegate(mesh, vertex, helper);
                helpers[directlyLeft.Value.Key] = vertex;
            }

            // Add all of the below-indicent edges into the sweep line status (helpers)
            // with this vertex as their helper
            IEnumerable <EdgeBase> belowEdges = meshUtilities.BelowEdges(vertex);
            foreach (EdgeBase edge in belowEdges)
            {
                helpers[edge] = vertex;
            }
#if DEBUG
            Debug.Assert(helpers.Count == hs + belowEdges.Count());
#endif
        }
 /// <summary>
 /// Find the edges which are below-indicent to the given vertex and
 /// indicent to the face we are triangulating
 /// </summary>
 /// <param name="vertex"></param>
 /// <returns></returns>
 private IEnumerable <EdgeBase> BelowEdges(TVertex vertex)
 {
     return(meshUtilities.BelowEdges(vertex).Where(e => e.Faces.First == face ||
                                                   e.Faces.Second == face));
 }