Commit 18261553 authored by Andrey Filippov's avatar Andrey Filippov

trying another way to resolve conflicts/ improve supertile connections

parent 1ca1c6d0
import java.awt.Point;
import java.util.HashMap;
import java.util.HashSet;
/** /**
** **
** ConnectionCosts - calculate and incrementally update cost of supertile connections ** ConnectionCosts - calculate and incrementally update cost of supertile connections
...@@ -25,6 +21,9 @@ import java.util.HashSet; ...@@ -25,6 +21,9 @@ import java.util.HashSet;
** -----------------------------------------------------------------------------** ** -----------------------------------------------------------------------------**
** **
*/ */
import java.awt.Point;
import java.util.HashMap;
import java.util.HashSet;
public class ConnectionCosts { public class ConnectionCosts {
TilePlanes.PlaneData [][] planes = null; TilePlanes.PlaneData [][] planes = null;
......
...@@ -2175,7 +2175,12 @@ public class EyesisCorrectionParameters { ...@@ -2175,7 +2175,12 @@ public class EyesisCorrectionParameters {
public double plMaxWorldSin2 = 0.1; // Maximal sine squared of the world angle between planes to merge. Set to >= 1.0 to disable public double plMaxWorldSin2 = 0.1; // Maximal sine squared of the world angle between planes to merge. Set to >= 1.0 to disable
public double plWeakWorsening = 1.0; // Relax merge requirements for weaker planes public double plWeakWorsening = 1.0; // Relax merge requirements for weaker planes
public int plStarSteps = 1; // How far to look around when calculationg connection cost public boolean plConflDualTri = false; // Resolve dual triangles conflict (odoodo)
public boolean plConflMulti = false; // Resolve multiple odo triangles conflicts
public boolean plConflDiag = false; // Resolve diagonal (ood) conflicts
public boolean plConflStar = true; // Resolve all conflicts around a supertile
public int plStarSteps = 2; // How far to look around when calculationg connection cost
public double plStarOrtho = 0.5; // When calculating cost for the connections scale 4 ortho neighbors public double plStarOrtho = 0.5; // When calculating cost for the connections scale 4 ortho neighbors
public double plStarDiag = 0.25; // When calculating cost for the connections scale 4 diagonal neighbors public double plStarDiag = 0.25; // When calculating cost for the connections scale 4 diagonal neighbors
public double plStarPwr = 0.5; // Divide cost by number of connections to this power public double plStarPwr = 0.5; // Divide cost by number of connections to this power
...@@ -2529,6 +2534,10 @@ public class EyesisCorrectionParameters { ...@@ -2529,6 +2534,10 @@ public class EyesisCorrectionParameters {
properties.setProperty(prefix+"plMaxWorldSin2", this.plMaxWorldSin2 +""); properties.setProperty(prefix+"plMaxWorldSin2", this.plMaxWorldSin2 +"");
properties.setProperty(prefix+"plWeakWorsening", this.plWeakWorsening +""); properties.setProperty(prefix+"plWeakWorsening", this.plWeakWorsening +"");
properties.setProperty(prefix+"plConflDualTri", this.plConflDualTri+"");
properties.setProperty(prefix+"plConflMulti", this.plConflMulti+"");
properties.setProperty(prefix+"plConflDiag", this.plConflDiag+"");
properties.setProperty(prefix+"plConflStar", this.plConflStar+"");
properties.setProperty(prefix+"plStarSteps", this.plStarSteps+""); properties.setProperty(prefix+"plStarSteps", this.plStarSteps+"");
properties.setProperty(prefix+"plStarOrtho", this.plStarOrtho +""); properties.setProperty(prefix+"plStarOrtho", this.plStarOrtho +"");
properties.setProperty(prefix+"plStarDiag", this.plStarDiag +""); properties.setProperty(prefix+"plStarDiag", this.plStarDiag +"");
...@@ -2863,6 +2872,10 @@ public class EyesisCorrectionParameters { ...@@ -2863,6 +2872,10 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(prefix+"plMaxWorldSin2")!=null) this.plMaxWorldSin2=Double.parseDouble(properties.getProperty(prefix+"plMaxWorldSin2")); if (properties.getProperty(prefix+"plMaxWorldSin2")!=null) this.plMaxWorldSin2=Double.parseDouble(properties.getProperty(prefix+"plMaxWorldSin2"));
if (properties.getProperty(prefix+"plWeakWorsening")!=null) this.plWeakWorsening=Double.parseDouble(properties.getProperty(prefix+"plWeakWorsening")); if (properties.getProperty(prefix+"plWeakWorsening")!=null) this.plWeakWorsening=Double.parseDouble(properties.getProperty(prefix+"plWeakWorsening"));
if (properties.getProperty(prefix+"plConflDualTri")!=null) this.plConflDualTri=Boolean.parseBoolean(properties.getProperty(prefix+"plConflDualTri"));
if (properties.getProperty(prefix+"plConflMulti")!=null) this.plConflMulti=Boolean.parseBoolean(properties.getProperty(prefix+"plConflMulti"));
if (properties.getProperty(prefix+"plConflDiag")!=null) this.plConflDiag=Boolean.parseBoolean(properties.getProperty(prefix+"plConflDiag"));
if (properties.getProperty(prefix+"plConflStar")!=null) this.plConflStar=Boolean.parseBoolean(properties.getProperty(prefix+"plConflStar"));
if (properties.getProperty(prefix+"plStarSteps")!=null) this.plStarSteps=Integer.parseInt(properties.getProperty(prefix+"plStarSteps")); if (properties.getProperty(prefix+"plStarSteps")!=null) this.plStarSteps=Integer.parseInt(properties.getProperty(prefix+"plStarSteps"));
if (properties.getProperty(prefix+"plStarOrtho")!=null) this.plStarOrtho=Double.parseDouble(properties.getProperty(prefix+"plStarOrtho")); if (properties.getProperty(prefix+"plStarOrtho")!=null) this.plStarOrtho=Double.parseDouble(properties.getProperty(prefix+"plStarOrtho"));
if (properties.getProperty(prefix+"plStarDiag")!=null) this.plStarDiag=Double.parseDouble(properties.getProperty(prefix+"plStarDiag")); if (properties.getProperty(prefix+"plStarDiag")!=null) this.plStarDiag=Double.parseDouble(properties.getProperty(prefix+"plStarDiag"));
...@@ -3225,6 +3238,10 @@ public class EyesisCorrectionParameters { ...@@ -3225,6 +3238,10 @@ public class EyesisCorrectionParameters {
gd.addNumericField("Maximal sine squared of the world angle between planes to merge. Set to >= 1.0 to disable", this.plMaxWorldSin2, 6); gd.addNumericField("Maximal sine squared of the world angle between planes to merge. Set to >= 1.0 to disable", this.plMaxWorldSin2, 6);
gd.addNumericField("Relax merge requirements for weaker planes", this.plWeakWorsening, 6); gd.addNumericField("Relax merge requirements for weaker planes", this.plWeakWorsening, 6);
gd.addCheckbox ("Resolve dual triangles conflict (odoodo)", this.plConflDualTri);
gd.addCheckbox ("Resolve multiple odo triangles conflicts", this.plConflMulti);
gd.addCheckbox ("Resolve diagonal (ood) conflicts", this.plConflDiag);
gd.addCheckbox ("Resolve all conflicts around a supertile", this.plConflStar);
gd.addNumericField("How far to look around when calculationg connection cost", this.plStarSteps, 0); gd.addNumericField("How far to look around when calculationg connection cost", this.plStarSteps, 0);
gd.addNumericField("When calculating cost for the connections scale 4 ortho neighbors", this.plStarOrtho, 6); gd.addNumericField("When calculating cost for the connections scale 4 ortho neighbors", this.plStarOrtho, 6);
gd.addNumericField("When calculating cost for the connections scale 4 diagonal neighbors", this.plStarDiag, 6); gd.addNumericField("When calculating cost for the connections scale 4 diagonal neighbors", this.plStarDiag, 6);
...@@ -3572,6 +3589,10 @@ public class EyesisCorrectionParameters { ...@@ -3572,6 +3589,10 @@ public class EyesisCorrectionParameters {
this.plMaxWorldSin2= gd.getNextNumber(); this.plMaxWorldSin2= gd.getNextNumber();
this.plWeakWorsening= gd.getNextNumber(); this.plWeakWorsening= gd.getNextNumber();
this.plConflDualTri= gd.getNextBoolean();
this.plConflMulti= gd.getNextBoolean();
this.plConflDiag= gd.getNextBoolean();
this.plConflStar= gd.getNextBoolean();
this.plStarSteps= (int) gd.getNextNumber(); this.plStarSteps= (int) gd.getNextNumber();
this.plStarOrtho= gd.getNextNumber(); this.plStarOrtho= gd.getNextNumber();
this.plStarDiag= gd.getNextNumber(); this.plStarDiag= gd.getNextNumber();
......
This diff is collapsed.
...@@ -3431,6 +3431,10 @@ public class TileProcessor { ...@@ -3431,6 +3431,10 @@ public class TileProcessor {
st.resolveConflicts( st.resolveConflicts(
clt_parameters.plMaxEigen, clt_parameters.plMaxEigen,
clt_parameters.plConflDualTri, // boolean conflDualTri, // Resolve dual triangles conflict (odoodo)
clt_parameters.plConflMulti, // boolean conflMulti, // Resolve multiple odo triangles conflicts
clt_parameters.plConflDiag, // boolean conflDiag, // Resolve diagonal (ood) conflicts
clt_parameters.plConflStar, // boolean conflStar, // Resolve all conflicts around a supertile
clt_parameters.plStarSteps, // int starSteps, // How far to look around when calculationg connection cost clt_parameters.plStarSteps, // int starSteps, // How far to look around when calculationg connection cost
clt_parameters.plStarOrtho, // double orthoWeight, clt_parameters.plStarOrtho, // double orthoWeight,
clt_parameters.plStarDiag, // double diagonalWeight, clt_parameters.plStarDiag, // double diagonalWeight,
...@@ -3533,6 +3537,10 @@ public class TileProcessor { ...@@ -3533,6 +3537,10 @@ public class TileProcessor {
st.resolveConflicts( st.resolveConflicts(
clt_parameters.plMaxEigen, clt_parameters.plMaxEigen,
clt_parameters.plConflDualTri, // boolean conflDualTri, // Resolve dual triangles conflict (odoodo)
clt_parameters.plConflMulti, // boolean conflMulti, // Resolve multiple odo triangles conflicts
clt_parameters.plConflDiag, // boolean conflDiag, // Resolve diagonal (ood) conflicts
clt_parameters.plConflStar, // boolean conflStar, // Resolve all conflicts around a supertile
clt_parameters.plStarSteps, // int starSteps, // How far to look around when calculationg connection cost clt_parameters.plStarSteps, // int starSteps, // How far to look around when calculationg connection cost
clt_parameters.plStarOrtho, // double orthoWeight, clt_parameters.plStarOrtho, // double orthoWeight,
clt_parameters.plStarDiag, // double diagonalWeight, clt_parameters.plStarDiag, // double diagonalWeight,
......
This diff is collapsed.
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