diff --git a/src/main/java/pythagoras/f/AbstractCubicCurve.java b/src/main/java/pythagoras/f/AbstractCubicCurve.java index 3b78d1c..a0b3526 100644 --- a/src/main/java/pythagoras/f/AbstractCubicCurve.java +++ b/src/main/java/pythagoras/f/AbstractCubicCurve.java @@ -33,13 +33,13 @@ public abstract class AbstractCubicCurve implements ICubicCurve } @Override // from interface ICubicCurve - public double getFlatnessSq () { + public float getFlatnessSq () { return CubicCurves.getFlatnessSq(getX1(), getY1(), getCtrlX1(), getCtrlY1(), getCtrlX2(), getCtrlY2(), getX2(), getY2()); } @Override // from interface ICubicCurve - public double getFlatness () { + public float getFlatness () { return CubicCurves.getFlatness(getX1(), getY1(), getCtrlX1(), getCtrlY1(), getCtrlX2(), getCtrlY2(), getX2(), getY2()); } diff --git a/src/main/java/pythagoras/f/AbstractRectangle.java b/src/main/java/pythagoras/f/AbstractRectangle.java index b70231b..0f0bcbc 100644 --- a/src/main/java/pythagoras/f/AbstractRectangle.java +++ b/src/main/java/pythagoras/f/AbstractRectangle.java @@ -114,7 +114,7 @@ public abstract class AbstractRectangle extends RectangularShape implements IRec public boolean contains (float rx, float ry, float rw, float rh) { if (isEmpty()) return false; - double x1 = getX(), y1 = getY(), x2 = x1 + getWidth(), y2 = y1 + getHeight(); + float x1 = getX(), y1 = getY(), x2 = x1 + getWidth(), y2 = y1 + getHeight(); return (x1 <= rx) && (rx + rw <= x2) && (y1 <= ry) && (ry + rh <= y2); } @@ -122,7 +122,7 @@ public abstract class AbstractRectangle extends RectangularShape implements IRec public boolean intersects (float rx, float ry, float rw, float rh) { if (isEmpty()) return false; - double x1 = getX(), y1 = getY(), x2 = x1 + getWidth(), y2 = y1 + getHeight(); + float x1 = getX(), y1 = getY(), x2 = x1 + getWidth(), y2 = y1 + getHeight(); return (rx + rw > x1) && (rx < x2) && (ry + rh > y1) && (ry < y2); } diff --git a/src/main/java/pythagoras/f/ICubicCurve.java b/src/main/java/pythagoras/f/ICubicCurve.java index edfd83b..84e5a6a 100644 --- a/src/main/java/pythagoras/f/ICubicCurve.java +++ b/src/main/java/pythagoras/f/ICubicCurve.java @@ -47,11 +47,11 @@ public interface ICubicCurve extends IShape, Cloneable /** Returns the square of the flatness (maximum distance of a control point from the line * connecting the end points) of this curve. */ - double getFlatnessSq (); + float getFlatnessSq (); /** Returns the flatness (maximum distance of a control point from the line connecting the end * points) of this curve. */ - double getFlatness (); + float getFlatness (); /** Subdivides this curve and stores the results into {@code left} and {@code right}. */ void subdivide (CubicCurve left, CubicCurve right);