private static boolean makeConcavePolygon(final PlanetModel planetModel,final GeoCompositePolygon rval,final MutableBoolean seenConcave,final EdgeBuffer edgeBuffer,final List<GeoPolygon> holes,final GeoPoint testPoint){
  if (edgeBuffer.size() == 0) {
    return true;
  }
  if (seenConcave.value) {
    throw new IllegalArgumentException("Illegal polygon; polygon edges intersect each other");
  }
  seenConcave.value=true;
  if (edgeBuffer.size() < 3) {
    throw new IllegalArgumentException("Illegal polygon; polygon edges intersect each other");
  }
  final List<GeoPoint> points=new ArrayList<GeoPoint>(edgeBuffer.size());
  final BitSet internalEdges=new BitSet(edgeBuffer.size() - 1);
  Edge edge=edgeBuffer.pickOne();
  boolean isInternal=false;
  for (int i=0; i < edgeBuffer.size(); i++) {
    points.add(edge.startPoint);
    if (i < edgeBuffer.size() - 1) {
      internalEdges.set(i,edge.isInternal);
    }
 else {
      isInternal=edge.isInternal;
    }
    edge=edgeBuffer.getNext(edge);
  }
  if (testPoint != null && holes != null && holes.size() > 0) {
    final GeoPolygon testPolygon=new GeoConcavePolygon(planetModel,points,null,internalEdges,isInternal);
    if (testPolygon.isWithin(testPoint)) {
      return false;
    }
  }
  final GeoPolygon realPolygon=new GeoConcavePolygon(planetModel,points,holes,internalEdges,isInternal);
  if (testPoint != null && (holes == null || holes.size() == 0)) {
    if (realPolygon.isWithin(testPoint)) {
      return false;
    }
  }
  rval.addShape(realPolygon);
  return true;
}

private static boolean makeConcavePolygon ( final PlanetModel planetModel , final GeoCompositePolygon rval , final MutableBoolean seenConcave , final EdgeBuffer edgeBuffer , final List < GeoPolygon > holes , final GeoPoint testPoint ) { if ( edgeBuffer . size ( ) == 0 ) { return true ; } if ( seenConcave . value ) { throw new IllegalArgumentException ( "Illegal polygon; polygon edges intersect each other" ) ; } seenConcave . value = true ; if ( edgeBuffer . size ( ) < 3 ) { throw new IllegalArgumentException ( "Illegal polygon; polygon edges intersect each other" ) ; } final List < GeoPoint > points = new ArrayList < GeoPoint > ( edgeBuffer . size ( ) ) ; final BitSet internalEdges = new BitSet ( edgeBuffer . size ( ) - 1 ) ; Edge edge = edgeBuffer . pickOne ( ) ; boolean isInternal = false ; for ( int i = 0 ; i < edgeBuffer . size ( ) ; i ++ ) { points . add ( edge . startPoint ) ; if ( i < edgeBuffer . size ( ) - 1 ) { internalEdges . set ( i , edge . isInternal ) ; } else { isInternal = edge . isInternal ; } edge = edgeBuffer . getNext ( edge ) ; } if ( testPoint != null && holes != null && holes . size ( ) > 0 ) { final GeoPolygon testPolygon = new GeoConcavePolygon ( planetModel , points , null , internalEdges , isInternal ) ; if ( testPolygon . isWithin ( testPoint ) ) { return false ; } } final GeoPolygon realPolygon = new GeoConcavePolygon ( planetModel , points , holes , internalEdges , isInternal ) ; if ( testPoint != null && ( holes == null || holes . size ( ) == 0 ) ) { if ( realPolygon . isWithin ( testPoint ) ) { return false ; } } rval . addShape ( realPolygon ) ; return true ; }
look for a concave polygon in the remainder of the edgebuffer . by this point , if there are any edges in the edgebuffer , they represent a concave polygon .
