diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orientation.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orientation.h index bcc02ce5ae6..0eb2a055366 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orientation.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orientation.h @@ -453,7 +453,7 @@ namespace Polygon_mesh_processing { * @tparam TriangleMesh a model of `FaceListGraph` and `MutableFaceGraph` . * @tparam NamedParameters a sequence of \ref namedparameters * -* @param tm a triangulated `TriangleMesh` +* @param tm a closed triangulated `TriangleMesh` * @param orient_positively indicates if the output mesh should be oriented positively (`true`) or negatively (`false`). * default value is true. * A closed polygon mesh is considered to have a positive orientation if the normal vectors @@ -487,6 +487,7 @@ void orient(TriangleMesh& tm, bool orient_positively, const NamedParameters& np) if (!is_triangle_mesh(tm)) return ; if (!is_valid(tm)) return ; + if (!is_closed(tm)) return; Vpm vpm = boost::choose_param(get_param(np, internal_np::vertex_point), get_const_property_map(boost::vertex_point, tm)); diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_orient_cc.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_orient_cc.cpp index 1e15f42f042..3cb4bdf0858 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_orient_cc.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_orient_cc.cpp @@ -74,13 +74,18 @@ bool test_orientation(TriangleMesh& tm, bool is_positive, const NamedParameters& int main() { +<<<<<<< HEAD std::ifstream input("data-coref/nested_cubes_invalid_volume.off"); +======= + std::ifstream input("data/Volume_nested_spheres.off"); +>>>>>>> 5bf8e4d86b... Add requirement close for orient function assert(input); - SMesh sm1, sm2, sm3, sm4; + SMesh sm1, sm2, sm3, sm4, volume; input >> sm1; sm2 = sm1; sm3 = sm1; sm4 = sm1; + volume = sm1; PMP::orient(sm1); if(!test_orientation(sm1, true, PMP::parameters::all_default())) return 1; @@ -109,10 +114,6 @@ int main() return 1; - SMesh volume; - std::ifstream input2("data/Volume_nested_spheres.off"); - assert(input); - input2 >> volume; PMP::orient_to_bound_a_volume(volume, true); if( !PMP::does_bound_a_volume(volume))