-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCartesian.java
More file actions
51 lines (41 loc) · 1.21 KB
/
Cartesian.java
File metadata and controls
51 lines (41 loc) · 1.21 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
import javax.swing.JFrame;
import cartesian.coordinate.CCPoint;
import cartesian.coordinate.CCSystem;
import cartesian.coordinate.CCLine;
public class Cartesian extends JFrame {
private static final long serialVersionUID = 1L;
private CCSystem s;
private double[] size;
public Cartesian(double a , double b, double c, double d) {
super("Viewer");
setTitle("Viewer");
size = new double[] {a,b,c,d};
setVisible(true);
setSize(1000, 1000);
setLocationRelativeTo(null);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
s = new CCSystem(a, b, c, d);
add(s);
}
/**
* Creates a cartesian coordinate system with x-axis from -a to a and y-axis from -a to a
* @param a size
*/
public Cartesian(double a) {
this(-a,-a,a,a);
}
public void addPoint(CCPoint point) {
s.lock.lock();
//if(s.points.size() > 10000) s.points.remove(0);
/*if(s.points.size() > 5000) {
for (int i = 0; i < 200; i++) {
s.points.remove(0);
}
}*/
s.add(point);
s.lock.unlock();
}
public void addLine(CCLine line) {
s.add(line);
}
}