// 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)); }
public override bool Equals(object obj) { if (obj == null) { return(false); } VertexBase otherVertex = obj as VertexBase; if (otherVertex == null) { return(false); } return(id == otherVertex.id); }
/// <summary> /// Find a free incident half-edge after half1 and before half2. Here 'free' is defined as /// as having a null face to the left. The edge should be inbound to the query vertex. /// </summary> /// <param name="vertex"></param> /// <param name="begin"></param> /// <param name="end"></param> /// <returns></returns> private static Half FindFreeIncident(VertexBase vertex, Half begin, Half end) { Debug.Assert(begin.Target == vertex); Debug.Assert(end.Target == vertex); Debug.Assert(begin.Target == end.Target); Half current = begin; do { if (current.IsFree) { return(current); } current = current.VertexNext; }while (current != end); return(null); }
public VertexBase(VertexBase other) : this() { }
public bool Remove(VertexBase item) { throw new NotImplementedException(); }
/// <summary> /// Find a free incident half-edge around vertex. /// </summary> /// <param name="vertex">The vertex around which the search is to be performed</param> /// <returns>An inbound half-edge with a null face, or null if none could be found.</returns> private static Half FindFreeIncident(VertexBase vertex) { Half incident = vertex.half.pair; return(FindFreeIncident(vertex, incident, incident)); }
/// <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); }
/// <summary> /// Find the edge connecting /// </summary> /// <param name="v1">The first vertex</param> /// <param name="v2">The second vertex</param> /// <returns>The edge between first vertex and second vertex, or null if none exists</returns> public TEdge Find(VertexBase v1, VertexBase v2) { Half half = FindHalf(v1, v2); return(half != null ? (TEdge)half.Edge : null); }