public GeoComplexPolygon(final PlanetModel planetModel,final List<List<GeoPoint>> pointsList,final GeoPoint testPoint,final boolean testPointInSet){
  super(planetModel);
  this.testPointInSet=testPointInSet;
  this.testPoint=testPoint;
  this.testPointFixedYPlane=new Plane(0.0,1.0,0.0,-testPoint.y);
  this.testPointFixedXPlane=new Plane(1.0,0.0,0.0,-testPoint.x);
  this.testPointFixedZPlane=new Plane(0.0,0.0,1.0,-testPoint.z);
  this.testPointFixedYAbovePlane=new Plane(testPointFixedYPlane,true);
  this.testPointFixedYBelowPlane=new Plane(testPointFixedYPlane,false);
  this.testPointFixedXAbovePlane=new Plane(testPointFixedXPlane,true);
  this.testPointFixedXBelowPlane=new Plane(testPointFixedXPlane,false);
  this.testPointFixedZAbovePlane=new Plane(testPointFixedZPlane,true);
  this.testPointFixedZBelowPlane=new Plane(testPointFixedZPlane,false);
  this.edgePoints=new GeoPoint[pointsList.size()];
  this.shapeStartEdges=new Edge[pointsList.size()];
  final ArrayList<Edge> allEdges=new ArrayList<>();
  int edgePointIndex=0;
  for (  final List<GeoPoint> shapePoints : pointsList) {
    allEdges.ensureCapacity(allEdges.size() + shapePoints.size());
    GeoPoint lastGeoPoint=shapePoints.get(shapePoints.size() - 1);
    edgePoints[edgePointIndex]=lastGeoPoint;
    Edge lastEdge=null;
    Edge firstEdge=null;
    for (    final GeoPoint thisGeoPoint : shapePoints) {
      final Edge edge=new Edge(planetModel,lastGeoPoint,thisGeoPoint);
      allEdges.add(edge);
      if (firstEdge == null) {
        firstEdge=edge;
      }
      if (lastEdge != null) {
        lastEdge.next=edge;
        edge.previous=lastEdge;
      }
      lastEdge=edge;
      lastGeoPoint=thisGeoPoint;
    }
    firstEdge.previous=lastEdge;
    lastEdge.next=firstEdge;
    shapeStartEdges[edgePointIndex]=firstEdge;
    edgePointIndex++;
  }
  xTree=new XTree(allEdges);
  yTree=new YTree(allEdges);
  zTree=new ZTree(allEdges);
}

public GeoComplexPolygon ( final PlanetModel planetModel , final List < List < GeoPoint > > pointsList , final GeoPoint testPoint , final boolean testPointInSet ) { super ( planetModel ) ; this . testPointInSet = testPointInSet ; this . testPoint = testPoint ; this . testPointFixedYPlane = new Plane ( 0.0 , 1.0 , 0.0 , - testPoint . y ) ; this . testPointFixedXPlane = new Plane ( 1.0 , 0.0 , 0.0 , - testPoint . x ) ; this . testPointFixedZPlane = new Plane ( 0.0 , 0.0 , 1.0 , - testPoint . z ) ; this . testPointFixedYAbovePlane = new Plane ( testPointFixedYPlane , true ) ; this . testPointFixedYBelowPlane = new Plane ( testPointFixedYPlane , false ) ; this . testPointFixedXAbovePlane = new Plane ( testPointFixedXPlane , true ) ; this . testPointFixedXBelowPlane = new Plane ( testPointFixedXPlane , false ) ; this . testPointFixedZAbovePlane = new Plane ( testPointFixedZPlane , true ) ; this . testPointFixedZBelowPlane = new Plane ( testPointFixedZPlane , false ) ; this . edgePoints = new GeoPoint [ pointsList . size ( ) ] ; this . shapeStartEdges = new Edge [ pointsList . size ( ) ] ; final ArrayList < Edge > allEdges = new ArrayList < > ( ) ; int edgePointIndex = 0 ; for ( final List < GeoPoint > shapePoints : pointsList ) { allEdges . ensureCapacity ( allEdges . size ( ) + shapePoints . size ( ) ) ; GeoPoint lastGeoPoint = shapePoints . get ( shapePoints . size ( ) - 1 ) ; edgePoints [ edgePointIndex ] = lastGeoPoint ; Edge lastEdge = null ; Edge firstEdge = null ; for ( final GeoPoint thisGeoPoint : shapePoints ) { final Edge edge = new Edge ( planetModel , lastGeoPoint , thisGeoPoint ) ; allEdges . add ( edge ) ; if ( firstEdge == null ) { firstEdge = edge ; } if ( lastEdge != null ) { lastEdge . next = edge ; edge . previous = lastEdge ; } lastEdge = edge ; lastGeoPoint = thisGeoPoint ; } firstEdge . previous = lastEdge ; lastEdge . next = firstEdge ; shapeStartEdges [ edgePointIndex ] = firstEdge ; edgePointIndex ++ ; } xTree = new XTree ( allEdges ) ; yTree = new YTree ( allEdges ) ; zTree = new ZTree ( allEdges ) ; }
create a complex polygon from multiple lists of points , and a single point which is known to be in or out of set .
