private boolean intersectSimple(Rectangle2D.Double rect) { final long start = System.currentTimeMillis(); try { if (max == null || max.intersects(rect) == false) { return false; } for (Rectangle2D.Double r : areas) { if (rect.intersects(r)) { return true; } } return false; } finally { TPS1 += System.currentTimeMillis() - start; } }
private boolean intersectSimpleOld(Rectangle2D.Double rect) { final long start = System.currentTimeMillis(); try { if (max == null || max.intersects(rect) == false) { return false; if (rect.intersects(r)) { return true;
public Collection<T> findIntersects(Rectangle2D.Double r) { HashSet<T> result = new HashSet<T>(); root.findIntersects(r, result); for (Map.Entry<T,Rectangle2D.Double> entry : outside.entrySet()) { if (entry.getValue().intersects(r)) { result.add(entry.getKey()); } } return result; } public Collection<T> findInside(Rectangle2D.Double r) {
if (bounds1.intersects(bounds2)) { return 0;
Rectangle2D.Double[] rects = freeRectangles.toArray(new Rectangle2D.Double[0]); for (Rectangle2D.Double freeR : rects) { if (freeR.intersects(justPlacedPieceBB)) { freeRectangles.remove(freeR); Rectangle2D rIntersection = freeR.createIntersection(justPlacedPieceBB);
if (bounds2.intersects(bounds1)) {
private boolean intersectSimpleOld(Rectangle2D.Double rect) { final long start = System.currentTimeMillis(); try { if (max == null || max.intersects(rect) == false) { return false; if (rect.intersects(r)) { return true;
@Override public void paint(Graphics2D g, Shape alloc, Rectangle clipBounds) { Rectangle2D.Double allocBounds = ViewUtils.shape2Bounds(alloc); if (allocBounds.intersects(clipBounds)) { Font origFont = g.getFont(); Color origColor = g.getColor();
/** * Returns {@code true} if this envelope intersects the specified envelope. If this envelope * or the given rectangle have at least one {@link java.lang.Double#NaN NaN} value, then this * method returns {@code false}. * * <div class="section">Spanning the anti-meridian of a Geographic CRS</div> * This method supports anti-meridian spanning in the same way than * {@link AbstractEnvelope#intersects(Envelope)}. * * @param rect the rectangle to test for intersection. * @return {@code true} if this envelope intersects the specified rectangle. */ @Override public boolean intersects(final Rectangle2D rect) { if (rect instanceof Envelope2D) { // Need to bypass the overriden getWidth()/getHeight(). final Envelope2D env = (Envelope2D) rect; return intersects(env.x, env.y, env.width, env.height); } return super.intersects(rect); }
/** * Returns {@code true} if this envelope intersects the specified envelope. If this envelope * or the given rectangle have at least one {@link java.lang.Double#NaN NaN} value, then this * method returns {@code false}. * * <div class="section">Spanning the anti-meridian of a Geographic CRS</div> * This method supports anti-meridian spanning in the same way than * {@link AbstractEnvelope#intersects(Envelope)}. * * @param rect the rectangle to test for intersection. * @return {@code true} if this envelope intersects the specified rectangle. */ @Override public boolean intersects(final Rectangle2D rect) { if (rect instanceof Envelope2D) { // Need to bypass the overriden getWidth()/getHeight(). final Envelope2D env = (Envelope2D) rect; return intersects(env.x, env.y, env.width, env.height); } return super.intersects(rect); }
@Override public void draw(Graphics2D g) { Rectangle2D clipBounds = g.getClipBounds(); if (clipBounds != null) { for (Figure child : getChildren()) { if (child.isVisible() && child.getDrawingArea().intersects(clipBounds)) { child.draw(g); } } } else { for (Figure child : getChildren()) { if (child.isVisible()) { child.draw(g); } } } }
public void draw(Graphics2D g, Collection<Figure> children) { Rectangle2D clipBounds = g.getClipBounds(); if (clipBounds != null) { for (Figure f : children) { if (f.isVisible() && f.getDrawingArea().intersects(clipBounds)) { f.draw(g); } } } else { for (Figure f : children) { if (f.isVisible()) { f.draw(g); } } } }
private boolean intersectSimple(Rectangle2D.Double rect) { final long start = System.currentTimeMillis(); try { if (max == null || max.intersects(rect) == false) { return false; } for (Rectangle2D.Double r : areas) { if (rect.intersects(r)) { return true; } } return false; } finally { TPS1 += System.currentTimeMillis() - start; } }
public boolean intersects(double x, double y, double w, double h) { return new Rectangle2D.Double(x, y, w, h).intersects(getBounds2D()); }
@Override public void draw(Graphics2D g) { synchronized (getLock()) { ensureSorted(); ArrayList<Figure> toDraw = new ArrayList<Figure>(getChildren().size()); Rectangle clipRect = g.getClipBounds(); for (Figure f : getChildren()) { if (f.getDrawingArea().intersects(clipRect)) { toDraw.add(f); } } draw(g, toDraw); } }
/** * {@link #intersects(Rectangle2D)} */ @Override public boolean intersects(double x, double y, double w, double h) { if (bounds==null){ getBounds(); } return bounds.intersects(x, y, w, h); }
/** * tests whether the given rectangle will intersect to the bounds of the polygon. */ @Override public boolean intersects(Rectangle2D r) { if (bounds==null){ getBounds(); } return bounds.intersects(r); }
// returns true at the first collision // returns false if no collision with none of the houses Rectangle2D.Double player = new Rectangle2D.Double(x,y,w,h); Rectangle2D.Double[] houses = map.getHouseBounds(); boolean isAnyCollision = false; int i = 0; while (!isAnyCollision && cnt < houses.length) { isAnyCollision = player.intersects(houses[i]); } return isAnyCollision;
@Override public java.util.List<Figure> findFigures(Rectangle2D.Double bounds) { LinkedList<Figure> intersection = new LinkedList<Figure>(); for (Figure f : getChildren()) { if (f.isVisible() && f.getBounds().intersects(bounds)) { intersection.add(f); } } return intersection; }