-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGeometry.java
More file actions
35 lines (30 loc) · 1.46 KB
/
Geometry.java
File metadata and controls
35 lines (30 loc) · 1.46 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
import java.awt.*;
import java.util.*;
public class Geometry {
public Geometry(){
//constructor
}
@SuppressWarnings("unused")
public void makeStaticPlane(double x1, double x2, double y1, double y2, double z1, double z2, Color c1, Color c2){
VertexPool vp = new VertexPool();
TriangleGroup tg = new TriangleGroup(new ArrayList<Triangle>());
Vector3 v1 = vp.getSharedVertex(new Vector3(x1, y1, z1));
Vector3 v2 = vp.getSharedVertex(new Vector3(x2, y2, z2));
Vector3 corner1 = vp.getSharedVertex(new Vector3(x1, (y2+y1)/2, z2));
Vector3 corner2 = vp.getSharedVertex(new Vector3(x2, (y2+y1)/2, z1));
Triangle t1 = tg.add(new Triangle(v1, v2, corner1, c1));
Triangle t2 = tg.add(new Triangle(v1, v2, corner2, c2));
//adding this little mesh to the main hashmap
Manager.staticMeshMap.add(new GeometryGroup(vp, tg));
}
public void makePrism(double x1, double x2, double y1, double y2, double z1, double z2){
//TODO NOT FINISHED!!!
Color c1 = Color.GREEN;
Color c2 = Color.WHITE;
VertexPool vp = new VertexPool();
TriangleGroup tg = new TriangleGroup(new ArrayList<Triangle>());
Vector3 topleft = vp.getSharedVertex(new Vector3(x1, y1, z1));
Vector3 bottomright = vp.getSharedVertex(new Vector3(x2, y2, z2));
Manager.staticMeshMap.add(new GeometryGroup(vp, tg));
}
}