From ed838bf943b44f9c0ddf539110e810985e57bab9 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 24 Nov 2016 14:24:11 +0100 Subject: [PATCH] Fix a bug also in 4.9, with 3 collinear points --- Convex_hull_3/include/CGAL/convex_hull_3.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Convex_hull_3/include/CGAL/convex_hull_3.h b/Convex_hull_3/include/CGAL/convex_hull_3.h index b6a8761c5b4..a8118bac224 100644 --- a/Convex_hull_3/include/CGAL/convex_hull_3.h +++ b/Convex_hull_3/include/CGAL/convex_hull_3.h @@ -708,6 +708,8 @@ convex_hull_3(InputIterator first, InputIterator beyond, --size; } + typename Traits::Collinear_3 collinear = traits.collinear_3_object(); + if ( size == 1 ) // 1 point { ch_object = make_object(*points.begin()); @@ -722,7 +724,9 @@ convex_hull_3(InputIterator first, InputIterator beyond, ch_object = make_object(seg); return; } - else if ( size == 3 ) // 3 points + else if ( ( size == 3 ) && (! collinear(*(points.begin()), + *(++points.begin()), + *(--points.end()) ) ) ) // 3 points { typedef typename Traits::Triangle_3 Triangle_3; typename Traits::Construct_triangle_3 construct_triangle = @@ -735,7 +739,6 @@ convex_hull_3(InputIterator first, InputIterator beyond, } // at least 4 points - typename Traits::Collinear_3 collinear = traits.collinear_3_object(); P3_iterator point1_it = points.begin(); P3_iterator point2_it = points.begin();