Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CityDoctor
CityDoctor2
Commits
eb56cfd9
Commit
eb56cfd9
authored
Jul 13, 2026
by
Pries
Browse files
First version of utility classes for Sweep-Healing
parent
3032c1f9
Pipeline
#12419
passed with stage
in 2 minutes and 44 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
CityDoctorParent/Extensions/CityDoctorHealer/src/main/java/de/hft/stuttgart/citydoctor2/healing/SweepEdge.java
0 → 100644
View file @
eb56cfd9
package
de.hft.stuttgart.citydoctor2.healing
;
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
;
public
class
SweepEdge
{
private
Edge
edge
;
private
Vector3d
refPt
;
private
Vector3d
dir
;
//todo: falls es eine extra Klasse für einheitsvektoren gibt, diese Klasse benutzen
boolean
bValid
=
false
;
public
SweepEdge
(
Edge
e
,
Polygon
p
,
double
epsPointDist
)
{
edge
=
e
;
//todo: falls geschickter --> Ring statt Polygon uebergeben
//todo: Wenn die Kante nicht zu kurz ist (epsPointDist)
// --> Anfangs- oder Endpunkt als Referenzpunkt, je nachdem welcher Punkt zum Polygon gehoert
// --> Richtungsvektor dir als Einheitsvektor berechnen
// --> valid = true;
}
public
boolean
valid
()
{
return
bValid
;
}
public
boolean
intersection
(
Plane
plane
,
Vector3d
ipt
,
double
eps
)
{
//todo: Schnittpunkt berechnen
return
false
;
}
public
boolean
isOnEdge
(
Vector3d
pt
)
{
//todo: pruefen ob pt zwischen Anfangs- und Endpunkt liegt
return
false
;
}
}
CityDoctorParent/Extensions/CityDoctorHealer/src/main/java/de/hft/stuttgart/citydoctor2/healing/SweepUtilities.java
0 → 100644
View file @
eb56cfd9
package
de.hft.stuttgart.citydoctor2.healing
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
de.hft.stuttgart.citydoctor2.check.ModificationListener
;
import
de.hft.stuttgart.citydoctor2.check.error.NonPlanarPolygonDistancePlaneError
;
import
de.hft.stuttgart.citydoctor2.datastructure.LinearRing
;
import
de.hft.stuttgart.citydoctor2.datastructure.Polygon
;
import
de.hft.stuttgart.citydoctor2.datastructure.Vertex
;
import
de.hft.stuttgart.citydoctor2.math.Plane
;
import
de.hft.stuttgart.citydoctor2.math.Vector3d
;
/* todo: in HealPlanarPolygonSweep visit-Methode austauschen
public boolean visit(NonPlanarPolygonDistancePlaneError err, ModificationListener l) {
logger.debug("Executing Repair for NonPlanarPolygonDistancePlaneError");
SweepUtilities utils = new SweepUtilities(err);
todo: Epsilon-Werte setzen
utils.initialize();
if ( utils.calculate() ) {
utils.doHeal();
return true;
}
else {
logger.debug("Repair by Sweep not possible");
return false;
}
}
*/
public
class
SweepUtilities
{
private
Plane
targetPlane
;
private
Polygon
pol
;
//todo: weitere Attribute hinzufuegen (fuer collectOutgoingEdges, ...)
// todo: Epsilons passend initialisieren
private
double
epsPointDist
=
0.001
;
//Mindestlaenge einer Kante
private
double
epsPlaneDist
=
0.001
;
//Maximalabstand zur Ebene
private
double
epsIntersection
=
0.001
;
//Epsilon fuer Winkel zwischen Kante und Ebene
private
List
<
SweepVertex
>
verts
=
new
ArrayList
<>();
public
SweepUtilities
(
NonPlanarPolygonDistancePlaneError
err
)
{
targetPlane
=
err
.
getPlane
();
pol
=
err
.
getPolygon
();
collectSweepVertices
(
pol
);
}
public
void
initialize
()
{
for
(
SweepVertex
v
:
verts
)
{
v
.
collectOutgoingEdges
(
pol
/* todo: weitere Uebergabeparameter hinzufuegen */
,
epsPointDist
);
v
.
initStatus
(
targetPlane
,
epsPlaneDist
);
}
}
public
boolean
calculate
()
{
//if there is already an error vertex --> no calculations
if
(
!
canHeal
()
)
return
false
;
boolean
bError
=
false
;
//todo spaeter: Anzahl der Ecken mit mehr als einer outging Edge zaehlen
// Wenn es alle diese Ecken auf der Zielebene liegen --> weiter
// Wenn es maximal drei solche Ecken gibt: Zielebene neu berechnen
// Wenn es mehr als drei solche Ecken gibt: diese Ecken bekommen den ERROR-Status,
// bError = true;
/*
// If there is a new target plane, new initialization of status is necessary:
for (SweepVertex v : verts) {
v.initStatus(targetPlane, epsPlaneDist);
}
*/
if
(
!
bError
)
{
for
(
SweepVertex
v
:
verts
)
{
v
.
calculateNewPoint
(
targetPlane
,
epsPointDist
);
}
}
return
canHeal
();
}
public
void
doHeal
()
{
for
(
SweepVertex
v
:
verts
)
{
v
.
doHeal
();
}
}
private
boolean
canHeal
()
{
for
(
SweepVertex
v
:
verts
)
{
SweepVertexStatus
status
=
v
.
getStatus
();
if
(
SweepVertexStatus
.
ERROR
==
status
||
SweepVertexStatus
.
NONE
==
status
)
return
false
;
}
return
true
;
}
private
void
collectSweepVertices
(
Polygon
p
)
{
collectSweepVertices
(
p
.
getExteriorRing
());
for
(
LinearRing
lr
:
p
.
getInnerRings
())
{
collectSweepVertices
(
lr
);
}
}
private
void
collectSweepVertices
(
LinearRing
ring
)
{
for
(
Vertex
v
:
ring
.
getVertices
())
{
verts
.
add
(
new
SweepVertex
(
v
));
}
}
}
CityDoctorParent/Extensions/CityDoctorHealer/src/main/java/de/hft/stuttgart/citydoctor2/healing/SweepVertex.java
0 → 100644
View file @
eb56cfd9
package
de.hft.stuttgart.citydoctor2.healing
;
import
java.util.ArrayList
;
import
java.util.List
;
import
de.hft.stuttgart.citydoctor2.datastructure.Vertex
;
import
de.hft.stuttgart.citydoctor2.datastructure.Polygon
;
import
de.hft.stuttgart.citydoctor2.math.Plane
;
import
de.hft.stuttgart.citydoctor2.math.Vector3d
;
enum
SweepVertexStatus
{
NONE
,
ON_PLANE
,
SWEEP
,
PROJECT
,
ERROR
}
public
class
SweepVertex
{
private
SweepVertexStatus
status
=
SweepVertexStatus
.
NONE
;
private
Vertex
vert
;
private
Vector3d
newPoint
;
private
List
<
SweepEdge
>
outgoingEdges
=
new
ArrayList
<>();
public
SweepVertex
(
Vertex
v
)
{
vert
=
v
;
}
//todo: weitere Uebergabeparameter hinzufuegen
public
void
collectOutgoingEdges
(
Polygon
pol
/* todo: weitere Uebergabeparameter hinzufuegen */
,
double
epsPointDist
)
{
//todo: Liste outgoingEdges fuellen
}
public
void
initStatus
(
Plane
targetPlane
,
double
distPlaneEps
)
{
if
(
targetPlane
.
getDistance
(
vert
)
<
distPlaneEps
)
{
status
=
SweepVertexStatus
.
ON_PLANE
;
}
else
if
(
outgoingEdges
.
size
()
<
1
)
{
status
=
SweepVertexStatus
.
PROJECT
;
}
/*
* todo spaeter:
* else {
* status = SweepVertexStatus.SWEEP;
* }
*
* zunaechst Ecken mit mehr als einer outgoing Edge nicht beruecksichtigen:
*/
else
if
(
outgoingEdges
.
size
()
==
1
)
status
=
SweepVertexStatus
.
SWEEP
;
else
status
=
SweepVertexStatus
.
ERROR
;
}
public
void
calculateNewPoint
(
Plane
targetPlane
,
double
epsPointDist
)
{
if
(
SweepVertexStatus
.
PROJECT
==
status
)
{
newPoint
=
targetPlane
.
projectPointToPlane
(
vert
);
}
else
if
(
SweepVertexStatus
.
SWEEP
==
status
)
{
if
(
1
!=
getNoOutgoingEdges
()
)
{
status
=
SweepVertexStatus
.
ERROR
;
}
else
{
//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
// --> wenn die Edge "umkippt" oder zum Punkt degeneriert (epsPointDist): status = SweepVertexStatus.ERROR
}
}
}
public
void
doHeal
()
{
if
(
SweepVertexStatus
.
SWEEP
==
status
||
SweepVertexStatus
.
PROJECT
==
status
)
{
vert
.
setX
(
newPoint
.
getX
());
vert
.
setY
(
newPoint
.
getY
());
vert
.
setZ
(
newPoint
.
getZ
());
}
}
public
SweepVertexStatus
getStatus
()
{
return
status
;
}
public
int
getNoOutgoingEdges
()
{
return
outgoingEdges
.
size
();
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment