Commit 5da02385 authored by Numanoglu's avatar Numanoglu
Browse files

Angle Tolerance between Plane and Line

parent 9d8e0e40
Pipeline #12431 failed with stage
...@@ -41,9 +41,9 @@ public class SweepEdge { ...@@ -41,9 +41,9 @@ public class SweepEdge {
this.direction = direction; this.direction = direction;
} }
public Vector3d intersection(Plane plane, double minLinePlaneAngleRatio) { public Vector3d intersection(Plane plane, double minLinePlaneAngle) {
if (!hasIntersectionPoint(plane, minLinePlaneAngleRatio)) { if (!hasIntersectionPoint(plane, minLinePlaneAngle)) {
return null; return null;
} }
...@@ -52,23 +52,24 @@ public class SweepEdge { ...@@ -52,23 +52,24 @@ public class SweepEdge {
return referencePoint.plus(direction.mult(lineParameter)); return referencePoint.plus(direction.mult(lineParameter));
} }
public boolean hasIntersectionPoint(Plane plane, double minLinePlaneAngleRatio) { public boolean hasIntersectionPoint(Plane plane, double minLinePlaneAngle) {
if (plane == null) { if (plane == null) {
return false; return false;
} }
double denominator = plane.getNormal().dot(direction); double denominator = plane.getNormal().dot(direction);
return Math.abs(denominator) >= minLinePlaneAngleRatio; double linePlaneAngle = Math.asin(Math.min(1.0, Math.abs(denominator)));
return linePlaneAngle >= minLinePlaneAngle;
} }
public boolean intersection(Plane plane, Vector3d intersectionPoint, double minLinePlaneAngleRatio) { public boolean intersection(Plane plane, Vector3d intersectionPoint, double minLinePlaneAngle) {
if (intersectionPoint == null) { if (intersectionPoint == null) {
return false; return false;
} }
Vector3d point = intersection(plane, minLinePlaneAngleRatio); Vector3d point = intersection(plane, minLinePlaneAngle);
if (point == null) { if (point == null) {
return false; return false;
} }
......
...@@ -22,8 +22,7 @@ public class SweepUtilities { ...@@ -22,8 +22,7 @@ public class SweepUtilities {
// todo: Toleranzen passend initialisieren // todo: Toleranzen passend initialisieren
private double minSweepEdgeLength = 0.001; // Mindestlaenge einer Kante private double minSweepEdgeLength = 0.001; // Mindestlaenge einer Kante
private double maxPointPlaneDistance = 0.001; // Maximalabstand zur Ebene private double maxPointPlaneDistance = 0.001; // Maximalabstand zur Ebene
// TODO Transformiere mit arcsin() um dem Nenner den kompl.Winkel zuzuordnen private double minLinePlaneAngle = Math.toRadians(1.0); // Mindestwinkel zwischen Gerade und Ebene
private double minLinePlaneAngleRatio = 0.001; // MindestNeigung: vgl. <EbenenenNormale,GeradenRichtVektor>
private List<SweepVertex> sweepVertices; private List<SweepVertex> sweepVertices;
...@@ -83,7 +82,7 @@ public class SweepUtilities { ...@@ -83,7 +82,7 @@ public class SweepUtilities {
*/ */
for (SweepVertex v : sweepVertices) { for (SweepVertex v : sweepVertices) {
v.calculateNewPoint(targetPlane, errorPolygon, minSweepEdgeLength, minLinePlaneAngleRatio); v.calculateNewPoint(targetPlane, errorPolygon, minSweepEdgeLength, minLinePlaneAngle);
} }
return canHeal(); return canHeal();
......
...@@ -118,7 +118,7 @@ public class SweepVertex { ...@@ -118,7 +118,7 @@ public class SweepVertex {
} }
public void calculateNewPoint (Plane targetPlane, Polygon p, double minSweepEdgeLength, double minLinePlaneAngleRatio) { public void calculateNewPoint (Plane targetPlane, Polygon p, double minSweepEdgeLength, double minLinePlaneAngle) {
newPoint = null; newPoint = null;
...@@ -156,7 +156,7 @@ public class SweepVertex { ...@@ -156,7 +156,7 @@ public class SweepVertex {
return; return;
} }
Vector3d intersectionPoint = sweepEdge.intersection(targetPlane, minLinePlaneAngleRatio); Vector3d intersectionPoint = sweepEdge.intersection(targetPlane, minLinePlaneAngle);
if (intersectionPoint == null) { if (intersectionPoint == null) {
status = SweepVertexStatus.ERROR; status = SweepVertexStatus.ERROR;
return; return;
......
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