public cEdge MakeNullEdge() { cEdge e = new cEdge(); InsertBeforeHead(e); return(e); }
public void InitHead(cEdge h) { head = new cEdge(); head = h; head.next = head.prev = head; n = 1; }
public void ClearEdgeList() { if (head != null) { head = null; } n = 0; }
public cVertex() { PrevVertex = NextVertex = null; Point = new cPointi(); IndexInPointCloud = 0; Edge = null; IsOnHull = false; IsProcessed = false; }
public cEdge next, prev; /* pointers to neighbours in cEdgeList */ public cEdge() { Adjface = new cFace[2]; Adjface[0] = Adjface[1] = null; Endpts = new cVertex[2]; Endpts[0] = Endpts[1] = null; newface = null; delete = false; next = prev = null; }
/*Inserts newE before oldE */ public void InsertBeforeHead(cEdge e) { if (head == null) { InitHead(e); } else { InsertBefore(e, head); } }
public void InsertBefore(cEdge newE, cEdge oldE) { if (head == null) { InitHead(newE); } else { oldE.prev.next = newE; newE.prev = oldE.prev; newE.next = oldE; oldE.prev = newE; n++; } }
public void PrintEdges() { cEdge temp = head; int i = 1; if (head != null) { do { temp.PrintEdge(i); temp = temp.next; i++; } while (temp != head); } }
public void Delete(cEdge e) { if (head == head.next) { head = null; } else if (e == head) { head = head.next; } e.prev.next = e.next; e.next.prev = e.prev; n--; }
/*--------------------------------------------------------------------- * MakeConeFace makes a new face and two new edges between the * edge and the point that are passed to it. It returns a pointer to * the new face. * ---------------------------------------------------------------------*/ private cFace MakeConeFace(cEdge e, cVertex p) { cEdge[] new_edge = new cEdge[2]; cFace new_face; int i, j; /* Make two new edges (if don't already exist). */ for (i = 0; i < 2; ++i) { /* If the edge exists, copy it into new_edge. */ new_edge[i] = e.Endpts[i].Edge; if (new_edge[i] == null) { /* Otherwise (duplicate is null), MakeNullEdge. */ new_edge[i] = Edges.MakeNullEdge(); new_edge[i].Endpts[0] = e.Endpts[i]; new_edge[i].Endpts[1] = p; e.Endpts[i].Edge = new_edge[i]; } } /* Make the new face. */ new_face = Faces.MakeNullFace(); new_face.Edges[0] = e; new_face.Edges[1] = new_edge[0]; new_face.Edges[2] = new_edge[1]; MakeCcw(new_face, e, p); /* Set the adjacent face pointers. */ for (i = 0; i < 2; ++i) { for (j = 0; j < 2; ++j) { /* Only one NULL link should be set to new_face. */ if (new_edge[i].Adjface[j] == null) { new_edge[i].Adjface[j] = new_face; break; } } } return(new_face); }
public bool Voronoi(List <Vector3> myListVectors) { if (Delaunay(myListVectors)) { for (int i = 0; i < this.Faces.ListFaces.Count; i++) { cFace face = this.Faces.ListFaces[i]; for (int j = 0; j < face.Edges.Length; j++) { cEdge edge = face.Edges[j]; for (int k = 0; k < edge.Adjface.Length; k++) { cFace adjFace = edge.Adjface[k]; cEdge newEdge = new cEdge(); //Kante m durch Verbindung der Umkreismittelpunkte von k und k+1 } } } return(true); } return(false); //var t = DelaunayTriangulation<TCell>.Create(data); //var myCells = t.Cells; //var edges = new HashSet<TEdge>(new EdgeComparer()); //foreach (var c in myCells) //{ // for (int i = 0; i < c.Adjacency.Length; i++) // { // var af = c.Adjacency[i]; // if (af != null) // edges.Add(new TEdge { Source = c, Target = af }); // } //} //return new VoronoiMesh<TCell, TEdge> //{ // Cells = myCells, // Edges = edges.ToList() //}; }
/*--------------------------------------------------------------------- * MakeCcw puts the pointCloud in the face structure in counterclock wise * order. We want to store the pointCloud in the same * order as in the visible face. The third vertex is always p. * ---------------------------------------------------------------------*/ private void MakeCcw(cFace f, cEdge e, cVertex p) { cFace fv; /* The visible face adjacent to e */ int i; /* Index of e.endpoint[0] in fv. */ cEdge s = new cEdge(); /* Temporary, for swapping */ if (e.Adjface[0].visible) { fv = e.Adjface[0]; } else { fv = e.Adjface[1]; } /* Set vertex[0] & [1] of f to have the same orientation * as do the corresponding pointCloud of fv. */ for (i = 0; fv.Vertices[i] != e.Endpts[0]; ++i) { ; } /* Orient f the same as fv. */ if (fv.Vertices[(i + 1) % 3] != e.Endpts[1]) { f.Vertices[0] = e.Endpts[1]; f.Vertices[1] = e.Endpts[0]; } else { f.Vertices[0] = e.Endpts[0]; f.Vertices[1] = e.Endpts[1]; Swap(s, f.Edges[1], f.Edges[2]); } /* This swap is tricky. e is edge[0]. edge[1] is based on endpt[0], * edge[2] on endpt[1]. So if e is oriented "forwards," we * need to move edge[1] to follow [0], because it precedes. */ f.Vertices[2] = p; }
public cEdgeList() { head = null; n = 0; }
private void Swap(cEdge t, cEdge x, cEdge y) { t = x; x = y; y = t; }
protected void Swap(cEdge t, cEdge x, cEdge y) { t = x; x = y; y = t; }