Commit 11f09fca authored by Pries's avatar Pries
Browse files

little changes in first Version of sweep-utility-classes

parent eb56cfd9
Pipeline #12420 failed with stage
in 2 minutes and 26 seconds
......@@ -45,18 +45,22 @@ public class SweepUtilities {
private double epsIntersection = 0.001; //Epsilon fuer Winkel zwischen Kante und Ebene
private List<SweepVertex> verts = new ArrayList<>();
private List<SweepVertex> verts;
public SweepUtilities(NonPlanarPolygonDistancePlaneError err) {
targetPlane = err.getPlane();
pol = err.getPolygon();
collectSweepVertices(pol);
}
public void initialize() {
int nVerts = countSweepVertices(pol);
verts = new ArrayList<>(nVerts);
collectSweepVertices(pol);
for (SweepVertex v : verts) {
v.collectOutgoingEdges(pol/* todo: weitere Uebergabeparameter hinzufuegen */, epsPointDist);
v.initStatus(targetPlane, epsPlaneDist);
......@@ -66,6 +70,10 @@ public class SweepUtilities {
public boolean calculate() {
// if there are no vertices --> no calculations
if ( null == verts )
return false;
//if there is already an error vertex --> no calculations
if ( !canHeal() )
return false;
......@@ -86,7 +94,7 @@ public class SweepUtilities {
if ( !bError ) {
for (SweepVertex v : verts) {
v.calculateNewPoint(targetPlane, epsPointDist);
v.calculateNewPoint(targetPlane, pol, epsPointDist);
}
}
......@@ -112,7 +120,17 @@ public class SweepUtilities {
}
private int countSweepVertices(Polygon p) {
int nVerts = p.getExteriorRing().getVertices().size();
for (LinearRing lr : p.getInnerRings()) {
nVerts += lr.getVertices().size();
}
return nVerts;
}
private void collectSweepVertices(Polygon p) {
collectSweepVertices(p.getExteriorRing());
for (LinearRing lr : p.getInnerRings()) {
collectSweepVertices(lr);
......@@ -120,6 +138,7 @@ public class SweepUtilities {
}
private void collectSweepVertices(LinearRing ring) {
for (Vertex v : ring.getVertices()) {
verts.add(new SweepVertex(v));
}
......
package de.hft.stuttgart.citydoctor2.healing;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.citydoctor2.datastructure.Edge;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.math.Plane;
import de.hft.stuttgart.citydoctor2.math.Vector3d;
......@@ -22,7 +23,7 @@ public class SweepVertex {
private Vertex vert;
private Vector3d newPoint;
private List<SweepEdge> outgoingEdges = new ArrayList<>();
private List<Edge> outgoingEdges = new LinkedList<>();
public SweepVertex(Vertex v) {
......@@ -59,7 +60,7 @@ public class SweepVertex {
}
public void calculateNewPoint (Plane targetPlane, double epsPointDist) {
public void calculateNewPoint (Plane targetPlane, Polygon p, double epsPointDist) {
if ( SweepVertexStatus.PROJECT == status ) {
newPoint = targetPlane.projectPointToPlane(vert);
......@@ -69,6 +70,7 @@ public class SweepVertex {
status = SweepVertexStatus.ERROR;
}
else {
SweepEdge e = new SweepEdge(outgoingEdges.getFirst(), p, epsPointDist);
//todo: Schnittpunkt der outgoing Edge mit der targePlane berechnen
//todo: dafuer Hilfsklasse SweepEdge fuer Parameterdarstellung usw. nutzen
//todo: Parameter des Schnittpunkts auf der Edge berechnen
......
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