private static boolean polygonOverlapsEnvelope_ ( Polygon polygon_a , Envelope envelope_b , double tolerance , ProgressTracker progress_tracker ) { // Quick rasterize test to see whether the the geometries are disjoint, // or if one is contained in the other. int relation = tryRasterizedContainsOrDisjoint_ ( polygon_a , envelope_b , tolerance , false ) ; if ( relation == Relation . disjoint || relation == Relation . contains || relation == Relation . within ) return false ; Envelope2D env_a = new Envelope2D ( ) , env_b = new Envelope2D ( ) ; polygon_a . queryEnvelope2D ( env_a ) ; envelope_b . queryEnvelope2D ( env_b ) ; if ( envelopeInfContainsEnvelope_ ( env_b , env_a , tolerance ) ) return false ; if ( env_b . getWidth ( ) <= tolerance || env_b . getHeight ( ) <= tolerance ) return false ; // has no interior Polygon polygon_b = new Polygon ( ) ; polygon_b . addEnvelope ( envelope_b , false ) ; return polygonOverlapsPolygonImpl_ ( polygon_a , polygon_b , tolerance , progress_tracker ) ; }
Returns true if polygon_a overlaps envelope_b .