public void CheckEdge(WingedEdge w) { bool aux = false; foreach (EdgeWE e in w.Edges) { if (e.LeftFace != null && e.RightFace != null) { List <VertexWE> v1 = w.GetFaceVertices(e.RightFace); List <VertexWE> v2 = w.GetFaceVertices(e.LeftFace); VertexWE RightOppositeVertex = null; VertexWE LeftOppositeVertex = null; for (int i = 0; i < v1.Count; i++) { if (!Equals(v1[i], e.Vertex1) && !Equals(v1[i], e.Vertex2)) { RightOppositeVertex = v1[i]; } if (!Equals(v2[i], e.Vertex1) && !Equals(v2[i], e.Vertex2)) { LeftOppositeVertex = v2[i]; } } Vector3 Rightcc = CalculateCircumscribedCircumference(v1[0], v1[1], v1[2]); Vector3 Leftcc = CalculateCircumscribedCircumference(v2[0], v2[1], v2[2]); double RightccRadius = CalculateRadius(Rightcc, v1[0], v1[1], v1[2]); double LeftccRadius = CalculateRadius(Leftcc, v2[0], v2[1], v2[2]); if (InsideCC(Rightcc, RightccRadius, LeftOppositeVertex) || InsideCC(Leftcc, LeftccRadius, RightOppositeVertex)) { List <FaceWE> newfaces = w.FlipEdge(e); aux = true; break; } } } if (aux) { CheckEdge(w); } }
public void Continue() { while (pointlist.Count > 0) { VertexWE v = wingededge.AddVertex(pointlist[0].x, pointlist[0].y, pointlist[0].z); pointlist.RemoveAt(0); FaceWE currentFace = wingededge.PointInTriangle(v); List <FaceWE> newFaces = wingededge.AddVertex(currentFace, v); } CheckEdge(wingededge); List <FaceWE> faceToRemove = new List <FaceWE>(); for (int i = wingededge.Faces.Count - 1; i >= 0; i--) { if (wingededge.IsFaceBorder(wingededge.Faces[i])) { faceToRemove.Add(wingededge.Faces[i]); } } for (int i = 0; i < faceToRemove.Count; i++) { wingededge.RemoveFace(faceToRemove[i]); } List <Vector3> VoronoiVertices = new List <Vector3>(); for (int i = 0; i < wingededge.Faces.Count; i++) { List <VertexWE> vertices = wingededge.GetFaceVertices(wingededge.Faces[i]); wingededge.Faces[i].FaceCircumcenter = CalculateCircumscribedCircumference(vertices[0], vertices[1], vertices[2]); } GrahamScan(); TriangulatorGenerator meshGen = GetComponent <TriangulatorGenerator>(); meshGen.GenerateMesh(wingededge); }