/** * Returns how many times ray from point (x,y) cross shape */ public static int crossShape(java.awt.Shape s, double x, double y) { if (!s.getBounds2D().contains(x, y)) { return(0); } return(crossPath(s.getPathIterator(null), x, y)); }
/** * Returns how many times rectangle stripe cross shape or the are intersect */ public static int intersectShape(java.awt.Shape s, double x, double y, double w, double h) { if (!s.getBounds2D().intersects(x, y, w, h)) { return(0); } return(intersectPath(s.getPathIterator(null), x, y, w, h)); }