/** * Appends the tri nabors of the specified node to the specified list. * @param node the node for which to get nabors. * @param nabors the list to which nabors are appended. */ public synchronized void getTriNabors(Node node, TriList nabors) { clearTriMarks(); getTriNabors(node,node._tri,nabors); }
/** * Gets an iterator for all edges on the hull of the mesh. * @return the iterator. */ public synchronized EdgeIterator getEdgesOnHull() { clearTriMarks(); Edge edge = getEdgeOnHull(_troot); final HashSet<Edge> edges = new HashSet<Edge>(128); getEdgesOnHull(edge,edges); return new EdgeIterator() { private Iterator<Edge> i = edges.iterator(); public final boolean hasNext() { return i.hasNext(); } public final Edge next() { return i.next(); } }; }
/** * Appends the node nabors of the specified node to the specified list. * @param node the node for which to get nabors. * @param nabors the list to which nabors are appended. */ public synchronized void getNodeNabors(Node node, NodeList nabors) { clearNodeMarks(); clearTriMarks(); getNodeNabors(node,node._tri,nabors); }
/** * Returns a tri that references the specified nodes. * @param na a node. * @param nb a node. * @return a tri that references the specified nodes; * or null, if a node is not in the mesh or the mesh * has no tris. */ public synchronized Tri findTri(Node na, Node nb) { Tri tri = findTri(na); if (tri!=null) { clearTriMarks(); tri = findTri(tri,na,nb); } return tri; }
/** * Returns a tri that references the specified nodes. * @param na a node. * @param nb a node. * @param nc a node. * @return a tri that references the specified nodes; * or null, if a node is not in the mesh or the mesh * has no tris. */ public synchronized Tri findTri(Node na, Node nb, Node nc) { Tri tri = findTri(na,nb); if (tri!=null) { clearTriMarks(); tri = findTri(tri,na,nb,nc); } return tri; }
clearTriMarks(); ArrayList<Tri> stack = new ArrayList<Tri>(128); ArrayList<Tri> list = new ArrayList<Tri>(_ntri);
/** * Finds the node nearest to the point with specified coordinates. */ private Node findNodeNearest(double x, double y) { // First, find the nearest node among the sampled nodes. _nmin = _nroot; _dmin = distanceSquared(_nmin,x,y); for (Node n:_sampledNodes) { double d = distanceSquared(n,x,y); if (d<_dmin) { _dmin = d; _nmin = n; } } // Then, recursively search node nabors to find the nearest node. // Note that we clear the node marks once, so that we never compute // the distance to a node twice, but that we clear the tri marks // *inside* the loop, to ensure that we visit all tri nabors of the // current nearest node. clearNodeMarks(); double dmin; do { clearTriMarks(); dmin = _dmin; findNodeNaborNearest(x,y,_nmin,_nmin._tri); } while (_dmin<dmin); return _nmin; }
private boolean getNaturalNabors(float x, float y) { _mesh.clearNodeMarks(); _mesh.clearTriMarks(); _nodeList.clear(); _triList.clear(); TriMesh.PointLocation pl = _mesh.locatePoint(x,y); if (pl.isOutside()) return false; addTri(x,y,pl.tri()); return true; } private void addTri(double xp, double yp, TriMesh.Tri tri) {
clearTriMarks(); clearNodeMarks();
clearTriMarks(); _edgeSet.clear(); if (pl.isInside()) {
clearTriMarks(); clearNodeMarks(); getDelaunayEdgesOpposite(node,tri);