handle isolated vertices in the target mesh

This commit is contained in:
Sébastien Loriot 2021-01-27 10:17:42 +01:00
parent 6511f95999
commit 026abdb175
2 changed files with 54 additions and 0 deletions

View File

@ -167,6 +167,8 @@ void copy_face_graph_impl(const SourceMesh& sm, TargetMesh& tm,
for(tm_vertex_descriptor v : vertices(tm)) for(tm_vertex_descriptor v : vertices(tm))
{ {
tm_halfedge_descriptor h = halfedge(v, tm); tm_halfedge_descriptor h = halfedge(v, tm);
if (h==boost::graph_traits<TargetMesh>::null_halfedge())
continue;
tm_halfedge_descriptor next_around_vertex=h; tm_halfedge_descriptor next_around_vertex=h;
do{ do{
next_around_vertex=opposite(next(next_around_vertex, tm), tm); next_around_vertex=opposite(next(next_around_vertex, tm), tm);

View File

@ -35,6 +35,57 @@ test_copy_face_graph_nm_umbrella()
} }
} }
template <typename T>
void
test_copy_face_graph_isolated_vertices()
{
typedef Kernel::Point_3 Point_3;
{
T s, t;
add_vertex(s);
CGAL::copy_face_graph(s, t);
}
{
T s, t;
add_vertex(t);
CGAL::copy_face_graph(s, t);
}
{
T s, t;
CGAL::make_triangle(Point_3(), Point_3(), Point_3(), s);
add_vertex(s);
t=s;
CGAL::copy_face_graph(s, t);
}
{
T s, t;
CGAL::make_triangle(Point_3(), Point_3(), Point_3(), s);
add_vertex(s);
add_vertex(t);
CGAL::copy_face_graph(s, t);
}
{
T s, t;
CGAL::make_tetrahedron(Point_3(), Point_3(), Point_3(), Point_3(), s);
add_vertex(s);
t=s;
CGAL::copy_face_graph(s, t);
}
{
T s, t;
CGAL::make_tetrahedron(Point_3(), Point_3(), Point_3(), Point_3(), s);
add_vertex(s);
add_vertex(t);
CGAL::copy_face_graph(s, t);
}
}
template <typename T> template <typename T>
void void
join_face_test() join_face_test()
@ -619,6 +670,7 @@ void
test_Euler_operations() test_Euler_operations()
{ {
test_copy_face_graph_nm_umbrella<Graph>(); test_copy_face_graph_nm_umbrella<Graph>();
test_copy_face_graph_isolated_vertices<Graph>();
join_face_test<Graph>(); join_face_test<Graph>();
add_vertex_and_face_to_border_test<Graph>(); add_vertex_and_face_to_border_test<Graph>();
add_face_to_border_test<Graph>(); add_face_to_border_test<Graph>();