private void processTris( double xp, double yp, TriMesh mesh, TriMesh.TriList triList) { _edgeList.clear(); int ntri = triList.ntri(); TriMesh.Tri[] tris = triList.tris(); for (int itri=0; itri<ntri; ++itri) { TriMesh.Tri tri = tris[itri]; TriMesh.Tri ta = tri.triA(); TriMesh.Tri tb = tri.triB(); TriMesh.Tri tc = tri.triC(); TriMesh.Node na = tri.nodeA(); TriMesh.Node nb = tri.nodeB(); TriMesh.Node nc = tri.nodeC(); tri.centerCircle(_xy); double xt = _xy[0]-xp, yt = _xy[1]-yp; processTriNabor(xp,yp,xt,yt,mesh,ta,nb,nc); processTriNabor(xp,yp,xt,yt,mesh,tb,nc,na); processTriNabor(xp,yp,xt,yt,mesh,tc,na,nb); } } private void processTriNabor(
/** * Marks the specified tri inner or outer. * The outer box must valid. */ private synchronized void markTriInnerOrOuter(Tri tri) { assert _xminOuter<_xmaxOuter:"outer box is valid"; assert _yminOuter<_ymaxOuter:"outer box is valid"; double[] po = {0.0,0.0}; double s = tri.centerCircle(po); double r = sqrt(s); double xo = po[0]; double yo = po[1]; if (xo-r>=_xminOuter && yo-r>=_yminOuter && xo+r<=_xmaxOuter && yo+r<=_ymaxOuter) { tri.setInner(); tri.clearOuter(); } else { tri.setOuter(); tri.clearInner(); } }
private void processTriNabor( double xp, double yp, double xt, double yt, TriMesh mesh, TriMesh.Tri ta, TriMesh.Node nb, TriMesh.Node nc) { boolean saveEdge = true; if (ta!=null && mesh.isMarked(ta)) { ta.centerCircle(_xy); double xa = _xy[0]-xp; double ya = _xy[1]-yp; double xy = xt*ya-xa*yt; accumulate(nc,xy); saveEdge = false; } if (saveEdge) addEdge(xp,yp,xt,yt,nb,nc); }
/** * Returns the circumcenter of this tri. * @return array of circumcenter coordinates {xc,yc}. */ public double[] centerCircle() { double[] c = new double[2]; centerCircle(c); return c; }