return new PointLocation(n0); } else if (x==x1 && y==y1 && z==z1) { return new PointLocation(n1); } else if (x==x2 && y==y2 && z==z2) { return new PointLocation(n2); } else if (x==x3 && y==y3 && z==z3) { return new PointLocation(n3); return locatePoint(tetNabor,x,y,z); } else { return new PointLocation(tet,false); return locatePoint(tetNabor,x,y,z); } else { return new PointLocation(tet,false); return locatePoint(tetNabor,x,y,z); } else { return new PointLocation(tet,false); return locatePoint(tetNabor,x,y,z); } else { return new PointLocation(tet,false); return new PointLocation(tet); return new PointLocation(new Edge(tet,n2,n3)); } else if (d0==0.0 && d2==0.0) { return new PointLocation(new Edge(tet,n3,n1));
/** * Locates a point. */ private PointLocation locatePoint(double x, double y, double z) { // If no tets yet, search the node list for an exact match. // Here, we use unperturbed node coordinates. if (_troot==null) { if (_nroot!=null) { Node node = _nroot; do { if (x==node.x() && y==node.y() && z==node.z()) return new PointLocation(node); node = node._next; } while (node!=_nroot); } return new PointLocation(null,false); } // Otherwise, find a good tet in which to begin the recursive search. Node nmin = _nroot; double dmin = distanceSquared(nmin,x,y,z); for (Node n:_sampledNodes) { double d = distanceSquared(n,x,y,z); if (d<dmin) { dmin = d; nmin = n; } } Tet tet = nmin._tet; return locatePoint(tet,x,y,z); }