math.geom2d.curve
Class AbstractContinuousCurve2D

java.lang.Object
  extended by math.geom2d.curve.AbstractContinuousCurve2D
All Implemented Interfaces:
java.lang.Cloneable, ContinuousCurve2D, Curve2D, GeometricObject2D, Shape2D
Direct Known Subclasses:
AbstractSmoothCurve2D, LinearCurve2D

public abstract class AbstractContinuousCurve2D
extends java.lang.Object
implements ContinuousCurve2D, java.lang.Cloneable

Provides a base implementation for continuous curves.

Author:
dlegland

Field Summary
 
Fields inherited from interface math.geom2d.Shape2D
ACCURACY
 
Constructor Summary
AbstractContinuousCurve2D()
           
 
Method Summary
 java.awt.Shape asAwtShape()
           
 LinearCurve2D asPolyline(int n)
          Converts this continuous curve to an instance of LinearCurve2D with the given number of edges.
abstract  ContinuousCurve2D clone()
          Overrides Object declaration to ensure Curve2D implementation are cloned as Curve2D.
 java.util.Collection<? extends ContinuousCurve2D> continuousCurves()
          Returns the collection of continuous curves which constitute this curve.
 void draw(java.awt.Graphics2D g2)
          Draws the curve on the given Graphics2D object.
 Point2D firstPoint()
          Returns the first point of the curve.
 Point2D lastPoint()
          Returns the last point of the curve.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface math.geom2d.curve.ContinuousCurve2D
appendPath, clip, curvature, isClosed, leftTangent, reverse, rightTangent, smoothPieces, subCurve, transform
 
Methods inherited from interface math.geom2d.curve.Curve2D
getT0, getT1, intersections, isSingular, point, position, project, singularPoints, t0, t1, vertices
 
Methods inherited from interface math.geom2d.Shape2D
boundingBox, contains, contains, distance, distance, isBounded, isEmpty
 
Methods inherited from interface math.geom2d.GeometricObject2D
almostEquals
 

Constructor Detail

AbstractContinuousCurve2D

public AbstractContinuousCurve2D()
Method Detail

asPolyline

public LinearCurve2D asPolyline(int n)
Converts this continuous curve to an instance of LinearCurve2D with the given number of edges. Returns either an instance of Polyline2D or LinearRing2D, depending on the curve is closed or not. This method can be overridden to return the correct type.

Specified by:
asPolyline in interface ContinuousCurve2D
Parameters:
n - the number of line segments
Returns:
a polyline with n line segments.
See Also:
ContinuousCurve2D.asPolyline(int)

continuousCurves

public java.util.Collection<? extends ContinuousCurve2D> continuousCurves()
Description copied from interface: Curve2D
Returns the collection of continuous curves which constitute this curve.

Specified by:
continuousCurves in interface Curve2D
Returns:
a collection of continuous curves.

firstPoint

public Point2D firstPoint()
Description copied from interface: Curve2D
Returns the first point of the curve. It must returns the same result as point(t0()).

Specified by:
firstPoint in interface Curve2D
Returns:
the first point of the curve
See Also:
Curve2D.t0(), Curve2D.point(double)

lastPoint

public Point2D lastPoint()
Description copied from interface: Curve2D
Returns the last point of the curve. It must returns the same result as this.point(this.t1()).

Specified by:
lastPoint in interface Curve2D
Returns:
the last point of the curve.
See Also:
Curve2D.t1(), Curve2D.point(double)

draw

public void draw(java.awt.Graphics2D g2)
Description copied from interface: Curve2D
Draws the curve on the given Graphics2D object.

Specified by:
draw in interface Curve2D
Specified by:
draw in interface Shape2D
Parameters:
g2 - the graphics to draw the curve in

asAwtShape

public java.awt.Shape asAwtShape()
Specified by:
asAwtShape in interface Curve2D
Returns:
the shape corresponding to this curve

clone

public abstract ContinuousCurve2D clone()
Description copied from interface: Curve2D
Overrides Object declaration to ensure Curve2D implementation are cloned as Curve2D.

Specified by:
clone in interface Curve2D
Overrides:
clone in class java.lang.Object
Returns:
the cloned curve