/** searches for all opposite HalfEdges */ public void computeOppositeHalfEdges() { if (debug) { System.out.println("Compute opposite half edges..."); } for (HalfEdge halfEdge : halfEdges) { halfEdge.setOpposite(computeOppositeHalfEdge(halfEdge)); } }
public void triangulate(FaceList newFaces, double minArea) { HalfEdge hedge; if (numVertices() < 4) { return; } Vertex v0 = he0.head(); Face prevFace = null; hedge = he0.next; HalfEdge oppPrev = hedge.opposite; Face face0 = null; for (hedge = hedge.next; hedge != he0.prev; hedge = hedge.next) { Face face = createTriangle(v0, hedge.prev.head(), hedge.head(), minArea); face.he0.next.setOpposite(oppPrev); face.he0.prev.setOpposite(hedge.opposite); oppPrev = face.he0; newFaces.add(face); if (face0 == null) { face0 = face; } } hedge = new HalfEdge(he0.prev.prev.head(), this); hedge.setOpposite(oppPrev); hedge.prev = he0; hedge.prev.next = hedge; hedge.next = he0.prev; hedge.next.prev = hedge; computeNormalAndCentroid(minArea); checkConsistency(); for (Face face = face0; face != null; face = face.next) { face.checkConsistency(); } }