/** * Tests if the interior of the <code>Shape</code> intersects the interior of a specified <code> * Rectangle2D</code>. This method might conservatively return <code>true</code> when: * * <ul> * <li>there is a high probability that the <code>Rectangle2D</code> and the <code>Shape * </code> intersect, but * <li>the calculations to accurately determine this intersection are prohibitively expensive. * </ul> * * This means that this method might return <code>true</code> even though the <code>Rectangle2D * </code> does not intersect the <code>Shape</code>. * * @param r the specified <code>Rectangle2D</code> * @return <code>true</code> if the interior of the <code>Shape</code> and the interior of the * specified <code>Rectangle2D</code> intersect, or are both highly likely to intersect and * intersection calculations would be too expensive to perform; <code>false</code> * otherwise. * @see #intersects(double, double, double, double) */ public boolean intersects(Rectangle2D r) { Geometry rect = rectangleToGeometry(r); return geometry.intersects(rect); }
/** * Tests if the interior of the <code>Shape</code> entirely contains the specified <code> * Rectangle2D</code>. This method might conservatively return <code>false</code> when: * * <ul> * <li>the <code>intersect</code> method returns <code>true</code> and * <li>the calculations to determine whether or not the <code>Shape</code> entirely contains * the <code>Rectangle2D</code> are prohibitively expensive. * </ul> * * This means that this method might return <code>false</code> even though the <code>Shape * </code> contains the <code>Rectangle2D</code>. The <code>Area</code> class can be used to * perform more accurate computations of geometric intersection for any <code>Shape</code> * object if a more precise answer is required. * * @param r The specified <code>Rectangle2D</code> * @return <code>true</code> if the interior of the <code>Shape</code> entirely contains the * <code>Rectangle2D</code>; <code>false</code> otherwise or, if the <code>Shape</code> * contains the <code>Rectangle2D</code> and the <code>intersects</code> method returns * <code>true</code> and the containment calculations would be too expensive to perform. * @see #contains(double, double, double, double) */ public boolean contains(Rectangle2D r) { Geometry rect = rectangleToGeometry(r); return geometry.contains(rect); }
Geometry rect = rectangleToGeometry(r);
Geometry rect = rectangleToGeometry(r);
Geometry rect = rectangleToGeometry(r);
Geometry rect = rectangleToGeometry(r);