Skip to content

Commit f6f6b0f

Browse files
Merge pull request #138 from Geode-solutions/fix/shp-unique-vertices
fix(Intersection): faster check for polygons intersections
2 parents e2fd059 + 12fcb70 commit f6f6b0f

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

.vscode/settings.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
"${workspaceFolder:OpenGeode}/build/opengeode/install/include",
88
"${workspaceFolder:OpenGeode-IO}/include",
99
"${workspaceFolder:OpenGeode-IO}/build/opengeode-io/install/include",
10-
"${workspaceFolder:OpenGeode-Geosciences}/include"
10+
"${workspaceFolder:OpenGeode-Geosciences}/include",
11+
"${workspaceFolder:OpenGeode-GeosciencesIO}/include",
12+
"${workspaceFolder:OpenGeode-GeosciencesIO}/build"
1113
],
1214
"files.watcherExclude": {
1315
"${workspaceFolder}/build/**": true

src/geode/inspector/criterion/intersections/model_intersections.cpp

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -112,23 +112,16 @@ namespace
112112
return triangles_intersection_detection(
113113
p1_vertices, p2_vertices );
114114
}
115-
for( const auto v : geode::LRange{ p1_vertices.size() - 2 } )
115+
const auto p1_triangles = polygon_fan_triangles( p1_vertices, 0 );
116+
const auto p2_triangles = polygon_fan_triangles( p2_vertices, 0 );
117+
for( const auto& p1_triangle : p1_triangles )
116118
{
117-
for( const auto& triangle :
118-
polygon_fan_triangles( p1_vertices, v ) )
119+
for( const auto& p2_triangle : p2_triangles )
119120
{
120-
for( const auto other_v :
121-
geode::LRange{ p2_vertices.size() - 2 } )
121+
if( triangles_intersection_detection(
122+
p1_triangle, p2_triangle ) )
122123
{
123-
for( const auto& other_triangle :
124-
polygon_fan_triangles( p2_vertices, other_v ) )
125-
{
126-
if( triangles_intersection_detection(
127-
triangle, other_triangle ) )
128-
{
129-
return true;
130-
}
131-
}
124+
return true;
132125
}
133126
}
134127
}

0 commit comments

Comments
 (0)