/** * Locates a point with specified coordinates. * @param x the x coordinate. * @param y the y coordinate. * @param z the z coordinate. * @return the {@link PointLocation}. */ public synchronized PointLocation locatePoint(float x, float y, float z) { return locatePoint((double)x,(double)y,(double)z); }
private void addGhostNodes(float[] x, float[] y, float[] z) { int ng = x.length; for (int ig=0; ig<ng; ++ig) { float xg = x[ig]; float yg = y[ig]; float zg = z[ig]; TetMesh.PointLocation pl = _mesh.locatePoint(xg,yg,zg); if (pl.isOutside()) { TetMesh.Node n = new TetMesh.Node(xg,yg,zg); n.data = new NodeData(); n.index = -1-ig; // ghost nodes have negative indices _mesh.addNode(n); } } }
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) {
/** * 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); }
PointLocation pl = locatePoint(x,y,z);
PointLocation pl = locatePoint(node._x,node._y,node._z);
Tet tetNabor = tet.tetNabor(n0); if (tetNabor!=null) { return locatePoint(tetNabor,x,y,z); } else { return new PointLocation(tet,false); Tet tetNabor = tet.tetNabor(n1); if (tetNabor!=null) { return locatePoint(tetNabor,x,y,z); } else { return new PointLocation(tet,false); Tet tetNabor = tet.tetNabor(n2); if (tetNabor!=null) { return locatePoint(tetNabor,x,y,z); } else { return new PointLocation(tet,false); Tet tetNabor = tet.tetNabor(n3); if (tetNabor!=null) { return locatePoint(tetNabor,x,y,z); } else { return new PointLocation(tet,false);
float yg = y[ig]; float zg = z[ig]; TetMesh.PointLocation pl = _mesh.locatePoint(xg,yg,zg); if (pl.isOutside()) { TetMesh.Node n = new TetMesh.Node(xg,yg,zg);