@Override public boolean intersect(Shape s) { if (s instanceof BBox) { return intersect((BBox) s); } else if (s instanceof Circle) { return ((Circle) s).intersect(this); } throw new UnsupportedOperationException("unsupported shape"); }
/** * Calculates the intersecting BBox between this and the specified BBox * * @return the intersecting BBox or null if not intersecting */ public BBox calculateIntersection(BBox bBox) { if (!this.intersect(bBox)) return null; double minLon = Math.max(this.minLon, bBox.minLon); double maxLon = Math.min(this.maxLon, bBox.maxLon); double minLat = Math.max(this.minLat, bBox.minLat); double maxLat = Math.min(this.maxLat, bBox.maxLat); return new BBox(minLon, maxLon, minLat, maxLat); }
public boolean intersect(Circle c) { // necessary to improve speed? if (!getBounds().intersect(c.getBounds())) { return false; } return normDist(c.lat, c.lon) <= calc.calcNormalizedDist(radiusInMeter + c.radiusInMeter); }
@Override public boolean intersect(Shape s) { if (s instanceof BBox) { return intersect((BBox) s); } else if (s instanceof Circle) { return ((Circle) s).intersect(this); } throw new UnsupportedOperationException("unsupported shape"); }
@Override public boolean intersect( Shape s ) { if (s instanceof BBox) { return intersect((BBox) s); } else if (s instanceof Circle) { return ((Circle) s).intersect(this); } throw new UnsupportedOperationException("unsupported shape"); }
@Override public boolean intersect(Shape s) { if (s instanceof BBox) { return intersect((BBox) s); } else if (s instanceof Circle) { return ((Circle) s).intersect(this); } throw new UnsupportedOperationException("unsupported shape"); }
/** * Calculates the intersecting BBox between this and the specified BBox * * @return the intersecting BBox or null if not intersecting */ public BBox calculateIntersection(BBox bBox) { if (!this.intersect(bBox)) return null; double minLon = Math.max(this.minLon, bBox.minLon); double maxLon = Math.min(this.maxLat, bBox.maxLat); double minLat = Math.max(this.minLat, bBox.minLat); double maxLat = Math.min(this.maxLat, bBox.maxLat); return new BBox(minLon, maxLon, minLat, maxLat); }
/** * Calculates the intersecting BBox between this and the specified BBox * * @return the intersecting BBox or null if not intersecting */ public BBox calculateIntersection(BBox bBox) { if (!this.intersect(bBox)) return null; double minLon = Math.max(this.minLon, bBox.minLon); double maxLon = Math.min(this.maxLon, bBox.maxLon); double minLat = Math.max(this.minLat, bBox.minLat); double maxLat = Math.min(this.maxLat, bBox.maxLat); return new BBox(minLon, maxLon, minLat, maxLat); }
public boolean intersect( Circle c ) { // necessary to improve speed? if (!getBounds().intersect(c.getBounds())) { return false; } return normDist(c.lat, c.lon) <= calc.calcNormalizedDist(radiusInKm + c.radiusInKm); }
public boolean intersect(Circle c) { // necessary to improve speed? if (!getBounds().intersect(c.getBounds())) { return false; } return normDist(c.lat, c.lon) <= calc.calcNormalizedDist(radiusInMeter + c.radiusInMeter); }
public boolean intersect(Circle c) { // necessary to improve speed? if (!getBounds().intersect(c.getBounds())) { return false; } return normDist(c.lat, c.lon) <= calc.calcNormalizedDist(radiusInMeter + c.radiusInMeter); }