}
public boolean intersects(Rectangle2D rect) {
Iterator it = region.getContours().iterator();
while (it.hasNext()) {
Contour c = (Contour) it.next();
AffineTransform combined = transform;
if (c.getTranslation() != null) {
combined = AffineTransform.getTranslateInstance(c.getTranslation().getX(), c.getTranslation().getY());
combined.preConcatenate(transform);
}
Rectangle2D translatedRect = rect;
if (!combined.isIdentity()) {
try {
AffineTransform inverse = combined.createInverse();
translatedRect = inverse.createTransformedShape(rect).getBounds2D();
} catch (NoninvertibleTransformException e) {
e.printStackTrace();
}
}
// Take the blur tapering into account
Rectangle bounds = c.getOuterShape().getBounds();
bounds.grow((int) (c.getWidth()), (int) (c.getWidth()));
if (bounds.intersects(translatedRect))
return true;
}
return false;