Commit f147a2b2 authored by Riegel's avatar Riegel
Browse files

Converted DistanceResult to Record. Ref #69

parent 8bb293f5
......@@ -20,33 +20,9 @@ package de.hft.stuttgart.citydoctor2.math;
/**
* Result of a distance calculation between two points
*
* @author Matthias Betz
*
* @author Matthias Betz
*/
public class DistanceResult {
private final Vector3d point1;
private final Vector3d point2;
private final double distance;
public DistanceResult(Vector3d point1, Vector3d point2, double distance) {
super();
this.point1 = point1;
this.point2 = point2;
this.distance = distance;
}
public Vector3d getPoint1() {
return point1;
}
public Vector3d getPoint2() {
return point2;
}
public double getDistance() {
return distance;
}
public record DistanceResult(Vector3d point1, Vector3d point2, double distance) {
}
......@@ -51,7 +51,7 @@ public class Segment3d implements Serializable {
* @return the distance
*/
public double getDistance(Segment3d otherSeg) {
return getDistanceResult(otherSeg).getDistance();
return getDistanceResult(otherSeg).distance();
}
public DistanceResult getDistanceResult(Segment3d other) {
......
......@@ -124,9 +124,9 @@ public class RingSelfIntCheck extends Check {
Segment3d s1 = new Segment3d(e1.getFrom(), e1.getTo());
Segment3d s2 = new Segment3d(e2.getFrom(), e2.getTo());
DistanceResult dr = s1.getDistanceResult(s2);
if (dr.getDistance() < epsilon) {
if (dr.distance() < epsilon) {
// intersection
CheckError err = new RingEdgeIntersectionError(lr, e1, e2, dr.getPoint1());
CheckError err = new RingEdgeIntersectionError(lr, e1, e2, dr.point1());
CheckResult cr = new CheckResult(this, ResultStatus.ERROR, err);
lr.addCheckResult(cr);
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