diff --git a/src/main/java/pythagoras/d/IRectangularShape.java b/src/main/java/pythagoras/d/IRectangularShape.java
index 51fa0fe..be4a6c2 100644
--- a/src/main/java/pythagoras/d/IRectangularShape.java
+++ b/src/main/java/pythagoras/d/IRectangularShape.java
@@ -23,18 +23,27 @@ public interface IRectangularShape extends IShape
/** Returns the height of the framing rectangle. */
double getHeight ();
+ /** Returns the minimum x,y-coordinate of the framing rectangle. */
+ Point getMin ();
+
/** Returns the minimum x-coordinate of the framing rectangle. */
double getMinX ();
/** Returns the minimum y-coordinate of the framing rectangle. */
double getMinY ();
+ /** Returns the maximum x,y-coordinate of the framing rectangle. */
+ Point getMax ();
+
/** Returns the maximum x-coordinate of the framing rectangle. */
double getMaxX ();
/** Returns the maximum y-coordinate of the framing rectangle. */
double getMaxY ();
+ /** Returns the center of the framing rectangle. */
+ Point getCenter ();
+
/** Returns the x-coordinate of the center of the framing rectangle. */
double getCenterX ();
diff --git a/src/main/java/pythagoras/d/RectangularShape.java b/src/main/java/pythagoras/d/RectangularShape.java
index de70305..3e2951e 100644
--- a/src/main/java/pythagoras/d/RectangularShape.java
+++ b/src/main/java/pythagoras/d/RectangularShape.java
@@ -80,6 +80,12 @@ public abstract class RectangularShape implements IRectangularShape
setFrameFromCenter(center.getX(), center.getY(), corner.getX(), corner.getY());
}
+ @Override // from IRectangularShape
+ public Point getMin ()
+ {
+ return new Point(getMinX(), getMinY());
+ }
+
@Override // from IRectangularShape
public double getMinX () {
return getX();
@@ -90,6 +96,12 @@ public abstract class RectangularShape implements IRectangularShape
return getY();
}
+ @Override // from IRectangularShape
+ public Point getMax ()
+ {
+ return new Point(getMaxX(), getMaxY());
+ }
+
@Override // from IRectangularShape
public double getMaxX () {
return getX() + getWidth();
@@ -100,6 +112,12 @@ public abstract class RectangularShape implements IRectangularShape
return getY() + getHeight();
}
+ @Override // from IRectangularShape
+ public Point getCenter ()
+ {
+ return new Point(getCenterX(), getCenterY());
+ }
+
@Override // from IRectangularShape
public double getCenterX () {
return getX() + getWidth() / 2;
diff --git a/src/main/java/pythagoras/f/IRectangularShape.java b/src/main/java/pythagoras/f/IRectangularShape.java
index 5b3fdae..037b5f9 100644
--- a/src/main/java/pythagoras/f/IRectangularShape.java
+++ b/src/main/java/pythagoras/f/IRectangularShape.java
@@ -23,18 +23,27 @@ public interface IRectangularShape extends IShape
/** Returns the height of the framing rectangle. */
float getHeight ();
+ /** Returns the minimum x,y-coordinate of the framing rectangle. */
+ Point getMin ();
+
/** Returns the minimum x-coordinate of the framing rectangle. */
float getMinX ();
/** Returns the minimum y-coordinate of the framing rectangle. */
float getMinY ();
+ /** Returns the maximum x,y-coordinate of the framing rectangle. */
+ Point getMax ();
+
/** Returns the maximum x-coordinate of the framing rectangle. */
float getMaxX ();
/** Returns the maximum y-coordinate of the framing rectangle. */
float getMaxY ();
+ /** Returns the center of the framing rectangle. */
+ Point getCenter ();
+
/** Returns the x-coordinate of the center of the framing rectangle. */
float getCenterX ();
diff --git a/src/main/java/pythagoras/f/RectangularShape.java b/src/main/java/pythagoras/f/RectangularShape.java
index 0ef2aa8..2ea57e2 100644
--- a/src/main/java/pythagoras/f/RectangularShape.java
+++ b/src/main/java/pythagoras/f/RectangularShape.java
@@ -80,6 +80,12 @@ public abstract class RectangularShape implements IRectangularShape
setFrameFromCenter(center.getX(), center.getY(), corner.getX(), corner.getY());
}
+ @Override // from IRectangularShape
+ public Point getMin ()
+ {
+ return new Point(getMinX(), getMinY());
+ }
+
@Override // from IRectangularShape
public float getMinX () {
return getX();
@@ -90,6 +96,12 @@ public abstract class RectangularShape implements IRectangularShape
return getY();
}
+ @Override // from IRectangularShape
+ public Point getMax ()
+ {
+ return new Point(getMaxX(), getMaxY());
+ }
+
@Override // from IRectangularShape
public float getMaxX () {
return getX() + getWidth();
@@ -100,6 +112,12 @@ public abstract class RectangularShape implements IRectangularShape
return getY() + getHeight();
}
+ @Override // from IRectangularShape
+ public Point getCenter ()
+ {
+ return new Point(getCenterX(), getCenterY());
+ }
+
@Override // from IRectangularShape
public float getCenterX () {
return getX() + getWidth() / 2;
diff --git a/src/main/java/pythagoras/i/IRectangle.java b/src/main/java/pythagoras/i/IRectangle.java
index a0641ab..899eaa9 100644
--- a/src/main/java/pythagoras/i/IRectangle.java
+++ b/src/main/java/pythagoras/i/IRectangle.java
@@ -42,12 +42,12 @@ public interface IRectangle extends IShape, Cloneable
int getMinY ();
/** Returns the maximum x-coordinate of the framing rectangle. Note: this method
- * differs from its inting-point counterparts in that it considers {@code (x + width - 1)} to
+ * differs from its floating-point counterparts in that it considers {@code (x + width - 1)} to
* be a rectangle's maximum x-coordinate. */
int getMaxX ();
/** Returns the maximum y-coordinate of the framing rectangle. Note: this method
- * differs from its inting-point counterparts in that it considers {@code (y + height - 1)}
+ * differs from its floating-point counterparts in that it considers {@code (y + height - 1)}
* to be a rectangle's maximum x-coordinate. */
int getMaxY ();