Skip to content

Commit

Permalink
Fixed issue #326.
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsschmidt1337 committed Jun 29, 2016
1 parent 7d9045c commit 4e85dcc
Showing 1 changed file with 27 additions and 9 deletions.
36 changes: 27 additions & 9 deletions src/org/nschmidt/ldparteditor/data/VM15Flipper.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,37 @@ public void flipSelection() {
HashMap<GData3, GData3> trianglePair = new HashMap<GData3, GData3>();
int i = 0;
int j = 0;
for (GData3 s1 : effSelectedTriangles) {
for (GData3 s2 : effSelectedTriangles) {
if (j > i && !surfsToIgnore.contains(s2)) {
if (s1.colourNumber != 16 && s1.colourNumber == s2.colourNumber && s1.r == s2.r && s1.g == s2.g && s1.b == s2.b && hasSameEdge(s1, s2)) {
surfsToIgnore.add(s1);
surfsToIgnore.add(s2);
trianglePair.put(s1, s2);
// Special case for only two triangles
if (effSelectedTriangles.size() == 2) {
for (GData3 s1 : effSelectedTriangles) {
for (GData3 s2 : effSelectedTriangles) {
if (j > i && !surfsToIgnore.contains(s2)) {
if (hasSameEdge(s1, s2)) {
surfsToIgnore.add(s1);
surfsToIgnore.add(s2);
trianglePair.put(s1, s2);
}
}
j++;
}
j++;
i++;
}
i++;
} else {
for (GData3 s1 : effSelectedTriangles) {
for (GData3 s2 : effSelectedTriangles) {
if (j > i && !surfsToIgnore.contains(s2)) {
if (s1.colourNumber != 16 && s1.colourNumber == s2.colourNumber && s1.r == s2.r && s1.g == s2.g && s1.b == s2.b && hasSameEdge(s1, s2)) {
surfsToIgnore.add(s1);
surfsToIgnore.add(s2);
trianglePair.put(s1, s2);
}
}
j++;
}
i++;
}
}

effSelectedTriangles.removeAll(surfsToIgnore);
for (GData3 s1 : trianglePair.keySet()) {
GData3 s2 = trianglePair.get(s1);
Expand Down

0 comments on commit 4e85dcc

Please sign in to comment.