pythagoras.d

## Class AbstractCubicCurve

• All Implemented Interfaces:
Cloneable, ICubicCurve, IShape
Direct Known Subclasses:
CubicCurve

```public abstract class AbstractCubicCurve
extends Object
implements ICubicCurve```
Provides most of the implementation of `ICubicCurve`, obtaining only the start, end and control points from the derived class.
• ### Constructor Summary

Constructors
Constructor and Description
`AbstractCubicCurve()`
• ### Method Summary

All Methods
Modifier and Type Method and Description
`Rectangle` `bounds()`
Returns a copy of the bounding rectangle for this shape.
`Rectangle` `bounds(Rectangle target)`
Initializes the supplied rectangle with this shape's bounding rectangle.
`CubicCurve` `clone()`
Returns a mutable copy of this curve.
`boolean` ```contains(double px, double py)```
Returns true if this shape contains the specified point.
`boolean` ```contains(double rx, double ry, double rw, double rh)```
Returns true if this shape completely contains the specified rectangle.
`boolean` `contains(IRectangle r)`
Returns true if this shape completely contains the supplied rectangle.
`boolean` `contains(XY p)`
Returns true if this shape contains the supplied point.
`Point` `ctrlP1()`
Returns a copy of the first control point of this curve.
`Point` `ctrlP2()`
Returns a copy of the second control point of this curve.
`double` `flatness()`
Returns the flatness (maximum distance of a control point from the line connecting the end points) of this curve.
`double` `flatnessSq()`
Returns the square of the flatness (maximum distance of a control point from the line connecting the end points) of this curve.
`boolean` ```intersects(double rx, double ry, double rw, double rh)```
Returns true if this shape intersects the specified rectangle.
`boolean` `intersects(IRectangle r)`
Returns true if this shape intersects the supplied rectangle.
`boolean` `isEmpty()`
Returns true if this shape encloses no area.
`Point` `p1()`
Returns a copy of the starting point of this curve.
`Point` `p2()`
Returns a copy of the ending point of this curve.
`PathIterator` `pathIterator(Transform t)`
Returns an iterator over the path described by this shape.
`PathIterator` ```pathIterator(Transform at, double flatness)```
Returns an iterator over the path described by this shape.
`void` ```subdivide(CubicCurve left, CubicCurve right)```
Subdivides this curve and stores the results into `left` and `right`.
• ### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Methods inherited from interface pythagoras.d.ICubicCurve

`ctrlX1, ctrlX2, ctrlY1, ctrlY2, x1, x2, y1, y2`
• ### Constructor Detail

• #### AbstractCubicCurve

`public AbstractCubicCurve()`
• ### Method Detail

• #### p1

`public Point p1()`
Description copied from interface: `ICubicCurve`
Returns a copy of the starting point of this curve.
Specified by:
`p1` in interface `ICubicCurve`
• #### ctrlP1

`public Point ctrlP1()`
Description copied from interface: `ICubicCurve`
Returns a copy of the first control point of this curve.
Specified by:
`ctrlP1` in interface `ICubicCurve`
• #### ctrlP2

`public Point ctrlP2()`
Description copied from interface: `ICubicCurve`
Returns a copy of the second control point of this curve.
Specified by:
`ctrlP2` in interface `ICubicCurve`
• #### p2

`public Point p2()`
Description copied from interface: `ICubicCurve`
Returns a copy of the ending point of this curve.
Specified by:
`p2` in interface `ICubicCurve`
• #### flatnessSq

`public double flatnessSq()`
Description copied from interface: `ICubicCurve`
Returns the square of the flatness (maximum distance of a control point from the line connecting the end points) of this curve.
Specified by:
`flatnessSq` in interface `ICubicCurve`
• #### flatness

`public double flatness()`
Description copied from interface: `ICubicCurve`
Returns the flatness (maximum distance of a control point from the line connecting the end points) of this curve.
Specified by:
`flatness` in interface `ICubicCurve`
• #### subdivide

```public void subdivide(CubicCurve left,
CubicCurve right)```
Description copied from interface: `ICubicCurve`
Subdivides this curve and stores the results into `left` and `right`.
Specified by:
`subdivide` in interface `ICubicCurve`
• #### clone

`public CubicCurve clone()`
Description copied from interface: `ICubicCurve`
Returns a mutable copy of this curve.
Specified by:
`clone` in interface `ICubicCurve`
Overrides:
`clone` in class `Object`
• #### isEmpty

`public boolean isEmpty()`
Description copied from interface: `IShape`
Returns true if this shape encloses no area.
Specified by:
`isEmpty` in interface `IShape`
• #### contains

```public boolean contains(double px,
double py)```
Description copied from interface: `IShape`
Returns true if this shape contains the specified point.
Specified by:
`contains` in interface `IShape`
• #### contains

```public boolean contains(double rx,
double ry,
double rw,
double rh)```
Description copied from interface: `IShape`
Returns true if this shape completely contains the specified rectangle.
Specified by:
`contains` in interface `IShape`
• #### contains

`public boolean contains(XY p)`
Description copied from interface: `IShape`
Returns true if this shape contains the supplied point.
Specified by:
`contains` in interface `IShape`
• #### contains

`public boolean contains(IRectangle r)`
Description copied from interface: `IShape`
Returns true if this shape completely contains the supplied rectangle.
Specified by:
`contains` in interface `IShape`
• #### intersects

```public boolean intersects(double rx,
double ry,
double rw,
double rh)```
Description copied from interface: `IShape`
Returns true if this shape intersects the specified rectangle.
Specified by:
`intersects` in interface `IShape`
• #### intersects

`public boolean intersects(IRectangle r)`
Description copied from interface: `IShape`
Returns true if this shape intersects the supplied rectangle.
Specified by:
`intersects` in interface `IShape`
• #### bounds

`public Rectangle bounds()`
Description copied from interface: `IShape`
Returns a copy of the bounding rectangle for this shape.
Specified by:
`bounds` in interface `IShape`
• #### bounds

`public Rectangle bounds(Rectangle target)`
Description copied from interface: `IShape`
Initializes the supplied rectangle with this shape's bounding rectangle.
Specified by:
`bounds` in interface `IShape`
Returns:
the supplied rectangle.
• #### pathIterator

`public PathIterator pathIterator(Transform t)`
Description copied from interface: `IShape`
Returns an iterator over the path described by this shape.
Specified by:
`pathIterator` in interface `IShape`
Parameters:
`t` - if supplied, the points in the path are transformed using this.
• #### pathIterator

```public PathIterator pathIterator(Transform at,
double flatness)```
Description copied from interface: `IShape`
Returns an iterator over the path described by this shape.
Specified by:
`pathIterator` in interface `IShape`
Parameters:
`at` - if supplied, the points in the path are transformed using this.
`flatness` - when approximating curved segments with lines, this controls the maximum distance the lines are allowed to deviate from the approximated curve, thus a higher flatness value generally allows for a path with fewer segments.