2323
2424#include < geode/mesh/helpers/detail/solid_mesh_validity_fix.hpp>
2525
26+ #include < geode/basic/attribute_manager.hpp>
2627#include < geode/basic/uuid.hpp>
2728
2829#include < geode/geometry/point.hpp>
@@ -51,10 +52,12 @@ namespace geode
5152 }
5253 }
5354 GenericMapping< index_t > vertex_mappings;
54- for ( const auto v : Range{ mesh.nb_vertices () } )
55+ for ( const auto vertex_id : Range{ mesh.nb_vertices () } )
5556 {
56- auto polyhedra_around = mesh.polyhedra_around_vertex ( v );
57- const auto & polyhedron_vertices = polyhedra_around_vertices[v];
57+ auto polyhedra_around =
58+ mesh.polyhedra_around_vertex ( vertex_id );
59+ const auto & polyhedron_vertices =
60+ polyhedra_around_vertices[vertex_id];
5861 auto nb_polyhedra_around = polyhedra_around.size ();
5962 if ( nb_polyhedra_around == polyhedron_vertices.size () )
6063 {
@@ -68,20 +71,23 @@ namespace geode
6871 total_polyhedra.emplace_back ( std::move ( polyhedron ) );
6972 }
7073 const auto new_vertex_id =
71- builder.create_point ( mesh.point ( v ) );
72- builder.replace_vertex ( v, new_vertex_id );
74+ builder.create_point ( mesh.point ( vertex_id ) );
75+ mesh.vertex_attribute_manager ().copy_attribute_value (
76+ vertex_id, new_vertex_id );
77+ builder.replace_vertex ( vertex_id, new_vertex_id );
7378 for ( const auto & polyhedron_vertex : polyhedron_vertices )
7479 {
7580 if ( absl::c_find ( total_polyhedra, polyhedron_vertex )
7681 == total_polyhedra.end () )
7782 {
7883 builder.associate_polyhedron_vertex_to_vertex (
79- polyhedron_vertex, v );
84+ polyhedron_vertex, vertex_id );
8085 break ;
8186 }
8287 }
83- vertex_mappings.map ( v, new_vertex_id );
84- polyhedra_around = mesh.polyhedra_around_vertex ( v );
88+ vertex_mappings.map ( vertex_id, new_vertex_id );
89+ polyhedra_around =
90+ mesh.polyhedra_around_vertex ( vertex_id );
8591 nb_polyhedra_around += polyhedra_around.size ();
8692 }
8793 }
0 commit comments