Commit 66663802 authored by Riegel's avatar Riegel
Browse files

Converted GmStraight2dIntersectionResult.java to record

parent 1c34a83f
......@@ -19,15 +19,8 @@
package de.hft.stuttgart.citydoctor2.edge;
public class GmStraight2dIntersectionResult {
private final double paramHE;
private final double paramInt;
private final GmStraight2d straightHE;
private final GmStraight2d straightInt;
private final boolean areParallel;
public record GmStraight2dIntersectionResult(double paramHE, double paramInt, GmStraight2d straightHE,
GmStraight2d straightInt, boolean areParallel) {
public static GmStraight2dIntersectionResult parallel(GmStraight2d s1, GmStraight2d s2) {
return new GmStraight2dIntersectionResult(0, 0, s1, s2, true);
......@@ -38,33 +31,5 @@ public class GmStraight2dIntersectionResult {
return new GmStraight2dIntersectionResult(paramHE, paramInt, straightHE, straightInt, false);
}
private GmStraight2dIntersectionResult(double paramHE, double paramInt, GmStraight2d straightHE,
GmStraight2d straightInt, boolean areParallel) {
this.paramHE = paramHE;
this.paramInt = paramInt;
this.straightHE = straightHE;
this.straightInt = straightInt;
this.areParallel = areParallel;
}
public double getParamHE() {
return paramHE;
}
public double getParamInt() {
return paramInt;
}
public GmStraight2d getStraightHE() {
return straightHE;
}
public GmStraight2d getStraightInt() {
return straightInt;
}
public boolean areParallel() {
return areParallel;
}
}
......@@ -299,8 +299,8 @@ public class IntersectPlanarPolygons {
assignParameterToCorrectList(params[1], intersectionValues, intersectedPolygonPoints);
}
} else {
if (heStraight2d.isWithinBoundaries(intersectionResult.getParamHE(), 1e-9)) {
assignParameterToCorrectList(intersectionResult.getParamInt(), intersectionValues,
if (heStraight2d.isWithinBoundaries(intersectionResult.paramHE(), 1e-9)) {
assignParameterToCorrectList(intersectionResult.paramInt(), intersectionValues,
intersectedPolygonPoints);
}
}
......
......@@ -100,11 +100,11 @@ public class IntersectPolygonAndStraight2d {
assignParameterToCorrectList(params[1], intersectionValues, intersectedPolygonPoints);
}
} else {
if (hEStraight.isWithinBoundaries(res.getParamHE())) {
if (hEStraight.isWithinBoundaries(res.paramHE())) {
// Point2d pnt = mIntStraight.evaluate( paramInt );
// cout << "got ( " << pnt.getU() << ", " << pnt.getV() << " ) as int point with
// param " << paramInt << endl;
assignParameterToCorrectList(res.getParamInt(), intersectionValues, intersectedPolygonPoints);
assignParameterToCorrectList(res.paramInt(), intersectionValues, intersectedPolygonPoints);
}
}
}
......
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