Repository navigation
Expand file tree
/
Copy pathWall.java
More file actions
53 lines (46 loc) · 1.5 KB
/
Copy pathWall.java
File metadata and controls
53 lines (46 loc) · 1.5 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
public class Wall {
private Vertex2D point1;
private Vertex2D point2;
private float maxX;
private float minX;
private float maxY;
private float minY;
private float maxZ;
private float minZ;
private Normal normal;
public Wall(Triangle t) {
Vertex3D v1 = t.getV1();
Vertex3D v2 = t.getV2();
Vertex3D v3 = t.getV3();
this.normal = t.getNormal();
if (v1.getX() == v2.getX() && v1.getY() == v2.getY()) {
point1 = new Vertex2D(v1.getX(), v1.getY());
point2 = new Vertex2D(v3.getX(), v3.getY());
} else if (v2.getX() == v3.getX() && v2.getY() == v3.getY()) {
point1 = new Vertex2D(v2.getX(), v2.getY());
point2 = new Vertex2D(v1.getX(), v1.getY());
} else if (v3.getX() == v1.getX() && v3.getY() == v1.getY()) {
point1 = new Vertex2D(v3.getX(), v3.getY());
point2 = new Vertex2D(v2.getX(), v2.getY());
} else {
System.out.println("WHOOPS CAN'T VERIFY WALLS!!!!!");
}
this.maxZ = Math.max(v1.getZ(), Math.max(v2.getZ(), v3.getZ()));
this.minZ = Math.min(v1.getZ(), Math.min(v2.getZ(), v3.getZ()));
}
public Vertex2D getPoint1() {
return point1;
}
public Vertex2D getPoint2() {
return point2;
}
public float getMaxZ() {
return this.maxZ;
}
public float getMinZ() {
return this.minZ;
}
public Normal getNormal() {
return this.normal;
}
}