1 /**
2
3 * File: PointSet2D.java
4 * Project: javaGeom
5 *
6 * Distributed under the LGPL License.
7 *
8 * Created: 4 feb. 09
9 */
10 package math.geom2d.point;
11
12 import java.util.Collection;
13
14 import math.geom2d.AffineTransform2D;
15 import math.geom2d.Box2D;
16 import math.geom2d.Point2D;
17
18
19 /**
20 * A set of points. All points within the set are instances of Point2D.
21 * The most direct implementation of PointSet2D is PointArray2D.
22 * @author dlegland
23 *
24 */
25 public interface PointSet2D extends PointShape2D, Iterable<Point2D> {
26
27 /**
28 * Adds a new point to the point set. If point is not an instance of
29 * Point2D, a Point2D with same location is added instead of point.
30 *
31 * @param point the initial point in the set
32 */
33 public void addPoint(java.awt.geom.Point2D point);
34
35 /**
36 * Add a series of points
37 *
38 * @param points an array of points
39 */
40 public void addPoints(Collection<? extends Point2D> points);
41
42 /**
43 * Returns an iterator on the internal point collection.
44 *
45 * @return the collection of points
46 */
47 public Collection<Point2D> getPoints();
48
49 /**
50 * Returns the number of points in the set.
51 *
52 * @return the number of points
53 */
54 public int getPointNumber();
55
56 /**
57 * Transforms the point set by returning a new point set containing each
58 * transformed point.
59 */
60 public abstract PointSet2D transform(AffineTransform2D trans);
61
62 /**
63 * Returns a new point set containing only points located within the box.
64 */
65 public abstract PointSet2D clip(Box2D box);
66 }