// TODO: Euler operators from http://www.cgal.org/Manual/3.2/doc_html/cgal_manual/HalfedgeDS_ref/Class_HalfedgeDS_decorator.html#Cross_link_anchor_573 /// <summary> /// Split the face across a diagonal between two vertices a and b. /// The returned edge has a pair of faces accessible through its /// Faces property. edge.Faces.First will always be the new face /// instance. edge.Faces.Second will always be the original reduced /// face instance that was supplied as a parameter. /// </summary> /// <param name="face">The face to be split</param> /// <param name="a">The start of the diagonal</param> /// <param name="b">The end of the diagonal</param> /// <returns></returns> public TEdge SplitFace(FaceBase face, VertexBase a, VertexBase b) { // Two vertices alone are not sufficient to determine a // unique face, so the face is also supplied. (The two // vertices may lie on the same boundary between two faces. Half p = a.FindHalfEdge(half => (half.Face == face)); Half q = b.FindHalfEdge(half => (half.Face == face)); Half h = p.previous; Half g = q.previous; return(SplitFace(h, g)); }
/// <summary> /// Find an existing half-edge between fromVertex to toVertex /// </summary> /// <param name="fromVertex">The hald-edge source.</param> /// <param name="toVertex">The half-edge target.</param> /// <returns>An existing half-edge, or null.</returns> private static Half FindHalf(VertexBase fromVertex, VertexBase toVertex) { Half result = fromVertex.FindHalfEdge(half => half.Target == toVertex); return(result); }