int ntet = tetList.ntet(); TetMesh.Tet[] tets = tetList.tets(); for (int itet=0; itet<ntet; ++itet) {
private void processTets( double xp, double yp, double zp, TetMesh mesh, TetMesh.TetList tetList) { _faceList.clear(); int ntet = tetList.ntet(); TetMesh.Tet[] tets = tetList.tets(); for (int itet=0; itet<ntet; ++itet) { TetMesh.Tet tet = tets[itet]; TetMesh.Tet ta = tet.tetA(); TetMesh.Tet tb = tet.tetB(); TetMesh.Tet tc = tet.tetC(); TetMesh.Tet td = tet.tetD(); TetMesh.Node na = tet.nodeA(); TetMesh.Node nb = tet.nodeB(); TetMesh.Node nc = tet.nodeC(); TetMesh.Node nd = tet.nodeD(); tet.centerSphere(_xyz); double xt = _xyz[0]-xp, yt = _xyz[1]-yp, zt = _xyz[2]-zp; processTetNabor(xp,yp,zp,xt,yt,zt,mesh,ta,nb,nc,nd); processTetNabor(xp,yp,zp,xt,yt,zt,mesh,tb,nc,na,nd); processTetNabor(xp,yp,zp,xt,yt,zt,mesh,tc,nd,na,nb); processTetNabor(xp,yp,zp,xt,yt,zt,mesh,td,na,nc,nb); } } private void processTetNabor(
/** * Returns a new tet, possibly one resurrected from the dead. * Resurrection reduces the need for garbage collection of dead tets. * Assuming that the new tet will be linked into the mesh, the root * tet is set to the new tet. */ private Tet makeTet(Node n0, Node n1, Node n2, Node n3) { ++_ntet; int ndead = _deadTets.ntet(); if (ndead==0) { _troot = new Tet(n0,n1,n2,n3); } else { _troot = _deadTets.remove(ndead-1); _troot.init(n0,n1,n2,n3); } if (_ntetListeners>0) fireTetAdded(_troot); return _troot; }
/** * Kills a tet and, if there is room, buries it in the graveyard, * from where it may be resurrected later. * Never updates the root tet, even when the tet being killed is the * root tet. The caller is responsible for setting the root tet, as * necessary. */ private void killTet(Tet tet) { --_ntet; fireTetRemoved(tet); int ndead = _deadTets.ntet(); if (ndead<256) _deadTets.add(tet); // We assume that killTet is called only within contexts in // which _troot is updated to point to a live tet in the mesh. // Therefore, we do not update _troot here, when _troot==tet. }