/** * Marks the specified tet inner or outer. * The outer box must valid. */ private synchronized void markTetInnerOrOuter(Tet tet) { assert _xminOuter<_xmaxOuter:"outer box is valid"; assert _yminOuter<_ymaxOuter:"outer box is valid"; assert _zminOuter<_zmaxOuter:"outer box is valid"; double[] po = {0.0,0.0,0.0}; double s = tet.centerSphere(po); double r = sqrt(s); double xo = po[0]; double yo = po[1]; double zo = po[2]; if (xo-r>=_xminOuter && yo-r>=_yminOuter && zo-r>=_zminOuter && xo+r<=_xmaxOuter && yo+r<=_ymaxOuter && zo+r<=_zmaxOuter) { tet.setInner(); tet.clearOuter(); } else { tet.setOuter(); tet.clearInner(); } }
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(
private void processTetNabor( double xp, double yp, double zp, double xt, double yt, double zt, TetMesh mesh, TetMesh.Tet ta, TetMesh.Node nb, TetMesh.Node nc, TetMesh.Node nd) { boolean saveFace = true; if (ta!=null && mesh.isMarked(ta)) { ta.centerSphere(_xyz); double xa = _xyz[0]-xp, ya = _xyz[1]-yp, za = _xyz[2]-zp; double xb = nb.xp()-xp, yb = nb.yp()-yp, zb = nb.zp()-zp; double xd = nd.xp()-xp, yd = nd.yp()-yp, zd = nd.zp()-zp; double xc = nc.xp()-xp, yc = nc.yp()-yp, zc = nc.zp()-zp; double xbd = xb+xd, ybd = yb+yd, zbd = zb+zd; double xdc = xd+xc, ydc = yd+yc, zdc = zd+zc; double xcb = xc+xb, ycb = yc+yb, zcb = zc+zb; double xyz = yt*za-ya*zt, yzx = zt*xa-za*xt, zxy = xt*ya-xa*yt; accumulate(nb,xbd*xyz+ybd*yzx+zbd*zxy); accumulate(nd,xdc*xyz+ydc*yzx+zdc*zxy); accumulate(nc,xcb*xyz+ycb*yzx+zcb*zxy); saveFace = false; } if (saveFace) addFace(xp,yp,zp,xt,yt,zt,nb,nc,nd); }
/** * Returns the circumcenter of this tet. * @return array of circumcenter coordinates {xc,yc,zc}. */ public double[] centerSphere() { double[] c = new double[3]; centerSphere(c); return c; }