- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTriangle.java
More file actions
Latest commit
44 lines (34 loc) · 1.91 KB
/
Copy pathTriangle.java
File metadata and controls
44 lines (34 loc) · 1.91 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
publicclassTriangleimplementsTriangleInterface,Comparable<Triangle> {
Point[] t=newPoint[3];
Edge[] e_s=newEdge[3];
intid;
Edgee1,e2,e3;
booleanvisited=false;
publicTriangle(Pointp1,Pointp2,Pointp3,intid,Edgee1,Edgee2,Edgee3){
t[0]=p1;
t[1]=p2;
t[2]=p3;
this.id=id;
e_s[0]=e1;
e_s[1]=e2;
e_s[2]=e3;
}
publicEdge[] getEdges(){
returne_s;
}
publicbooleansame(float[] c){
//036 063 306 360 603 630
return (t[0].p[0]==c[0] && t[0].p[1]==c[1] && t[0].p[2]==c[2] && t[1].p[0]==c[3] && t[1].p[1]==c[4] && t[1].p[2]==c[5] && t[2].p[0]==c[6] && t[2].p[1]==c[7] && t[2].p[2]==c[8]) || (t[0].p[0]==c[0] && t[0].p[1]==c[1] && t[0].p[2]==c[2] && t[1].p[0]==c[6] && t[1].p[1]==c[7] && t[1].p[2]==c[8] && t[2].p[0]==c[3] && t[2].p[1]==c[4] && t[2].p[2]==c[5]) || (t[0].p[0]==c[3] && t[0].p[1]==c[4] && t[0].p[2]==c[5] && t[1].p[0]==c[0] && t[1].p[1]==c[1] && t[1].p[2]==c[2] && t[2].p[0]==c[6] && t[2].p[1]==c[7] && t[2].p[2]==c[8]) || (t[0].p[0]==c[3] && t[0].p[1]==c[4] && t[0].p[2]==c[5] && t[1].p[0]==c[6] && t[1].p[1]==c[7] && t[1].p[2]==c[8] && t[2].p[0]==c[0] && t[2].p[1]==c[1] && t[2].p[2]==c[2]) || (t[0].p[0]==c[6] && t[0].p[1]==c[7] && t[0].p[2]==c[8] && t[1].p[0]==c[0] && t[1].p[1]==c[1] && t[1].p[2]==c[2] && t[2].p[0]==c[3] && t[2].p[1]==c[4] && t[2].p[2]==c[5]) || (t[0].p[0]==c[6] && t[0].p[1]==c[7] && t[0].p[2]==c[8] && t[1].p[0]==c[3] && t[1].p[1]==c[4] && t[1].p[2]==c[5] && t[2].p[0]==c[0] && t[2].p[1]==c[1] && t[2].p[2]==c[2]);
}
publicbooleancontains(float[] c){
return ((t[0].p[0]==c[0]&&t[0].p[1]==c[1]&&t[0].p[2]==c[2])||(t[1].p[0]==c[0]&&t[1].p[1]==c[1]&&t[1].p[2]==c[2])||(t[2].p[0]==c[0]&&t[2].p[1]==c[1]&&t[2].p[2]==c[2]));
}
publicPointInterface [] triangle_coord(){ returnt; }
@Override
publicintcompareTo(Trianglet){
//System.out.println("\t\t I'll return "+this.id+t.id);
if (this.id>t.id) return -1;
if (this.id==t.id) return0;
return1;
}
}