public static final List<Geo> polyNearPoly(GeoArray s,GeoArray r,double near){
  int rlen=r.getSize();
  int slen=s.getSize();
  Geo pl0=r.get(rlen - 1);
  Geo pl1=new Geo();
  Geo sl0=s.get(slen - 1);
  Geo sl1=new Geo();
  List<Geo> list=null;
  for (int j=0; j < rlen; j++) {
    pl1=r.get(j,pl1);
    for (int i=0; i < slen; i++) {
      sl1=s.get(i,sl1);
      Geo ret=segmentsIntersectOrNear(sl0,sl1,pl0,pl1,near);
      if (ret != null) {
        if (list == null) {
          list=new LinkedList<Geo>();
        }
        list.add(ret);
      }
      sl0=sl1;
    }
    pl0=pl1;
  }
  return list;
}

public static final List < Geo > polyNearPoly ( GeoArray s , GeoArray r , double near ) { int rlen = r . getSize ( ) ; int slen = s . getSize ( ) ; Geo pl0 = r . get ( rlen - 1 ) ; Geo pl1 = new Geo ( ) ; Geo sl0 = s . get ( slen - 1 ) ; Geo sl1 = new Geo ( ) ; List < Geo > list = null ; for ( int j = 0 ; j < rlen ; j ++ ) { pl1 = r . get ( j , pl1 ) ; for ( int i = 0 ; i < slen ; i ++ ) { sl1 = s . get ( i , sl1 ) ; Geo ret = segmentsIntersectOrNear ( sl0 , sl1 , pl0 , pl1 , near ) ; if ( ret != null ) { if ( list == null ) { list = new LinkedList < Geo > ( ) ; } list . add ( ret ) ; } sl0 = sl1 ; } pl0 = pl1 ; } return list ; }
is one region ' s boundary within ' near ' range of a region ? note : good practice is s describes a smaller area than r .
