View Javadoc

1   /* file : OrientedCurve2D.java
2    * 
3    * Project : geometry
4    *
5    * ===========================================
6    * 
7    * This library is free software; you can redistribute it and/or modify it 
8    * under the terms of the GNU Lesser General Public License as published by
9    * the Free Software Foundation, either version 2.1 of the License, or (at
10   * your option) any later version.
11   *
12   * This library is distributed in the hope that it will be useful, but 
13   * WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
14   * or FITNESS FOR A PARTICULAR PURPOSE.
15   *
16   * See the GNU Lesser General Public License for more details.
17   *
18   * You should have received a copy of the GNU Lesser General Public License
19   * along with this library. if not, write to :
20   * The Free Software Foundation, Inc., 59 Temple Place, Suite 330,
21   * Boston, MA 02111-1307, USA.
22   * 
23   * Created on 25 dec. 2006
24   *
25   */
26  
27  package math.geom2d.domain;
28  
29  import math.geom2d.AffineTransform2D;
30  import math.geom2d.Box2D;
31  import math.geom2d.curve.Curve2D;
32  import math.geom2d.curve.CurveSet2D;
33  
34  /**
35   * An OrientedCurve2D defines an 'inside' and an 'outside'. It is typically a
36   * part of the boundary of a domain. Several OrientedCurve2D form a
37   * ContinuousBoundary2D, and one or several ContinousBoundary2D form a
38   * Boundary2D.
39   * 
40   * @author dlegland
41   */
42  public interface OrientedCurve2D extends Curve2D {
43  
44      /**
45       * Return the angle portion that the curve turn around the given point.
46       * Result is a signed angle.
47       * 
48       * @param point a point of the plane
49       * @return a signed angle
50       */
51      public abstract double getWindingAngle(java.awt.geom.Point2D point);
52  
53      /**
54       * Get the signed distance of the curve to the given point: this distance is
55       * positive if the point lies outside the shape, and is negative if the
56       * point lies inside the shape. In this case, absolute value of distance is
57       * equals to the distance to the border of the shape.
58       * 
59       * @param point a point of the plane
60       * @return the signed distance to the curve
61       */
62      public abstract double getSignedDistance(java.awt.geom.Point2D point);
63  
64      /**
65       * The same as getSignedDistance(Point2D), but by passing 2 double as
66       * arguments.
67       * 
68       * @param x x-coord of a point
69       * @param y y-coord of a point
70       * @return the signed distance of the point (x,y) to the curve
71       */
72      public abstract double getSignedDistance(double x, double y);
73  
74      /**
75       * Returns true if the point is 'inside' the domain bounded by the curve.
76       * 
77       * @param pt a point in the plane
78       * @return true if the point is on the left side of the curve.
79       */
80      // TODO: think about either deprecate or better define
81      public abstract boolean isInside(java.awt.geom.Point2D pt);
82  
83      public abstract Curve2D getReverseCurve();
84  
85      // TODO: what to do with non-continuous oriented curves ?
86      // public abstract OrientedCurve2D getSubCurve(double t0, double t1);
87  
88      public abstract CurveSet2D clip(Box2D box);
89  
90      public abstract Curve2D transform(AffineTransform2D trans);
91  }