View Javadoc

1   /**
2    * 
3    */
4   
5   package math.geom3d.curve;
6   
7   import java.util.Collection;
8   
9   import math.geom3d.Point3D;
10  import math.geom3d.Shape3D;
11  import math.geom3d.curve.Curve3D;
12  import math.geom3d.transform.AffineTransform3D;
13  
14  /**
15   * Interface for 3D space curve. Curve can be continuous, or a set of continuous
16   * curves.
17   * 
18   * @author dlegland
19   */
20  public interface Curve3D extends Shape3D {
21  
22      /**
23       * Get value of parameter t for the first point of the curve. It can be
24       * -Infinity, in this case the piece of curve is not bounded.
25       */
26      public abstract double getT0();
27  
28      /**
29       * Get value of parameter t for the last point of the curve. It can be
30       * +Infinity, in this case the piece of curve is not bounded.
31       */
32      public abstract double getT1();
33  
34      /**
35       * Gets the point from a parametric representation of the curve. If the
36       * parameter lies outside the definition range, the parameter corresponding
37       * to the closest bound is used instead. This method can be used to draw an
38       * approximated outline of a curve, by selecting multiple values for t and
39       * drawing lines between them.
40       */
41      public abstract Point3D getPoint(double t);
42  
43      /**
44       * Same as getPoint(t), but gives the point as a parameter. This avoids
45       * repetitive memory allocations.
46       */
47      public abstract Point3D getPoint(double t, Point3D point);
48  
49      /**
50       * Get the first point of the curve. It must returns the same result as
51       * <code>getPoint(getT0())</code>.
52       * 
53       * @return the first point of the curve
54       */
55      public abstract Point3D getFirstPoint();
56  
57      /**
58       * Get the last point of the curve. It must returns the same result as
59       * <code>getPoint(getT1())</code>.
60       * 
61       * @return the last point of the curve.
62       */
63      public abstract Point3D getLastPoint();
64  
65      /**
66       * Returns a set of singular points, i. e. which do not locally admit
67       * derivative.
68       * 
69       * @return a collection of Point3D.
70       */
71      public abstract Collection<Point3D> getSingularPoints();
72  
73      /**
74       * Get position of the point on the curve. If the point does not belong to
75       * the curve, return Double.NaN.
76       * 
77       * @param point a point belonging to the curve
78       * @return the position of the point on the curve
79       */
80      public abstract double getPosition(Point3D point);
81  
82      /**
83       * Returns the position of the closest orthogonal projection of the point on
84       * the curve, or of the closest singular point. This function should always
85       * returns a valid value.
86       * 
87       * @param point a point to project
88       * @return the position of the closest orthogonal projection
89       */
90      public abstract double project(Point3D point);
91  
92      /**
93       * Returns the curve with same trace on the plane with parametrization in
94       * reverse order.
95       */
96      public abstract Curve3D getReverseCurve();
97  
98      /**
99       * Returns the collection of continuous curves which constitute this curve.
100      * 
101      * @return a collection of continuous curves.
102      */
103     public abstract Collection<? extends ContinuousCurve3D> getContinuousCurves();
104 
105     /**
106      * Returns a portion of the original curve, delimited by two positions on
107      * the curve.
108      * 
109      * @param t0 position of the start of the sub-curve
110      * @param t1 position of the end of the sub-curve
111      * @return the portion of original curve comprised between t0 and t1.
112      */
113     public abstract Curve3D getSubCurve(double t0, double t1);
114 
115     /**
116      * Transforms the curve by an affine transform. The result is an instance of
117      * Curve3D.
118      */
119     public abstract Curve3D transform(AffineTransform3D trans);
120 
121     // /**
122     // * When a curve is clipped, the result is a set of curves.
123     // */
124     // public abstract CurveSet2D<? extends Curve3D> clip(Box2D box);
125 }