Commit 2799ce51 authored by Numanoglu's avatar Numanoglu
Browse files

Require explicit sweep tolerances

parent 7088483b
......@@ -29,7 +29,7 @@ public class HealPlanarPolygonSweep implements HealingMethod {
return false;
}
SweepUtilities utils = new SweepUtilities(err);
SweepUtilities utils = new SweepUtilities(err, 0.001, 0.001);
utils.initialize();
if (utils.calculate()) {
utils.doHeal();
......
......@@ -15,20 +15,23 @@ import de.hft.stuttgart.citydoctor2.math.Plane;
public class SweepUtilities {
private static final Logger logger = LogManager.getLogger(SweepUtilities.class);
private static final double PI = Math.PI;
private Plane targetPlane;
private Polygon errorPolygon;
// todo: Toleranzen passend initialisieren
private double minSweepEdgeLength = 0.001; // Mindestlaenge einer Kante
private double maxPointPlaneDistance = 0.001; // Maximalabstand zur Ebene
private double minLinePlaneAngle = PI / 180.0; // Mindestwinkel zwischen Gerade und Ebene im Bogenmass
private double minSweepEdgeLength;
private double pointOnPlaneTolerance;
private double minLinePlaneAngle;
private List<SweepVertex> sweepVertices;
public SweepUtilities(NonPlanarPolygonDistancePlaneError err) {
public SweepUtilities(NonPlanarPolygonDistancePlaneError err, double pointOnPlaneTolerance,
double sweepEdgeAndAngleTolerance) {
this.pointOnPlaneTolerance = pointOnPlaneTolerance;
minSweepEdgeLength = sweepEdgeAndAngleTolerance;
minLinePlaneAngle = sweepEdgeAndAngleTolerance;
if (err == null) {
return;
......@@ -54,7 +57,7 @@ public class SweepUtilities {
for (SweepVertex v : sweepVertices) {
v.collectOutgoingEdges(errorPolygon, minSweepEdgeLength);
v.initStatus(targetPlane, maxPointPlaneDistance);
v.initStatus(targetPlane, pointOnPlaneTolerance);
}
}
......@@ -78,7 +81,7 @@ public class SweepUtilities {
/*
// If there is a new target plane, new initialization of status is necessary:
for (SweepVertex v : verts) {
v.initStatus(targetPlane, maxPointPlaneDistance);
v.initStatus(targetPlane, pointOnPlaneTolerance);
}
*/
......
......@@ -71,14 +71,14 @@ public class SweepVertex {
}
}
public void initStatus (Plane targetPlane, double maxPointPlaneDistance) {
public void initStatus (Plane targetPlane, double pointOnPlaneTolerance) {
if (targetPlane == null) {
status = SweepVertexStatus.ERROR;
return;
}
if ( targetPlane.getDistance(sweepVertex) < maxPointPlaneDistance ) {
if ( targetPlane.getDistance(sweepVertex) < pointOnPlaneTolerance ) {
status = SweepVertexStatus.ON_PLANE;
}
else if ( outgoingEdges.size() == 0 ) {
......
......@@ -345,7 +345,7 @@ public class SweepUtilitiesStepTest {
private SweepUtilities createSweepUtilities(Polygon sweepPolygon, Plane targetPlane) {
NonPlanarPolygonDistancePlaneError error = new NonPlanarPolygonDistancePlaneError(sweepPolygon, 0, null,
targetPlane);
return new SweepUtilities(error);
return new SweepUtilities(error, 0.001, 0.001);
}
private Polygon getPolygonAtIndex(Building building, int index) {
......
......@@ -111,7 +111,7 @@ public class SweepUtilitiesSyntheticTest {
private boolean runSweep(Polygon sweepPolygon, Plane targetPlane) {
NonPlanarPolygonDistancePlaneError error = new NonPlanarPolygonDistancePlaneError(sweepPolygon, 0, null,
targetPlane);
SweepUtilities utilities = new SweepUtilities(error);
SweepUtilities utilities = new SweepUtilities(error, 0.001, 0.001);
utilities.initialize();
if (!utilities.calculate()) {
......
Supports Markdown
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