nl_tokens: / * choose x y such that ( matrix multiply ) :
pl_tokens: private boolean jump2 ( double wantLat , double wantLon , int [ ] rectIndex ) { int row = Math . <mask> ( Math . min ( rectIndex [ 0 ] , nrows - 1 ) , 0 ) ; int col = Math . max ( Math . min ( rectIndex [ 1 ] , ncols - 1 ) , 0 ) ; double lat = latEdge . get ( row , col ) ; double lon = lonEdge . get ( row , col ) ; double diffLat = wantLat - lat ; double diffLon = wantLon - lon ; double dlatdy = latEdge . get ( row + 1 , col ) - lat ; double dlatdx = latEdge . get ( row , col + 1 ) - lat ; double dlondx = lonEdge . get ( row , col + 1 ) - lon ; double dlondy = lonEdge . get ( row + 1 , col ) - lon ; // solve for dlon double dx = ( diffLon - dlondy * diffLat / dlatdy ) / ( dlondx - dlatdx * dlondy / dlatdy ) ; // double dy =  (diffLat - dlatdx * diffLon / dlondx) / (dlatdy - dlatdx * dlondy / dlondx); double dy = ( diffLat - dlatdx * dx ) / dlatdy ; if ( debug ) System . out . printf ( "   jump from %d %d (dlondx=%f dlondy=%f dlatdx=%f dlatdy=%f) (diffLat,Lon=%f %f) (deltalat,Lon=%f %f)" , row , col , dlondx , dlondy , dlatdx , dlatdy , diffLat , diffLon , dy , dx ) ; int drow = ( int ) Math . round ( dy ) ; int dcol = ( int ) Math . round ( dx ) ; if ( ( drow == 0 ) && ( dcol == 0 ) ) { if ( debug ) System . out . printf ( "%n   incr:" ) ; return incr ( wantLat , wantLon , rectIndex ) ; } else { rectIndex [ 0 ] = Math . max ( Math . min ( row + drow , nrows - 1 ) , 0 ) ; rectIndex [ 1 ] = Math . max ( Math . min ( col + dcol , ncols - 1 ) , 0 ) ; if ( debug ) System . out . printf ( " to (%d %d)%n" , rectIndex [ 0 ] , rectIndex [ 1 ] ) ; if ( ( row == rectIndex [ 0 ] ) && ( col == rectIndex [ 1 ] ) ) return false ; // nothing has changed } return true ; }