_nmin = null; _dmin = 0.0; _deadTets = new TetList(); _nnodeListeners = 0; _ntetListeners = 0;
if (tet!=null) { mark(tet); nabors.add(tet); Node n0 = tet._n0; Node n1 = tet._n1;
if (tet!=null) { mark(tet); nabors.add(tet); Node n0 = tet._n0; Node n1 = tet._n1;
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(
/** * Constructs an interpolator with specified method and samples. * This constructor is provided primarily for testing. * The default Hale-Liang method is accurate and fast. * @param method the implementation method. * @param f array of sample values f(x1,x2,x3). * @param x1 array of sample x1 coordinates. * @param x2 array of sample x2 coordinates. * @param x3 array of sample x3 coordinates. */ public SibsonInterpolator3( Method method, float[] f, float[] x1, float[] x2, float[] x3) { makeMesh(f,x1,x2,x3); _nodeList = new TetMesh.NodeList(); _tetList = new TetMesh.TetList(); if (method==Method.WATSON_SAMBRIDGE) { _va = new WatsonSambridge(); } else if (method==Method.BRAUN_SAMBRIDGE) { _va = new BraunSambridge(); } else if (method==Method.HALE_LIANG) { _va = new HaleLiang(); } }
/** * Appends the tet nabors of the specified face to the specified list. * @param face the face for which to get nabors. * @param nabors the list to which nabors are appended. */ public synchronized void getTetNabors(Face face, TetList nabors) { Tet tetLeft = face.tetLeft(); Tet tetRight = face.tetRight(); if (tetLeft==null && tetRight==null) { Node na = face.nodeA(); Node nb = face.nodeB(); Node nc = face.nodeC(); face = findFace(na,nb,nc); tetLeft = face.tetLeft(); tetRight = face.tetRight(); } if (tetLeft!=null) nabors.add(tetLeft); if (tetRight!=null) nabors.add(tetRight); }
private void addTet(double xp, double yp, double zp, TetMesh.Tet tet) { _mesh.mark(tet); _tetList.add(tet); addNode(tet.nodeA()); addNode(tet.nodeB()); addNode(tet.nodeC()); addNode(tet.nodeD()); TetMesh.Tet ta = tet.tetA(); TetMesh.Tet tb = tet.tetB(); TetMesh.Tet tc = tet.tetC(); TetMesh.Tet td = tet.tetD(); if (needTet(xp,yp,zp,ta)) addTet(xp,yp,zp,ta); if (needTet(xp,yp,zp,tb)) addTet(xp,yp,zp,tb); if (needTet(xp,yp,zp,tc)) addTet(xp,yp,zp,tc); if (needTet(xp,yp,zp,td)) addTet(xp,yp,zp,td); } private void addNode(TetMesh.Node node) {
/** * 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. }
private boolean getNaturalNabors(float x, float y, float z) { _mesh.clearNodeMarks(); _mesh.clearTetMarks(); _nodeList.clear(); _tetList.clear(); TetMesh.PointLocation pl = _mesh.locatePoint(x,y,z); if (pl.isOutside()) return false; addTet(x,y,z,pl.tet()); return true; } private void addTet(double xp, double yp, double zp, TetMesh.Tet tet) {