private static boolean polygonTouchesMultiPoint_ ( Polygon polygon_a , MultiPoint multipoint_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 , multipoint_b , tolerance , false ) ; if ( relation == Relation . disjoint || relation == Relation . contains ) return false ; Envelope2D env_a_inflated = new Envelope2D ( ) ; polygon_a . queryEnvelope2D ( env_a_inflated ) ; env_a_inflated . inflate ( tolerance , tolerance ) ; Point2D ptB ; boolean b_boundary = false ; MultiPathImpl polygon_a_impl = ( MultiPathImpl ) polygon_a . _getImpl ( ) ; Polygon pa = null ; Polygon p_polygon_a = polygon_a ; boolean b_checked_polygon_a_quad_tree = false ; for ( int i = 0 ; i < multipoint_b . getPointCount ( ) ; i ++ ) { ptB = multipoint_b . getXY ( i ) ; if ( env_a_inflated . contains ( ptB ) ) { PolygonUtils . PiPResult result = PolygonUtils . isPointInPolygon2D ( p_polygon_a , ptB , tolerance ) ; if ( result == PolygonUtils . PiPResult . PiPBoundary ) b_boundary = true ; else if ( result == PolygonUtils . PiPResult . PiPInside ) return false ; } if ( ! b_checked_polygon_a_quad_tree ) { if ( PointInPolygonHelper . quadTreeWillHelp ( polygon_a , multipoint_b . getPointCount ( ) - 1 ) && ( polygon_a_impl . _getAccelerators ( ) == null || polygon_a_impl . _getAccelerators ( ) . getQuadTree ( ) == null ) ) { pa = new Polygon ( ) ; polygon_a . copyTo ( pa ) ; ( ( MultiPathImpl ) pa . _getImpl ( ) ) . _buildQuadTreeAccelerator ( Geometry . GeometryAccelerationDegree . enumMedium ) ; p_polygon_a = pa ; } else { p_polygon_a = polygon_a ; } b_checked_polygon_a_quad_tree = true ; } } if ( b_boundary ) return true ; return false ; }
Returns true if polygon_a touches multipoint_b .