/** * Gets all objects within an elliptical region. * * @param x1 first focus, longitude * @param y1 first focus, latitude * @param x2 second focus, longitude * @param y2 second focus, latitude * @param distance the maximal sum of the distances between an object and the two foci * @return the objects found in the elliptical region * @throws IllegalArgumentException if the distance is shorter than the distance between the foci */ public Collection<T> getElliptical( final double x1, final double y1, final double x2, final double y2, final double distance) { if ( Math.pow( distance , 2 ) < Math.pow( (x1 - x2), 2 ) + Math.pow( (y1 - y2) , 2 ) ) { throw new IllegalArgumentException( "wrong ellipse specification: distance must be greater than distance between foci." +" x1="+x1 +" y1="+y1 +" x2="+x2 +" y2="+y2 +" distance="+distance ); } return this.top.getElliptical(x1, y1, x2, y2, distance, new ArrayList<>()); }
this.northwest.getElliptical(x1, y1, x2, y2, maxDistance, values); this.northeast.getElliptical(x1, y1, x2, y2, maxDistance, values); this.southeast.getElliptical(x1, y1, x2, y2, maxDistance, values); this.southwest.getElliptical(x1, y1, x2, y2, maxDistance, values);