-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgui.java
35 lines (30 loc) · 799 Bytes
/
gui.java
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
import java.util.LinkedList;
import Jcg.geometry.*;
import Jcg.polyhedron.Face;
import Jcg.polyhedron.Halfedge;
import Jcg.polyhedron.Polyhedron_3;
import Jcg.polyhedron.Vertex;
public class gui {
public Polyhedron_3<Point_3> polyhedron3D;
double pas = 0.1;
public gui(Polyhedron_3<Point_3> polyhedron3D) {
this.polyhedron3D=polyhedron3D;
}
void translate(int dir, LinkedList<Vertex<Point_3>> handle_vertices) {
Vector_3 t = new Vector_3();
if (Math.abs(dir)==1) {
t = new Vector_3(dir*pas, 0, 0);
}
else if (Math.abs(dir)==2) {
t = new Vector_3(0, dir/2*pas, 0);
}
else if (Math.abs(dir)==3) {
t = new Vector_3(0, 0, dir/3*pas);
}
for (Vertex<Point_3> v : handle_vertices) {
Point_3 point = v.getPoint().sum(t);
v.setPoint(point);
}
return ;
}
}