From a44e21b8ebeb8b111b16e722c7619f94de7970ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 1 Sep 2016 16:36:01 +0200 Subject: [PATCH] use Kernel functor instead of free functions --- .../CGAL/Kernel/nearest_point_segment_3.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Kernel_23/include/CGAL/Kernel/nearest_point_segment_3.h b/Kernel_23/include/CGAL/Kernel/nearest_point_segment_3.h index d3be1ffdb0c..2d01bf664d9 100644 --- a/Kernel_23/include/CGAL/Kernel/nearest_point_segment_3.h +++ b/Kernel_23/include/CGAL/Kernel/nearest_point_segment_3.h @@ -47,19 +47,26 @@ bool is_inside_segment_3(const typename K::Point_3& query, const typename K::Segment_3 & s, typename K::Point_3& closest_point_on_segment, - const K&) + const K& k) { + typename K::Construct_vector_3 vector = + k.construct_vector_3_object(); + typename K::Construct_vertex_3 vertex_on = + k.construct_vertex_3_object(); + typename K::Compute_scalar_product_3 scalar_product = + k.compute_scalar_product_3_object(); + typedef typename K::FT FT; typedef typename K::Point_3 Point; - const Point& a = s.source(); - const Point& b = s.target(); - if((b-a)*(query-a) < FT(0)) + const Point& a = vertex_on(s, 0); + const Point& b = vertex_on(s, 1); + if( scalar_product(vector(a,b), vector(a, query)) < FT(0) ) { closest_point_on_segment = a; return false; } - if((a-b)*(query-b) < FT(0)) + if( scalar_product(vector(b,a), vector(b, query)) < FT(0) ) { closest_point_on_segment = b; return false;