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
7eb83cde
Commit
7eb83cde
authored
Apr 16, 2026
by
Matthias Betz
Browse files
fixes
parent
0a760af4
Pipeline
#12384
failed with stage
in 1 minute and 35 seconds
Changes
6
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/bht/BoundingVolumeHierarchyTree.java
View file @
7eb83cde
This diff is collapsed.
Click to expand it.
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/checks/bht/SolidSelfIntCheckAABB.java
View file @
7eb83cde
...
...
@@ -88,8 +88,11 @@ public class SolidSelfIntCheckAABB extends Check {
CheckResult
cr
;
// Build BVH on polygons, but compute AABBs from the *original* polygons
BoundingVolumeHierarchyTree
<
Polygon
>
tree
=
new
BoundingVolumeHierarchyTree
<>(
polys
,
p
->
AABB
.
of
(
p
.
getOriginal
()));
BoundingVolumeHierarchyTree
<
Polygon
>
tree
=
new
BoundingVolumeHierarchyTree
.
Builder
<
Polygon
>()
.
elements
(
polys
)
.
function
(
p
->
AABB
.
of
(
p
.
getOriginal
()))
.
build
();
// TODO: comparison with older version without tree
List
<
PolygonIntersection
>
intersections
=
SelfIntersectionUtil
.
calculateSolidSelfIntersection
(
g
,
0.001
,
tree
);
...
...
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/checks/geometry/NestedRingsCheck.java
View file @
7eb83cde
...
...
@@ -84,7 +84,7 @@ public class NestedRingsCheck extends Check {
@Override
public
void
check
(
Polygon
p
)
{
if
(
useAabbFilter
)
{
if
(
p
.
getInnerRings
().
size
()
>
3
)
{
checkWithBoundingBoxFilter
(
p
);
}
else
{
checkOriginal
(
p
);
...
...
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/checks/geometry/RingSelfIntCheck.java
View file @
7eb83cde
...
...
@@ -204,10 +204,8 @@ public class RingSelfIntCheck extends Check {
}
}
BoundingVolumeHierarchyTree
<
Edge
>
edgeTree
=
new
BoundingVolumeHierarchyTree
<>(
edges
,
e
->
AABB
.
of
(
e
.
getFrom
(),
e
.
getTo
(),
epsilon
),
BoundingVolumeHierarchyTree
.
BuildConfig
.
binaryDefault
());
BoundingVolumeHierarchyTree
<
Edge
>
edgeTree
=
BoundingVolumeHierarchyTree
.
newBinary
(
edges
,
e
->
AABB
.
of
(
e
.
getFrom
(),
e
.
getTo
(),
epsilon
));
for
(
int
i
=
0
;
i
<
edges
.
size
();
i
++)
{
Edge
e1
=
edges
.
get
(
i
);
...
...
@@ -263,11 +261,9 @@ public class RingSelfIntCheck extends Check {
}
List
<
Edge
>
edges
=
getEdgesForRing
(
lr
);
BoundingVolumeHierarchyTree
<
Vertex
>
vertexTree
=
new
BoundingVolumeHierarchyTree
<>(
vertices
,
v
->
AABB
.
of
(
v
,
epsilon
),
BoundingVolumeHierarchyTree
.
BuildConfig
.
binaryDefault
());
BoundingVolumeHierarchyTree
<
Vertex
>
vertexTree
=
BoundingVolumeHierarchyTree
.
newBinary
(
vertices
,
v
->
AABB
.
of
(
v
,
epsilon
));
for
(
Edge
e
:
edges
)
{
if
(
checkForPointsTouchingEdgeTree
(
lr
,
e
,
vertexTree
))
{
...
...
@@ -275,10 +271,8 @@ public class RingSelfIntCheck extends Check {
}
}
BoundingVolumeHierarchyTree
<
Edge
>
edgeTree
=
new
BoundingVolumeHierarchyTree
<>(
edges
,
e
->
AABB
.
of
(
e
.
getFrom
(),
e
.
getTo
(),
epsilon
),
BoundingVolumeHierarchyTree
.
BuildConfig
.
binaryDefault
());
BoundingVolumeHierarchyTree
<
Edge
>
edgeTree
=
BoundingVolumeHierarchyTree
.
newBinary
(
edges
,
e
->
AABB
.
of
(
e
.
getFrom
(),
e
.
getTo
(),
epsilon
));
for
(
int
i
=
0
;
i
<
edges
.
size
();
i
++)
{
Edge
e1
=
edges
.
get
(
i
);
...
...
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/checks/util/SelfIntersectionUtil.java
View file @
7eb83cde
...
...
@@ -133,21 +133,18 @@ public class SelfIntersectionUtil {
public
static
List
<
PolygonIntersection
>
calculateSolidSelfIntersectionWithTree
(
Geometry
g
,
double
delta
,
BoundingVolumeHierarchyTree
.
Build
Config
treeConfig
)
{
BoundingVolumeHierarchyTree
.
Build
er
<
Integer
>
treeConfig
)
{
List
<
TesselatedPolygon
>
tesselatedPolygons
=
tesselateAndFilter
(
g
,
delta
);
List
<
Integer
>
indices
=
new
ArrayList
<>(
tesselatedPolygons
.
size
());
for
(
int
i
=
0
;
i
<
tesselatedPolygons
.
size
();
i
++)
{
indices
.
add
(
i
);
}
treeConfig
.
elements
(
indices
).
function
(
index
->
AABB
.
of
(
tesselatedPolygons
.
get
(
index
).
getOriginal
()));
// Build BVH on polygon indices, while computing AABBs from the original polygons
BoundingVolumeHierarchyTree
<
Integer
>
tree
=
new
BoundingVolumeHierarchyTree
<>(
indices
,
index
->
AABB
.
of
(
tesselatedPolygons
.
get
(
index
).
getOriginal
()),
treeConfig
);
BoundingVolumeHierarchyTree
<
Integer
>
tree
=
treeConfig
.
build
();
List
<
PolygonIntersection
>
intersections
=
new
ArrayList
<>();
...
...
@@ -187,7 +184,7 @@ public class SelfIntersectionUtil {
return
calculateSolidSelfIntersectionWithTree
(
g
,
delta
,
BoundingVolumeHierarchyTree
.
Build
Config
.
binaryDefault
()
new
BoundingVolumeHierarchyTree
.
Build
er
<
Integer
>()
.
binaryDefault
()
);
}
...
...
CityDoctorParent/CityDoctorValidation/src/test/java/de/hft/stuttgart/citydoctor2/checks/util/SolidSelfIntersectionBVHUtilTest.java
View file @
7eb83cde
package
de.hft.stuttgart.citydoctor2.checks.util
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
java.io.File
;
import
java.util.List
;
import
org.junit.Test
;
import
org.citygml4j.core.model.CityGMLVersion
;
import
org.citygml4j.core.model.core.CityModel
;
import
org.junit.jupiter.api.Test
;
import
de.hft.stuttgart.citydoctor2.check.ValidationConfiguration
;
import
de.hft.stuttgart.citydoctor2.database.UnconnectedCache
;
import
de.hft.stuttgart.citydoctor2.datastructure.Building
;
import
de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel
;
import
de.hft.stuttgart.citydoctor2.datastructure.Geometry
;
...
...
@@ -15,13 +20,30 @@ import de.hft.stuttgart.citydoctor2.datastructure.Lod;
import
de.hft.stuttgart.citydoctor2.datastructure.Polygon
;
import
de.hft.stuttgart.citydoctor2.datastructure.bht.AABB
;
import
de.hft.stuttgart.citydoctor2.datastructure.bht.BoundingVolumeHierarchyTree
;
import
de.hft.stuttgart.citydoctor2.exceptions.CityDoctorWriteException
;
import
de.hft.stuttgart.citydoctor2.parser.CityGmlParseException
;
import
de.hft.stuttgart.citydoctor2.parser.CityGmlParser
;
import
de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
de.hft.stuttgart.citydoctor2.utils.PolygonIntersection
;
public
class
SolidSelfIntersectionBVHUtilTest
{
@Test
public
void
testWriteModel
()
throws
CityDoctorWriteException
{
Building
b
=
new
Building
();
b
.
addGeometry
(
GeometryTestUtils
.
createGoodGeometry
());
b
.
setGmlObject
(
new
org
.
citygml4j
.
core
.
model
.
building
.
Building
());
UnconnectedCache
unconnectedCache
=
new
UnconnectedCache
();
CityDoctorModel
model
=
new
CityDoctorModel
(
new
ParserConfiguration
(
8
,
false
),
new
File
(
"test.gml"
),
unconnectedCache
);
model
.
setParsedCityGMLVersion
(
CityGMLVersion
.
v2_0
);
model
.
setCityModel
(
new
CityModel
());
model
.
addBuilding
(
b
);
model
.
saveAs
(
"test.gml"
,
false
);
}
@Test
public
void
testBVHCalculateOnKnownGoodModel
()
throws
CityGmlParseException
,
InvalidGmlFileException
{
...
...
@@ -42,7 +64,7 @@ public class SolidSelfIntersectionBVHUtilTest {
assertTrue
(
"Expected at least 2 polygons"
,
polys
.
size
()
>
1
);
BoundingVolumeHierarchyTree
<
Polygon
>
tree
=
new
BoundingVolumeHierarchyTree
<>
(
polys
,
p
->
AABB
.
of
(
p
.
getOriginal
()));
BoundingVolumeHierarchyTree
.
newBinary
(
polys
,
p
->
AABB
.
of
(
p
.
getOriginal
()));
double
delta
=
0.001
;
...
...
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