/** * Returns the largest Y coordinate of the framing * rectangle of the <code>Shape</code> in <code>double</code> * precision. * * @return the largest Y coordinate of the framing * rectangle of the <code>Shape</code>. * @since 1.2 */ public double getMaxY() { return getY() + getHeight(); }
/** * Returns the largest Y coordinate of the framing * rectangle of the <code>Shape</code> in <code>double</code> * precision. * * @return the largest Y coordinate of the framing * rectangle of the <code>Shape</code>. * @since 1.2 */ public double getMaxY() { return getY() + getHeight(); }
/** * Returns the Y coordinate of the center of the framing * rectangle of the <code>Shape</code> in <code>double</code> * precision. * @return the Y coordinate of the center of the framing rectangle * of the <code>Shape</code>. * @since 1.2 */ public double getCenterY() { return getY() + getHeight() / 2.0; }
/** * set minimum X * * @param x minimum x */ public void setX(double x) { setRect(x, getY(), getWidth(), getHeight()); }
/** * set minimum Y * * @param y minimum y */ public void setY(double y) { setRect(getX(), y, getWidth(), getHeight()); }
/** * set minimum Y * * @param y minimum y */ public void setY(double y) { setRect(getX(), y, getWidth(), getHeight()); }
/** * set X width * * @param w x width */ public void setWidth(double w) { setRect(getX(), getY(), w, getHeight()); }
/** * set minimum X * * @param x minimum x */ public void setX(double x) { setRect(x, getY(), getWidth(), getHeight()); }
/** * set minimum Y * * @param y minimum y */ public void setY(double y) { setRect(getX(), y, getWidth(), getHeight()); }
/** * set X width * * @param w x width */ public void setWidth(double w) { setRect(getX(), getY(), w, getHeight()); }
/** * Get the maximum corner of the bounding box. * * @return maximum corner of the bounding box */ public ProjectionPoint getMaxPoint() { return new ProjectionPointImpl(getX() + getWidth(), getY() + getHeight()); }
/** * Get the maximum corner of the bounding box. * * @return maximum corner of the bounding box */ public ProjectionPoint getMaxPoint() { return new ProjectionPointImpl(getX() + getWidth(), getY() + getHeight()); }
public boolean intersects(double x, double y, double w, double h) { if (isEmpty() || w <= 0 || h <= 0) { return false; } double x0 = getX(); double y0 = getY(); return (x + w > x0 && y + h > y0 && x < x0 + getWidth() && y < y0 + getHeight()); }
/** * Get the maximum corner of the bounding box. * * @return maximum corner of the bounding box */ public ProjectionPoint getMaxPoint() { return new ProjectionPointImpl(getX() + getWidth(), getY() + getHeight()); }
/** * Get a String representation of this object. * * @return a String representation of this object. */ public String toString() { return "min: " + Format.d(getX(), 3) + " " + Format.d(getY(), 3) + " size: " + Format.d(getWidth(), 3) + " " + Format.d(getHeight(), 3); }
/** * Get a String representation of this object. * * @return a String representation of this object. */ public String toString() { return "min: " + Format.d(getX(), 3) + " " + Format.d(getY(), 3) + " size: " + Format.d(getWidth(), 3) + " " + Format.d(getHeight(), 3); }
/** * Get a String representation of this object. * * @return a String representation of this object. */ public String toString() { return "min: " + Format.d(getX(), 3) + " " + Format.d(getY(), 3) + " size: " + Format.d(getWidth(), 3) + " " + Format.d(getHeight(), 3); }
@Test public void testGetHeight1() { // getX() should give the y value for the upper left corner double minY = projectionRect.getMinY(); double maxY = projectionRect.getMaxY(); double testHeight = maxY - minY; double height = projectionRect.getHeight(); assertEquals(testHeight, height, 0); }
private ProjectionRect scaleShiftRect(double scaleFactor, double deltaX, double deltaY) { // quick and dirty method to scale and shift a rectangle, based on projectionRect double centerX = projectionRect.getCenterX(); double centerY = projectionRect.getCenterY(); double width = projectionRect.getWidth(); double height = projectionRect.getHeight(); double testMinX = (centerX + deltaX) - scaleFactor * (width/2); double testMinY = (centerY + deltaY) - scaleFactor * (height/2); return new ProjectionRect(new ProjectionPointImpl(testMinX, testMinY), scaleFactor * width, scaleFactor * height); }