diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Plane_3_Plane_3_intersection.h b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Plane_3_Plane_3_intersection.h index b0cc8f3ec226..138d2c9bd45b 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Plane_3_Plane_3_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Plane_3_Plane_3_intersection.h @@ -84,10 +84,13 @@ intersection(const typename K::Plane_3& plane1, typename K::Line_3, typename K::Plane_3> > result_type; - typedef typename K::Point_3 Point_3; typedef typename K::Line_3 Line_3; typedef typename K::Plane_3 Plane_3; + auto res = intersection_point(plane1,plane2,plane3, k); + if (res) + return result_type(*res); + // Intersection between plane1 and plane2 can either be // a line, a plane, or empty. typename Intersection_traits<K, Plane_3, Plane_3>::result_type @@ -97,26 +100,19 @@ intersection(const typename K::Plane_3& plane1, { if(const Line_3* l = intersect_get<Line_3>(o12)) { - // either point or line - typename Intersection_traits<K, Plane_3, Line_3>::result_type - v = internal::intersection(plane3, *l, k); - if(v) - { - if(const Point_3* p = intersect_get<Point_3>(v)) - return result_type(*p); - else if(const Line_3* l = intersect_get<Line_3>(v)) - return result_type(*l); - } + if (internal::do_intersect(*l, plane3, k)) + return result_type(*l); } - else if(const Plane_3 *pl = intersect_get<Plane_3>(o12)) + else { + CGAL_assertion(intersect_get<Plane_3>(o12) != nullptr); // either line or plane typename Intersection_traits<K, Plane_3, Plane_3>::result_type - v = internal::intersection(plane3, *pl, k); + v = internal::intersection(plane3, plane1, k); if(v) { - if(const Plane_3* p = intersect_get<Plane_3>(v)) - return result_type(*p); + if( intersect_get<Plane_3>(v)!=nullptr) + return result_type(plane1); else if(const Line_3* l = intersect_get<Line_3>(v)) return result_type(*l); } diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_io.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_io.h index eebd53cd03f7..886832d0508a 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_io.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_io.h @@ -17,26 +17,19 @@ #ifndef CGAL__TEST_IO_H #define CGAL__TEST_IO_H -#include <fstream> +#include <sstream> #include <cassert> -#ifndef TEST_FILENAME -# define TEST_FILENAME "Test_IO.out" -#endif - template <class T> void _test_io_for(const T& t) { - { - std::ofstream oFile(TEST_FILENAME, std::ios::out); - oFile << t << std::endl; - } + std::stringstream ss; + ss << t << std::endl; - std::ifstream iFile(TEST_FILENAME, std::ios::in); T u = t; - iFile >> u; - assert(!iFile.fail()); + ss >> u; + assert(! ss.fail() ); assert(u == t); } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/self_intersections.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/self_intersections.h index 3d085dbb27f4..183fc299f70e 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/self_intersections.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/self_intersections.h @@ -530,7 +530,8 @@ self_intersections_impl(const FaceRange& face_range, * @tparam FaceRange a model of `ConstRange` with value type `boost::graph_traits<TriangleMesh>::%face_descriptor`. * @tparam TriangleMesh a model of `FaceListGraph` * @tparam FacePairOutputIterator a model of `OutputIterator` holding objects of type - * `std::pair<boost::graph_traits<TriangleMesh>::%face_descriptor, boost::graph_traits<TriangleMesh>::%face_descriptor>` + * `std::pair<boost::graph_traits<TriangleMesh>::%face_descriptor, boost::graph_traits<TriangleMesh>::%face_descriptor>`. + * It does not need to be thread-safe. * @tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" * * @param face_range the range of faces to check for self-intersection. @@ -596,7 +597,8 @@ self_intersections(const FaceRange& face_range, * Possible values are `Sequential_tag`, `Parallel_tag`, and `Parallel_if_available_tag`. * @tparam TriangleMesh a model of `FaceListGraph` * @tparam FacePairOutputIterator a model of `OutputIterator` holding objects of type - * `std::pair<boost::graph_traits<TriangleMesh>::%face_descriptor, boost::graph_traits<TriangleMesh>::%face_descriptor>` + * `std::pair<boost::graph_traits<TriangleMesh>::%face_descriptor, boost::graph_traits<TriangleMesh>::%face_descriptor>`. + * It does not need to be thread-safe. * @tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" * * @param tmesh the triangulated surface mesh to be checked