public void addNode( AdvancingFrontNode node ) { // System.out.println( "add:" + node.key + ":" + System.identityHashCode(node.key)); // m_nodeTree.put( node.getKey(), node ); aFront.addNode( node ); }
private AdvancingFrontNode locateNode( double x ) { AdvancingFrontNode node = findSearchNode(x); if( x < node.value ) { while( (node = node.prev) != null ) { if( x >= node.value ) { search = node; return node; } } } else { while( (node = node.next) != null ) { if( x < node.value ) { search = node.prev; return node.prev; } } } return null; }
public AdvancingFrontNode locateNode( TriangulationPoint point ) { return aFront.locateNode( point ); }
public void createAdvancingFront() { AdvancingFrontNode head,tail,middle; // Initial triangle DelaunayTriangle iTriangle = new DelaunayTriangle( _points.get(0), getTail(), getHead() ); addToList( iTriangle ); head = new AdvancingFrontNode( iTriangle.points[1] ); head.triangle = iTriangle; middle = new AdvancingFrontNode( iTriangle.points[0] ); middle.triangle = iTriangle; tail = new AdvancingFrontNode( iTriangle.points[2] ); aFront = new AdvancingFront( head, tail ); aFront.addNode( middle ); // TODO: I think it would be more intuitive if head is middles next and not previous // so swap head and tail aFront.head.next = middle; middle.next = aFront.tail; middle.prev = aFront.head; aFront.tail.prev = middle; }
public void removeNode( AdvancingFrontNode node ) { // System.out.println( "remove:" + node.key + ":" + System.identityHashCode(node.key)); // m_nodeTree.delete( node.getKey() ); aFront.removeNode( node ); }
/** * Try to map a node to all sides of this triangle that don't have * a neighbor. * * @param t */ public void mapTriangleToNodes( DelaunayTriangle t ) { AdvancingFrontNode n; for( int i=0; i<3; i++ ) { if( t.neighbors[i] == null ) { n = aFront.locatePoint( t.pointCW( t.points[i] ) ); if( n != null ) { n.triangle = t; } } } }
/** * We use a balancing tree to locate a node smaller or equal to * given key value * * @param x * @return */ public AdvancingFrontNode locateNode( TriangulationPoint point ) { return locateNode( point.getX() ); }
AdvancingFrontNode node = findSearchNode(px); final double nx = node.point.getX();