Commit ada2ac85 authored by Andrey Filippov's avatar Andrey Filippov

testing/debugging diagonal swapping

parent 5d6289e3
...@@ -23,172 +23,230 @@ ...@@ -23,172 +23,230 @@
*/ */
public class Conflict{ public class Conflict{
int start_layer; int nsTile= -1;
int end_layer; int start_layer;
boolean [] start_dirs = new boolean[24]; int end_layer;
// 0 ... 7 - ortho-diagonal-ortho boolean [] start_dirs = new boolean[24];
// 0 ... 3 from start_layer to end_layer: 0 - start_layer->N->SE->W->end_layer, 1 - start_layer->E->SW->N->end_layer, ... // 0 ... 7 - ortho-diagonal-ortho
// 4 ... 7 from end_layer to start_layer: 4 - end_layer->N->SE->W->start_layer, 7 - end_layer->E->SW->N->start_layer, ... // 0 ... 3 from start_layer to end_layer: 0 - start_layer->N->SE->W->end_layer, 1 - start_layer->E->SW->N->end_layer, ...
// 8 ... 15 - ortho-ortho-diagonal (turn right) // 4 ... 7 from end_layer to start_layer: 4 - end_layer->N->SE->W->start_layer, 7 - end_layer->E->SW->N->start_layer, ...
// 8 ... 11 : 8 - start_layer->N->E->SW->end_layer, 9 - start_layer->E->S->NW->end_layer, ... // 8 ... 15 - ortho-ortho-diagonal (turn right)
// 12 ... 15 : 12 - end_layer->N->E->SW->start_layer, 13 - end_layer->E->S->NW->start_layer, ... // 8 ... 11 : 8 - start_layer->N->E->SW->end_layer, 9 - start_layer->E->S->NW->end_layer, ...
// 16 ... 23 - ortho-ortho-diagonal (turn left) // 12 ... 15 : 12 - end_layer->N->E->SW->start_layer, 13 - end_layer->E->S->NW->start_layer, ...
// 16 ... 19 : 16 - start_layer->N->W->SE->end_layer, 17 - start_layer->E->N->SW->end_layer, ... // 16 ... 23 - ortho-ortho-diagonal (turn left)
// 20 ... 23 : 20 - end_layer->N->W->SE->start_layer, 21 - end_layer->E->N->SW->start_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, ...
Conflict(int start_layer, int end_layer, int start_dir) // for ortho-diag-ortho private void dbgCheck(){
{ // if (nsTile== 630){
if (end_layer > start_layer) { // System.out.println("Conflict().dbgCheck, nsTile = "+nsTile);
this.start_layer = start_layer; // System.out.println("Conflict().dbgCheck, nsTile = "+nsTile);
this.end_layer = end_layer; // }
this.start_dirs[start_dir] = true; }
} else { public Conflict(
this.start_layer = end_layer; int nsTile,
this.end_layer = start_layer; int start_layer,
this.start_dirs[start_dir + 4] = true; int end_layer,
int start_dir) // for ortho-diag-ortho
{
this.nsTile = nsTile;
if (end_layer > start_layer) {
this.start_layer = start_layer;
this.end_layer = end_layer;
this.start_dirs[start_dir] = true;
} else {
this.start_layer = end_layer;
this.end_layer = start_layer;
this.start_dirs[start_dir + 4] = true;
}
}
Conflict(int start_layer, int end_layer, int start_dir, boolean right) // for ortho-ortho-diag
{
if (end_layer > start_layer) {
this.start_layer = start_layer;
this.end_layer = end_layer;
this.start_dirs[(right? 8 : 12) + start_dir] = true;
} else {
this.start_layer = end_layer;
this.end_layer = start_layer;
this.start_dirs[(right? 16 : 20) + start_dir] = true;
}
} }
dbgCheck();
}
Conflict(int [] arr) Conflict(
{ int nsTile,
this.start_layer = arr[0]; int start_layer,
this.end_layer = arr[1]; int end_layer,
for (int i = 0; i < start_dirs.length; i++){ int start_dir,
start_dirs[i] = (arr[2] & (1 << i)) != 0; boolean right) // for ortho-ortho-diag
} {
} this.nsTile = nsTile;
Conflict(int bits) if (end_layer > start_layer) {
{ this.start_layer = start_layer;
this.start_layer = -1; this.end_layer = end_layer;
this.end_layer = -1; this.start_dirs[(right? 8 : 16) + start_dir] = true;
for (int i = 0; i < start_dirs.length; i++){ } else {
start_dirs[i] = (bits & (1 << i)) != 0; this.start_layer = end_layer;
} this.end_layer = start_layer;
} this.start_dirs[(right? 12 : 20) + start_dir] = true;
}
dbgCheck();
}
boolean combine (Conflict other_conflict)
{ Conflict(int nsTile,
if ((other_conflict.start_layer == this.start_layer) && (other_conflict.end_layer == this.end_layer)) { int [] arr)
for (int i = 0; i < start_dirs.length; i++) start_dirs[i] |= other_conflict.start_dirs[i]; {
return true; this.nsTile = nsTile;
} this.start_layer = arr[0];
return false; this.end_layer = arr[1];
} for (int i = 0; i < start_dirs.length; i++){
start_dirs[i] = (arr[2] & (1 << i)) != 0;
int getStartLayer(){
return start_layer;
}
int getEndLayer(){
return end_layer;
} }
}
int getDirBits(){ Conflict(int bits)
int dirs_bits = 0; {
for (int i = 0; i < start_dirs.length; i++){ this.start_layer = -1;
if (start_dirs[i]) dirs_bits |= (1 << i); this.end_layer = -1;
} for (int i = 0; i < start_dirs.length; i++){
return dirs_bits; 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)
{
dbgCheck();
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];
return true;
}
return false;
}
int getStartLayer(){
return start_layer;
}
int getEndLayer(){
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 dirs_bits = 0;
for (int i = 0; i < start_dirs.length; i++){
if (start_dirs[i]) dirs_bits |= (1 << i);
}
return dirs_bits;
}
int getDirBitsOrthoDiagOrtho(){
int dirs_bits = 0;
for (int i = 0; i < 8; i++){
if (start_dirs[i]) dirs_bits |= (1 << i);
} }
return dirs_bits;
}
int getDirBitsOrthoDiagOrtho(){ int getDirBitsOrthoOrthoDiag(boolean right){
int dirs_bits = 0; int dirs_bits = 0;
if (right) {
for (int i = 0; i < 8; i++){
if (start_dirs[i]) dirs_bits |= (1 << (i + 8));
}
} else {
for (int i = 0; i < 8; i++){ for (int i = 0; i < 8; i++){
if (start_dirs[i]) dirs_bits |= (1 << i); if (start_dirs[i]) dirs_bits |= (1 << (i + 16));
} }
return dirs_bits;
} }
return dirs_bits;
}
int getDirBitsOrthoOrthoDiag(boolean right){ int [] toArray()
int dirs_bits = 0; {
if (right) { int dirs_bits = 0;
for (int i = 0; i < 8; i++){ for (int i = 0; i < start_dirs.length; i++){
if (start_dirs[i]) dirs_bits |= (1 << (i + 8)); if (start_dirs[i]) dirs_bits |= (1 << i);
} }
} else { int [] rslt = {start_layer, end_layer, dirs_bits};
for (int i = 0; i < 8; i++){ return rslt;
if (start_dirs[i]) dirs_bits |= (1 << (i + 16)); }
}
} int getNumConflicts(){
return dirs_bits; int numbits = 0;
} for (int i = 0; i < start_dirs.length; i++){
if (start_dirs[i]) numbits++;
int [] toArray()
{
int dirs_bits = 0;
for (int i = 0; i < start_dirs.length; i++){
if (start_dirs[i]) dirs_bits |= (1 << i);
}
int [] rslt = {start_layer, end_layer, dirs_bits};
return rslt;
} }
return numbits;
}
int getNumConflicts(){ int getNumOrthoDiagOrthoConflicts(){
int numbits = 0; int numbits = 0;
for (int i = 0; i < start_dirs.length; i++){ for (int i = 0; i < 8; i++){
if (start_dirs[i]) numbits++; if (start_dirs[i]) numbits++;
}
return numbits;
} }
return numbits;
}
int getNumOrthoDiagOrthoConflicts(){ int getNumOrthoOrthoDiagConflicts(){
int numbits = 0; int numbits = 0;
for (int i = 0; i < 8; i++){ for (int i = 8; i < 24; i++){
if (start_dirs[i]) numbits++; if (start_dirs[i]) numbits++;
}
return numbits;
} }
return numbits;
}
int getNumOrthoOrthoDiagConflicts(){ int getIncompatibleOrthoDiagOrthoConflicts(){
int numbits = 0; int num_incompat = 0;
for (int i = 8; i < 24; i++){ for (int i = 0; i < 8; i++){
if (start_dirs[i]) numbits++; if (start_dirs[i]) {
} int [] incomp_bits= {
return numbits; i ^ 4,
} (i & 4) | ((i + 1) & 3),
(i & 4) | ((i - 1) & 3)};
int getIncompatibleOrthoDiagOrthoConflicts(){ for (int j = 1; j < 3; j++){ // skip dual triangles
int num_incompat = 0; int i1 = incomp_bits[j];
for (int i = 0; i < 8; i++){ if (start_dirs[i1]){
if (start_dirs[i]) { num_incompat ++;
int [] incomp_bits= {
i ^ 4,
(i & 4) | ((i + 1) & 3),
(i & 4) | ((i - 1) & 3)};
for (int j = 1; j < 3; j++){ // skip dual triangles
int i1 = incomp_bits[j];
if (start_dirs[i1]){
num_incompat ++;
}
} }
} }
} }
return num_incompat / 2;
} }
return num_incompat / 2;
public int getDualTriOrthoDiagOrthoConflicts()
{
int num_dual = 0;
for (int i = 0; i < 4; i++) if (start_dirs[i] && start_dirs[i + 4]) num_dual++;
return num_dual;
}
} }
public int getDualTriOrthoDiagOrthoConflicts()
{
int num_dual = 0;
for (int i = 0; i < 4; i++) if (start_dirs[i] && start_dirs[i + 4]) num_dual++;
return num_dual;
}
}
...@@ -96,7 +96,7 @@ public class Conflicts { ...@@ -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]++;
...@@ -153,14 +153,7 @@ public class Conflicts { ...@@ -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(
...@@ -309,7 +302,7 @@ public class Conflicts { ...@@ -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){
...@@ -335,7 +328,7 @@ public class Conflicts { ...@@ -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){
...@@ -361,7 +354,7 @@ public class Conflicts { ...@@ -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){
......
...@@ -3684,207 +3684,7 @@ public class SuperTiles{ ...@@ -3684,207 +3684,7 @@ public class SuperTiles{
return num_added; return num_added;
} }
/*
class Conflict{
int start_layer;
int end_layer;
boolean [] start_dirs = new boolean[8]; // 4 last - opposite direction
Conflict(int start_layer, int end_layer, int start_dir)
{
if (end_layer > start_layer) {
this.start_layer = start_layer;
this.end_layer = end_layer;
this.start_dirs[start_dir] = true;
} else {
this.start_layer = end_layer;
this.end_layer = start_layer;
this.start_dirs[start_dir + 4] = true;
}
}
boolean combine (Conflict other_conflict)
{
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];
return true;
}
return false;
}
int [] toArray()
{
int dirs_bits = 0;
for (int i = 0; i < start_dirs.length; i++){
if (start_dirs[i]) dirs_bits |= (1 << i);
}
int [] rslt = {start_layer, end_layer, dirs_bits};
return rslt;
}
}
*/
/**
public int [][] detectTriangularTileConflicts(
int nsTile0,
HashMap<Integer,Integer> replacement_tiles, //
int [][][] replacement_neibs,
TileSurface.TileNeibs tnSurface)
{
ArrayList<Conflict> conflicts_list= new ArrayList<Conflict>();
if ( planes[nsTile0] != null) {
Integer repl_indx = (replacement_tiles != null) ? replacement_tiles.get(new Integer(nsTile0)): null;
for (int np0 = 0; np0 < planes[nsTile0].length; np0++){
if (planes[nsTile0][np0] != null) {
int [] neibs0 = ((repl_indx == null) || (replacement_neibs[repl_indx][np0] == null)) ?
planes[nsTile0][np0].getNeibBest() :
replacement_neibs[repl_indx][np0];
for (int dir = 0; dir < 8; dir +=2){
int np1;
np1= neibs0[dir]; // planes[nsTile0][np0].getNeibBest(dir);
if (np1 >=0) {
int nsTile1 = tnSurface.getNeibIndex(nsTile0, dir);
if (nsTile1 >= 0){
int dir1 = (dir + 3) % 8;
Integer repl_indx1 = (replacement_tiles != null) ? replacement_tiles.get(new Integer(nsTile1)): null;
int [] neibs1 = ((repl_indx1 == null) || (replacement_neibs[repl_indx1][np1] == null) )?
planes[nsTile1][np1].getNeibBest() :
replacement_neibs[repl_indx1][np1];
int np2 = neibs1[dir1]; // planes[nsTile1][np1].getNeibBest(dir1);
if (np2 >= 0){
int nsTile2 = tnSurface.getNeibIndex(nsTile1, dir1);
if (nsTile2 >= 0){
int dir2 = (dir1 + 3) % 8;
Integer repl_indx2 = (replacement_tiles != null) ? replacement_tiles.get(new Integer(nsTile2)): null;
int [] neibs2 = ((repl_indx2 == null) || (replacement_neibs[repl_indx2][np2] == null)) ?
planes[nsTile2][np2].getNeibBest() :
replacement_neibs[repl_indx2][np2];
int np3 = neibs2[dir2]; // planes[nsTile2][np2].getNeibBest(dir2);
if ((np3 >= 0) && (np3 != np0)){
Conflict conflict = new Conflict(np0, np3, dir/2);
label_apply:
{
for (Conflict conf_old:conflicts_list){
if (conf_old.combine(conflict)){
break label_apply;
}
}
conflicts_list.add(conflict);
}
}
}
}
}
}
}
}
}
}
if(conflicts_list.isEmpty()){
return null;
}
int [][] conflicts = new int [conflicts_list.size()][];
int indx=0;
for (Conflict conflict:conflicts_list){
conflicts[indx++] = conflict.toArray();
}
return conflicts;
}
*/
/*
public void printConflictSummary(int [] conflict_stats)
{
System.out.print("Detected conflicts:");
for (int i = 0; i < 8; i++){
if (conflict_stats[i] != 0) System.out.print(" type "+i+": "+conflict_stats[i]);
}
if (conflict_stats[8] != 0) {
System.out.print(" number of incompatible triangles = " + conflict_stats[8]);
}
if (conflict_stats[9] != 0) {
System.out.print(" number of dual triangles = " + conflict_stats[9]);
}
System.out.println();
}
*/
/**
* Find "triangular" conflicts after running selectNeighborPlanesMutual.
* Such conflicts happen is when starting N (or other ortho direction) from some node,
* then turning 135 degrees right, and then 135 right again it will get to the different
* layer than started (and all 3 connections exist.
* @param debugLevel
* @return 3-d array, first index - tile number, 2-nd - tile conflict number. Each conflict
* is stored as {start layer, end layer, bitmask of start directions} (+1 - N, +2 - E, +4 - S, +8 - W)
*/
/*
public int [][][] detectTriangularConflicts(
final int debugLevel)
{
final int tilesX = tileProcessor.getTilesX();
final int tilesY = tileProcessor.getTilesY();
final int superTileSize = tileProcessor.getSuperTileSize();
final int stilesX = (tilesX + superTileSize -1)/superTileSize;
final int stilesY = (tilesY + superTileSize -1)/superTileSize;
final int nStiles = stilesX * stilesY;
final int [][][] conflicts = new int [planes.length][][];
final TileSurface.TileNeibs tnSurface = tileSurface.new TileNeibs(stilesX, stilesY);
final Thread[] threads = ImageDtt.newThreadArray(tileProcessor.threadsMax);
final AtomicInteger ai = new AtomicInteger(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
public void run() {
for (int nsTile0 = ai.getAndIncrement(); nsTile0 < nStiles; nsTile0 = ai.getAndIncrement()) {
if ( planes[nsTile0] != null) {
conflicts[nsTile0] = detectTriangularTileConflicts(
nsTile0,
null, // HashMap<Integer,Integer> replacement_tiles, //
null, // int [][][] replacement_neibs,
tnSurface);
}
}
}
};
}
ImageDtt.startAndJoin(threads);
if (debugLevel > -1){
int [] conflict_stats = getNumConflicts(
conflicts,
debugLevel);
printConflictSummary(conflict_stats);
}
return conflicts;
}
*/
/**
public int [] getNumConflicts(
int [][][] conflicts,
int debugLevel)
{
int [] num_conflicts = new int [10];
for (int nsTile = 0; nsTile < conflicts.length; nsTile++) if (conflicts[nsTile] != null){
for (int nc = 0; nc < conflicts[nsTile].length; nc++){
int np = 0;
for (int i = 0; i < 8; i++){
if ((conflicts[nsTile][nc][2] & (1 << i)) != 0) {
np ++;
}
}
num_conflicts[np]++;
if (debugLevel > 0) {
int bits =conflicts[nsTile][nc][2];
System.out.println("detectTriangularConflicts() nsTile = "+nsTile+
" nl1 = "+ conflicts[nsTile][nc][0]+
" nl2 = "+ conflicts[nsTile][nc][1]+
" bits = "+ getNumPairsTriangularConflict(bits) + " ("+bits+")"+
" number of incompatible triangles = "+getIncompatiblePairsTriangularConflict(bits)+
" number of dual triangles = "+numDualTri(bits));
}
num_conflicts[8] += getIncompatiblePairsTriangularConflict(conflicts[nsTile][nc][2]);
num_conflicts[9] += numDualTri(conflicts[nsTile][nc][2]);
}
}
return num_conflicts;
}
*/
public void testResoveTriangle( public void testResoveTriangle(
double rquality, double rquality,
double weakWorsening, double weakWorsening,
...@@ -3946,47 +3746,271 @@ public class SuperTiles{ ...@@ -3946,47 +3746,271 @@ public class SuperTiles{
} }
} }
} }
/**
int getNumPairsTriangularConflict(int mask){ public int [] resolveDiagonalTriangularConflicts(
int numbits = 0; int [][][] conflicts,
for (int i = 0; i < 8; i++){ Conflicts conflict_stats, // to be updated after applying resolution
if ((mask & (1 << i)) > 0) numbits++; double orthoWeight,
} double diagonalWeight,
return numbits; double dblTriLoss, // When resolving double triangles allow minor degradation (0.0 - strict)
} boolean preferDisparity,
int getIncompatiblePairsTriangularConflict(int mask){ int debugLevel,
int num_incompat = 0; int dbg_X,
for (int i = 0; i < 8; i++){ int dbg_Y)
if ((mask & (1 << i)) > 0) { {
int [] incomp_bits= { final int tilesX = tileProcessor.getTilesX();
i ^ 4, final int tilesY = tileProcessor.getTilesY();
(i & 4) | ((i + 1) & 3), final int superTileSize = tileProcessor.getSuperTileSize();
(i & 4) | ((i - 1) & 3)}; final int stilesX = (tilesX + superTileSize -1)/superTileSize;
for (int j = 1; j < 3; j++){ // skip dual triangles final int stilesY = (tilesY + superTileSize -1)/superTileSize;
int i1 = incomp_bits[j]; final int dbgTile = dbg_Y * stilesX + dbg_X;
if ((mask & (1 << i1)) > 0){ final TileSurface.TileNeibs tnSurface = tileSurface.new TileNeibs(stilesX, stilesY);
num_incompat ++; int [] rslt = {0,0};
for (int nsTile = 0; nsTile < conflicts.length; nsTile++) if (conflicts[nsTile] != null) {
// conflicts may disappear after being fixed, recheck for null
for (int nConfl = 0; (conflicts[nsTile] != null) && (nConfl < conflicts[nsTile].length); nConfl++){
int dl = ((debugLevel > 0) && (nsTile == dbgTile)) ? 3 : 0;
Conflict confl = new Conflict(nsTile, conflicts[nsTile][nConfl]);
for (int dir_orient = 0; dir_orient < 16; dir_orient++){
boolean right = (dir_orient & 8) != 0;
boolean reverse = (dir_orient & 4) != 0;
int start_dir4 = dir_orient & 3;
if (confl.conflictExists(
start_dir4,
right,
reverse)){
boolean OK = resolveDiagonalTriangularConflict(
confl, // Conflict conflict,
start_dir4, // int start_dir4,
right, // boolean right,
reverse, // boolean reverse,
tnSurface, // TileSurface.TileNeibs tnSurface,
conflicts, // int [][][] conflicts,
conflict_stats, // Conflicts conflict_stats, // to be updated after applying resolution
orthoWeight, // double orthoWeight,
diagonalWeight, // double diagonalWeight,
dblTriLoss, // double dblTriLoss, // When resolving double triangles allow minor degradation (0.0 - strict)
preferDisparity, // boolean preferDisparity,
dl); // int debugLevel)
if (OK) rslt[0]++; // will not count if some conflicts disappeared as a result
else rslt[1]++;
} }
} }
} }
} }
return num_incompat / 2; return rslt;
} }
public int numDualTri(int mask)
public boolean resolveDiagonalTriangularConflict(
Conflict conflict,
int start_dir4,
boolean right,
boolean reverse,
TileSurface.TileNeibs tnSurface,
int [][][] conflicts,
Conflicts conflict_stats, // to be updated after applying resolution
double orthoWeight,
double diagonalWeight,
double dblTriLoss, // When resolving double triangles allow minor degradation (0.0 - strict)
boolean preferDisparity,
int debugLevel)
{ {
int num_dual = 0; if (debugLevel > 1) {
int mask2 = mask & (mask >> 4); System.out.println("******* resolveDiagonalTriangularConflict(): "+conflict.toString()+": start_dir4 = "+ start_dir4 + ", right = "+right+", reverse = "+reverse);
for (int i = 0; i < 4; i++) if ((mask2 & (1 <<i)) != 0) num_dual++; }
return num_dual;
if (!conflict.conflictExists(
start_dir4,
right,
reverse)) {
System.out.println("conflict does not exist");
return false; // should be tested before to distinguish between non-existent and failure to resolve
}
Conflicts iconflicts = new Conflicts(this);
int dir01 = 2 * start_dir4;
int dir12 = 2 * ((start_dir4 + (right? 1 : 3)) % 4);
int dir20 = (dir12 + (right? 3 : 5)) % 8;
int dir02 = (dir20 + 4) % 8;
int nsTile = conflict.getSTile();
int nl = conflict.getStartLayer(reverse);
int nl_end = conflict.getEndLayer(reverse);
int nsTile1 = tnSurface.getNeibIndex(nsTile, dir01);
int nl1 = planes[nsTile][nl].getNeibBest(dir01);
int nsTile2 = tnSurface.getNeibIndex(nsTile1, dir12);
if (nl1 <0){
System.out.println(conflict.toString()+" : start_dir4 = "+ start_dir4 + ", right = "+right+", reverse = "+reverse+" nl1 < 0 !");
return false;
}
int nl2 = planes[nsTile1][nl1].getNeibBest(dir12);
// now nsTile2:nl2 is supposed to be connected to nsTile:nl_end != nl
int [] mod_supertiles = {nsTile,nsTile2};
int [] nsTiles = getInvolvedSupertiles( // first mod_supertiles.length entries will be mod_supertiles[]
mod_supertiles,
tnSurface);
if (debugLevel > 1) {
System.out.println("Involved supertiles:");
for (int i = 0; i < nsTiles.length; i++){
System.out.println(i+":"+nsTiles[i]);
}
}
HashMap<Integer,Integer> replacement_tiles = new HashMap<Integer,Integer>();
for (int i = 0; i < mod_supertiles.length; i++){
replacement_tiles.put(mod_supertiles[i], new Integer(i));
}
int [][][] neibs_prev = new int [mod_supertiles.length][][];
double [][][] val_weights = new double [mod_supertiles.length][][];
// Calculate original costs and neighhbors
updateConnectionsCost (
mod_supertiles, // int [] nsTiles,
null, // int [][][] neibs_prev,
neibs_prev, // int [][][] neibs, // should be initialized at top dimension if neibs_prev==null
val_weights, // double [][][] val_weights, // should be initialized at top dimension if neibs_prev==null
orthoWeight,
diagonalWeight,
tnSurface,
preferDisparity,
debugLevel);
if ((neibs_prev == null) || (neibs_prev[0] == null) || (neibs_prev[1] == null)){
System.out.println("resolveDiagonalTriangularConflict(): BUG");
System.out.println("neibs_prev="+neibs_prev);
System.out.println("neibs_prev[0]="+neibs_prev[0]);
System.out.println("neibs_prev[1]="+neibs_prev[1]);
return false;
}
int [][][] neibs = {neibs_prev[0].clone(),neibs_prev[1].clone()}; // both non-null
for (int nt = 0; nt < neibs.length; nt++){
for (int l = 0; l < neibs_prev[nt].length; l++) if (neibs_prev[nt][l]!= null){
neibs[nt][l] = neibs_prev[nt][l].clone();
}
}
int [][][] conflicts_old = new int [nsTiles.length][][];
for (int isTile = 0; isTile < nsTiles.length; isTile++){
conflicts_old[isTile] = iconflicts.detectTriangularTileConflicts(
nsTiles[isTile], // int nsTile0,
replacement_tiles, //HashMap<Integer,Integer> replacement_tiles, //
neibs_prev, // int [][][] replacement_neibs,
tnSurface); // TileSurface.TileNeibs tnSurface)
}
if (debugLevel > 1) {
System.out.println("Calculating original conflicts");
}
iconflicts.addConflicts(conflicts_old,
debugLevel - 1); // debugLevel);
if (nl2 <0){
System.out.println(conflict.toString()+" : start_dir4 = "+ start_dir4 + ", right = "+right+", reverse = "+reverse+" nl2 < 0 !");
return false;
}
// now swap diagonal connection
neibs[0][nl][dir02] = nl2;
neibs[1][nl2][dir20] = nl;
neibs[0][nl_end][dir02] = neibs_prev[0][nl][dir02];
if (neibs_prev[0][nl][dir02] >= 0) {
neibs[1][neibs_prev[0][nl][dir02]][dir20] = nl_end;
}
int [][][] new_conflicts = new int [nsTiles.length][][];
double new_costs_diff = updateConnectionsCost (
mod_supertiles, // int [] nsTiles,
neibs_prev, // int [][][] neibs_prev,
neibs, // int [][][] neibs, // should be initialized at top dimension if neibs_prev==null
val_weights, // double [][][] val_weights, // should be initialized at top dimension if neibs_prev==null
orthoWeight,
diagonalWeight,
tnSurface,
preferDisparity,
debugLevel);
for (int isTile = 0; isTile < nsTiles.length; isTile++){
new_conflicts[isTile] = iconflicts.detectTriangularTileConflicts(
nsTiles[isTile], // int nsTile0,
replacement_tiles, //HashMap<Integer,Integer> replacement_tiles, //
neibs, // neibs, // int [][][] replacement_neibs,
tnSurface); // TileSurface.TileNeibs tnSurface)
}
Conflicts new_conflicts_stats = new Conflicts(
new_conflicts,
this,
debugLevel - 1); // debugLevel);
new_conflicts_stats.subConflicts(iconflicts); // subtract old number of different types of conflicts
if (debugLevel > -1) {
System.out.println("resolveDiagonalTriangularConflict(): resolving conflict "+conflict.toString()+
", start dir4 = "+start_dir4+
", orientation = "+(right?"right":"left") +
", improvement (negative diff) = "+new_costs_diff);
}
if (debugLevel > -1) {
new_conflicts_stats.printConflictSummary(
"Conflicts difference after resolution:", true, true, true);
}
// See if it is good
if (debugLevel > -1) {
if (new_conflicts_stats.getNumConflicts() > 0) {
if (debugLevel > -1) System.out.println("FAILURE: number of conflicts increased");
} else if (new_costs_diff > dblTriLoss){
if (debugLevel > -1) System.out.println("FAILURE: cost increased too much");
} else if ((new_costs_diff >= 0.0) && (new_conflicts_stats.getNumConflicts() == 0)){
if (debugLevel > -1) System.out.println("FAILURE: cost increased, but conflicts number is the same");
} else if (new_costs_diff >= 0.0){
if (debugLevel > -1) System.out.println("SUCCESS: cost did not decrease, but conflicts did");
} else if (new_conflicts_stats.getNumConflicts() == 0){
if (debugLevel > -1) System.out.println("SUCCESS: conflicts number is the same, but connection cost decreased");
} else {
if (debugLevel > -1) System.out.println("SUCCESS: both conflicts and connection cost decreased");
}
if (debugLevel > 1) {
System.out.println("resolveDiagonalTriangularConflict(): nsTile = "+conflict.getSTile());
}
}
if (new_conflicts_stats.getNumConflicts() > 0) {
return false;
}
if (new_costs_diff > dblTriLoss){
return false;
}
if ((new_costs_diff >= 0.0) && (new_conflicts_stats.getNumConflicts() == 0)){
return false;
}
boolean apply = true;
// apply changes
if (apply) {
// update statistics
conflict_stats.addConflicts(new_conflicts_stats);
// update conflict
for (int i = 0; i < nsTiles.length; i++){
conflicts[nsTiles[i]]= new_conflicts[i];
}
// apply resolution
for (int i = 0; i < mod_supertiles.length; i++){
for (int l = 0; l < neibs[i].length; l ++) if (neibs[i][l] != null){
if (planes[mod_supertiles[i]].length <= l) {
System.out.println("BUG: (planes["+mod_supertiles[i]+"].length="+planes[mod_supertiles[i]].length+" <= "+l);
return false;
}
planes[mod_supertiles[i]][l].setNeibBest(neibs[i][l]);
}
}
}
return true;
} }
*/
public int [] resolveMultiTriangularConflicts( public int [] resolveMultiTriangularConflicts(
int [][][] conflicts, int [][][] conflicts,
// int [] conflict_stats, // to be updated after applying resolution
Conflicts conflict_stats, // to be updated after applying resolution Conflicts conflict_stats, // to be updated after applying resolution
double maxEigen, // maximal eigenvalue of planes to consider
double orthoWeight, double orthoWeight,
double diagonalWeight, double diagonalWeight,
double dblTriLoss, // When resolving double triangles allow minor degradation (0.0 - strict) double dblTriLoss, // When resolving double triangles allow minor degradation (0.0 - strict)
...@@ -4016,20 +4040,19 @@ public class SuperTiles{ ...@@ -4016,20 +4040,19 @@ public class SuperTiles{
tnSurface, tnSurface,
conflicts, conflicts,
conflict_stats, // to be updated after applying resolution conflict_stats, // to be updated after applying resolution
maxEigen, // maximal eigenvalue of planes to consider // maxEigen, // maximal eigenvalue of planes to consider
orthoWeight, orthoWeight,
diagonalWeight, diagonalWeight,
dblTriLoss, // When resolving double triangles allow minor degradation (0.0 - strict) dblTriLoss, // When resolving double triangles allow minor degradation (0.0 - strict)
preferDisparity, preferDisparity,
dl, // debugLevel, dl); // debugLevel,
dbg_X,
dbg_Y) ;
if (OK) rslt[0]++; if (OK) rslt[0]++;
else rslt[1]++; else rslt[1]++;
} }
} }
return rslt; return rslt;
} }
public boolean resolveMultiTriangularConflict( public boolean resolveMultiTriangularConflict(
...@@ -4039,16 +4062,12 @@ public class SuperTiles{ ...@@ -4039,16 +4062,12 @@ public class SuperTiles{
int dir_mask, int dir_mask,
TileSurface.TileNeibs tnSurface, TileSurface.TileNeibs tnSurface,
int [][][] conflicts, int [][][] conflicts,
// int [] conflict_stats, // to be updated after applying resolution
Conflicts conflict_stats, // to be updated after applying resolution Conflicts conflict_stats, // to be updated after applying resolution
double maxEigen, // maximal eigenvalue of planes to consider
double orthoWeight, double orthoWeight,
double diagonalWeight, double diagonalWeight,
double dblTriLoss, // When resolving double triangles allow minor degradation (0.0 - strict) double dblTriLoss, // When resolving double triangles allow minor degradation (0.0 - strict)
boolean preferDisparity, boolean preferDisparity,
int debugLevel, int debugLevel)
int dbg_X,
int dbg_Y)
{ {
Conflicts iconflicts = new Conflicts(this); Conflicts iconflicts = new Conflicts(this);
// neibs_raw may have unused directions // neibs_raw may have unused directions
...@@ -4099,7 +4118,6 @@ public class SuperTiles{ ...@@ -4099,7 +4118,6 @@ public class SuperTiles{
for (int i = 0; i < mod_supertiles.length; i++){ for (int i = 0; i < mod_supertiles.length; i++){
replacement_tiles.put(mod_supertiles[i], new Integer(i)); replacement_tiles.put(mod_supertiles[i], new Integer(i));
} }
// int [] nsTiles = mod_supertiles;
int [][][] neibs_prev = new int [mod_supertiles.length][][]; int [][][] neibs_prev = new int [mod_supertiles.length][][];
double [][][] val_weights_original = new double [mod_supertiles.length][][]; double [][][] val_weights_original = new double [mod_supertiles.length][][];
updateConnectionsCost ( updateConnectionsCost (
...@@ -4134,17 +4152,11 @@ public class SuperTiles{ ...@@ -4134,17 +4152,11 @@ public class SuperTiles{
iconflicts.addConflicts(conflicts_old, iconflicts.addConflicts(conflicts_old,
debugLevel - 1); // debugLevel); debugLevel - 1); // debugLevel);
/*
int [] conflict_stats_old = getNumConflicts(
conflicts_old,
debugLevel - 1); // debugLevel);
*/
// After getting old (referfence data) iterate through all variants, for each calculate cost and number of conflicts. // After getting old (referfence data) iterate through all variants, for each calculate cost and number of conflicts.
// First - just collect data - cost and full statistics of the conflicts, print them // First - just collect data - cost and full statistics of the conflicts, print them
// Then select the best one (not incrementing number of conflicts? and reducing cost) // Then select the best one (not incrementing number of conflicts? and reducing cost)
int [][][][] variant_conflicts = new int [neibs_vars.length][nsTiles.length][][]; int [][][][] variant_conflicts = new int [neibs_vars.length][nsTiles.length][][];
// int [][] variant_conflicts_stats = new int [neibs_vars.length][];
Conflicts [] variant_conflicts_stats = new Conflicts [neibs_vars.length]; Conflicts [] variant_conflicts_stats = new Conflicts [neibs_vars.length];
...@@ -4179,17 +4191,7 @@ public class SuperTiles{ ...@@ -4179,17 +4191,7 @@ public class SuperTiles{
variant_conflicts[variant], variant_conflicts[variant],
this, this,
debugLevel - 1); // debugLevel); debugLevel - 1); // debugLevel);
/* variant_conflicts_stats[variant].subConflicts(iconflicts); // subtract old number of different types of conflicts
int [] conflict_stats_new = getNumConflicts(
variant_conflicts[variant],
debugLevel - 1); // debugLevel);
*/
/*
variant_conflicts_stats[variant] = new int [conflict_stats_new.length];
for (int i = 0; i < conflict_stats_new.length; i++){
variant_conflicts_stats[variant][i] = conflict_stats_new[i]- conflict_stats_old[i];
}
*/ variant_conflicts_stats[variant].subConflicts(iconflicts); // subtract old number of different types of conflicts
if (debugLevel > -1) { if (debugLevel > -1) {
System.out.println("resolveMultiTriangularConflict(): resolving conflict for tile "+nsTile+ System.out.println("resolveMultiTriangularConflict(): resolving conflict for tile "+nsTile+
...@@ -4218,15 +4220,6 @@ public class SuperTiles{ ...@@ -4218,15 +4220,6 @@ public class SuperTiles{
false, // boolean use_all, false, // boolean use_all,
true, // boolean use_odo, true, // boolean use_odo,
false); // ); // boolean use_ood) false); // ); // boolean use_ood)
/*
for (int i = 0; i < variant_conflicts_stats[variant].length; i++){
if (variant_conflicts_stats[variant][i] < 0) {
num_better += 1;
} else if (variant_conflicts_stats[variant][i] > 0) {
num_worse += 1;
}
}
*/
num_better_worse[variant][0] = num_better; num_better_worse[variant][0] = num_better;
num_better_worse[variant][1] = num_worse; num_better_worse[variant][1] = num_worse;
if ((num_worse == 0) && if ((num_worse == 0) &&
...@@ -4240,9 +4233,9 @@ public class SuperTiles{ ...@@ -4240,9 +4233,9 @@ public class SuperTiles{
} }
} }
if (debugLevel > 1){ if (debugLevel > 1){
System.out.println("resolveMultiTriangularConflict(): for tile "+nsTile); System.out.println("resolveMultiTriangularConflict(): for tile "+nsTile);
} }
if ((best_variant < 0) || (variant_costs_diff[best_variant] > dblTriLoss)){ if ((best_variant < 0) || (variant_costs_diff[best_variant] > dblTriLoss)){
if (debugLevel > -1) { if (debugLevel > -1) {
...@@ -4259,12 +4252,6 @@ public class SuperTiles{ ...@@ -4259,12 +4252,6 @@ public class SuperTiles{
", nl2 = "+nl2 + ", nl2 = "+nl2 +
", dir_mask = "+dir_mask+". Of "+ neibs_vars.length+" variants - use variant # " + best_variant+ ", dir_mask = "+dir_mask+". Of "+ neibs_vars.length+" variants - use variant # " + best_variant+
" cost difference (negative) = "+variant_costs_diff[best_variant]+" num conflict reductions = "+num_better_worse[best_variant][0]); " cost difference (negative) = "+variant_costs_diff[best_variant]+" num conflict reductions = "+num_better_worse[best_variant][0]);
/*
System.out.print("Conflicts number change per type: ");
printConflictSummary(variant_conflicts_stats[best_variant]);
System.out.print("Conflicts before resolution: ");
printConflictSummary(conflict_stats_old);
*/
variant_conflicts_stats[best_variant].printConflictSummary( variant_conflicts_stats[best_variant].printConflictSummary(
"Conflicts number change per type: ", "Conflicts number change per type: ",
true, // use_all, true, // use_all,
...@@ -4276,11 +4263,6 @@ public class SuperTiles{ ...@@ -4276,11 +4263,6 @@ public class SuperTiles{
true, //use_odo, true, //use_odo,
true); // use_ood); true); // use_ood);
// update statistics // update statistics
/*
for (int i = 0; i < conflict_stats.length; i++){
conflict_stats[i] += variant_conflicts_stats[best_variant][i];
}
*/
conflict_stats.addConflicts(variant_conflicts_stats[best_variant]); conflict_stats.addConflicts(variant_conflicts_stats[best_variant]);
...@@ -4577,7 +4559,7 @@ public class SuperTiles{ ...@@ -4577,7 +4559,7 @@ public class SuperTiles{
for (int nsTile = 0; nsTile < conflicts.length; nsTile++) if (conflicts[nsTile] != null) { for (int nsTile = 0; nsTile < conflicts.length; nsTile++) if (conflicts[nsTile] != null) {
// conflicts may disappear after being fixed, recheck for null // conflicts may disappear after being fixed, recheck for null
for (int nConfl = 0; (conflicts[nsTile] != null) && (nConfl < conflicts[nsTile].length); nConfl++){ for (int nConfl = 0; (conflicts[nsTile] != null) && (nConfl < conflicts[nsTile].length); nConfl++){
Conflict confl = new Conflict(conflicts[nsTile][nConfl]); // getDualTriOrthoDiagOrthoConflicts Conflict confl = new Conflict(nsTile, conflicts[nsTile][nConfl]); // getDualTriOrthoDiagOrthoConflicts
// if (numDualTri(conflicts[nsTile][nConfl][2]) > 0) { // if (numDualTri(conflicts[nsTile][nConfl][2]) > 0) {
if (confl.getDualTriOrthoDiagOrthoConflicts() > 0) { if (confl.getDualTriOrthoDiagOrthoConflicts() > 0) {
for (int dir4 = 0; dir4 < 4; dir4 ++ ){ for (int dir4 = 0; dir4 < 4; dir4 ++ ){
......
...@@ -3477,7 +3477,6 @@ public class TileProcessor { ...@@ -3477,7 +3477,6 @@ public class TileProcessor {
int [] conflict_resoultion_results = st.resolveMultiTriangularConflicts( int [] conflict_resoultion_results = st.resolveMultiTriangularConflicts(
conflicts0, // int [][][] conflicts, conflicts0, // int [][][] conflicts,
conflicts0_stats, conflicts0_stats,
clt_parameters.plMaxEigen,
clt_parameters.plStarOrtho, // double orthoWeight, clt_parameters.plStarOrtho, // double orthoWeight,
clt_parameters.plStarDiag, // double diagonalWeight, clt_parameters.plStarDiag, // double diagonalWeight,
clt_parameters.plDblTriLoss, // double diagonalWeight, clt_parameters.plDblTriLoss, // double diagonalWeight,
...@@ -3486,56 +3485,30 @@ public class TileProcessor { ...@@ -3486,56 +3485,30 @@ public class TileProcessor {
clt_parameters.tileX, clt_parameters.tileX,
clt_parameters.tileY); clt_parameters.tileY);
System.out.println("Pass "+(pass+1)+": multi_tri_results (success/failures) = "+conflict_resoultion_results[0]+" / "+conflict_resoultion_results[1]); System.out.println("Pass "+(pass+1)+": multi_tri_results (success/failures) = "+conflict_resoultion_results[0]+" / "+conflict_resoultion_results[1]);
if ((dual_tri_results[0] == 0) &&(conflict_resoultion_results[0] == 0)) break;
} int [] diagonal_resoultion_results = st.resolveDiagonalTriangularConflicts(
/*
int [] conflicts1_stats = st.getNumConflicts(
conflicts0,
1); // -1); // debugLevel);
st.printConflictSummary(conflicts1_stats);
*/
Conflicts conflicts1_stats = new Conflicts(
conflicts0,
st,
-1); // debugLevel);
conflicts1_stats.printConflictSummary("Detected conflicts (all):", true,false,false);
conflicts1_stats.printConflictSummary("Detected conflicts (ortho-diag-ortho):", false, true,false);
conflicts1_stats.printConflictSummary("Detected conflicts(ortho-ortho-diag):", false, false, true);
/*
for (int pass = 0; pass < 10; pass ++) {
int [] dual_tri_results = st. resolveDualTriangularConflicts(
conflicts0, // int [][][] conflicts, conflicts0, // int [][][] conflicts,
conflicts0_stats, conflicts0_stats,
clt_parameters.plMaxEigen, clt_parameters.plStarOrtho, // double orthoWeight,
clt_parameters.plStarOrtho, // double orthoWeight, clt_parameters.plStarDiag, // double diagonalWeight,
clt_parameters.plStarDiag, // double diagonalWeight,
clt_parameters.plDblTriLoss, // double diagonalWeight, clt_parameters.plDblTriLoss, // double diagonalWeight,
clt_parameters.plPreferDisparity, clt_parameters.plPreferDisparity,
1, // final int debugLevel) 1, // final int debugLevel)
clt_parameters.tileX, clt_parameters.tileX,
clt_parameters.tileY); clt_parameters.tileY);
System.out.println("Pass "+(pass+1)+": dual_tri_results (success/failures) = "+dual_tri_results[0]+" / "+dual_tri_results[1]); System.out.println("Pass "+(pass+1)+": resolveDiagonalTriangularConflicts (success/failures) = "+diagonal_resoultion_results[0]+" / "+diagonal_resoultion_results[1]);
if (dual_tri_results[0] == 0) break; if ( (dual_tri_results[0] == 0) &&
(conflict_resoultion_results[0] == 0) &&
(diagonal_resoultion_results[0] == 0)) break;
} }
Conflicts conflicts1_stats = new Conflicts(
conflicts1_stats = st.getNumConflicts(
conflicts0, conflicts0,
1); // -1); // debugLevel); st,
st.printConflictSummary(conflicts1_stats); 1); // -1); // debugLevel);
*/
conflicts1_stats.printConflictSummary("Detected conflicts (all):", true,false,false);
conflicts1_stats.printConflictSummary("Detected conflicts (ortho-diag-ortho):", false, true,false);
/* conflicts1_stats.printConflictSummary("Detected conflicts(ortho-ortho-diag):", false, false, true);
// re-checking conflicts (make sure update is correct)
int [][][] conflicts1r = st.detectTriangularConflicts(
1); // final int debugLevel)
int [] conflicts1r_stats = st.getNumConflicts(
conflicts1r,
-1); // debugLevel);
st.printConflictSummary(conflicts1r_stats);
*/
st.testResoveTriangle( st.testResoveTriangle(
clt_parameters.plWorstWorsening, // final double worst_worsening, clt_parameters.plWorstWorsening, // final double worst_worsening,
...@@ -3549,8 +3522,6 @@ public class TileProcessor { ...@@ -3549,8 +3522,6 @@ public class TileProcessor {
1, // final int debugLevel) 1, // final int debugLevel)
clt_parameters.tileX, clt_parameters.tileX,
clt_parameters.tileY); clt_parameters.tileY);
if (clt_parameters.plSplitApply) { if (clt_parameters.plSplitApply) {
while (true) { while (true) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment