Commit 81be0b1d authored by Riegel's avatar Riegel
Browse files

Merge branch 'dev_GUI' into 'dev'

Open source release of CityDoctorGUI and other extensions.

See merge request !6
parents 12d96d95 5a4d0a74
Pipeline #10056 passed with stage
in 1 minute and 6 seconds
...@@ -22,8 +22,8 @@ import java.util.List; ...@@ -22,8 +22,8 @@ import java.util.List;
public class HalfEdge2d extends BaseEntity { public class HalfEdge2d extends BaseEntity {
private Coordinate2d start; private final Coordinate2d start;
private Coordinate2d end; private final Coordinate2d end;
private HalfEdge2d partner; private HalfEdge2d partner;
...@@ -71,7 +71,7 @@ public class HalfEdge2d extends BaseEntity { ...@@ -71,7 +71,7 @@ public class HalfEdge2d extends BaseEntity {
return pPartner; return pPartner;
} }
private HalfEdge2d setPartner(HalfEdge2d pPartner) { private void setPartner(HalfEdge2d pPartner) {
if (partner != null) { if (partner != null) {
if (pPartner != null) { if (pPartner != null) {
throw new IllegalStateException("cannot overwrite existing partner-connection"); throw new IllegalStateException("cannot overwrite existing partner-connection");
...@@ -92,7 +92,6 @@ public class HalfEdge2d extends BaseEntity { ...@@ -92,7 +92,6 @@ public class HalfEdge2d extends BaseEntity {
} }
} }
} }
return pPartner;
} }
public HalfEdge2d getPartner() { public HalfEdge2d getPartner() {
......
...@@ -82,6 +82,22 @@ public class IntersectPlanarPolygons { ...@@ -82,6 +82,22 @@ public class IntersectPlanarPolygons {
for (Interval in2 : intervals2) { for (Interval in2 : intervals2) {
if (in1.isOverlapping(in2)) { if (in1.isOverlapping(in2)) {
Interval overlap = in1.overlap(in2); Interval overlap = in1.overlap(in2);
handleIntersectionIntervalOverlap(cpPolygon1, cpPolygon2, straight, intersections, epsilon, overlap);
} else if (Math.abs(in1.getStart() - in2.getEnd()) < Global.getHighAccuracyTolerance()) {
// check if the overlaps with a tolerance (numeric errors)
Point3d point = straight.evaluate(in1.getStart());
checkAndAddRealIntersectionPoint(cpPolygon1, cpPolygon2, point, intersections, epsilon);
} else if (Math.abs(in1.getEnd() - in2.getStart()) < Global.getHighAccuracyTolerance()) {
Point3d point = straight.evaluate(in1.getEnd());
checkAndAddRealIntersectionPoint(cpPolygon1, cpPolygon2, point, intersections, epsilon);
}
}
}
}
private static void handleIntersectionIntervalOverlap(EdgePolygon cpPolygon1, EdgePolygon cpPolygon2,
GmStraight straight, List<PolygonPolygonIntersection> intersections, double epsilon, Interval overlap) {
Point3d start = straight.evaluate(overlap.getStart()); Point3d start = straight.evaluate(overlap.getStart());
if (overlap.getLength() < Global.getHighAccuracyTolerance() * 1e6) { if (overlap.getLength() < Global.getHighAccuracyTolerance() * 1e6) {
checkAndAddRealIntersectionPoint(cpPolygon1, cpPolygon2, start, intersections, epsilon); checkAndAddRealIntersectionPoint(cpPolygon1, cpPolygon2, start, intersections, epsilon);
...@@ -96,16 +112,6 @@ public class IntersectPlanarPolygons { ...@@ -96,16 +112,6 @@ public class IntersectPlanarPolygons {
} }
} }
} else if (Math.abs(in1.getStart() - in2.getEnd()) < Global.getHighAccuracyTolerance()) {
// check if the overlaps with a tolerance (numeric errors)
Point3d point = straight.evaluate(in1.getStart());
checkAndAddRealIntersectionPoint(cpPolygon1, cpPolygon2, point, intersections, epsilon);
} else if (Math.abs(in1.getEnd() - in2.getStart()) < Global.getHighAccuracyTolerance()) {
Point3d point = straight.evaluate(in1.getEnd());
checkAndAddRealIntersectionPoint(cpPolygon1, cpPolygon2, point, intersections, epsilon);
}
}
}
} }
private static boolean isPolyLineASharedEdge(EdgePolygon p1, PolyLine polyLine) { private static boolean isPolyLineASharedEdge(EdgePolygon p1, PolyLine polyLine) {
...@@ -136,10 +142,12 @@ public class IntersectPlanarPolygons { ...@@ -136,10 +142,12 @@ public class IntersectPlanarPolygons {
/** /**
* *
* Checks if the given point is a "real" intersection point and add's it to the * Checks if the given point is a 'real' intersection point and adds it to the
* intersection segments member variable. Real means, that this point isn't * intersection segments member variable. 'Real' meaning, that this point isn't
* shared by both polygons as corner point. * a shared corner point of both polygons.
* *
* @param p1 First polygon
* @param p2 Second polygon
* @param point A possible intersection point * @param point A possible intersection point
*/ */
private static void checkAndAddRealIntersectionPoint(EdgePolygon p1, EdgePolygon p2, Point3d point, private static void checkAndAddRealIntersectionPoint(EdgePolygon p1, EdgePolygon p2, Point3d point,
...@@ -200,7 +208,6 @@ public class IntersectPlanarPolygons { ...@@ -200,7 +208,6 @@ public class IntersectPlanarPolygons {
* with the exception, that the straight and the half edges of the polygon will * with the exception, that the straight and the half edges of the polygon will
* be projected on the plane of the polygon, so the calculation of the * be projected on the plane of the polygon, so the calculation of the
* intersection will be reduced to a 2d problem. * intersection will be reduced to a 2d problem.
*
* The intersection intervals contains pairs of parameters from the intersection * The intersection intervals contains pairs of parameters from the intersection
* straight. If an intersection between the straight and the polygon contains * straight. If an intersection between the straight and the polygon contains
* only a point, the according interval will contain the same parameter twice * only a point, the according interval will contain the same parameter twice
...@@ -239,7 +246,7 @@ public class IntersectPlanarPolygons { ...@@ -239,7 +246,7 @@ public class IntersectPlanarPolygons {
GmBoundedStraight heStraight = e.getStraight(); GmBoundedStraight heStraight = e.getStraight();
// Straights are colinear; checked in the handleEmdeddedEdges method // Straights are colinear; checked in the handleEmdeddedEdges method
if (heStraight.isColinear(intersectingStraight, angleEpsilon, epsilon)) { if (heStraight.isCollinear(intersectingStraight, angleEpsilon, epsilon)) {
continue; continue;
} }
...@@ -256,7 +263,7 @@ public class IntersectPlanarPolygons { ...@@ -256,7 +263,7 @@ public class IntersectPlanarPolygons {
// check if the straight of the HalfEdge is collinear to the intersection // check if the straight of the HalfEdge is collinear to the intersection
// straight; this might result in an embedded edge intersection result // straight; this might result in an embedded edge intersection result
// TODO MW: really needed? this check is also made some lines above // TODO MW: really needed? this check is also made some lines above
if (heStraight.isColinear(intersectingStraight, angleEpsilon, epsilon)) { if (heStraight.isCollinear(intersectingStraight, angleEpsilon, epsilon)) {
currHESharesAPntWithTheOtherPolygon = false; currHESharesAPntWithTheOtherPolygon = false;
} }
...@@ -271,12 +278,22 @@ public class IntersectPlanarPolygons { ...@@ -271,12 +278,22 @@ public class IntersectPlanarPolygons {
GmBoundedStraight2d heStraight2d = polyPlane.projectOn2dStraight(heStraight); GmBoundedStraight2d heStraight2d = polyPlane.projectOn2dStraight(heStraight);
GmStraight2dIntersectionResult intersectionResult = heStraight2d.intersect(intersectingStraight2d); GmStraight2dIntersectionResult intersectionResult = heStraight2d.intersect(intersectingStraight2d);
analyseProjectedIntersection(intersectionResult, intersectingStraight2d, heStraight2d, intersectionValues, intersectedPolygonPoints);
}
processIntersectionIntervals(p, intersectingStraight, intersectionValues, intersectedPolygonPoints,
intersectionIntervals);
return intersectionIntervals;
}
private static void analyseProjectedIntersection(GmStraight2dIntersectionResult intersectionResult, GmStraight2d intersectingStraight2d, GmBoundedStraight2d heStraight2d, TreeSet<Double> intersectionValues, TreeSet<Double> intersectedPolygonPoints) {
if (intersectionResult.areParallel()) { if (intersectionResult.areParallel()) {
Vector2d dir = intersectingStraight2d.getDirection(); Vector2d dir = intersectingStraight2d.getDirection();
Vector2d diffVec = heStraight2d.getOrigin().minus(intersectingStraight2d.getOrigin()); Vector2d diffVec = heStraight2d.getOrigin().minus(intersectingStraight2d.getOrigin());
double diffVecDotPerpDir = diffVec.dot(dir.getPerpendicularVector()); double diffVecDotPerpDir = diffVec.dot(dir.getPerpendicularVector());
if (Math.abs(diffVecDotPerpDir) < Global.getZeroAngleCosinus()) { if (Math.abs(diffVecDotPerpDir) < Global.getZeroAngleCosine()) {
// Straights are identical // Straights are identical
Point2d p1 = heStraight2d.getOrigin(); Point2d p1 = heStraight2d.getOrigin();
Point2d p2 = heStraight2d.getTarget(); Point2d p2 = heStraight2d.getTarget();
...@@ -299,19 +316,13 @@ public class IntersectPlanarPolygons { ...@@ -299,19 +316,13 @@ public class IntersectPlanarPolygons {
assignParameterToCorrectList(params[1], intersectionValues, intersectedPolygonPoints); assignParameterToCorrectList(params[1], intersectionValues, intersectedPolygonPoints);
} }
} else { } else {
if (heStraight2d.isWithinBoundaries(intersectionResult.getParamHE(), 1e-9)) { if (heStraight2d.isWithinBoundaries(intersectionResult.paramHE(), 1e-9)) {
assignParameterToCorrectList(intersectionResult.getParamInt(), intersectionValues, assignParameterToCorrectList(intersectionResult.paramInt(), intersectionValues,
intersectedPolygonPoints); intersectedPolygonPoints);
} }
} }
} }
processIntersectionIntervals(p, intersectingStraight, intersectionValues, intersectedPolygonPoints,
intersectionIntervals);
return intersectionIntervals;
}
/** /**
* This methods computes the intervals of the intersection between the given * This methods computes the intervals of the intersection between the given
* straight and polygon. It gets only parameters where the straight hits the * straight and polygon. It gets only parameters where the straight hits the
...@@ -350,16 +361,35 @@ public class IntersectPlanarPolygons { ...@@ -350,16 +361,35 @@ public class IntersectPlanarPolygons {
List<Double> valuesList = new ArrayList<>(intersectionValues); List<Double> valuesList = new ArrayList<>(intersectionValues);
for (int i = 0; i < valuesList.size(); i++) { for (int i = 0; i < valuesList.size(); i++) {
double i1 = valuesList.get(i); double i1 = valuesList.get(i);
i = i + 1; int j = i + 1;
if (i < valuesList.size()) { if (j < valuesList.size()) {
double i2 = valuesList.get(i); double i2 = valuesList.get(j);
// check if the double values are corner points of the polygon // check if the double values are corner points of the polygon
boolean gotPolygonPoint = false; boolean gotPolygonPoint = intersectedPolygonPoints.contains(i1) ||
if (intersectedPolygonPoints.contains(i1) || intersectedPolygonPoints.contains(i2)) { intersectedPolygonPoints.contains(i2);
gotPolygonPoint = true;
}
if (gotPolygonPoint) { if (gotPolygonPoint) {
Interval newLineInt = checkIntersectionInvervalPoints(pcPolygon, intersectingStraight,
intersectionIntervals, i1, i2);
if (newLineInt != null) {
intersectionIntervals.add(newLineInt);
}
} else {
intersectionIntervals.add(new Interval(i1, i2));
}
}
// it's possible, that 'it' equals 'endIt' at the end of the loop.
// this would lead to an increment of an iterator pointing to the end
// iterator. don't ask me why, but incrementing such an iterator
// is forbidden and you get an assertion.
if (i >= valuesList.size()) {
break;
}
}
}
private static Interval checkIntersectionInvervalPoints(EdgePolygon pcPolygon, GmStraight intersectingStraight, List<Interval> intersectionIntervals, double i1, double i2) {
// maybe an interval // maybe an interval
// check if the point between the two parameters is inside the // check if the point between the two parameters is inside the
// polygon or outside ( i.e. i1 and i2 are both corner points of // polygon or outside ( i.e. i1 and i2 are both corner points of
...@@ -375,34 +405,19 @@ public class IntersectPlanarPolygons { ...@@ -375,34 +405,19 @@ public class IntersectPlanarPolygons {
while (intervalIterator.hasNext() && !intersectionIntervals.isEmpty()) { while (intervalIterator.hasNext() && !intersectionIntervals.isEmpty()) {
for (Interval inter = intervalIterator.next(); intervalIterator for (Interval inter = intervalIterator.next(); intervalIterator
.hasNext(); inter = intervalIterator.next()) { .hasNext(); inter = intervalIterator.next()) {
if (Math.abs(inter.getLength()) < Global.getHighAccuracyTolerance()) { if (Math.abs(inter.getLength()) < Global.getHighAccuracyTolerance() &&
if (Math.abs(inter.getStart() - i1) < 1e-9 (Math.abs(inter.getStart() - i1) < 1e-9 || Math.abs(inter.getStart() - i2) < 1e-9)) {
|| Math.abs(inter.getStart() - i2) < 1e-9) {
intervalIterator.remove(); intervalIterator.remove();
intervalIterator = intersectionIntervals.iterator(); intervalIterator = intersectionIntervals.iterator();
break; break;
} }
}
}
}
intersectionIntervals.add(newLineInt);
} else {
i--;
}
} else {
intersectionIntervals.add(new Interval(i1, i2));
} }
} }
// it's possible, that 'it' equals 'endIt' at the end of the loop. return newLineInt;
// this would lead to an increment of an iterator pointing to the end
// iterator. don't ask me why, but incrementing such an iterator
// is forbidden and you get an assertion.
if (i >= valuesList.size()) {
break;
}
} }
return null;
} }
/** /**
...@@ -444,46 +459,9 @@ public class IntersectPlanarPolygons { ...@@ -444,46 +459,9 @@ public class IntersectPlanarPolygons {
List<HalfEdge> heList = new ArrayList<>(p1.getHalfEdges()); List<HalfEdge> heList = new ArrayList<>(p1.getHalfEdges());
heList.addAll(p2.getHalfEdges()); heList.addAll(p2.getHalfEdges());
List<HalfEdge> heListColinear = new ArrayList<>(); List<HalfEdge> heListCollinear = getCollinearHalfEdgeList(p1, p2, straight, epsilon, angleEpsilon, heList);
for (HalfEdge he : heList) {
if (null != he.getPartner()) { for (HalfEdge he : heListCollinear) {
// this half edge is shared by both polygons ==> no intersection
// NOTE: The issue of more than 2 half edges per edge is solved by
// circular pointer, so we have to cycle threw all partners
HalfEdge pStartHE = he;
HalfEdge pPartnerHE = pStartHE.getPartner();
boolean bothPolysShareThisEdge = false;
while (pStartHE != pPartnerHE && !bothPolysShareThisEdge) {
if (pPartnerHE.getPolygon() == p1 || pPartnerHE.getPolygon() == p2) {
bothPolysShareThisEdge = true;
}
pPartnerHE = pPartnerHE.getPartner();
}
if (bothPolysShareThisEdge) {
continue;
}
}
GmBoundedStraight straightHe = he.getStraight();
Point3d origin = straightHe.getOrigin();
Point3d target = straightHe.getTarget();
boolean straightsAreColinear = IntersectPlanarPolygons.areStraightsColinear(straightHe, straight, epsilon,
angleEpsilon);
ProjectedPoint3d projPoint1 = straight.project(origin);
ProjectedPoint3d projPoint2 = straight.project(target);
boolean originLiesOnIntStraight = projPoint1.getPoint().isAlmostEqual(origin,
PROJECTED_POINT_DISTANCE_EPSILON);
boolean targetLiesOnIntStraight = projPoint2.getPoint().isAlmostEqual(target,
PROJECTED_POINT_DISTANCE_EPSILON);
if (straightsAreColinear && (originLiesOnIntStraight || targetLiesOnIntStraight)) {
heListColinear.add(he);
}
}
for (HalfEdge he : heListColinear) {
// 1.2) determine if fully or partially or not at all embedded // 1.2) determine if fully or partially or not at all embedded
// create parameter interval of the first projected half edge // create parameter interval of the first projected half edge
Point3d startPoint1 = he.getStraight().getOrigin(); Point3d startPoint1 = he.getStraight().getOrigin();
...@@ -491,7 +469,7 @@ public class IntersectPlanarPolygons { ...@@ -491,7 +469,7 @@ public class IntersectPlanarPolygons {
ProjectedPoint3d projP1 = straight.project(startPoint1); ProjectedPoint3d projP1 = straight.project(startPoint1);
ProjectedPoint3d projP2 = straight.project(endPoint1); ProjectedPoint3d projP2 = straight.project(endPoint1);
Interval int1 = new Interval(projP1.getParameter(), projP2.getParameter()); Interval int1 = new Interval(projP1.getParameter(), projP2.getParameter());
for (HalfEdge he2 : heListColinear) { for (HalfEdge he2 : heListCollinear) {
if (he == he2) { if (he == he2) {
continue; continue;
} }
...@@ -528,7 +506,62 @@ public class IntersectPlanarPolygons { ...@@ -528,7 +506,62 @@ public class IntersectPlanarPolygons {
} }
} }
private static boolean areStraightsColinear(GmBoundedStraight straight1, GmStraight straight2, double epsilon, private static List<HalfEdge> getCollinearHalfEdgeList(EdgePolygon p1, EdgePolygon p2, GmStraight straight, double epsilon, double angleEpsilon, List<HalfEdge> heList) {
List<HalfEdge> heListCollinear = new ArrayList<>();
for (HalfEdge he : heList) {
if (isHalfEdgeSharedByPolygons(he, p1, p2)){
// If the HalfEdge is shared, it is not collinear.
// Ignore it and continue with next HalfEdge.
continue;
}
GmBoundedStraight straightHe = he.getStraight();
Point3d origin = straightHe.getOrigin();
Point3d target = straightHe.getTarget();
boolean straightsAreCollinear = IntersectPlanarPolygons.areStraightsCollinear(straightHe, straight, epsilon,
angleEpsilon);
ProjectedPoint3d projPoint1 = straight.project(origin);
ProjectedPoint3d projPoint2 = straight.project(target);
boolean originLiesOnIntStraight = projPoint1.getPoint().isAlmostEqual(origin,
PROJECTED_POINT_DISTANCE_EPSILON);
boolean targetLiesOnIntStraight = projPoint2.getPoint().isAlmostEqual(target,
PROJECTED_POINT_DISTANCE_EPSILON);
if (straightsAreCollinear && (originLiesOnIntStraight || targetLiesOnIntStraight)) {
heListCollinear.add(he);
}
}
return heListCollinear;
}
/**
* Checks whether a specific HalfEdge is shared by two EdgePolygons.
*
*
* @param he The HalfEdge in question
* @param p1 First Polygon
* @param p2 Second Polygon
* @return true if the HalfEdge is shared
*/
private static boolean isHalfEdgeSharedByPolygons(HalfEdge he, EdgePolygon p1, EdgePolygon p2) {
boolean bothPolysShareThisEdge = false;
if (he.getPartner() != null) {
// NOTE: The issue of more than 2 half edges per edge is solved by
// circular pointer, so we have to cycle threw all partners
HalfEdge pPartnerHE = he.getPartner();
while (he != pPartnerHE && !bothPolysShareThisEdge) {
if (pPartnerHE.getPolygon() == p1 || pPartnerHE.getPolygon() == p2) {
bothPolysShareThisEdge = true;
}
pPartnerHE = pPartnerHE.getPartner();
}
}
return bothPolysShareThisEdge;
}
private static boolean areStraightsCollinear(GmBoundedStraight straight1, GmStraight straight2, double epsilon,
double angleEpsilon) { double angleEpsilon) {
UnitVector3d rDir1 = straight1.getDir(); UnitVector3d rDir1 = straight1.getDir();
...@@ -543,11 +576,8 @@ public class IntersectPlanarPolygons { ...@@ -543,11 +576,8 @@ public class IntersectPlanarPolygons {
ProjectedPoint3d foot1 = straight2.project(rOrigin); ProjectedPoint3d foot1 = straight2.project(rOrigin);
Point3d rTarget = straight1.getTarget(); Point3d rTarget = straight1.getTarget();
ProjectedPoint3d foot2 = straight2.project(rTarget); ProjectedPoint3d foot2 = straight2.project(rTarget);
if ((foot1.getPoint().minus(rOrigin)).getLength() > epsilon return !(((foot1.getPoint().minus(rOrigin)).getLength() > epsilon)
|| (foot2.getPoint().minus(rTarget)).getLength() > epsilon) { || ((foot2.getPoint().minus(rTarget)).getLength() > epsilon));
return false;
}
return true;
} }
private static List<PolygonPolygonIntersection> handlePolygonsInSamePlane(GmPlane plane, EdgePolygon p1, private static List<PolygonPolygonIntersection> handlePolygonsInSamePlane(GmPlane plane, EdgePolygon p1,
...@@ -577,14 +607,6 @@ public class IntersectPlanarPolygons { ...@@ -577,14 +607,6 @@ public class IntersectPlanarPolygons {
Polygon2d poly2d1 = new Polygon2dNs(poly2dCoords1, true); Polygon2d poly2d1 = new Polygon2dNs(poly2dCoords1, true);
Polygon2d poly2d2 = new Polygon2dNs(poly2dCoords2, true); Polygon2d poly2d2 = new Polygon2dNs(poly2dCoords2, true);
List<HalfEdge2d> halfEdges = poly2d1.getHalfEdges();
for (HalfEdge2d he : halfEdges) {
if (he.getPartner() == null) {
}
}
halfEdges = poly2d2.getHalfEdges();
List<PolygonPolygonIntersection> result = new ArrayList<>(); List<PolygonPolygonIntersection> result = new ArrayList<>();
List<Polygon2dPolygon2dInt> ppi2ds = IntersectPolygon2d.getIntersections(poly2d1, poly2d2, epsilon); List<Polygon2dPolygon2dInt> ppi2ds = IntersectPolygon2d.getIntersections(poly2d1, poly2d2, epsilon);
for (Polygon2dPolygon2dInt ppi2d : ppi2ds) { for (Polygon2dPolygon2dInt ppi2d : ppi2ds) {
......
...@@ -100,11 +100,11 @@ public class IntersectPolygonAndStraight2d { ...@@ -100,11 +100,11 @@ public class IntersectPolygonAndStraight2d {
assignParameterToCorrectList(params[1], intersectionValues, intersectedPolygonPoints); assignParameterToCorrectList(params[1], intersectionValues, intersectedPolygonPoints);
} }
} else { } else {
if (hEStraight.isWithinBoundaries(res.getParamHE())) { if (hEStraight.isWithinBoundaries(res.paramHE())) {
// Point2d pnt = mIntStraight.evaluate( paramInt ); // Point2d pnt = mIntStraight.evaluate( paramInt );
// cout << "got ( " << pnt.getU() << ", " << pnt.getV() << " ) as int point with // cout << "got ( " << pnt.getU() << ", " << pnt.getV() << " ) as int point with
// param " << paramInt << endl; // param " << paramInt << endl;
assignParameterToCorrectList(res.getParamInt(), intersectionValues, intersectedPolygonPoints); assignParameterToCorrectList(res.paramInt(), intersectionValues, intersectedPolygonPoints);
} }
} }
} }
...@@ -164,11 +164,9 @@ public class IntersectPolygonAndStraight2d { ...@@ -164,11 +164,9 @@ public class IntersectPolygonAndStraight2d {
for (Double d : crIntersectedPolygonPoints) { for (Double d : crIntersectedPolygonPoints) {
boolean pntIsPartOfExistingInterval = false; boolean pntIsPartOfExistingInterval = false;
for (Interval interval : mIntersectionIntervals) { for (Interval interval : mIntersectionIntervals) {
if (pntIsPartOfExistingInterval) {
break;
}
if (interval.getStart() == d || interval.getEnd() == d) { if (interval.getStart() == d || interval.getEnd() == d) {
pntIsPartOfExistingInterval = true; pntIsPartOfExistingInterval = true;
break;
} }
} }
......
...@@ -18,12 +18,13 @@ ...@@ -18,12 +18,13 @@
*/ */
package de.hft.stuttgart.citydoctor2.edge; package de.hft.stuttgart.citydoctor2.edge;
public class Interval { public class Interval {
private static final Interval INVALID_INTERVAL = new Interval(1, 0); private static final Interval INVALID_INTERVAL = new Interval(1, 0);
private double start; private final double start;
private double end; private final double end;
public Interval(double start, double end) { public Interval(double start, double end) {
this.start = start; this.start = start;
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
package de.hft.stuttgart.citydoctor2.edge; package de.hft.stuttgart.citydoctor2.edge;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -28,9 +29,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.Polygon; ...@@ -28,9 +29,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.math.MovedPolygon; import de.hft.stuttgart.citydoctor2.math.MovedPolygon;
import de.hft.stuttgart.citydoctor2.math.Vector3d; import de.hft.stuttgart.citydoctor2.math.Vector3d;
public class MeshSurface { public record MeshSurface(List<CDPolygonNs> polygons) {
private List<CDPolygonNs> polygons;
public static MeshSurface of(Geometry geom) { public static MeshSurface of(Geometry geom) {
List<CDPolygonNs> polygonList = new ArrayList<>(); List<CDPolygonNs> polygonList = new ArrayList<>();
...@@ -45,12 +44,5 @@ public class MeshSurface { ...@@ -45,12 +44,5 @@ public class MeshSurface {
return new MeshSurface(polygonList); return new MeshSurface(polygonList);
} }
public MeshSurface(List<CDPolygonNs> polygons) {
this.polygons = polygons;
}
public List<CDPolygonNs> getPolygons() {
return polygons;
}
} }
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
package de.hft.stuttgart.citydoctor2.edge; package de.hft.stuttgart.citydoctor2.edge;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
...@@ -26,7 +27,7 @@ public class MeshSurfaceUtils { ...@@ -26,7 +27,7 @@ public class MeshSurfaceUtils {
public static List<PolygonPolygonIntersection> selfIntersects(MeshSurface ms, double epsilon, double angleEpsilon) { public static List<PolygonPolygonIntersection> selfIntersects(MeshSurface ms, double epsilon, double angleEpsilon) {
Objects.requireNonNull(ms); Objects.requireNonNull(ms);
List<CDPolygonNs> polygons = ms.getPolygons(); List<CDPolygonNs> polygons = ms.polygons();
List<PolygonPolygonIntersection> intersections = new ArrayList<>(); List<PolygonPolygonIntersection> intersections = new ArrayList<>();
for (int i = 0; i < polygons.size() - 1; i++) { for (int i = 0; i < polygons.size() - 1; i++) {
EdgePolygon p1 = polygons.get(i); EdgePolygon p1 = polygons.get(i);
......
...@@ -20,8 +20,8 @@ package de.hft.stuttgart.citydoctor2.edge; ...@@ -20,8 +20,8 @@ package de.hft.stuttgart.citydoctor2.edge;
public class Point2d { public class Point2d {
private double x; private final double x;
private double y; private final double y;
public Point2d(double x, double y) { public Point2d(double x, double y) {
this.x = x; this.x = x;
......
...@@ -18,11 +18,12 @@ ...@@ -18,11 +18,12 @@
*/ */
package de.hft.stuttgart.citydoctor2.edge; package de.hft.stuttgart.citydoctor2.edge;
public class Point3d { public class Point3d {
private double x; private final double x;
private double y; private final double y;
private double z; private final double z;
public Point3d(double x, double y, double z) { public Point3d(double x, double y, double z) {
this.x = x; this.x = x;
......
...@@ -23,7 +23,7 @@ import java.util.List; ...@@ -23,7 +23,7 @@ import java.util.List;
public class PolyLine2d extends BaseEntity { public class PolyLine2d extends BaseEntity {
private PolyLineSegment2d mpFirst; private final PolyLineSegment2d mpFirst;
private PolyLineSegment2d mpLast; private PolyLineSegment2d mpLast;
public PolyLine2d(PolyLineSegment2d pStart) { public PolyLine2d(PolyLineSegment2d pStart) {
......
...@@ -25,8 +25,8 @@ public class PolyLineSegment extends BaseEntity { ...@@ -25,8 +25,8 @@ public class PolyLineSegment extends BaseEntity {
private static final Logger logger = LogManager.getLogger(PolyLineSegment.class); private static final Logger logger = LogManager.getLogger(PolyLineSegment.class);
private Coordinate3d mpStart; private final Coordinate3d mpStart;
private Coordinate3d mpEnd; private final Coordinate3d mpEnd;
private PolyLineSegment mpNext; private PolyLineSegment mpNext;
......
...@@ -104,16 +104,14 @@ public class Polygon2d extends BaseEntity { ...@@ -104,16 +104,14 @@ public class Polygon2d extends BaseEntity {
point = halfEdge.getStart().getPoint(); point = halfEdge.getStart().getPoint();
lowerU = (point.getX() < lowerU) ? point.getX() : lowerU; lowerU = Math.min(point.getX(), lowerU);
lowerV = (point.getY() < lowerV) ? point.getY() : lowerV; lowerV = Math.min(point.getY(), lowerV);
upperU = (point.getX() > upperU) ? point.getX() : upperU; upperU = Math.max(point.getX(), upperU);
upperV = (point.getY() > upperV) ? point.getY() : upperV; upperV = Math.max(point.getY(), upperV);
} }
Box2d box = new Box2d(new Point2d(lowerU, lowerV), new Point2d(upperU, upperV)); return new Box2d(new Point2d(lowerU, lowerV), new Point2d(upperU, upperV));
return box;
} }
public static void connectHalfEdges(List<HalfEdge2d> rHalfEdges) { public static void connectHalfEdges(List<HalfEdge2d> rHalfEdges) {
......
...@@ -18,12 +18,13 @@ ...@@ -18,12 +18,13 @@
*/ */
package de.hft.stuttgart.citydoctor2.edge; package de.hft.stuttgart.citydoctor2.edge;
public class Polygon2dPolygon2dInt { public class Polygon2dPolygon2dInt {
private Polygon2d mcpPolygon1; private final Polygon2d mcpPolygon1;
private Polygon2d mcpPolygon2; private final Polygon2d mcpPolygon2;
private PolyLine2d line; private final PolyLine2d line;
private IntersectionType intType; private final IntersectionType intType;
public Polygon2dPolygon2dInt(Polygon2d mcpPolygon1, Polygon2d mcpPolygon2, PolyLine2d line, public Polygon2dPolygon2dInt(Polygon2d mcpPolygon1, Polygon2d mcpPolygon2, PolyLine2d line,
IntersectionType intType) { IntersectionType intType) {
......
...@@ -18,12 +18,13 @@ ...@@ -18,12 +18,13 @@
*/ */
package de.hft.stuttgart.citydoctor2.edge; package de.hft.stuttgart.citydoctor2.edge;
public class PolygonPolygonIntersection { public class PolygonPolygonIntersection {
private EdgePolygon p1; private final EdgePolygon p1;
private EdgePolygon p2; private final EdgePolygon p2;
private PolyLine polyLine; private final PolyLine polyLine;
private IntersectionType type; private final IntersectionType type;
public PolygonPolygonIntersection(EdgePolygon p1, EdgePolygon p2, PolyLine polyLine, IntersectionType type) { public PolygonPolygonIntersection(EdgePolygon p1, EdgePolygon p2, PolyLine polyLine, IntersectionType type) {
this.p1 = p1; this.p1 = p1;
......
...@@ -18,10 +18,11 @@ ...@@ -18,10 +18,11 @@
*/ */
package de.hft.stuttgart.citydoctor2.edge; package de.hft.stuttgart.citydoctor2.edge;
public class ProjectedPoint3d { public class ProjectedPoint3d {
private Point3d point; private final Point3d point;
private double parameter; private final double parameter;
public ProjectedPoint3d(Point3d point, double d) { public ProjectedPoint3d(Point3d point, double d) {
this.point = point; this.point = point;
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
package de.hft.stuttgart.citydoctor2.edge; package de.hft.stuttgart.citydoctor2.edge;
public class UnitVector3d extends Vector3d { public class UnitVector3d extends Vector3d {
public static UnitVector3d of(Vector3d vec) { public static UnitVector3d of(Vector3d vec) {
...@@ -37,13 +38,7 @@ public class UnitVector3d extends Vector3d { ...@@ -37,13 +38,7 @@ public class UnitVector3d extends Vector3d {
public double dot(UnitVector3d other) { public double dot(UnitVector3d other) {
double scalar = getX() * other.getX() + getY() * other.getY() + getZ() * other.getZ(); double scalar = getX() * other.getX() + getY() * other.getY() + getZ() * other.getZ();
if (scalar > 1.0) { return (scalar >= 0) ? Math.min(scalar, 1.0) : Math.max(scalar, -1.0);
return 1.0;
}
if (scalar < -1.0) {
return -1.0;
}
return scalar;
} }
......
...@@ -18,16 +18,18 @@ ...@@ -18,16 +18,18 @@
*/ */
package de.hft.stuttgart.citydoctor2.edge; package de.hft.stuttgart.citydoctor2.edge;
public class Vector2d { public class Vector2d {
private double x; private final double x;
private double y; private final double y;
public Vector2d(double x, double y) { public Vector2d(double x, double y) {
this.x = x; this.x = x;
this.y = y; this.y = y;
} }
@SuppressWarnings("SuspiciousNameCombination")
public Vector2d getPerpendicularVector() { public Vector2d getPerpendicularVector() {
return new Vector2d(y, -x); return new Vector2d(y, -x);
} }
......
...@@ -18,11 +18,12 @@ ...@@ -18,11 +18,12 @@
*/ */
package de.hft.stuttgart.citydoctor2.edge; package de.hft.stuttgart.citydoctor2.edge;
import java.util.Arrays; import java.util.Arrays;
public class Vector3d { public class Vector3d {
private double[] val = new double[3]; private final double[] val = new double[3];
public Vector3d(double x, double y, double z) { public Vector3d(double x, double y, double z) {
val[0] = x; val[0] = x;
...@@ -46,9 +47,9 @@ public class Vector3d { ...@@ -46,9 +47,9 @@ public class Vector3d {
val[1] = 0; val[1] = 0;
val[2] = 0; val[2] = 0;
} else { } else {
val[0] = val[0] /= length; val[0] /= length;
val[1] = val[1] /= length; val[1] /= length;
val[2] = val[2] /= length; val[2] /= length;
} }
} }
......
...@@ -103,11 +103,11 @@ public class IntersectionErrorsTest { ...@@ -103,11 +103,11 @@ public class IntersectionErrorsTest {
} }
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, edgePoly2, 0.000001, 0.001); List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, edgePoly2, 0.000001, 0.001);
......
...@@ -77,7 +77,7 @@ public class MeshSurfaceUtilsTest { ...@@ -77,7 +77,7 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v1); ext.addVertex(v1);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = polygons.get(0); CDPolygonNs edgePoly1 = polygons.get(0);
List<Coordinate3d> coordinates = edgePoly1.getCoordinates(); List<Coordinate3d> coordinates = edgePoly1.getCoordinates();
...@@ -147,7 +147,7 @@ public class MeshSurfaceUtilsTest { ...@@ -147,7 +147,7 @@ public class MeshSurfaceUtilsTest {
List<Coordinate3d> coordChildren = firstHalfEdge.getChildren(Coordinate3d.class); List<Coordinate3d> coordChildren = firstHalfEdge.getChildren(Coordinate3d.class);
assertEquals(2, coordChildren.size()); assertEquals(2, coordChildren.size());
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
assertNotNull(intersectPolygons); assertNotNull(intersectPolygons);
...@@ -195,11 +195,11 @@ public class MeshSurfaceUtilsTest { ...@@ -195,11 +195,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6); ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
assertNotNull(intersectPolygons); assertNotNull(intersectPolygons);
...@@ -248,11 +248,11 @@ public class MeshSurfaceUtilsTest { ...@@ -248,11 +248,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6); ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -311,11 +311,11 @@ public class MeshSurfaceUtilsTest { ...@@ -311,11 +311,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v2); ext.addVertex(v2);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -375,11 +375,11 @@ public class MeshSurfaceUtilsTest { ...@@ -375,11 +375,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6); ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -429,11 +429,11 @@ public class MeshSurfaceUtilsTest { ...@@ -429,11 +429,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6); ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -482,11 +482,11 @@ public class MeshSurfaceUtilsTest { ...@@ -482,11 +482,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6); ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
DebugUtils.printGeoknechtPolygon(edgePoly1, edgePoly2); DebugUtils.printGeoknechtPolygon(edgePoly1, edgePoly2);
...@@ -543,11 +543,11 @@ public class MeshSurfaceUtilsTest { ...@@ -543,11 +543,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6); ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -596,11 +596,11 @@ public class MeshSurfaceUtilsTest { ...@@ -596,11 +596,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v4); ext.addVertex(v4);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
DebugUtils.printGeoknechtPolygon(edgePoly1, edgePoly2); DebugUtils.printGeoknechtPolygon(edgePoly1, edgePoly2);
...@@ -652,11 +652,11 @@ public class MeshSurfaceUtilsTest { ...@@ -652,11 +652,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6); ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -706,11 +706,11 @@ public class MeshSurfaceUtilsTest { ...@@ -706,11 +706,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6); ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -760,11 +760,11 @@ public class MeshSurfaceUtilsTest { ...@@ -760,11 +760,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6); ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -810,11 +810,11 @@ public class MeshSurfaceUtilsTest { ...@@ -810,11 +810,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6); ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -866,11 +866,11 @@ public class MeshSurfaceUtilsTest { ...@@ -866,11 +866,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6); ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -922,11 +922,11 @@ public class MeshSurfaceUtilsTest { ...@@ -922,11 +922,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6); ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -978,11 +978,11 @@ public class MeshSurfaceUtilsTest { ...@@ -978,11 +978,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6); ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -1049,11 +1049,11 @@ public class MeshSurfaceUtilsTest { ...@@ -1049,11 +1049,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v5); ext.addVertex(v5);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -1110,11 +1110,11 @@ public class MeshSurfaceUtilsTest { ...@@ -1110,11 +1110,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v11); ext.addVertex(v11);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -1173,11 +1173,11 @@ public class MeshSurfaceUtilsTest { ...@@ -1173,11 +1173,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v11); ext.addVertex(v11);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -1238,11 +1238,11 @@ public class MeshSurfaceUtilsTest { ...@@ -1238,11 +1238,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v5); ext.addVertex(v5);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>de.hft.stuttgart</groupId> <groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId> <artifactId>CityDoctorParent</artifactId>
......
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