@Override // from interface IShape public boolean intersects (float x, float y, float width, float height) { if ((width <= 0f) || (height <= 0f)) { return false; } else if (!bounds().intersects(x, y, width, height)) { return false; } int crossCount = Crossing.intersectShape(this, x, y, width, height); return Crossing.isInsideEvenOdd(crossCount); }
/** * Returns how many times rectangle stripe cross shape or the are intersect */ public static int intersectShape (IShape s, float x, float y, float w, float h) { if (!s.bounds().intersects(x, y, w, h)) { return 0; } return intersectPath(s.pathIterator(null), x, y, w, h); }
@Override // from interface IShape public boolean intersects (float x, float y, float width, float height) { if ((width <= 0f) || (height <= 0f)) { return false; } else if (!bounds().intersects(x, y, width, height)) { return false; } int crossCount = Crossing.intersectShape(this, x, y, width, height); return Crossing.isInsideEvenOdd(crossCount); }
/** * Returns how many times rectangle stripe cross shape or the are intersect */ public static int intersectShape (IShape s, float x, float y, float w, float h) { if (!s.bounds().intersects(x, y, w, h)) { return 0; } return intersectPath(s.pathIterator(null), x, y, w, h); }
/** * Gets a Region instance bounded by the given dimensions. The given bounds will be restricted * to the given bounds of this GestureRegionDirector, and null may be returned if suitable * bounds are not found or a conflicting region was already defined on this * GestureRegionDirector. */ public GestureDirector getRegion (IRectangle bounds) { if (!_bounds.intersects(bounds)) { Log.log.warning("Supplied region is not within our defined bounds", "_bounds", _bounds, "bounds", bounds); return null; } Rectangle regionBounds = _bounds.intersection(bounds); GestureDirector region = _regions.get(regionBounds); if (region != null) return region; // make sure we don't intersect any other defined regions for (Rectangle existingRegionBounds : _regions.keySet()) { if (existingRegionBounds.intersects(regionBounds)) { Log.log.warning("New region intersects existing region", "existing", existingRegionBounds, "new", regionBounds); return null; } } // new region! region = new GestureDirector(_plat, regionBounds, _timer); _regions.put(regionBounds, region); return region; }