public bool RefineMentTest(int halfedge) { ExtrudableMesh _extrudableMesh = modellingObject.GetComponentInChildren <ExtrudableMesh>(); Manifold manifold = _extrudableMesh._manifold; if (manifold.IsHalfedgeInUse(halfedge)) { int h2 = manifold.GetNextHalfEdge(halfedge); h2 = manifold.GetNextHalfEdge(h2); if (manifold.IsHalfedgeInUse(h2)) { int v1 = _extrudableMesh._manifold.SplitEdge(halfedge); int v2 = _extrudableMesh._manifold.SplitEdge(h2); int output = _extrudableMesh._manifold.SplitFaceByEdges(manifold.GetIncidentFace(halfedge), v1, v2); _extrudableMesh.UpdateMesh(); ControlsManager man = modellingObject.GetComponentInChildren <Controls.ControlsManager>(); man.UpdateControls(); return(true); } } return(false); }
public bool ValidateFaceLoop(int halfedgeId1, int halfedgeId2) { Manifold manifold = _extrudableMesh._manifold; //if (manifold.GetIncidentFace(halfedgeId1) == manifold.GetIncidentFace(halfedgeId2)) //{ // return false; //} if (!manifold.IsHalfedgeInUse(halfedgeId1) || !manifold.IsHalfedgeInUse(halfedgeId2)) { return(false); } int f = manifold.GetIncidentFace(halfedgeId1); int h = halfedgeId1; while (true) { int h2 = manifold.GetNextHalfEdge(h); h2 = manifold.GetNextHalfEdge(h2); int h3 = manifold.GetOppHalfEdge(h2); if (h2 == halfedgeId2 || h3 == halfedgeId2) { return(true); } else if (manifold.GetIncidentFace(h3) == f) { return(false); } h = h3; } }
public bool RefinementTestLoop(int halfedge1, int halfedge2) { if (!ValidateFaceLoop(halfedge1, halfedge2)) { return(false); } ExtrudableMesh _extrudableMesh = modellingObject.GetComponentInChildren <ExtrudableMesh>(); Manifold manifold = _extrudableMesh._manifold; int h = halfedge1; int initital_f = manifold.GetIncidentFace(halfedge1); int f = initital_f; List <int> faceloop = new List <int>(); List <int> edgeloop = new List <int>(); while (true) { if (manifold.IsFaceInUse(f)) { if (manifold.IsHalfedgeInUse(h)) { int h2 = manifold.GetNextHalfEdge(h); h2 = manifold.GetNextHalfEdge(h2); if (manifold.IsHalfedgeInUse(h2)) { int w = manifold.SplitEdge(h); edgeloop.Add(w); faceloop.Add(f); h = manifold.GetOppHalfEdge(h2); f = manifold.GetIncidentFace(h); if (f == initital_f) { int[] farray = faceloop.ToArray(); int[] earray = edgeloop.ToArray(); for (int i = 0; i < farray.Length; i++) { if (i == farray.Length - 1) { int output = manifold.SplitFaceByEdges(farray[i], earray[i], earray[0]); // earray[1]); } else { int output = manifold.SplitFaceByEdges(farray[i], earray[i], earray[i + 1]); } } _extrudableMesh.UpdateMesh(); return(true); } } else { return(false); } } else { return(false); } } else { return(false); } } }