private static boolean pointTouchesEnvelope_ ( Point2D pt_a , Envelope2D env_b , double tolerance , ProgressTracker progress_tracker ) { if ( env_b . getHeight ( ) <= tolerance && env_b . getWidth ( ) <= tolerance ) return false ; // when treates as a point, points cannot touch points Envelope2D env_b_inflated = new Envelope2D ( ) , env_b_deflated = new Envelope2D ( ) ; env_b_inflated . setCoords ( env_b ) ; env_b_inflated . inflate ( tolerance , tolerance ) ; if ( ! env_b_inflated . contains ( pt_a ) ) return false ; if ( env_b . getHeight ( ) <= tolerance || env_b . getWidth ( ) <= tolerance ) { env_b_deflated . setCoords ( env_b ) ; if ( env_b . getHeight ( ) > tolerance ) env_b_deflated . inflate ( 0 , - tolerance ) ; else env_b_deflated . inflate ( - tolerance , 0 ) ; if ( env_b . getHeight ( ) > tolerance ) { if ( pt_a . y > env_b_deflated . ymin && pt_a . y < env_b_deflated . ymax ) return false ; } else { if ( pt_a . x > env_b_deflated . xmin && pt_a . x < env_b_deflated . xmax ) return false ; } return true ; } env_b_deflated . setCoords ( env_b ) ; env_b_deflated . inflate ( - tolerance , - tolerance ) ; if ( env_b_deflated . containsExclusive ( pt_a ) ) return false ; return true ; }
Returns true if pt_a touches env_b .