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;
public class HalfEdge2d extends BaseEntity {
private Coordinate2d start;
private Coordinate2d end;
private final Coordinate2d start;
private final Coordinate2d end;
private HalfEdge2d partner;
......@@ -71,7 +71,7 @@ public class HalfEdge2d extends BaseEntity {
return pPartner;
}
private HalfEdge2d setPartner(HalfEdge2d pPartner) {
private void setPartner(HalfEdge2d pPartner) {
if (partner != null) {
if (pPartner != null) {
throw new IllegalStateException("cannot overwrite existing partner-connection");
......@@ -92,7 +92,6 @@ public class HalfEdge2d extends BaseEntity {
}
}
}
return pPartner;
}
public HalfEdge2d getPartner() {
......
......@@ -82,20 +82,7 @@ public class IntersectPlanarPolygons {
for (Interval in2 : intervals2) {
if (in1.isOverlapping(in2)) {
Interval overlap = in1.overlap(in2);
Point3d start = straight.evaluate(overlap.getStart());
if (overlap.getLength() < Global.getHighAccuracyTolerance() * 1e6) {
checkAndAddRealIntersectionPoint(cpPolygon1, cpPolygon2, start, intersections, epsilon);
} else {
Point3d end = straight.evaluate(overlap.getEnd());
PolyLine pPL = new PolyLine(new Coordinate3d(start), new Coordinate3d(end));
if (!isPolyLineASharedEdge(cpPolygon1, pPL)) {
PolygonPolygonIntersection pPPI = new PolygonPolygonIntersection(cpPolygon1, cpPolygon2,
pPL);
intersections.add(pPPI);
}
}
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());
......@@ -108,6 +95,25 @@ public class IntersectPlanarPolygons {
}
}
private static void handleIntersectionIntervalOverlap(EdgePolygon cpPolygon1, EdgePolygon cpPolygon2,
GmStraight straight, List<PolygonPolygonIntersection> intersections, double epsilon, Interval overlap) {
Point3d start = straight.evaluate(overlap.getStart());
if (overlap.getLength() < Global.getHighAccuracyTolerance() * 1e6) {
checkAndAddRealIntersectionPoint(cpPolygon1, cpPolygon2, start, intersections, epsilon);
} else {
Point3d end = straight.evaluate(overlap.getEnd());
PolyLine pPL = new PolyLine(new Coordinate3d(start), new Coordinate3d(end));
if (!isPolyLineASharedEdge(cpPolygon1, pPL)) {
PolygonPolygonIntersection pPPI = new PolygonPolygonIntersection(cpPolygon1, cpPolygon2,
pPL);
intersections.add(pPPI);
}
}
}
private static boolean isPolyLineASharedEdge(EdgePolygon p1, PolyLine polyLine) {
// get coordinates of the poly line
Point3d polyLineStart = polyLine.getStart().getPoint();
......@@ -136,10 +142,12 @@ public class IntersectPlanarPolygons {
/**
*
* Checks if the given point is a "real" intersection point and add's it to the
* intersection segments member variable. Real means, that this point isn't
* shared by both polygons as corner point.
*
* Checks if the given point is a 'real' intersection point and adds it to the
* intersection segments member variable. 'Real' meaning, that this point isn't
* a shared corner point of both polygons.
*
* @param p1 First polygon
* @param p2 Second polygon
* @param point A possible intersection point
*/
private static void checkAndAddRealIntersectionPoint(EdgePolygon p1, EdgePolygon p2, Point3d point,
......@@ -200,7 +208,6 @@ public class IntersectPlanarPolygons {
* 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
* intersection will be reduced to a 2d problem.
*
* The intersection intervals contains pairs of parameters from the intersection
* straight. If an intersection between the straight and the polygon contains
* only a point, the according interval will contain the same parameter twice
......@@ -239,7 +246,7 @@ public class IntersectPlanarPolygons {
GmBoundedStraight heStraight = e.getStraight();
// Straights are colinear; checked in the handleEmdeddedEdges method
if (heStraight.isColinear(intersectingStraight, angleEpsilon, epsilon)) {
if (heStraight.isCollinear(intersectingStraight, angleEpsilon, epsilon)) {
continue;
}
......@@ -256,7 +263,7 @@ public class IntersectPlanarPolygons {
// check if the straight of the HalfEdge is collinear to the intersection
// straight; this might result in an embedded edge intersection result
// 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;
}
......@@ -271,39 +278,7 @@ public class IntersectPlanarPolygons {
GmBoundedStraight2d heStraight2d = polyPlane.projectOn2dStraight(heStraight);
GmStraight2dIntersectionResult intersectionResult = heStraight2d.intersect(intersectingStraight2d);
if (intersectionResult.areParallel()) {
Vector2d dir = intersectingStraight2d.getDirection();
Vector2d diffVec = heStraight2d.getOrigin().minus(intersectingStraight2d.getOrigin());
double diffVecDotPerpDir = diffVec.dot(dir.getPerpendicularVector());
if (Math.abs(diffVecDotPerpDir) < Global.getZeroAngleCosinus()) {
// Straights are identical
Point2d p1 = heStraight2d.getOrigin();
Point2d p2 = heStraight2d.getTarget();
Point2d orig = intersectingStraight2d.getOrigin();
double[] params = new double[2];
if (Math.abs(dir.getX()) > Global.getHighAccuracyTolerance()) {
params[0] = (p1.getX() - orig.getX()) / dir.getX();
params[1] = (p2.getX() - orig.getX()) / dir.getX();
} else if (Math.abs(dir.getY()) > Global.getHighAccuracyTolerance()) {
params[0] = (p1.getY() - orig.getY()) / dir.getY();
params[1] = (p2.getY() - orig.getY()) / dir.getY();
} else {
throw new IllegalStateException(
"Directional vector of identical straights is equal to the zero vector " + dir);
}
assignParameterToCorrectList(params[0], intersectionValues, intersectedPolygonPoints);
assignParameterToCorrectList(params[1], intersectionValues, intersectedPolygonPoints);
}
} else {
if (heStraight2d.isWithinBoundaries(intersectionResult.getParamHE(), 1e-9)) {
assignParameterToCorrectList(intersectionResult.getParamInt(), intersectionValues,
intersectedPolygonPoints);
}
}
analyseProjectedIntersection(intersectionResult, intersectingStraight2d, heStraight2d, intersectionValues, intersectedPolygonPoints);
}
processIntersectionIntervals(p, intersectingStraight, intersectionValues, intersectedPolygonPoints,
......@@ -312,6 +287,42 @@ public class IntersectPlanarPolygons {
}
private static void analyseProjectedIntersection(GmStraight2dIntersectionResult intersectionResult, GmStraight2d intersectingStraight2d, GmBoundedStraight2d heStraight2d, TreeSet<Double> intersectionValues, TreeSet<Double> intersectedPolygonPoints) {
if (intersectionResult.areParallel()) {
Vector2d dir = intersectingStraight2d.getDirection();
Vector2d diffVec = heStraight2d.getOrigin().minus(intersectingStraight2d.getOrigin());
double diffVecDotPerpDir = diffVec.dot(dir.getPerpendicularVector());
if (Math.abs(diffVecDotPerpDir) < Global.getZeroAngleCosine()) {
// Straights are identical
Point2d p1 = heStraight2d.getOrigin();
Point2d p2 = heStraight2d.getTarget();
Point2d orig = intersectingStraight2d.getOrigin();
double[] params = new double[2];
if (Math.abs(dir.getX()) > Global.getHighAccuracyTolerance()) {
params[0] = (p1.getX() - orig.getX()) / dir.getX();
params[1] = (p2.getX() - orig.getX()) / dir.getX();
} else if (Math.abs(dir.getY()) > Global.getHighAccuracyTolerance()) {
params[0] = (p1.getY() - orig.getY()) / dir.getY();
params[1] = (p2.getY() - orig.getY()) / dir.getY();
} else {
throw new IllegalStateException(
"Directional vector of identical straights is equal to the zero vector " + dir);
}
assignParameterToCorrectList(params[0], intersectionValues, intersectedPolygonPoints);
assignParameterToCorrectList(params[1], intersectionValues, intersectedPolygonPoints);
}
} else {
if (heStraight2d.isWithinBoundaries(intersectionResult.paramHE(), 1e-9)) {
assignParameterToCorrectList(intersectionResult.paramInt(), intersectionValues,
intersectedPolygonPoints);
}
}
}
/**
* This methods computes the intervals of the intersection between the given
* straight and polygon. It gets only parameters where the straight hits the
......@@ -350,45 +361,18 @@ public class IntersectPlanarPolygons {
List<Double> valuesList = new ArrayList<>(intersectionValues);
for (int i = 0; i < valuesList.size(); i++) {
double i1 = valuesList.get(i);
i = i + 1;
if (i < valuesList.size()) {
double i2 = valuesList.get(i);
int j = i + 1;
if (j < valuesList.size()) {
double i2 = valuesList.get(j);
// check if the double values are corner points of the polygon
boolean gotPolygonPoint = false;
if (intersectedPolygonPoints.contains(i1) || intersectedPolygonPoints.contains(i2)) {
gotPolygonPoint = true;
}
if (gotPolygonPoint) {
// maybe an interval
// check if the point between the two parameters is inside the
// polygon or outside ( i.e. i1 and i2 are both corner points of
// a concave polygon, so the connection line don't need to lie
// inside the polygon )
Point3d pnt = intersectingStraight.evaluate((i1 + i2) / 2);
if (pcPolygon.isPointInsidePolygon(pnt, 1e-9)) {
Interval newLineInt = new Interval(i1, i2);
// there is already at least one point interval present. We need
// to remove this first, otherwise we would get a normal interval
// and one or two point intervals at the end of the normal int.
Iterator<Interval> intervalIterator = intersectionIntervals.iterator();
while (intervalIterator.hasNext() && !intersectionIntervals.isEmpty()) {
for (Interval inter = intervalIterator.next(); intervalIterator
.hasNext(); inter = intervalIterator.next()) {
if (Math.abs(inter.getLength()) < Global.getHighAccuracyTolerance()) {
if (Math.abs(inter.getStart() - i1) < 1e-9
|| Math.abs(inter.getStart() - i2) < 1e-9) {
intervalIterator.remove();
intervalIterator = intersectionIntervals.iterator();
break;
}
}
}
}
boolean gotPolygonPoint = intersectedPolygonPoints.contains(i1) ||
intersectedPolygonPoints.contains(i2);
if (gotPolygonPoint) {
Interval newLineInt = checkIntersectionInvervalPoints(pcPolygon, intersectingStraight,
intersectionIntervals, i1, i2);
if (newLineInt != null) {
intersectionIntervals.add(newLineInt);
} else {
i--;
}
} else {
intersectionIntervals.add(new Interval(i1, i2));
......@@ -405,6 +389,37 @@ public class IntersectPlanarPolygons {
}
}
private static Interval checkIntersectionInvervalPoints(EdgePolygon pcPolygon, GmStraight intersectingStraight, List<Interval> intersectionIntervals, double i1, double i2) {
// maybe an interval
// check if the point between the two parameters is inside the
// polygon or outside ( i.e. i1 and i2 are both corner points of
// a concave polygon, so the connection line don't need to lie
// inside the polygon )
Point3d pnt = intersectingStraight.evaluate((i1 + i2) / 2);
if (pcPolygon.isPointInsidePolygon(pnt, 1e-9)) {
Interval newLineInt = new Interval(i1, i2);
// there is already at least one point interval present. We need
// to remove this first, otherwise we would get a normal interval
// and one or two point intervals at the end of the normal int.
Iterator<Interval> intervalIterator = intersectionIntervals.iterator();
while (intervalIterator.hasNext() && !intersectionIntervals.isEmpty()) {
for (Interval inter = intervalIterator.next(); intervalIterator
.hasNext(); inter = intervalIterator.next()) {
if (Math.abs(inter.getLength()) < Global.getHighAccuracyTolerance() &&
(Math.abs(inter.getStart() - i1) < 1e-9 || Math.abs(inter.getStart() - i2) < 1e-9)) {
intervalIterator.remove();
intervalIterator = intersectionIntervals.iterator();
break;
}
}
}
return newLineInt;
}
return null;
}
/**
* Util method. Checks if the given parameter has already been inserted as
* intersection parameter. If this is true, the parameter will be added as
......@@ -444,46 +459,9 @@ public class IntersectPlanarPolygons {
List<HalfEdge> heList = new ArrayList<>(p1.getHalfEdges());
heList.addAll(p2.getHalfEdges());
List<HalfEdge> heListColinear = new ArrayList<>();
for (HalfEdge he : heList) {
if (null != he.getPartner()) {
// 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);
}
}
List<HalfEdge> heListCollinear = getCollinearHalfEdgeList(p1, p2, straight, epsilon, angleEpsilon, heList);
for (HalfEdge he : heListColinear) {
for (HalfEdge he : heListCollinear) {
// 1.2) determine if fully or partially or not at all embedded
// create parameter interval of the first projected half edge
Point3d startPoint1 = he.getStraight().getOrigin();
......@@ -491,7 +469,7 @@ public class IntersectPlanarPolygons {
ProjectedPoint3d projP1 = straight.project(startPoint1);
ProjectedPoint3d projP2 = straight.project(endPoint1);
Interval int1 = new Interval(projP1.getParameter(), projP2.getParameter());
for (HalfEdge he2 : heListColinear) {
for (HalfEdge he2 : heListCollinear) {
if (he == he2) {
continue;
}
......@@ -528,8 +506,63 @@ public class IntersectPlanarPolygons {
}
}
private static boolean areStraightsColinear(GmBoundedStraight straight1, GmStraight straight2, double epsilon,
double angleEpsilon) {
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) {
UnitVector3d rDir1 = straight1.getDir();
UnitVector3d rDir2 = straight2.getDir();
......@@ -543,12 +576,9 @@ public class IntersectPlanarPolygons {
ProjectedPoint3d foot1 = straight2.project(rOrigin);
Point3d rTarget = straight1.getTarget();
ProjectedPoint3d foot2 = straight2.project(rTarget);
if ((foot1.getPoint().minus(rOrigin)).getLength() > epsilon
|| (foot2.getPoint().minus(rTarget)).getLength() > epsilon) {
return false;
}
return true;
}
return !(((foot1.getPoint().minus(rOrigin)).getLength() > epsilon)
|| ((foot2.getPoint().minus(rTarget)).getLength() > epsilon));
}
private static List<PolygonPolygonIntersection> handlePolygonsInSamePlane(GmPlane plane, EdgePolygon p1,
EdgePolygon p2, double epsilon) {
......@@ -576,15 +606,7 @@ public class IntersectPlanarPolygons {
Polygon2d poly2d1 = new Polygon2dNs(poly2dCoords1, 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<Polygon2dPolygon2dInt> ppi2ds = IntersectPolygon2d.getIntersections(poly2d1, poly2d2, epsilon);
for (Polygon2dPolygon2dInt ppi2d : ppi2ds) {
......
......@@ -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);
}
}
}
......@@ -164,12 +164,10 @@ public class IntersectPolygonAndStraight2d {
for (Double d : crIntersectedPolygonPoints) {
boolean pntIsPartOfExistingInterval = false;
for (Interval interval : mIntersectionIntervals) {
if (pntIsPartOfExistingInterval) {
break;
}
if (interval.getStart() == d || interval.getEnd() == d) {
pntIsPartOfExistingInterval = true;
}
if (interval.getStart() == d || interval.getEnd() == d) {
pntIsPartOfExistingInterval = true;
break;
}
}
// the current value is not part of an existing interval, so insert it
......
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.edge;
public class Interval {
private static final Interval INVALID_INTERVAL = new Interval(1, 0);
private double start;
private double end;
public Interval(double start, double end) {
this.start = start;
this.end = end;
}
public Interval overlap(Interval other) {
if (isValid() && other.isValid() && isOverlapping(other)) {
return new Interval(Math.max(start, other.start), Math.min(end, other.end));
}
return INVALID_INTERVAL;
}
public boolean isOverlapping(Interval other) {
return !(end < other.start || other.end < start);
}
public boolean isValid() {
return end >= start;
}
public double getLength() {
return end - start;
}
public double getStart() {
return start;
}
public double getEnd() {
return end;
}
@Override
public String toString() {
return "Interval [start=" + start + ", end=" + end + "]";
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.edge;
public class Interval {
private static final Interval INVALID_INTERVAL = new Interval(1, 0);
private final double start;
private final double end;
public Interval(double start, double end) {
this.start = start;
this.end = end;
}
public Interval overlap(Interval other) {
if (isValid() && other.isValid() && isOverlapping(other)) {
return new Interval(Math.max(start, other.start), Math.min(end, other.end));
}
return INVALID_INTERVAL;
}
public boolean isOverlapping(Interval other) {
return !(end < other.start || other.end < start);
}
public boolean isValid() {
return end >= start;
}
public double getLength() {
return end - start;
}
public double getStart() {
return start;
}
public double getEnd() {
return end;
}
@Override
public String toString() {
return "Interval [start=" + start + ", end=" + end + "]";
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.edge;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.math.MovedPolygon;
import de.hft.stuttgart.citydoctor2.math.Vector3d;
public class MeshSurface {
private List<CDPolygonNs> polygons;
public static MeshSurface of(Geometry geom) {
List<CDPolygonNs> polygonList = new ArrayList<>();
Map<Vector3d, Coordinate3d> pointMap = new HashMap<>();
Vector3d moveBy = geom.calculateBoundingBox().getBox()[0];
for (Polygon p : geom.getPolygons()) {
MovedPolygon mp = MovedPolygon.ofPolygon(p, moveBy);
CDPolygonNs poly = CDPolygonNs.of(mp, pointMap);
polygonList.add(poly);
}
return new MeshSurface(polygonList);
}
public MeshSurface(List<CDPolygonNs> polygons) {
this.polygons = polygons;
}
public List<CDPolygonNs> getPolygons() {
return polygons;
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.edge;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.math.MovedPolygon;
import de.hft.stuttgart.citydoctor2.math.Vector3d;
public record MeshSurface(List<CDPolygonNs> polygons) {
public static MeshSurface of(Geometry geom) {
List<CDPolygonNs> polygonList = new ArrayList<>();
Map<Vector3d, Coordinate3d> pointMap = new HashMap<>();
Vector3d moveBy = geom.calculateBoundingBox().getBox()[0];
for (Polygon p : geom.getPolygons()) {
MovedPolygon mp = MovedPolygon.ofPolygon(p, moveBy);
CDPolygonNs poly = CDPolygonNs.of(mp, pointMap);
polygonList.add(poly);
}
return new MeshSurface(polygonList);
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.edge;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class MeshSurfaceUtils {
public static List<PolygonPolygonIntersection> selfIntersects(MeshSurface ms, double epsilon, double angleEpsilon) {
Objects.requireNonNull(ms);
List<CDPolygonNs> polygons = ms.getPolygons();
List<PolygonPolygonIntersection> intersections = new ArrayList<>();
for (int i = 0; i < polygons.size() - 1; i++) {
EdgePolygon p1 = polygons.get(i);
for (int j = i + 1; j < polygons.size(); j++) {
EdgePolygon p2 = polygons.get(j);
List<PolygonPolygonIntersection> result = IntersectPlanarPolygons.intersectPolygons(p1, p2, epsilon, angleEpsilon);
intersections.addAll(result);
}
}
return intersections;
}
private MeshSurfaceUtils() {
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.edge;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class MeshSurfaceUtils {
public static List<PolygonPolygonIntersection> selfIntersects(MeshSurface ms, double epsilon, double angleEpsilon) {
Objects.requireNonNull(ms);
List<CDPolygonNs> polygons = ms.polygons();
List<PolygonPolygonIntersection> intersections = new ArrayList<>();
for (int i = 0; i < polygons.size() - 1; i++) {
EdgePolygon p1 = polygons.get(i);
for (int j = i + 1; j < polygons.size(); j++) {
EdgePolygon p2 = polygons.get(j);
List<PolygonPolygonIntersection> result = IntersectPlanarPolygons.intersectPolygons(p1, p2, epsilon, angleEpsilon);
intersections.addAll(result);
}
}
return intersections;
}
private MeshSurfaceUtils() {
}
}
......@@ -20,8 +20,8 @@ package de.hft.stuttgart.citydoctor2.edge;
public class Point2d {
private double x;
private double y;
private final double x;
private final double y;
public Point2d(double x, double y) {
this.x = x;
......
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.edge;
public class Point3d {
private double x;
private double y;
private double z;
public Point3d(double x, double y, double z) {
this.x = x;
this.y = y;
this.z = z;
}
public Point3d(double[] values) {
this(values[0], values[1], values[2]);
}
public Point3d(Point3d p) {
this(p.getX(), p.getY(), p.getZ());
}
public boolean isAlmostEqual(Point3d origin, double eps) {
Vector3d vec = minus(origin);
double localEps = eps * eps;
if (localEps < Global.getHighAccuracyTolerance()) {
localEps = Global.getHighAccuracyTolerance();
}
return vec.getLength2() < localEps;
}
public Vector3d minus(Point3d org) {
return new Vector3d(x - org.getX(), y - org.getY(), z - org.getZ());
}
public Point3d plus(Vector3d v) {
return new Point3d(x + v.getX(), y + v.getY(), z + v.getZ());
}
public double getX() {
return x;
}
public double getY() {
return y;
}
public double getZ() {
return z;
}
public Point3d plus(Point3d point) {
return new Point3d(x + point.getX(), y + point.getY(), z + point.getZ());
}
public Point3d div(double d) {
return new Point3d(x / d, y /d, z / d);
}
@Override
public String toString() {
return "Point3d [x=" + x + ", y=" + y + ", z=" + z + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
long temp;
temp = Double.doubleToLongBits(x);
result = prime * result + (int) (temp ^ (temp >>> 32));
temp = Double.doubleToLongBits(y);
result = prime * result + (int) (temp ^ (temp >>> 32));
temp = Double.doubleToLongBits(z);
result = prime * result + (int) (temp ^ (temp >>> 32));
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Point3d other = (Point3d) obj;
if (Double.doubleToLongBits(x) != Double.doubleToLongBits(other.x))
return false;
if (Double.doubleToLongBits(y) != Double.doubleToLongBits(other.y))
return false;
if (Double.doubleToLongBits(z) != Double.doubleToLongBits(other.z))
return false;
return true;
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.edge;
public class Point3d {
private final double x;
private final double y;
private final double z;
public Point3d(double x, double y, double z) {
this.x = x;
this.y = y;
this.z = z;
}
public Point3d(double[] values) {
this(values[0], values[1], values[2]);
}
public Point3d(Point3d p) {
this(p.getX(), p.getY(), p.getZ());
}
public boolean isAlmostEqual(Point3d origin, double eps) {
Vector3d vec = minus(origin);
double localEps = eps * eps;
if (localEps < Global.getHighAccuracyTolerance()) {
localEps = Global.getHighAccuracyTolerance();
}
return vec.getLength2() < localEps;
}
public Vector3d minus(Point3d org) {
return new Vector3d(x - org.getX(), y - org.getY(), z - org.getZ());
}
public Point3d plus(Vector3d v) {
return new Point3d(x + v.getX(), y + v.getY(), z + v.getZ());
}
public double getX() {
return x;
}
public double getY() {
return y;
}
public double getZ() {
return z;
}
public Point3d plus(Point3d point) {
return new Point3d(x + point.getX(), y + point.getY(), z + point.getZ());
}
public Point3d div(double d) {
return new Point3d(x / d, y /d, z / d);
}
@Override
public String toString() {
return "Point3d [x=" + x + ", y=" + y + ", z=" + z + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
long temp;
temp = Double.doubleToLongBits(x);
result = prime * result + (int) (temp ^ (temp >>> 32));
temp = Double.doubleToLongBits(y);
result = prime * result + (int) (temp ^ (temp >>> 32));
temp = Double.doubleToLongBits(z);
result = prime * result + (int) (temp ^ (temp >>> 32));
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Point3d other = (Point3d) obj;
if (Double.doubleToLongBits(x) != Double.doubleToLongBits(other.x))
return false;
if (Double.doubleToLongBits(y) != Double.doubleToLongBits(other.y))
return false;
if (Double.doubleToLongBits(z) != Double.doubleToLongBits(other.z))
return false;
return true;
}
}
......@@ -23,7 +23,7 @@ import java.util.List;
public class PolyLine2d extends BaseEntity {
private PolyLineSegment2d mpFirst;
private final PolyLineSegment2d mpFirst;
private PolyLineSegment2d mpLast;
public PolyLine2d(PolyLineSegment2d pStart) {
......
......@@ -25,8 +25,8 @@ public class PolyLineSegment extends BaseEntity {
private static final Logger logger = LogManager.getLogger(PolyLineSegment.class);
private Coordinate3d mpStart;
private Coordinate3d mpEnd;
private final Coordinate3d mpStart;
private final Coordinate3d mpEnd;
private PolyLineSegment mpNext;
......
......@@ -104,16 +104,14 @@ public class Polygon2d extends BaseEntity {
point = halfEdge.getStart().getPoint();
lowerU = (point.getX() < lowerU) ? point.getX() : lowerU;
lowerV = (point.getY() < lowerV) ? point.getY() : lowerV;
lowerU = Math.min(point.getX(), lowerU);
lowerV = Math.min(point.getY(), lowerV);
upperU = (point.getX() > upperU) ? point.getX() : upperU;
upperV = (point.getY() > upperV) ? point.getY() : upperV;
upperU = Math.max(point.getX(), upperU);
upperV = Math.max(point.getY(), upperV);
}
Box2d box = new Box2d(new Point2d(lowerU, lowerV), new Point2d(upperU, upperV));
return box;
return new Box2d(new Point2d(lowerU, lowerV), new Point2d(upperU, upperV));
}
public static void connectHalfEdges(List<HalfEdge2d> rHalfEdges) {
......
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.edge;
public class Polygon2dPolygon2dInt {
private Polygon2d mcpPolygon1;
private Polygon2d mcpPolygon2;
private PolyLine2d line;
private IntersectionType intType;
public Polygon2dPolygon2dInt(Polygon2d mcpPolygon1, Polygon2d mcpPolygon2, PolyLine2d line,
IntersectionType intType) {
this.mcpPolygon1 = mcpPolygon1;
this.mcpPolygon2 = mcpPolygon2;
this.line = line;
this.intType = intType;
}
public PolyLine2d getPolyLine2d() {
return line;
}
public IntersectionType getIntType() {
return intType;
}
public Polygon2d getPolygon1() {
return mcpPolygon1;
}
public Polygon2d getPolygon2() {
return mcpPolygon2;
}
@Override
public String toString() {
return "Polygon2dPolygon2dInt [mcpPolygon1=" + mcpPolygon1 + ", mcpPolygon2=" + mcpPolygon2 + ", line=" + line
+ ", intType=" + intType + "]";
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.edge;
public class Polygon2dPolygon2dInt {
private final Polygon2d mcpPolygon1;
private final Polygon2d mcpPolygon2;
private final PolyLine2d line;
private final IntersectionType intType;
public Polygon2dPolygon2dInt(Polygon2d mcpPolygon1, Polygon2d mcpPolygon2, PolyLine2d line,
IntersectionType intType) {
this.mcpPolygon1 = mcpPolygon1;
this.mcpPolygon2 = mcpPolygon2;
this.line = line;
this.intType = intType;
}
public PolyLine2d getPolyLine2d() {
return line;
}
public IntersectionType getIntType() {
return intType;
}
public Polygon2d getPolygon1() {
return mcpPolygon1;
}
public Polygon2d getPolygon2() {
return mcpPolygon2;
}
@Override
public String toString() {
return "Polygon2dPolygon2dInt [mcpPolygon1=" + mcpPolygon1 + ", mcpPolygon2=" + mcpPolygon2 + ", line=" + line
+ ", intType=" + intType + "]";
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.edge;
public class PolygonPolygonIntersection {
private EdgePolygon p1;
private EdgePolygon p2;
private PolyLine polyLine;
private IntersectionType type;
public PolygonPolygonIntersection(EdgePolygon p1, EdgePolygon p2, PolyLine polyLine, IntersectionType type) {
this.p1 = p1;
this.p2 = p2;
this.polyLine = polyLine;
this.type = type;
}
public PolygonPolygonIntersection(EdgePolygon p1, EdgePolygon p2, PolyLine polyLine) {
this(p1, p2, polyLine, IntersectionType.NORMAL_INTERSECTION);
}
public PolyLine getPolyLine() {
return polyLine;
}
public IntersectionType getIntersectionType() {
return type;
}
public EdgePolygon getPolygon1() {
return p1;
}
public EdgePolygon getPolygon2() {
return p2;
}
@Override
public String toString() {
return "PolygonPolygonIntersection [p1=" + p1 + ", p2=" + p2 + ", polyLine=" + polyLine + ", type=" + type
+ "]";
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.edge;
public class PolygonPolygonIntersection {
private final EdgePolygon p1;
private final EdgePolygon p2;
private final PolyLine polyLine;
private final IntersectionType type;
public PolygonPolygonIntersection(EdgePolygon p1, EdgePolygon p2, PolyLine polyLine, IntersectionType type) {
this.p1 = p1;
this.p2 = p2;
this.polyLine = polyLine;
this.type = type;
}
public PolygonPolygonIntersection(EdgePolygon p1, EdgePolygon p2, PolyLine polyLine) {
this(p1, p2, polyLine, IntersectionType.NORMAL_INTERSECTION);
}
public PolyLine getPolyLine() {
return polyLine;
}
public IntersectionType getIntersectionType() {
return type;
}
public EdgePolygon getPolygon1() {
return p1;
}
public EdgePolygon getPolygon2() {
return p2;
}
@Override
public String toString() {
return "PolygonPolygonIntersection [p1=" + p1 + ", p2=" + p2 + ", polyLine=" + polyLine + ", type=" + type
+ "]";
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.edge;
public class ProjectedPoint3d {
private Point3d point;
private double parameter;
public ProjectedPoint3d(Point3d point, double d) {
this.point = point;
this.parameter = d;
}
public Point3d getPoint() {
return point;
}
public double getParameter() {
return parameter;
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.edge;
public class ProjectedPoint3d {
private final Point3d point;
private final double parameter;
public ProjectedPoint3d(Point3d point, double d) {
this.point = point;
this.parameter = d;
}
public Point3d getPoint() {
return point;
}
public double getParameter() {
return parameter;
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.edge;
public class UnitVector3d extends Vector3d {
public static UnitVector3d of(Vector3d vec) {
UnitVector3d unitVec = new UnitVector3d(vec.getX(), vec.getY(), vec.getZ());
unitVec.normalize();
return unitVec;
}
public static UnitVector3d of(double x, double y, double z) {
double length = Math.sqrt(x * x + y * y + z * z);
return new UnitVector3d(x / length, y / length, z / length);
}
private UnitVector3d(double x, double y, double z) {
super(x, y, z);
}
public double dot(UnitVector3d other) {
double scalar = getX() * other.getX() + getY() * other.getY() + getZ() * other.getZ();
if (scalar > 1.0) {
return 1.0;
}
if (scalar < -1.0) {
return -1.0;
}
return scalar;
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.edge;
public class UnitVector3d extends Vector3d {
public static UnitVector3d of(Vector3d vec) {
UnitVector3d unitVec = new UnitVector3d(vec.getX(), vec.getY(), vec.getZ());
unitVec.normalize();
return unitVec;
}
public static UnitVector3d of(double x, double y, double z) {
double length = Math.sqrt(x * x + y * y + z * z);
return new UnitVector3d(x / length, y / length, z / length);
}
private UnitVector3d(double x, double y, double z) {
super(x, y, z);
}
public double dot(UnitVector3d other) {
double scalar = getX() * other.getX() + getY() * other.getY() + getZ() * other.getZ();
return (scalar >= 0) ? Math.min(scalar, 1.0) : Math.max(scalar, -1.0);
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.edge;
public class Vector2d {
private double x;
private double y;
public Vector2d(double x, double y) {
this.x = x;
this.y = y;
}
public Vector2d getPerpendicularVector() {
return new Vector2d(y, -x);
}
public double dot(Vector2d other) {
return (getX() * other.getX() + getY() * other.getY());
}
public Vector2d mult(double scalar) {
return new Vector2d(x * scalar, y * scalar);
}
public double getX() {
return x;
}
public double getY() {
return y;
}
public UnitVector2d normalize() {
return UnitVector2d.convertFrom(this);
}
public double getLength() {
return Math.sqrt(getLength2());
}
public double getLength2() {
return x * x + y * y;
}
@Override
public String toString() {
return "Vector2d [x=" + x + ", y=" + y + "]";
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.edge;
public class Vector2d {
private final double x;
private final double y;
public Vector2d(double x, double y) {
this.x = x;
this.y = y;
}
@SuppressWarnings("SuspiciousNameCombination")
public Vector2d getPerpendicularVector() {
return new Vector2d(y, -x);
}
public double dot(Vector2d other) {
return (getX() * other.getX() + getY() * other.getY());
}
public Vector2d mult(double scalar) {
return new Vector2d(x * scalar, y * scalar);
}
public double getX() {
return x;
}
public double getY() {
return y;
}
public UnitVector2d normalize() {
return UnitVector2d.convertFrom(this);
}
public double getLength() {
return Math.sqrt(getLength2());
}
public double getLength2() {
return x * x + y * y;
}
@Override
public String toString() {
return "Vector2d [x=" + x + ", y=" + y + "]";
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.edge;
import java.util.Arrays;
public class Vector3d {
private double[] val = new double[3];
public Vector3d(double x, double y, double z) {
val[0] = x;
val[1] = y;
val[2] = z;
}
public Vector3d(Point3d point) {
this(point.getX(), point.getY(), point.getZ());
}
public double getLength() {
double value = val[0] * val[0] + val[1] * val[1] + val[2] * val[2];
return Math.sqrt(value);
}
public void normalize() {
double length = getLength();
if (length < Global.getHighAccuracyTolerance()) {
val[0] = 0;
val[1] = 0;
val[2] = 0;
} else {
val[0] = val[0] /= length;
val[1] = val[1] /= length;
val[2] = val[2] /= length;
}
}
public Vector3d cross(Vector3d crV2) {
return new Vector3d(getY() * crV2.getZ() - crV2.getY() * getZ(), getZ() * crV2.getX() - crV2.getZ() * getX(),
getX() * crV2.getY() - crV2.getX() * getY());
}
public UnitVector3d toUnitVector() {
return UnitVector3d.of(this);
}
public Vector3d mult(double d) {
return new Vector3d(val[0] * d, val[1] * d, val[2] * d);
}
public Vector3d plus(Vector3d other) {
return new Vector3d(getX() + other.getX(), getY() + other.getY(), getZ() + other.getZ());
}
public double getX() {
return val[0];
}
public double getY() {
return val[1];
}
public double getZ() {
return val[2];
}
public double getLength2() {
return val[0] * val[0] + val[1] * val[1] + val[2] * val[2];
}
public double dot(Vector3d crVector) {
return this.val[0] * crVector.getX() + this.val[1] * crVector.getY() + this.val[2] * crVector.getZ();
}
public static boolean areParallel(Vector3d crV1, Vector3d crV2, double angleEpsilon) {
return Math.abs((crV1.dot(crV2)) - (crV1.getLength() * crV2.getLength())) < angleEpsilon;
}
public static boolean areAntiParallel(Vector3d crV1, Vector3d crV2, double angleEpsilon) {
return Math.abs((crV1.dot(crV2)) + (crV1.getLength() * crV2.getLength())) < angleEpsilon;
}
public static boolean areAntiParallel(Vector3d rDir1, Vector3d rDir2) {
return areAntiParallel(rDir1, rDir2, Global.getTolVectorsParallel());
}
public static boolean areParallel(Vector3d rDir1, Vector3d rDir2) {
return areParallel(rDir1, rDir2, Global.getTolVectorsParallel());
}
public double[] toArray() {
return Arrays.copyOf(val, 3);
}
@Override
public String toString() {
return "Vector3d [val=" + Arrays.toString(val) + "]";
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.edge;
import java.util.Arrays;
public class Vector3d {
private final double[] val = new double[3];
public Vector3d(double x, double y, double z) {
val[0] = x;
val[1] = y;
val[2] = z;
}
public Vector3d(Point3d point) {
this(point.getX(), point.getY(), point.getZ());
}
public double getLength() {
double value = val[0] * val[0] + val[1] * val[1] + val[2] * val[2];
return Math.sqrt(value);
}
public void normalize() {
double length = getLength();
if (length < Global.getHighAccuracyTolerance()) {
val[0] = 0;
val[1] = 0;
val[2] = 0;
} else {
val[0] /= length;
val[1] /= length;
val[2] /= length;
}
}
public Vector3d cross(Vector3d crV2) {
return new Vector3d(getY() * crV2.getZ() - crV2.getY() * getZ(), getZ() * crV2.getX() - crV2.getZ() * getX(),
getX() * crV2.getY() - crV2.getX() * getY());
}
public UnitVector3d toUnitVector() {
return UnitVector3d.of(this);
}
public Vector3d mult(double d) {
return new Vector3d(val[0] * d, val[1] * d, val[2] * d);
}
public Vector3d plus(Vector3d other) {
return new Vector3d(getX() + other.getX(), getY() + other.getY(), getZ() + other.getZ());
}
public double getX() {
return val[0];
}
public double getY() {
return val[1];
}
public double getZ() {
return val[2];
}
public double getLength2() {
return val[0] * val[0] + val[1] * val[1] + val[2] * val[2];
}
public double dot(Vector3d crVector) {
return this.val[0] * crVector.getX() + this.val[1] * crVector.getY() + this.val[2] * crVector.getZ();
}
public static boolean areParallel(Vector3d crV1, Vector3d crV2, double angleEpsilon) {
return Math.abs((crV1.dot(crV2)) - (crV1.getLength() * crV2.getLength())) < angleEpsilon;
}
public static boolean areAntiParallel(Vector3d crV1, Vector3d crV2, double angleEpsilon) {
return Math.abs((crV1.dot(crV2)) + (crV1.getLength() * crV2.getLength())) < angleEpsilon;
}
public static boolean areAntiParallel(Vector3d rDir1, Vector3d rDir2) {
return areAntiParallel(rDir1, rDir2, Global.getTolVectorsParallel());
}
public static boolean areParallel(Vector3d rDir1, Vector3d rDir2) {
return areParallel(rDir1, rDir2, Global.getTolVectorsParallel());
}
public double[] toArray() {
return Arrays.copyOf(val, 3);
}
@Override
public String toString() {
return "Vector3d [val=" + Arrays.toString(val) + "]";
}
}
......@@ -103,11 +103,11 @@ public class IntersectionErrorsTest {
}
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, edgePoly2, 0.000001, 0.001);
......
......@@ -77,7 +77,7 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v1);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = polygons.get(0);
List<Coordinate3d> coordinates = edgePoly1.getCoordinates();
......@@ -147,7 +147,7 @@ public class MeshSurfaceUtilsTest {
List<Coordinate3d> coordChildren = firstHalfEdge.getChildren(Coordinate3d.class);
assertEquals(2, coordChildren.size());
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
assertNotNull(intersectPolygons);
......@@ -195,11 +195,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
assertNotNull(intersectPolygons);
......@@ -248,11 +248,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -311,11 +311,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v2);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -375,11 +375,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -429,11 +429,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -482,11 +482,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
DebugUtils.printGeoknechtPolygon(edgePoly1, edgePoly2);
......@@ -543,11 +543,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -596,11 +596,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v4);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
DebugUtils.printGeoknechtPolygon(edgePoly1, edgePoly2);
......@@ -652,11 +652,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -706,11 +706,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -760,11 +760,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -810,11 +810,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -866,11 +866,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -922,11 +922,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -978,11 +978,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -1049,11 +1049,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v5);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -1110,11 +1110,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v11);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -1173,11 +1173,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v11);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -1238,11 +1238,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v5);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......
<?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">
<modelVersion>4.0.0</modelVersion>
<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>
<parent>
<groupId>de.hft.stuttgart</groupId>
<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