@Override public String toString() { final StringBuilder edgeDescription = new StringBuilder(); for (final Edge shapeStartEdge : shapeStartEdges) { fillInEdgeDescription(edgeDescription, shapeStartEdge); } return "GeoComplexPolygon: {planetmodel=" + planetModel + ", number of shapes="+shapeStartEdges.length+", address="+ Integer.toHexString(hashCode())+", testPoint="+testPoint1+", testPointInSet="+testPoint1InSet+", shapes={"+edgeDescription+"}}"; }
@Override public boolean isWithin(final double x, final double y, final double z) { //System.out.println("IsWithin() for ["+x+","+y+","+z+"]"); return isInSet(x, y, z, testPoint1, testPoint1InSet, testPoint1FixedXPlane, testPoint1FixedXAbovePlane, testPoint1FixedXBelowPlane, testPoint1FixedYPlane, testPoint1FixedYAbovePlane, testPoint1FixedYBelowPlane, testPoint1FixedZPlane, testPoint1FixedZAbovePlane, testPoint1FixedZBelowPlane); }
public GeoComplexPolygon createGeoComplexPolygon(final PlanetModel planetModel, final List<List<GeoPoint>> pointsList, final GeoPoint testPoint) { // Is it inside or outside? final Boolean isTestPointInside = isInsidePolygon(testPoint, points); if (isTestPointInside != null) { try { // Legal pole if (isTestPointInside == poleMustBeInside) { return new GeoComplexPolygon(planetModel, pointsList, testPoint, isTestPointInside); } else { return new GeoComplexPolygon(planetModel, pointsList, new GeoPoint(-testPoint.x, -testPoint.y, -testPoint.z), !isTestPointInside); } } catch (IllegalArgumentException e) { // Probably bad choice of test point. return null; } } // If pole choice was illegal, try another one return null; }
@Override public void write(final OutputStream outputStream) throws IOException { writePointsList(outputStream, pointsList); testPoint1.write(outputStream); SerializableObject.writeBoolean(outputStream, testPoint1InSet); }
/** * Constructor for deserialization. * @param planetModel is the planet model. * @param inputStream is the input stream. */ public GeoComplexPolygon(final PlanetModel planetModel, final InputStream inputStream) throws IOException { this(planetModel, readPointsList(planetModel, inputStream), new GeoPoint(planetModel, inputStream), SerializableObject.readBoolean(inputStream)); }
final CountingEdgeIterator crossingEdgeIterator = createLinearCrossingEdgeIterator(testPoint, testPointFixedYPlane, testPointFixedYAbovePlane, testPointFixedYBelowPlane, x, y, z); final CountingEdgeIterator crossingEdgeIterator = createLinearCrossingEdgeIterator(testPoint, testPointFixedXPlane, testPointFixedXAbovePlane, testPointFixedXBelowPlane, x, y, z); } else if (testPointFixedZAbovePlane != null && testPointFixedZBelowPlane != null && testPointFixedZPlane.evaluateIsZero(x, y, z)) { final CountingEdgeIterator crossingEdgeIterator = createLinearCrossingEdgeIterator(testPoint, testPointFixedZPlane, testPointFixedZAbovePlane, testPointFixedZBelowPlane, x, y, z);