Skip to content

Commit 44ea91c

Browse files
committed
fix(ModelIntersections): Added test to avoid computing intersections on empty meshes.
1 parent ae41610 commit 44ea91c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,11 +408,22 @@ namespace geode
408408
std::vector< std::pair< ComponentMeshElement, ComponentMeshElement > >
409409
intersecting_triangles() const
410410
{
411-
const auto model_tree = create_surface_meshes_aabb_trees( model_ );
412411
std::vector<
413412
std::pair< ComponentMeshElement, ComponentMeshElement > >
414413
component_intersections;
415414
for( const auto& surface : model_.surfaces() )
415+
{
416+
if( surface.mesh().nb_polygons() == 0 )
417+
{
418+
geode::Logger::warn(
419+
"One of the surface meshes has an empty mesh, cannot "
420+
"compute the AABBTree used for detecting the mesh "
421+
"intersections, no intersections will be computed." );
422+
return component_intersections;
423+
}
424+
}
425+
const auto model_tree = create_surface_meshes_aabb_trees( model_ );
426+
for( const auto& surface : model_.surfaces() )
416427
{
417428
if( surface.mesh().type_name()
418429
!= TriangulatedSurface< dimension >::type_name_static() )

0 commit comments

Comments
 (0)