-
Notifications
You must be signed in to change notification settings - Fork 89
Expand file tree
/
Copy pathIGeometry.java
More file actions
127 lines (108 loc) · 3.9 KB
/
IGeometry.java
File metadata and controls
127 lines (108 loc) · 3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
package nodebox.graphics;
import java.util.Iterator;
import java.util.List;
public interface IGeometry extends Grob {
public static final int DEFAULT_POINT_AMOUNT = 100;
//// Container operations ////
public int getPointCount();
/**
* Get the points for this geometry.
* <p/>
* This method returns live references to the points.
* Changing them will change the original geometry.
*
* @return a list of Points.
*/
public List<Point> getPoints();
/**
* Add the given point to the geometry. The point is cloned.
*
* @param pt the point to add.
*/
public void addPoint(Point pt);
/**
* Add a new point to the geometry specified by its x and y coordinates.
*
* @param x the X coordinate.
* @param y the Y coordinate.
*/
public void addPoint(float x, float y);
/**
* Extend the current geometry with the given list of points.
*
* @param points the points to add to the geometry.
*/
public void extend(Iterator<Point> points);
/**
* Extend the current geometry with the given list of points.
*
* @param points the points to add to the geometry.
*/
public void extend(Point[] points);
//// Geometric operations ////
/**
* Make 100 new points along the contours of the existing path.
* <p/>
* Points are evenly distributed according to the length of each geometric object.
*
* @return a list of Points.
*/
public Point[] makePoints();
/**
* Make 100 new points along the contours of the existing path.
* <p/>
* Points are evenly distributed according to the length of each geometric object.
*
* @param amount the amount of points to distribute.
* @return a list of Points.
*/
public Point[] makePoints(int amount);
/**
* Make new points along the contours of the existing path.
* <p/>
* Points are evenly distributed according to the length of each geometric object.
*
* @param amount the amount of points to distribute.
* @param perContour if true, the points are distributed per contour. The amount of points returned will then be
* number of contours * amount.
* @return a list of Points.
*/
public Point[] makePoints(int amount, boolean perContour);
/**
* Generate new geometry with the given amount of points along the shape of the original geometry.
* <p/>
* The length of each segment is not given and will be determined based on the required number of points.
*
* @param amount the number of points to generate.
* @param perContour whether the given points are per contour, or for the entire geometry.
* @return a new geometry object. This method will return whatever comes out of it, so calling resample on a
* Contour will return a new Contour object.
*/
public IGeometry resampleByAmount(int amount, boolean perContour);
/**
* Generate new geometry with points along the shape of the original geometry, spaced at the given length.
* <p/>
* The number of points is not given and will be determined by the system based on the segment length.
*
* @param segmentLength the maximum length of each resampled segment.
* @return a new geometry object. This object will be of the same type as the callee, so calling resample on a Contour
* will return a new Contour object.
*/
public IGeometry resampleByLength(float segmentLength);
/**
* Flatten the geometry.
*/
public void flatten();
/**
* Make a flattened copy of the geometry.
*
* @return a flattened copy.
*/
public IGeometry flattened();
/**
* Clone the geometry, returning a new copy that is totally independent from the original.
*
* @return the new geometry object.
*/
public IGeometry clone();
}