math.geom2d.curve
Class AbstractSmoothCurve2D

java.lang.Object
  extended by math.geom2d.curve.AbstractContinuousCurve2D
      extended by math.geom2d.curve.AbstractSmoothCurve2D
All Implemented Interfaces:
java.lang.Cloneable, ContinuousCurve2D, Curve2D, SmoothCurve2D, GeometricObject2D, Shape2D
Direct Known Subclasses:
AbstractLine2D, Circle2D, CircleArc2D, CubicBezierCurve2D, Ellipse2D, EllipseArc2D, HyperbolaBranch2D, HyperbolaBranchArc2D, Line2D, Parabola2D, ParabolaArc2D, QuadBezierCurve2D

public abstract class AbstractSmoothCurve2D
extends AbstractContinuousCurve2D
implements SmoothCurve2D, java.lang.Cloneable

Provides a base implementation for smooth curves.

Author:
dlegland

Field Summary
 
Fields inherited from interface math.geom2d.Shape2D
ACCURACY
 
Constructor Summary
AbstractSmoothCurve2D()
           
 
Method Summary
abstract  SmoothCurve2D clone()
          Overrides Object declaration to ensure Curve2D implementation are cloned as Curve2D.
 boolean isSingular(double pos)
          Returns always false, as a smooth curve does not have singular points by definition.
 Vector2D leftTangent(double t)
          Computes the left tangent at the given position.
 Vector2D normal(double t)
          Returns the normal vector of the curve at the given position.
 Vector2D rightTangent(double t)
          Computes the right tangent at the given position.
 java.util.Collection<Point2D> singularPoints()
          Returns an empty set of Point2D, as a smooth curve does not have singular points by definition.
 java.util.Collection<? extends SmoothCurve2D> smoothPieces()
          Returns a set of smooth curves.
 java.util.Collection<Point2D> vertices()
          Returns a set of Point2D, containing the extremities of the curve if they are not infinite.
 
Methods inherited from class math.geom2d.curve.AbstractContinuousCurve2D
asAwtShape, asPolyline, continuousCurves, draw, firstPoint, lastPoint
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface math.geom2d.curve.SmoothCurve2D
clip, reverse, subCurve, tangent, transform
 
Methods inherited from interface math.geom2d.curve.ContinuousCurve2D
appendPath, asPolyline, curvature, isClosed
 
Methods inherited from interface math.geom2d.curve.Curve2D
asAwtShape, continuousCurves, draw, firstPoint, getT0, getT1, intersections, lastPoint, point, position, project, t0, t1
 
Methods inherited from interface math.geom2d.Shape2D
boundingBox, contains, contains, distance, distance, isBounded, isEmpty
 
Methods inherited from interface math.geom2d.GeometricObject2D
almostEquals
 

Constructor Detail

AbstractSmoothCurve2D

public AbstractSmoothCurve2D()
Method Detail

leftTangent

public Vector2D leftTangent(double t)
Description copied from interface: ContinuousCurve2D
Computes the left tangent at the given position. If the curve is smooth at position t, the result is the same as the tangent computed for the corresponding smooth curve, and is equal to the result of rightTangent(double). If the position t corresponds to a singular point, the tangent of the smooth portion before t is computed.

Specified by:
leftTangent in interface ContinuousCurve2D
Parameters:
t - the position on the curve
Returns:
the left tangent vector at the curve for position t

rightTangent

public Vector2D rightTangent(double t)
Description copied from interface: ContinuousCurve2D
Computes the right tangent at the given position. If the curve is smooth at position t, the result is the same as the tangent computed for the corresponding smooth curve, and is equal to the result of leftTangent(double). If the position t corresponds to a singular point, the tangent of the smooth portion after t is computed.

Specified by:
rightTangent in interface ContinuousCurve2D
Parameters:
t - the position on the curve
Returns:
the right tangent vector at the curve for position t

normal

public Vector2D normal(double t)
Description copied from interface: SmoothCurve2D
Returns the normal vector of the curve at the given position.

Specified by:
normal in interface SmoothCurve2D
Parameters:
t - a position on the curve
Returns:
the normal vector computed for position t
See Also:
SmoothCurve2D.tangent(double)

smoothPieces

public java.util.Collection<? extends SmoothCurve2D> smoothPieces()
Description copied from interface: ContinuousCurve2D
Returns a set of smooth curves.

Specified by:
smoothPieces in interface ContinuousCurve2D

singularPoints

public java.util.Collection<Point2D> singularPoints()
Returns an empty set of Point2D, as a smooth curve does not have singular points by definition.

Specified by:
singularPoints in interface Curve2D
Returns:
a collection of Point2D.
See Also:
Curve2D.singularPoints()

vertices

public java.util.Collection<Point2D> vertices()
Returns a set of Point2D, containing the extremities of the curve if they are not infinite.

Specified by:
vertices in interface Curve2D
Returns:
a collection of Point2D.
See Also:
Curve2D.vertices()

isSingular

public boolean isSingular(double pos)
Returns always false, as a smooth curve does not have singular points by definition.

Specified by:
isSingular in interface Curve2D
Parameters:
pos - the position of the point on the curve
Returns:
true if the point at this location is singular
See Also:
Curve2D.isSingular(double)

clone

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

Specified by:
clone in interface Curve2D
Specified by:
clone in class AbstractContinuousCurve2D
Returns:
the cloned curve