if (tri!=null) { mark(tri); nabors.add(tri); Node n0 = tri._n0; Node n1 = tri._n1;
/** * Appends the tri nabors of the specified edge to the specified list. * @param edge the edge for which to get nabors. * @param nabors the list to which nabors are appended. */ public synchronized void getTriNabors(Edge edge, TriList nabors) { Tri triLeft = edge.triLeft(); Tri triRight = edge.triRight(); if (triLeft==null && triRight==null) { Node na = edge.nodeA(); Node nb = edge.nodeB(); edge = findEdge(na,nb); triLeft = edge.triLeft(); triRight = edge.triRight(); } if (triLeft!=null) nabors.add(triLeft); if (triRight!=null) nabors.add(triRight); }
private void addTri(double xp, double yp, TriMesh.Tri tri) { _mesh.mark(tri); _triList.add(tri); addNode(tri.nodeA()); addNode(tri.nodeB()); addNode(tri.nodeC()); TriMesh.Tri ta = tri.triA(); TriMesh.Tri tb = tri.triB(); TriMesh.Tri tc = tri.triC(); if (needTri(xp,yp,ta)) addTri(xp,yp,ta); if (needTri(xp,yp,tb)) addTri(xp,yp,tb); if (needTri(xp,yp,tc)) addTri(xp,yp,tc); } private void addNode(TriMesh.Node node) {
/** * Kills a tri and, if there is room, buries it in the graveyard, * from where it may be resurrected later. */ private void killTri(Tri tri) { --_ntri; fireTriRemoved(tri); int ndead = _deadTris.ntri(); if (ndead<256) { _deadTris.add(tri); } // We assume that killTri is called only within contexts in // which _troot is updated to point to a live tri in the mesh. // Therefore, we do not update _troot here, when _troot==tri. }