diff --git a/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h b/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h index 38935fd42b0..b6568308226 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h @@ -617,6 +617,7 @@ template struct Construct_circumcenter : Store_kernel { Point const& p0=*f; int d = pd(p0); int k = static_cast(std::distance(f,e)); + CGAL_assume(k>=1); if(k==1) return p0; if(k==2){ typename Get_functor::type mid(this->kernel()); diff --git a/NewKernel_d/test/NewKernel_d/Epick_d.cpp b/NewKernel_d/test/NewKernel_d/Epick_d.cpp index 21c64288380..c72d5d207e6 100644 --- a/NewKernel_d/test/NewKernel_d/Epick_d.cpp +++ b/NewKernel_d/test/NewKernel_d/Epick_d.cpp @@ -712,6 +712,22 @@ void test3(){ std::ostringstream sv1; sv1 << v1; assert(sv1.str()=="3 3 2 1"); std::istringstream sv2("3 4 5 6"); sv2 >> v1; assert(v1[0]==4&&v1[1]==5); } +template +void test4(){ + typedef typename Ker::Point_d P; + typedef typename Ker::Construct_circumcenter_d CCc; + typedef typename Ker::Equal_d E; + Ker k(4); + CCc ccc Kinit(construct_circumcenter_d_object); + E ed Kinit(equal_d_object); + auto mkpt=[](auto...x){double l[]{(double)x...};return P(std::begin(l), std::end(l));}; + P tab1[]={mkpt(15,20,40,80),mkpt(10,23,36,80),mkpt(10,20,40,85),mkpt(10,15,40,80),mkpt(13,20,40,76)}; + assert(ed(ccc(tab1+0, tab1+5),mkpt(10,20,40,80))); + P tab2[]={mkpt(15,20,40,80),mkpt(13,24,40,80),mkpt(10,25,40,80),mkpt(10,20,43,84)}; + assert(ed(ccc(tab2+0, tab2+4),mkpt(10,20,40,80))); + P tab3[]={mkpt(15,20,35,80),mkpt(10,25,40,75),mkpt(13,24,37,76)}; + assert(ed(ccc(tab3+0, tab3+3),mkpt(10,20,40,80))); +} template struct CGAL::Epick_d >; template struct CGAL::Epick_d >; template struct CGAL::Epick_d; @@ -733,6 +749,7 @@ int main(){ test2>>(); test3>>(); test3>(); + test4>(); #endif }