diff --git a/Surface_mesh/examples/Surface_mesh/CMakeLists.txt b/Surface_mesh/examples/Surface_mesh/CMakeLists.txt index 7ce13885fc5..bfdb5630808 100644 --- a/Surface_mesh/examples/Surface_mesh/CMakeLists.txt +++ b/Surface_mesh/examples/Surface_mesh/CMakeLists.txt @@ -39,6 +39,7 @@ if ( CGAL_FOUND ) create_single_source_cgal_program("draw_surface_mesh.cpp") create_single_source_cgal_program("sm_draw_small_faces.cpp") + create_single_source_cgal_program("sm_check_wrong_orientation.cpp") if(CGAL_Qt5_FOUND ) target_link_libraries(draw_surface_mesh PUBLIC CGAL::CGAL_Qt5) target_link_libraries(sm_draw_small_faces PUBLIC CGAL::CGAL_Qt5) diff --git a/Surface_mesh/examples/Surface_mesh/sm_check_wrong_orientation.cpp b/Surface_mesh/examples/Surface_mesh/sm_check_wrong_orientation.cpp new file mode 100644 index 00000000000..972e98878c2 --- /dev/null +++ b/Surface_mesh/examples/Surface_mesh/sm_check_wrong_orientation.cpp @@ -0,0 +1,30 @@ +#include + + +#include +#include + +typedef CGAL::Simple_cartesian K; +typedef CGAL::Surface_mesh Mesh; +typedef Mesh::Vertex_index vertex_descriptor; +typedef Mesh::Face_index face_descriptor; +int main() +{ + Mesh m; + + // Add the points as vertices + vertex_descriptor u = m.add_vertex(K::Point_3(0,1,0)); + vertex_descriptor v = m.add_vertex(K::Point_3(0,0,0)); + vertex_descriptor w = m.add_vertex(K::Point_3(1,1,0)); + vertex_descriptor x = m.add_vertex(K::Point_3(1,0,0)); + + m.add_face(u,v,w); + face_descriptor f = m.add_face(u,v,x); + if(f == Mesh::null_face()) + { + std::cerr<<"The face could not be added because of an orientation error."<