private static void fillRightConcaveEdgeEvent( DTSweepContext tcx, DTSweepConstraint edge, AdvancingFrontNode node ) { fill( tcx, node.next ); if( node.next.point != edge.p ) { // Next above or below edge? if( orient2d( edge.q, node.next.point, edge.p ) == Orientation.CCW ) { // Below if( orient2d( node.point, node.next.point, node.next.next.point ) == Orientation.CCW ) { // Next is concave fillRightConcaveEdgeEvent( tcx, edge, node ); } else { // Next is convex } } } }
private static void fillLeftConcaveEdgeEvent( DTSweepContext tcx, DTSweepConstraint edge, AdvancingFrontNode node ) { fill( tcx, node.prev ); if( node.prev.point != edge.p ) { // Next above or below edge? if( orient2d( edge.q, node.prev.point, edge.p ) == Orientation.CW ) { // Below if( orient2d( node.point, node.prev.point, node.prev.prev.point ) == Orientation.CW ) { // Next is concave fillLeftConcaveEdgeEvent( tcx, edge, node ); } else { // Next is convex } } } }
fill( tcx, node ); if( node.prev == tcx.basin.leftNode && node.next == tcx.basin.rightNode )
/** * Find closes node to the left of the new point and * create a new triangle. If needed new holes and basins * will be filled to. * * @param tcx * @param point * @return */ private static AdvancingFrontNode pointEvent( DTSweepContext tcx, TriangulationPoint point ) { AdvancingFrontNode node,newNode; node = tcx.locateNode( point ); if( tcx.isDebugEnabled() ) { tcx.getDebugContext().setActiveNode( node ); } newNode = newFrontTriangle( tcx, point, node ); // Only need to check +epsilon since point never have smaller // x value than node due to how we fetch nodes from the front if( point.getX() <= node.point.getX() + EPSILON ) { fill( tcx, node ); } tcx.addNode( newNode ); fillAdvancingFront( tcx, newNode ); return newNode; }