Loading src/main/java/Conflict.java +205 −147 Original line number Original line Diff line number Diff line Loading @@ -23,6 +23,7 @@ */ */ public class Conflict{ public class Conflict{ int nsTile= -1; int start_layer; int start_layer; int end_layer; int end_layer; boolean [] start_dirs = new boolean[24]; boolean [] start_dirs = new boolean[24]; Loading @@ -35,9 +36,19 @@ public class Conflict{ // 16 ... 23 - ortho-ortho-diagonal (turn left) // 16 ... 23 - ortho-ortho-diagonal (turn left) // 16 ... 19 : 16 - start_layer->N->W->SE->end_layer, 17 - start_layer->E->N->SW->end_layer, ... // 16 ... 19 : 16 - start_layer->N->W->SE->end_layer, 17 - start_layer->E->N->SW->end_layer, ... // 20 ... 23 : 20 - end_layer->N->W->SE->start_layer, 21 - end_layer->E->N->SW->start_layer, ... // 20 ... 23 : 20 - end_layer->N->W->SE->start_layer, 21 - end_layer->E->N->SW->start_layer, ... private void dbgCheck(){ Conflict(int start_layer, int end_layer, int start_dir) // for ortho-diag-ortho // if (nsTile== 630){ // System.out.println("Conflict().dbgCheck, nsTile = "+nsTile); // System.out.println("Conflict().dbgCheck, nsTile = "+nsTile); // } } public Conflict( int nsTile, int start_layer, int end_layer, int start_dir) // for ortho-diag-ortho { { this.nsTile = nsTile; if (end_layer > start_layer) { if (end_layer > start_layer) { this.start_layer = start_layer; this.start_layer = start_layer; this.end_layer = end_layer; this.end_layer = end_layer; Loading @@ -48,23 +59,33 @@ public class Conflict{ this.start_dirs[start_dir + 4] = true; this.start_dirs[start_dir + 4] = true; } } dbgCheck(); } } Conflict(int start_layer, int end_layer, int start_dir, boolean right) // for ortho-ortho-diag Conflict( int nsTile, int start_layer, int end_layer, int start_dir, boolean right) // for ortho-ortho-diag { { this.nsTile = nsTile; if (end_layer > start_layer) { if (end_layer > start_layer) { this.start_layer = start_layer; this.start_layer = start_layer; this.end_layer = end_layer; this.end_layer = end_layer; this.start_dirs[(right? 8 : 12) + start_dir] = true; this.start_dirs[(right? 8 : 16) + start_dir] = true; } else { } else { this.start_layer = end_layer; this.start_layer = end_layer; this.end_layer = start_layer; this.end_layer = start_layer; this.start_dirs[(right? 16 : 20) + start_dir] = true; this.start_dirs[(right? 12 : 20) + start_dir] = true; } } dbgCheck(); } } Conflict(int [] arr) Conflict(int nsTile, int [] arr) { { this.nsTile = nsTile; this.start_layer = arr[0]; this.start_layer = arr[0]; this.end_layer = arr[1]; this.end_layer = arr[1]; for (int i = 0; i < start_dirs.length; i++){ for (int i = 0; i < start_dirs.length; i++){ Loading @@ -78,12 +99,39 @@ public class Conflict{ for (int i = 0; i < start_dirs.length; i++){ for (int i = 0; i < start_dirs.length; i++){ start_dirs[i] = (bits & (1 << i)) != 0; start_dirs[i] = (bits & (1 << i)) != 0; } } dbgCheck(); } int getSTile() { return this.nsTile; } } public String toString() { String s="Conflict"+ " nsTile = "+getSTile()+ " nl1 = "+ getStartLayer()+ " nl2 = "+ getEndLayer()+ " all = "+ getNumConflicts() + " ("+String.format("%06x", getDirBits())+")" + " odo = "+ getNumOrthoDiagOrthoConflicts() + " ood = "+ getNumOrthoOrthoDiagConflicts() + " number of odo incompatible triangles = "+ getIncompatibleOrthoDiagOrthoConflicts() + " number of odo dual triangles = " + getDualTriOrthoDiagOrthoConflicts(); return s; } public boolean conflictExists( int start_dir4, boolean right, boolean reverse) { return start_dirs[8 + start_dir4 + (reverse? 4:0) + (right? 0 : 8)]; } boolean combine (Conflict other_conflict) boolean combine (Conflict other_conflict) { { dbgCheck(); if ((other_conflict.start_layer == this.start_layer) && (other_conflict.end_layer == this.end_layer)) { if ((other_conflict.start_layer == this.start_layer) && (other_conflict.end_layer == this.end_layer)) { for (int i = 0; i < start_dirs.length; i++) start_dirs[i] |= other_conflict.start_dirs[i]; for (int i = 0; i < start_dirs.length; i++) start_dirs[i] |= other_conflict.start_dirs[i]; return true; return true; Loading @@ -99,6 +147,16 @@ public class Conflict{ return end_layer; return end_layer; } } int getStartLayer(boolean reverse){ return reverse? end_layer: start_layer; } int getEndLayer(boolean reverse){ return reverse? start_layer : end_layer; } int getDirBits(){ int getDirBits(){ int dirs_bits = 0; int dirs_bits = 0; for (int i = 0; i < start_dirs.length; i++){ for (int i = 0; i < start_dirs.length; i++){ Loading src/main/java/Conflicts.java +5 −12 Original line number Original line Diff line number Diff line Loading @@ -96,7 +96,7 @@ public class Conflicts { { { for (int nsTile = 0; nsTile < conflicts.length; nsTile++) if (conflicts[nsTile] != null){ for (int nsTile = 0; nsTile < conflicts.length; nsTile++) if (conflicts[nsTile] != null){ for (int nc = 0; nc < conflicts[nsTile].length; nc++){ for (int nc = 0; nc < conflicts[nsTile].length; nc++){ Conflict conf = new Conflict(conflicts[nsTile][nc]); Conflict conf = new Conflict(nsTile, conflicts[nsTile][nc]); if (conf.getNumOrthoDiagOrthoConflicts() > 0) num_ortho_diag_ortho[conf.getNumOrthoDiagOrthoConflicts() - 1]++; if (conf.getNumOrthoDiagOrthoConflicts() > 0) num_ortho_diag_ortho[conf.getNumOrthoDiagOrthoConflicts() - 1]++; if (conf.getNumOrthoOrthoDiagConflicts() > 0) num_ortho_ortho_diag[conf.getNumOrthoOrthoDiagConflicts() - 1]++; if (conf.getNumOrthoOrthoDiagConflicts() > 0) num_ortho_ortho_diag[conf.getNumOrthoOrthoDiagConflicts() - 1]++; if (conf.getNumConflicts() > 0) num_all_conflicts[conf.getNumConflicts() - 1]++; if (conf.getNumConflicts() > 0) num_all_conflicts[conf.getNumConflicts() - 1]++; Loading Loading @@ -153,14 +153,7 @@ public class Conflicts { public void printConflict(String prefix, Conflict conf) public void printConflict(String prefix, Conflict conf) { { System.out.println(prefix+ System.out.println(prefix+conf.toString()); " nl1 = "+ conf.getStartLayer()+ " nl2 = "+ conf.getEndLayer()+ " all = "+ conf.getNumConflicts() + " ("+String.format("%06x", conf.getDirBits())+")" + " odo = "+ conf.getNumOrthoDiagOrthoConflicts() + " ood = "+ conf.getNumOrthoOrthoDiagConflicts() + " number of odo incompatible triangles = "+ conf.getIncompatibleOrthoDiagOrthoConflicts() + " number of odo dual triangles = "+conf.getDualTriOrthoDiagOrthoConflicts()); } } public int numBetterWorse( public int numBetterWorse( Loading Loading @@ -309,7 +302,7 @@ public class Conflicts { int dir2 = (dir1 + 3) % 8; int dir2 = (dir1 + 3) % 8; int np3 = neibs2[dir2]; // planes[nsTile2][np2].getNeibBest(dir2); int np3 = neibs2[dir2]; // planes[nsTile2][np2].getNeibBest(dir2); if ((np3 >= 0) && (np3 != np0)){ if ((np3 >= 0) && (np3 != np0)){ Conflict conflict = new Conflict(np0, np3, dir/2); Conflict conflict = new Conflict(nsTile0, np0, np3, dir/2); label_apply: label_apply: { { for (Conflict conf_old:conflicts_list){ for (Conflict conf_old:conflicts_list){ Loading @@ -335,7 +328,7 @@ public class Conflicts { int dir2 = (dir1 + 3) % 8; int dir2 = (dir1 + 3) % 8; int np3 = neibs2[dir2]; // planes[nsTile2][np2].getNeibBest(dir2); int np3 = neibs2[dir2]; // planes[nsTile2][np2].getNeibBest(dir2); if ((np3 >= 0) && (np3 != np0)){ if ((np3 >= 0) && (np3 != np0)){ Conflict conflict = new Conflict(np0, np3, dir/2, true); // ood, right Conflict conflict = new Conflict(nsTile0, np0, np3, dir/2, true); // ood, right label_apply: label_apply: { { for (Conflict conf_old:conflicts_list){ for (Conflict conf_old:conflicts_list){ Loading @@ -361,7 +354,7 @@ public class Conflicts { int dir2 = (dir1 + 5) % 8; int dir2 = (dir1 + 5) % 8; int np3 = neibs2[dir2]; // planes[nsTile2][np2].getNeibBest(dir2); int np3 = neibs2[dir2]; // planes[nsTile2][np2].getNeibBest(dir2); if ((np3 >= 0) && (np3 != np0)){ if ((np3 >= 0) && (np3 != np0)){ Conflict conflict = new Conflict(np0, np3, dir/2, true); // ood, right Conflict conflict = new Conflict(nsTile0, np0, np3, dir/2, false); // ood, left label_apply: label_apply: { { for (Conflict conf_old:conflicts_list){ for (Conflict conf_old:conflicts_list){ Loading Loading
src/main/java/Conflict.java +205 −147 Original line number Original line Diff line number Diff line Loading @@ -23,6 +23,7 @@ */ */ public class Conflict{ public class Conflict{ int nsTile= -1; int start_layer; int start_layer; int end_layer; int end_layer; boolean [] start_dirs = new boolean[24]; boolean [] start_dirs = new boolean[24]; Loading @@ -35,9 +36,19 @@ public class Conflict{ // 16 ... 23 - ortho-ortho-diagonal (turn left) // 16 ... 23 - ortho-ortho-diagonal (turn left) // 16 ... 19 : 16 - start_layer->N->W->SE->end_layer, 17 - start_layer->E->N->SW->end_layer, ... // 16 ... 19 : 16 - start_layer->N->W->SE->end_layer, 17 - start_layer->E->N->SW->end_layer, ... // 20 ... 23 : 20 - end_layer->N->W->SE->start_layer, 21 - end_layer->E->N->SW->start_layer, ... // 20 ... 23 : 20 - end_layer->N->W->SE->start_layer, 21 - end_layer->E->N->SW->start_layer, ... private void dbgCheck(){ Conflict(int start_layer, int end_layer, int start_dir) // for ortho-diag-ortho // if (nsTile== 630){ // System.out.println("Conflict().dbgCheck, nsTile = "+nsTile); // System.out.println("Conflict().dbgCheck, nsTile = "+nsTile); // } } public Conflict( int nsTile, int start_layer, int end_layer, int start_dir) // for ortho-diag-ortho { { this.nsTile = nsTile; if (end_layer > start_layer) { if (end_layer > start_layer) { this.start_layer = start_layer; this.start_layer = start_layer; this.end_layer = end_layer; this.end_layer = end_layer; Loading @@ -48,23 +59,33 @@ public class Conflict{ this.start_dirs[start_dir + 4] = true; this.start_dirs[start_dir + 4] = true; } } dbgCheck(); } } Conflict(int start_layer, int end_layer, int start_dir, boolean right) // for ortho-ortho-diag Conflict( int nsTile, int start_layer, int end_layer, int start_dir, boolean right) // for ortho-ortho-diag { { this.nsTile = nsTile; if (end_layer > start_layer) { if (end_layer > start_layer) { this.start_layer = start_layer; this.start_layer = start_layer; this.end_layer = end_layer; this.end_layer = end_layer; this.start_dirs[(right? 8 : 12) + start_dir] = true; this.start_dirs[(right? 8 : 16) + start_dir] = true; } else { } else { this.start_layer = end_layer; this.start_layer = end_layer; this.end_layer = start_layer; this.end_layer = start_layer; this.start_dirs[(right? 16 : 20) + start_dir] = true; this.start_dirs[(right? 12 : 20) + start_dir] = true; } } dbgCheck(); } } Conflict(int [] arr) Conflict(int nsTile, int [] arr) { { this.nsTile = nsTile; this.start_layer = arr[0]; this.start_layer = arr[0]; this.end_layer = arr[1]; this.end_layer = arr[1]; for (int i = 0; i < start_dirs.length; i++){ for (int i = 0; i < start_dirs.length; i++){ Loading @@ -78,12 +99,39 @@ public class Conflict{ for (int i = 0; i < start_dirs.length; i++){ for (int i = 0; i < start_dirs.length; i++){ start_dirs[i] = (bits & (1 << i)) != 0; start_dirs[i] = (bits & (1 << i)) != 0; } } dbgCheck(); } int getSTile() { return this.nsTile; } } public String toString() { String s="Conflict"+ " nsTile = "+getSTile()+ " nl1 = "+ getStartLayer()+ " nl2 = "+ getEndLayer()+ " all = "+ getNumConflicts() + " ("+String.format("%06x", getDirBits())+")" + " odo = "+ getNumOrthoDiagOrthoConflicts() + " ood = "+ getNumOrthoOrthoDiagConflicts() + " number of odo incompatible triangles = "+ getIncompatibleOrthoDiagOrthoConflicts() + " number of odo dual triangles = " + getDualTriOrthoDiagOrthoConflicts(); return s; } public boolean conflictExists( int start_dir4, boolean right, boolean reverse) { return start_dirs[8 + start_dir4 + (reverse? 4:0) + (right? 0 : 8)]; } boolean combine (Conflict other_conflict) boolean combine (Conflict other_conflict) { { dbgCheck(); if ((other_conflict.start_layer == this.start_layer) && (other_conflict.end_layer == this.end_layer)) { if ((other_conflict.start_layer == this.start_layer) && (other_conflict.end_layer == this.end_layer)) { for (int i = 0; i < start_dirs.length; i++) start_dirs[i] |= other_conflict.start_dirs[i]; for (int i = 0; i < start_dirs.length; i++) start_dirs[i] |= other_conflict.start_dirs[i]; return true; return true; Loading @@ -99,6 +147,16 @@ public class Conflict{ return end_layer; return end_layer; } } int getStartLayer(boolean reverse){ return reverse? end_layer: start_layer; } int getEndLayer(boolean reverse){ return reverse? start_layer : end_layer; } int getDirBits(){ int getDirBits(){ int dirs_bits = 0; int dirs_bits = 0; for (int i = 0; i < start_dirs.length; i++){ for (int i = 0; i < start_dirs.length; i++){ Loading
src/main/java/Conflicts.java +5 −12 Original line number Original line Diff line number Diff line Loading @@ -96,7 +96,7 @@ public class Conflicts { { { for (int nsTile = 0; nsTile < conflicts.length; nsTile++) if (conflicts[nsTile] != null){ for (int nsTile = 0; nsTile < conflicts.length; nsTile++) if (conflicts[nsTile] != null){ for (int nc = 0; nc < conflicts[nsTile].length; nc++){ for (int nc = 0; nc < conflicts[nsTile].length; nc++){ Conflict conf = new Conflict(conflicts[nsTile][nc]); Conflict conf = new Conflict(nsTile, conflicts[nsTile][nc]); if (conf.getNumOrthoDiagOrthoConflicts() > 0) num_ortho_diag_ortho[conf.getNumOrthoDiagOrthoConflicts() - 1]++; if (conf.getNumOrthoDiagOrthoConflicts() > 0) num_ortho_diag_ortho[conf.getNumOrthoDiagOrthoConflicts() - 1]++; if (conf.getNumOrthoOrthoDiagConflicts() > 0) num_ortho_ortho_diag[conf.getNumOrthoOrthoDiagConflicts() - 1]++; if (conf.getNumOrthoOrthoDiagConflicts() > 0) num_ortho_ortho_diag[conf.getNumOrthoOrthoDiagConflicts() - 1]++; if (conf.getNumConflicts() > 0) num_all_conflicts[conf.getNumConflicts() - 1]++; if (conf.getNumConflicts() > 0) num_all_conflicts[conf.getNumConflicts() - 1]++; Loading Loading @@ -153,14 +153,7 @@ public class Conflicts { public void printConflict(String prefix, Conflict conf) public void printConflict(String prefix, Conflict conf) { { System.out.println(prefix+ System.out.println(prefix+conf.toString()); " nl1 = "+ conf.getStartLayer()+ " nl2 = "+ conf.getEndLayer()+ " all = "+ conf.getNumConflicts() + " ("+String.format("%06x", conf.getDirBits())+")" + " odo = "+ conf.getNumOrthoDiagOrthoConflicts() + " ood = "+ conf.getNumOrthoOrthoDiagConflicts() + " number of odo incompatible triangles = "+ conf.getIncompatibleOrthoDiagOrthoConflicts() + " number of odo dual triangles = "+conf.getDualTriOrthoDiagOrthoConflicts()); } } public int numBetterWorse( public int numBetterWorse( Loading Loading @@ -309,7 +302,7 @@ public class Conflicts { int dir2 = (dir1 + 3) % 8; int dir2 = (dir1 + 3) % 8; int np3 = neibs2[dir2]; // planes[nsTile2][np2].getNeibBest(dir2); int np3 = neibs2[dir2]; // planes[nsTile2][np2].getNeibBest(dir2); if ((np3 >= 0) && (np3 != np0)){ if ((np3 >= 0) && (np3 != np0)){ Conflict conflict = new Conflict(np0, np3, dir/2); Conflict conflict = new Conflict(nsTile0, np0, np3, dir/2); label_apply: label_apply: { { for (Conflict conf_old:conflicts_list){ for (Conflict conf_old:conflicts_list){ Loading @@ -335,7 +328,7 @@ public class Conflicts { int dir2 = (dir1 + 3) % 8; int dir2 = (dir1 + 3) % 8; int np3 = neibs2[dir2]; // planes[nsTile2][np2].getNeibBest(dir2); int np3 = neibs2[dir2]; // planes[nsTile2][np2].getNeibBest(dir2); if ((np3 >= 0) && (np3 != np0)){ if ((np3 >= 0) && (np3 != np0)){ Conflict conflict = new Conflict(np0, np3, dir/2, true); // ood, right Conflict conflict = new Conflict(nsTile0, np0, np3, dir/2, true); // ood, right label_apply: label_apply: { { for (Conflict conf_old:conflicts_list){ for (Conflict conf_old:conflicts_list){ Loading @@ -361,7 +354,7 @@ public class Conflicts { int dir2 = (dir1 + 5) % 8; int dir2 = (dir1 + 5) % 8; int np3 = neibs2[dir2]; // planes[nsTile2][np2].getNeibBest(dir2); int np3 = neibs2[dir2]; // planes[nsTile2][np2].getNeibBest(dir2); if ((np3 >= 0) && (np3 != np0)){ if ((np3 >= 0) && (np3 != np0)){ Conflict conflict = new Conflict(np0, np3, dir/2, true); // ood, right Conflict conflict = new Conflict(nsTile0, np0, np3, dir/2, false); // ood, left label_apply: label_apply: { { for (Conflict conf_old:conflicts_list){ for (Conflict conf_old:conflicts_list){ Loading