Skip to content

Commit 770227a

Browse files
committed
Format changes.
1 parent 6e6fcc2 commit 770227a

File tree

3 files changed

+330
-349
lines changed

3 files changed

+330
-349
lines changed

src/main/java/mesh/Edge3D.java

Lines changed: 37 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,41 @@
22

33
public class Edge3D {
44

5-
public int fromIndex;
6-
7-
public int toIndex;
8-
9-
public Edge3D(int fromIndex, int toIndex) {
10-
this.fromIndex = fromIndex;
11-
this.toIndex = toIndex;
12-
}
13-
14-
@Override
15-
public int hashCode() {
16-
final int prime = 31;
17-
int result = 1;
18-
result = prime * result + fromIndex;
19-
result = prime * result + toIndex;
20-
return result;
21-
}
22-
23-
@Override
24-
public boolean equals(Object obj) {
25-
if (this == obj)
26-
return true;
27-
if (obj == null)
28-
return false;
29-
if (getClass() != obj.getClass())
30-
return false;
31-
Edge3D other = (Edge3D) obj;
32-
if (fromIndex != other.fromIndex)
33-
return false;
34-
if (toIndex != other.toIndex)
35-
return false;
36-
return true;
37-
}
38-
39-
public Edge3D createPair() {
40-
return new Edge3D(toIndex, fromIndex);
41-
}
42-
43-
@Override
44-
public String toString() {
45-
return "Edge3D [fromIndex=" + fromIndex + ", toIndex=" + toIndex + "]";
46-
}
47-
5+
public int fromIndex;
6+
7+
public int toIndex;
8+
9+
public Edge3D(int fromIndex, int toIndex) {
10+
this.fromIndex = fromIndex;
11+
this.toIndex = toIndex;
12+
}
13+
14+
@Override
15+
public int hashCode() {
16+
final int prime = 31;
17+
int result = 1;
18+
result = prime * result + fromIndex;
19+
result = prime * result + toIndex;
20+
return result;
21+
}
22+
23+
@Override
24+
public boolean equals(Object obj) {
25+
if (this == obj) return true;
26+
if (obj == null) return false;
27+
if (getClass() != obj.getClass()) return false;
28+
Edge3D other = (Edge3D) obj;
29+
if (fromIndex != other.fromIndex) return false;
30+
if (toIndex != other.toIndex) return false;
31+
return true;
32+
}
33+
34+
public Edge3D createPair() {
35+
return new Edge3D(toIndex, fromIndex);
36+
}
37+
38+
@Override
39+
public String toString() {
40+
return "Edge3D [fromIndex=" + fromIndex + ", toIndex=" + toIndex + "]";
41+
}
4842
}

src/main/java/mesh/Face3D.java

Lines changed: 45 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -7,51 +7,49 @@
77

88
public class Face3D {
99

10-
public Color color;
11-
12-
public int[] indices;
13-
14-
public Vector3f normal;
15-
16-
public String tag;
17-
18-
public Face3D() {
19-
this(new int[0]);
20-
}
21-
22-
public Face3D(int... indices) {
23-
this.color = new Color();
24-
this.indices = new int[indices.length];
25-
this.normal = new Vector3f();
26-
this.tag = "";
27-
for (int i = 0; i < indices.length; i++)
28-
this.indices[i] = indices[i];
29-
}
30-
31-
public boolean sharesSameIndices(Face3D face) {
32-
int[] indices0 = Arrays.copyOf(face.indices, face.indices.length);
33-
int[] indices1 = Arrays.copyOf(indices, indices.length);
34-
Arrays.sort(indices0);
35-
Arrays.sort(indices1);
36-
return Arrays.equals(indices0, indices1);
37-
}
38-
39-
public int getIndexAt(int index) {
40-
return indices[index % indices.length];
41-
}
42-
43-
public int getVertexCount() {
44-
return indices.length;
45-
}
46-
47-
public Face3D(Face3D f) {
48-
this(f.indices);
49-
this.tag = new String(f.tag);
50-
}
51-
52-
@Override
53-
public String toString() {
54-
return "Face3D [indices=" + Arrays.toString(indices) + "]";
55-
}
56-
10+
public Color color;
11+
12+
public int[] indices;
13+
14+
public Vector3f normal;
15+
16+
public String tag;
17+
18+
public Face3D() {
19+
this(new int[0]);
20+
}
21+
22+
public Face3D(int... indices) {
23+
this.color = new Color();
24+
this.indices = new int[indices.length];
25+
this.normal = new Vector3f();
26+
this.tag = "";
27+
for (int i = 0; i < indices.length; i++) this.indices[i] = indices[i];
28+
}
29+
30+
public boolean sharesSameIndices(Face3D face) {
31+
int[] indices0 = Arrays.copyOf(face.indices, face.indices.length);
32+
int[] indices1 = Arrays.copyOf(indices, indices.length);
33+
Arrays.sort(indices0);
34+
Arrays.sort(indices1);
35+
return Arrays.equals(indices0, indices1);
36+
}
37+
38+
public int getIndexAt(int index) {
39+
return indices[index % indices.length];
40+
}
41+
42+
public int getVertexCount() {
43+
return indices.length;
44+
}
45+
46+
public Face3D(Face3D f) {
47+
this(f.indices);
48+
this.tag = new String(f.tag);
49+
}
50+
51+
@Override
52+
public String toString() {
53+
return "Face3D [indices=" + Arrays.toString(indices) + "]";
54+
}
5755
}

0 commit comments

Comments
 (0)