/** * Returns how many times a ray from point (x,y) crosses a shape. */ public static int crossShape (IShape s, float x, float y) { if (!s.bounds().contains(x, y)) { return 0; } return crossPath(s.pathIterator(null), x, y); }
/** * Returns how many times a ray from point (x,y) crosses a shape. */ public static int crossShape (IShape s, float x, float y) { if (!s.bounds().contains(x, y)) { return 0; } return crossPath(s.pathIterator(null), x, y); }
@Override // from RectangularShape public boolean contains (float rx, float ry, float rw, float rh) { if (!(contains(rx, ry) && contains(rx + rw, ry) && contains(rx + rw, ry + rh) && contains(rx, ry + rh))) { return false; } float absExtent = Math.abs(angleExtent()); if (arcType() != PIE || absExtent <= 180f || absExtent >= 360f) { return true; } Rectangle r = new Rectangle(rx, ry, rw, rh); float cx = centerX(), cy = centerY(); if (r.contains(cx, cy)) { return false; } Point p1 = startPoint(), p2 = endPoint(); return !r.intersectsLine(cx, cy, p1.x(), p1.y()) && !r.intersectsLine(cx, cy, p2.x(), p2.y()); }
@Override // from RectangularShape public boolean contains (float rx, float ry, float rw, float rh) { if (!(contains(rx, ry) && contains(rx + rw, ry) && contains(rx + rw, ry + rh) && contains(rx, ry + rh))) { return false; } float absExtent = Math.abs(angleExtent()); if (arcType() != PIE || absExtent <= 180f || absExtent >= 360f) { return true; } Rectangle r = new Rectangle(rx, ry, rw, rh); float cx = centerX(), cy = centerY(); if (r.contains(cx, cy)) { return false; } Point p1 = startPoint(), p2 = endPoint(); return !r.intersectsLine(cx, cy, p1.x(), p1.y()) && !r.intersectsLine(cx, cy, p2.x(), p2.y()); }