View Javadoc

1   /**
2    * File: 	AbstractSmoothCurve2D.java
3    * Project: javaGeom
4    * 
5    * Distributed under the LGPL License.
6    *
7    * Created: 21 mai 09
8    */
9   package math.geom2d.curve;
10  
11  import java.util.ArrayList;
12  import java.util.Collection;
13  
14  import math.geom2d.Point2D;
15  import math.geom2d.Vector2D;
16  
17  
18  /**
19   * Provides a base implementation for smooth curves.
20   * @author dlegland
21   */
22  public abstract class AbstractSmoothCurve2D extends AbstractContinuousCurve2D
23  implements SmoothCurve2D, Cloneable {
24  
25  
26  	/* (non-Javadoc)
27  	 * @see math.geom2d.curve.ContinuousCurve2D#getLeftTangent(double)
28  	 */
29      public Vector2D getLeftTangent(double t){
30      	return this.getTangent(t);
31      }
32      
33  	/* (non-Javadoc)
34  	 * @see math.geom2d.curve.ContinuousCurve2D#getRightTangent(double)
35  	 */
36      public Vector2D getRightTangent(double t){
37      	return this.getTangent(t);
38      }
39      
40  	/* (non-Javadoc)
41  	 * @see math.geom2d.curve.ContinuousCurve2D#getSmoothPieces()
42  	 */
43  	public Collection<? extends SmoothCurve2D> getSmoothPieces() {
44  		return wrapCurve(this);
45  	}
46  
47  	/** 
48  	 * Returns an empty set of Point2D, as a smooth curve does not have
49  	 * singular points by definition. 
50  	 * @see math.geom2d.curve.Curve2D#getSingularPoints()
51  	 */
52  	public Collection<Point2D> getSingularPoints() {
53  		return new ArrayList<Point2D>(0);
54  	}
55  
56  	/**
57  	 * Returns always false, as a smooth curve does not have singular points
58  	 * by definition.
59  	 * @see math.geom2d.curve.Curve2D#isSingular(double)
60  	 */
61  	public boolean isSingular(double pos) {
62  		return false;
63  	}
64  	
65      @Override
66  	public abstract SmoothCurve2D clone();
67  }