public Mesh GetMesh() { Mesh m = new Mesh(); int[] map = new int[Vertices.Count]; for (int i = 0; i < Vertices.Count; i++) { map[i] = -1; } for (int i = 0; i < Vertices.Count; i++) { ECVertex v = Vertices[i]; if (v.IsValid()) { map[i] = m.AddVertex(new Point3d(v.X, v.Y, v.Z)); } } for (int i = 0; i < Faces.Count; i++) { ECFace f = Faces[i]; if (f.IsValid()) { Triangle t = new Triangle(map[f.GetVertex(0).UId], map[f.GetVertex(1).UId], map[f.GetVertex(2).UId]); m.AddFace(t); } } return(m); }
public void ContractRegion(ECVertex v1, ECVertex v2, List <ECFace> tempList) { tempList.Clear(); ECFace.UnTagFaceLoop(v1); ECFace.UnTagFaceLoop(v2); ECFace.CollectFaceLoop(v1, tempList); ECFace.CollectFaceLoop(v2, tempList); }
public void KillFace(ECFace face) { if (face.IsValid()) { face.Kill(); ValidFacesCount--; } }
public void UnlinkFace(ECFace face) { this.AdjFace.Remove(face); if (AdjFace.Count == 0) { Kill(); } }
public ECFace CreateFace(ECVertex v1, ECVertex v2, ECVertex v3) { ECEdge e0 = this.GetEdge(v1, v2); ECEdge e1 = this.GetEdge(v2, v3); ECEdge e2 = this.GetEdge(v3, v1); ECFace f = new ECFace(e0, e1, e2); Faces.Add(f); f.UId = Faces.Count - 1; ValidFacesCount++; return(f); }
public void MayFixFace(ECFace face) { ECVertex v0 = face.GetVertex(0); ECVertex v1 = face.GetVertex(1); ECVertex v2 = face.GetVertex(2); ECEdge e0 = face.GetEdge(0); ECEdge e1 = face.GetEdge(1); ECEdge e2 = face.GetEdge(2); bool a = (v0 == v1); bool b = (v0 == v2); bool c = (v1 == v2); if (a && c) { KillEdge(e0); KillEdge(e1); KillEdge(e2); KillFace(face); } else if (a) { KillEdge(e0); e1.ReplaceBy(e2.Twin()); KillFace(face); } else if (b) { KillEdge(e2); e0.ReplaceBy(e1.Twin()); KillFace(face); } else if (c) { KillEdge(e1); e0.ReplaceBy(e2.Twin()); KillFace(face); } }
public int AddFace(int p0i, int p1i, int p2i) { ECFace face = CreateFace(Vertices[p0i], Vertices[p1i], Vertices[p2i]); return(Faces.Count - 1); }
public void LinkFace(ECFace face) { this.AdjFace.Add(face); }