-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLineArray.java
More file actions
52 lines (40 loc) · 1.01 KB
/
LineArray.java
File metadata and controls
52 lines (40 loc) · 1.01 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
import java.util.*;
import java.awt.*;
public class LineArray extends Polygon
{
public Point3D center;
public ArrayList<Point3D> points;
public ArrayList<Color> pointColors;
public ArrayList<LineP> colorLines;
public LineArray(ArrayList<Point3D> pts)
{
super();
id="LineArray";
points=pts;
pointColors=null;
for(int i=1;i<pts.size();i++)
lines.add(new Line3D(pts.get(i-1),pts.get(i)));
pan(new Point3D(0,0,0));
}
public LineArray(ArrayList<Point3D> pts, ArrayList<Color> clrs)
{
super();
points=pts;
pointColors=null;
colorLines=new ArrayList<LineP>();
for(int i=1;i<pts.size();i++) {
LineP ln = new LineP(pts.get(i-1),pts.get(i));
ln.color=clrs.get(i-1);
colorLines.add(ln);
}
pan(new Point3D(0,0,0));
}
public LineArray(ArrayList<Point3D> pts, int interval)
{
super();
for(int i=interval;i<pts.size();i+=interval)
if(i>0)
lines.add(new Line3D(pts.get(i-interval),pts.get(i)));
pan(new Point3D(0,0,0));
}
}