From cba8456715e6945bb120801f90a5d26269d92b27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 2 Jan 2017 15:28:28 +0100 Subject: [PATCH] add constructions for the intersection point of a plane by a line and of 2 lines this is undocumented and allow to have a lazy node for this construction --- .../include/CGAL/Kernel/function_objects.h | 52 +++++++++++++++++++ .../include/CGAL/Kernel/interface_macros.h | 4 ++ 2 files changed, 56 insertions(+) diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index fee859a34fa..7569527299e 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -1104,6 +1104,31 @@ namespace CommonKernelFunctors { { return this->operator()(Return_base_tag(), min_hx, min_hy, min_hz, max_hx, max_hy, max_hz); } }; + template + class Construct_line_line_intersection_point_3 + { + typedef typename K::Line_3 Line; + typedef typename K::Point_3 Point; + typename K::Construct_line_3 construct_line; + public: + typedef Point result_type; + + Point + operator()(const Point& l11, const Point& l12, + const Point& l21, const Point& l22) const + { + Line l1 = construct_line(l11, l12); + Line l2 = construct_line(l21, l22); + + typename cpp11::result_of::type + res = typename K::Intersect_3()(l1,l2); + CGAL_assertion(res!=boost::none); + const Point* e_pt = boost::get(&(*res)); + CGAL_assertion(e_pt!=NULL); + return *e_pt; + } + }; + template class Construct_max_vertex_2 { @@ -1477,6 +1502,33 @@ namespace CommonKernelFunctors { }; + template + class Construct_plane_line_intersection_point_3 + { + typedef typename K::Plane_3 Plane; + typedef typename K::Line_3 Line; + typedef typename K::Point_3 Point; + typename K::Construct_plane_3 construct_plane; + typename K::Construct_line_3 construct_line; + public: + typedef Point result_type; + + Point + operator()(const Point& p1, const Point& p2, const Point& p3, + const Point& l1, const Point& l2) const + { + Plane plane = construct_plane(p1, p2, p3); + Line line = construct_line( l1, l2 ); + + typename cpp11::result_of::type + res = typename K::Intersect_3()(plane,line); + CGAL_assertion(res!=boost::none); + const Point* e_pt = boost::get(&(*res)); + CGAL_assertion(e_pt!=NULL); + return *e_pt; + } + }; + template class Construct_point_on_2 { diff --git a/Kernel_23/include/CGAL/Kernel/interface_macros.h b/Kernel_23/include/CGAL/Kernel/interface_macros.h index 29e98635e06..68bbc804a91 100644 --- a/Kernel_23/include/CGAL/Kernel/interface_macros.h +++ b/Kernel_23/include/CGAL/Kernel/interface_macros.h @@ -302,6 +302,8 @@ CGAL_Kernel_cons(Construct_line_2, construct_line_2_object) CGAL_Kernel_cons(Construct_line_3, construct_line_3_object) +CGAL_Kernel_cons(Construct_line_line_intersection_point_3, + construct_line_line_intersection_point_3_object) CGAL_Kernel_cons(Construct_midpoint_2, construct_midpoint_2_object) CGAL_Kernel_cons(Construct_midpoint_3, @@ -370,6 +372,8 @@ CGAL_Kernel_cons(Construct_perpendicular_vector_2, construct_perpendicular_vector_2_object) CGAL_Kernel_cons(Construct_plane_3, construct_plane_3_object) +CGAL_Kernel_cons(Construct_plane_line_intersection_point_3, + construct_plane_line_intersection_point_3_object) CGAL_Kernel_cons(Construct_point_on_2, construct_point_on_2_object) CGAL_Kernel_cons(Construct_point_on_3,