Commit 8d462ca4 authored by a001188's avatar a001188
Browse files

Initial commit

parent c4d09f7f
...@@ -16,7 +16,7 @@ public class Coordinate implements Cloneable{ ...@@ -16,7 +16,7 @@ public class Coordinate implements Cloneable{
public static double OFFSET_Y = 0.1; public static double OFFSET_Y = 0.1;
public static double WIDTH = 0.8; public static double WIDTH = 0.8;
public static double HEIGHT = 0.8; public static double HEIGHT = 0.8;
public final static double MAX_DIFF = 0.000000001; public final static double MAX_DIFF = 0.00001;
public final double lat; public final double lat;
public final double lon; public final double lon;
public double value; public double value;
...@@ -97,8 +97,7 @@ public class Coordinate implements Cloneable{ ...@@ -97,8 +97,7 @@ public class Coordinate implements Cloneable{
} }
public boolean equals(Coordinate coord){ public boolean equals(Coordinate coord){
double diff = 0.0000001; if(Math.abs(lon - coord.lon)<MAX_DIFF && Math.abs(lat - coord.lat)<MAX_DIFF)
if(Math.abs(lon - coord.lon)<diff && Math.abs(lat - coord.lat)<diff)
return true; return true;
return false; return false;
} }
......
...@@ -129,7 +129,7 @@ public class IsoSplineContainer { ...@@ -129,7 +129,7 @@ public class IsoSplineContainer {
} }
else{ else{
boolean ok = canCreateIsoSplineElement(isoLevel); boolean ok = canCreateIsoSplineElement(isoLevel);
System.out.println("Wrong number of iso points: (" + ok + ")" + splineCoords.toString()); System.out.println("Wrong number of iso points: (" + ok + ")" + coords.toString());
} }
} }
...@@ -183,7 +183,7 @@ public class IsoSplineContainer { ...@@ -183,7 +183,7 @@ public class IsoSplineContainer {
if(isoLevel <= min || max <= isoLevel) if(isoLevel <= min || max <= isoLevel)
return false; return false;
if(Math.abs(min - max) < 0.00001) if(Math.abs(min - max) < Coordinate.MAX_DIFF)
return false; return false;
return true; return true;
......
...@@ -21,12 +21,12 @@ import org.json.JSONException; ...@@ -21,12 +21,12 @@ import org.json.JSONException;
public class Main { public class Main {
public static final int ISO_LEVELS =3; public static final int ISO_LEVELS =3;
public static final boolean test = false; public static final boolean test = false;
public static int minPolygonSize = 0; public static int minPolygonSize = 1;
public static boolean filtering = true; public static boolean filtering = true;
public static boolean original = false; public static boolean original = false;
public static int filterWidth = 2; public static int filterWidth = 2;
public static int filterIter = 3; public static int filterIter = 3;
public static double filterRange = 0.8; public static double filterRange = 1.0;
/** /**
...@@ -52,11 +52,11 @@ public class Main { ...@@ -52,11 +52,11 @@ public class Main {
gui.setVisible(true); gui.setVisible(true);
int f0=0; int f0=0;
int f1=0; int f1=0;
if(filtering){ if(!original && filtering){
f0=1; f0=1;
f1=2; f1=2;
} }
if(original){ if(original && !filtering){
f0=0; f0=0;
f1=1; f1=1;
} }
...@@ -65,7 +65,7 @@ public class Main { ...@@ -65,7 +65,7 @@ public class Main {
f1=2; f1=2;
} }
for (int f = f0; f0<f1; f0++){ for (int f = f0; f<f1; f++){
for(int i = 0; i<isoLevels.size(); i++){ for(int i = 0; i<isoLevels.size(); i++){
IsoApi clone = coords.clone(); IsoApi clone = coords.clone();
iso = new IsoSpline(clone); iso = new IsoSpline(clone);
......
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package isospline.analyze;
import isospline.Coordinate;
import isospline.IsoSplineContainer;
import isospline.IsoSplineContainers;
import isospline.Matrix;
/**
*
* @author a001188
*/
public class IsoSplineAnalyze {
public static final int SIZE=31;
public void calc(){
Coordinate coord;
IsoSplineContainers iscs;
Matrix matrix;
for(int i1 = 0; i1< SIZE; i1++)
for(int i2 = 0; i2< SIZE; i2=i2+2)
for(int i3 = 0; i3< SIZE; i3=i3+4)
for(int i4 = 0; i4< SIZE; i4=i4+8){
matrix = new Matrix(2,2);
matrix.add(new Coordinate(0.0, 0.0, 0, 0, i1));
matrix.add(new Coordinate(0.0, 1.0, 0, 1, i2));
matrix.add(new Coordinate(1.0, 0.0, 1, 0, i3));
matrix.add(new Coordinate(1.0, 1.0, 1, 1, i4));
iscs = new IsoSplineContainers(1,1);
iscs.createIsoSplineContainers(matrix);
IsoSplineContainer isc = iscs.getIsoSplineContainer(0, 0);
if(isc.canCreateIsoSplineElement(15))
System.out.println("JA " + isc.toString());
}
}
public static void main(String[] args){
IsoSplineAnalyze analyze = new IsoSplineAnalyze();
analyze.calc();
}
}
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