From 7325c00166dcfe97a0813443628aa640375c003a Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Fri, 30 Jan 2015 08:24:01 +0100 Subject: [PATCH 1/5] WIP: Side_of_bounded_diametral_sphere --- .../NewKernel_d/function_objects_cartesian.h | 78 ++++++++++++++++++- .../include/CGAL/NewKernel_d/functor_tags.h | 1 + NewKernel_d/test/NewKernel_d/Epick_d.cpp | 8 ++ 3 files changed, 85 insertions(+), 2 deletions(-) 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 cbb8d980d17..4a092442597 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h @@ -640,6 +640,80 @@ template struct Side_of_bounded_sphere : private Store_kernel { CGAL_KD_DEFAULT_FUNCTOR(Side_of_bounded_sphere_tag,(CartesianDKernelFunctors::Side_of_bounded_sphere),(Point_tag),(Side_of_oriented_sphere_tag,Orientation_of_points_tag)); +namespace CartesianDKernelFunctors { +template struct Side_of_bounded_diametral_sphere : private Store_kernel { + CGAL_FUNCTOR_INIT_STORE(Side_of_bounded_diametral_sphere) + typedef R_ R; + typedef typename Get_type::type Point; + typedef typename Get_type::type result_type; + typedef typename Get_functor >::type CP; + typedef typename Get_functor::type CD; + typedef typename R::Max_ambient_dimension D2; + typedef typename R::LA::template Rebind_dimension::Other LA; + typedef typename LA::Square_matrix Matrix; + typedef typename LA::Vector Vec; + + template + result_type operator()(Iter f, Iter const& e, Point const& p0) const { + typename Get_functor::type sp(this->kernel()); + typename Get_functor::type sqdo(this->kernel()); + typename Get_functor::type c(this->kernel()); + typename Get_functor::type pd(this->kernel()); + + /* + * Matrix P=(p1, p2, ...) (each point as a column) + * Matrix Q=2*t(p2-p1,p3-p1, ...) (each vector as a line) + * Matrix M: QP, adding a line of 1 at the top + * Vector B: (1, p2^2-p1^2, p3^2-p1^2, ...) + * Solve ML=B, the center of the sphere is PL + * + * It would likely be faster to write P then transpose, multiply, + * etc instead of doing it by hand. + */ + // TODO: split the main code into Center_of_diametral_sphere + // TODO: check for degenerate cases + + int k=std::distance(f,e); + int d=pd(p0); + Matrix m(k,k); + Vec b(k); + Vec l(k); + int j,i=0; + for(Iter f2=f;f2!=e;++f2,++i){ + b(i)=m(i,i)=sqdo(*f2); + j=0; + for(Iter f3=f;f3!=e;++f3,++j){ + m(j,i)=m(i,j)=sp(*f2,*f3); + } + } + for(i=1;ikernel())(R::LA::vector_begin(center),R::LA::vector_end(center)); + return enum_cast(CD(this->kernel())(cent,*f,p0)); + } +}; +} + +CGAL_KD_DEFAULT_FUNCTOR(Side_of_bounded_diametral_sphere_tag,(CartesianDKernelFunctors::Side_of_bounded_diametral_sphere),(Point_tag),(Point_dimension_tag,Squared_distance_to_origin_tag,Compute_point_cartesian_coordinate_tag,Side_of_bounded_sphere_tag)); + namespace CartesianDKernelFunctors { template struct Point_to_vector : private Store_kernel { CGAL_FUNCTOR_INIT_STORE(Point_to_vector) @@ -667,13 +741,13 @@ template struct Vector_to_point : private Store_kernel { typedef typename Get_type::type RT; typedef typename Get_type::type Vector; typedef typename Get_type::type Point; - typedef typename Get_functor >::type CV; + typedef typename Get_functor >::type CP; typedef typename Get_functor >::type CI; typedef Point result_type; typedef Vector argument_type; result_type operator()(argument_type const&v)const{ CI ci(this->kernel()); - return CV(this->kernel())(ci(v,Begin_tag()),ci(v,End_tag())); + return CP(this->kernel())(ci(v,Begin_tag()),ci(v,End_tag())); } }; } diff --git a/NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h b/NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h index c48f4c5d779..b8d9d856af2 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h @@ -291,6 +291,7 @@ namespace CGAL { CGAL_DECL_PREDICATE(Orientation_of_vectors); CGAL_DECL_PREDICATE(Side_of_oriented_sphere); CGAL_DECL_PREDICATE(Side_of_bounded_sphere); + CGAL_DECL_PREDICATE(Side_of_bounded_diametral_sphere); CGAL_DECL_PREDICATE(Contained_in_affine_hull); CGAL_DECL_PREDICATE(In_flat_orientation); CGAL_DECL_PREDICATE(In_flat_side_of_oriented_sphere); diff --git a/NewKernel_d/test/NewKernel_d/Epick_d.cpp b/NewKernel_d/test/NewKernel_d/Epick_d.cpp index f10794c16f8..29effafa0e0 100644 --- a/NewKernel_d/test/NewKernel_d/Epick_d.cpp +++ b/NewKernel_d/test/NewKernel_d/Epick_d.cpp @@ -372,6 +372,7 @@ void test3(){ typedef typename K1::Squared_distance_d SD; typedef typename K1::Point_dimension_d PD; typedef typename K1::Affinely_independent_d AI; + typedef typename CGAL::Get_functor::type SBDS; Ker k #if 1 @@ -402,6 +403,7 @@ void test3(){ SD sd Kinit(squared_distance_d_object); PD pd Kinit(point_dimension_d_object); AI ai Kinit(affinely_independent_d_object); + SBDS sbds (k); P a; // Triangulation needs this :-( a=cp(2,3,4); assert(pd(a)==3); @@ -524,6 +526,12 @@ void test3(){ assert(ifsos(fozn, tz+0, tz+3, tz[4]) == CGAL::ON_NEGATIVE_SIDE); assert(ifsos(fozp, tz+0, tz+3, tz[5]) == CGAL::ON_NEGATIVE_SIDE); assert(ifsos(fozn, tz+0, tz+3, tz[5]) == CGAL::ON_POSITIVE_SIDE); + P t1[]={cp(1,2,3),cp(3,2,1),cp(2,4,2)}; + assert(sbds(t1+0,t1+2,cp(2,2,3.414)) == CGAL::ON_BOUNDED_SIDE); + assert(sbds(t1+0,t1+2,cp(1,2,3)) == CGAL::ON_BOUNDARY); + assert(sbds(t1+0,t1+2,cp(2,2,3.415)) == CGAL::ON_UNBOUNDED_SIDE); + assert(sbds(t1+0,t1+3,cp(2.1,3.5,1.9)) == CGAL::ON_BOUNDED_SIDE); + assert(sbds(t1+0,t1+3,cp(10,10,10)) == CGAL::ON_UNBOUNDED_SIDE); } template struct CGAL::Epick_d >; template struct CGAL::Epick_d >; From a0c9c475738f8e1df9fe799a386cde3aad5eb5b2 Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Tue, 31 Mar 2015 16:48:46 +0200 Subject: [PATCH 2/5] Documentation with the new names: Construct_circumcenter_d, Compute_squared_radius_d, Side_of_bounded_sphere_d. --- Kernel_d/doc/Kernel_d/CGAL/Epick_d.h | 30 +++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/Kernel_d/doc/Kernel_d/CGAL/Epick_d.h b/Kernel_d/doc/Kernel_d/CGAL/Epick_d.h index 2cdb2c5cb85..a77d55c724f 100644 --- a/Kernel_d/doc/Kernel_d/CGAL/Epick_d.h +++ b/Kernel_d/doc/Kernel_d/CGAL/Epick_d.h @@ -68,7 +68,35 @@ Cartesian_const_iterator_d cartesian_begin()const; /*! returns an iterator pointing beyond the last Cartesian coordinate. */ Cartesian_const_iterator_d cartesian_end()const; }; -/// @} +/*! \cgalModels `Kernel_d::Center_of_sphere_d` + */ +struct Construct_circumcenter_d { +/*! returns the center of the sphere defined by `A=tuple[first,last)`. The sphere is centered in the affine hull of A and passes through all the points of A. The order of the points of A does not matter. + \pre A is affinely independant. + \cgalRequires The value type of `ForwardIterator` is `Epick_d::Point_d`. + */ +template +Point_d operator()(ForwardIterator first, ForwardIterator last); +}; +struct Compute_squared_radius_d { +/*! returns the radius of the sphere defined by `A=tuple[first,last)`. The sphere is centered in the affine hull of A and passes through all the points of A. The order of the points of A does not matter. + \pre A is affinely independant. + \cgalRequires The value type of `ForwardIterator` is `Epick_d::Point_d`. + */ +template +Point_d operator()(ForwardIterator first, ForwardIterator last); +}; +/*! \cgalModels `Kernel_d::Side_of_bounded_sphere_d` + */ +struct Side_of_bounded_sphere_d { +/*! returns the relative position of point p to the sphere defined by `A=tuple[first,last)`. The sphere is centered in the affine hull of A and passes through all the points of A. The order of the points of A does not matter. + \pre A is affinely independant. + \cgalRequires The value type of `ForwardIterator` is `Epick_d::Point_d`. + */ +template +Bounded_side operator()(ForwardIterator first, ForwardIterator last, const Point_d&p); +}; +Compute_squared_radius_d compute_squared_radius_d_object(); }; /* end Epick_d */ } /* end namespace CGAL */ From 3c489ef48291545d07f06f67694e59784be72706 Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Tue, 12 May 2015 17:25:51 +0200 Subject: [PATCH 3/5] More circum{sphere,center,radius} related functors. --- Kernel_d/doc/Kernel_d/CGAL/Epick_d.h | 1 + .../CGAL/NewKernel_d/Kernel_d_interface.h | 16 +- .../include/CGAL/NewKernel_d/Types/Sphere.h | 34 +-- .../NewKernel_d/function_objects_cartesian.h | 196 ++++++++++++------ .../include/CGAL/NewKernel_d/functor_tags.h | 4 +- NewKernel_d/test/NewKernel_d/Epick_d.cpp | 14 +- 6 files changed, 165 insertions(+), 100 deletions(-) diff --git a/Kernel_d/doc/Kernel_d/CGAL/Epick_d.h b/Kernel_d/doc/Kernel_d/CGAL/Epick_d.h index a77d55c724f..97c97fd3313 100644 --- a/Kernel_d/doc/Kernel_d/CGAL/Epick_d.h +++ b/Kernel_d/doc/Kernel_d/CGAL/Epick_d.h @@ -97,6 +97,7 @@ struct Side_of_bounded_sphere_d { template Bounded_side operator()(ForwardIterator first, ForwardIterator last, const Point_d&p); }; +Construct_circumcenter_d construct_circumcenter_d_object(); Compute_squared_radius_d compute_squared_radius_d_object(); }; /* end Epick_d */ } /* end namespace CGAL */ diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Kernel_d_interface.h b/NewKernel_d/include/CGAL/NewKernel_d/Kernel_d_interface.h index 5691da363e8..758c9bdb68c 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Kernel_d_interface.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Kernel_d_interface.h @@ -127,6 +127,17 @@ template struct Kernel_d_interface : public Base_ { return operator()(v, End_tag()); } }; + struct Compute_squared_radius_d : private Store_kernel { + typedef Kernel R_; // for the macro + CGAL_FUNCTOR_INIT_STORE(Compute_squared_radius_d) + typedef FT result_type; + template FT operator()(CGAL_FORWARDABLE(S) s)const{ + return typename Get_functor::type(this->kernel())(CGAL_FORWARD(S,s)); + } + template FT operator()(I b, I e)const{ + return typename Get_functor::type(this->kernel())(b,e); + } + }; typedef typename Construct_cartesian_const_iterator_d::result_type Cartesian_const_iterator_d; typedef typename Get_functor::type Squared_distance_d; typedef typename Get_functor::type Affine_rank_d; @@ -137,9 +148,10 @@ template struct Kernel_d_interface : public Base_ { typedef typename Get_functor::type Linear_rank_d; typedef typename Get_functor::type Linearly_independent_d; typedef typename Get_functor::type Oriented_side_d; - typedef typename Get_functor::type Side_of_bounded_sphere_d; + typedef typename Get_functor::type Side_of_bounded_sphere_d; typedef typename Get_functor::type Center_of_sphere_d; + typedef typename Get_functor::type Construct_circumcenter_d; typedef typename Get_functor::type Value_at_d; typedef typename Get_functor::type Point_of_sphere_d; typedef typename Get_functor::type Orthogonal_vector_d; @@ -186,8 +198,10 @@ template struct Kernel_d_interface : public Base_ { Construct_segment_d construct_segment_d_object()const{ return Construct_segment_d(*this); } Construct_sphere_d construct_sphere_d_object()const{ return Construct_sphere_d(*this); } Construct_hyperplane_d construct_hyperplane_d_object()const{ return Construct_hyperplane_d(*this); } + Compute_squared_radius_d compute_squared_radius_d_object()const{ return Compute_squared_radius_d(*this); } Squared_distance_d squared_distance_d_object()const{ return Squared_distance_d(*this); } Center_of_sphere_d center_of_sphere_d_object()const{ return Center_of_sphere_d(*this); } + Construct_circumcenter_d construct_circumcenter_d_object()const{ return Construct_circumcenter_d(*this); } Construct_direction_d construct_direction_d_object()const{ return Construct_direction_d(*this); } Construct_line_d construct_line_d_object()const{ return Construct_line_d(*this); } Construct_ray_d construct_ray_d_object()const{ return Construct_ray_d(*this); } diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Types/Sphere.h b/NewKernel_d/include/CGAL/NewKernel_d/Types/Sphere.h index 7ab10f16b99..ec565f2cc8c 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Types/Sphere.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Types/Sphere.h @@ -52,39 +52,13 @@ template struct Construct_sphere : Store_kernel { } template result_type operator()(Iter f, Iter e)const{ - // 2*(x-y).c == x^2-y^2 - typedef typename R_::LA LA; - typedef typename LA::Square_matrix Matrix; - typedef typename LA::Vector Vec; - typedef typename LA::Construct_vector CVec; typedef typename Get_type::type Point; - typename Get_functor::type c(this->kernel()); - typename Get_functor >::type cp(this->kernel()); - typename Get_functor::type pd(this->kernel()); - typename Get_functor::type sdo(this->kernel()); + typename Get_functor::type cc(this->kernel()); typename Get_functor::type sd(this->kernel()); - Point const& p0=*f; - int d = pd(p0); - FT const& n0 = sdo(p0); - Matrix m(d,d); - Vec b = typename CVec::Dimension()(d); - // Write the point coordinates in lines. - int i; - for(i=0; ++f!=e; ++i) { - Point const& p=*f; - for(int j=0;joperator()(CGAL_MOVE(center), r2); } }; 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 4a092442597..726c6f1e8fa 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h @@ -600,6 +600,123 @@ template struct Side_of_oriented_sphere : private Store_kernel { CGAL_KD_DEFAULT_FUNCTOR(Side_of_oriented_sphere_tag,(CartesianDKernelFunctors::Side_of_oriented_sphere),(Point_tag),(Point_dimension_tag,Squared_distance_to_origin_tag,Compute_point_cartesian_coordinate_tag)); +namespace CartesianDKernelFunctors { +template struct Construct_circumcenter : Store_kernel { + CGAL_FUNCTOR_INIT_STORE(Construct_circumcenter) + typedef typename Get_type::type Point; + typedef Point result_type; + typedef typename Get_type::type FT; + template + result_type operator()(Iter f, Iter e)const{ + typedef typename Get_type::type Point; + typedef typename R_::LA LA; + typename Get_functor::type c(this->kernel()); + typename Get_functor >::type cp(this->kernel()); + typename Get_functor::type pd(this->kernel()); + typename Get_functor::type sdo(this->kernel()); + + Point const& p0=*f; + int d = pd(p0); + if (d+1 == std::distance(f,e)) + { + // 2*(x-y).c == x^2-y^2 + typedef typename LA::Square_matrix Matrix; + typedef typename LA::Vector Vec; + typedef typename LA::Construct_vector CVec; + FT const& n0 = sdo(p0); + Matrix m(d,d); + Vec b = typename CVec::Dimension()(d); + // Write the point coordinates in lines. + int i; + for(i=0; ++f!=e; ++i) { + Point const& p=*f; + for(int j=0;j::Other LAd; + typedef typename LAd::Square_matrix Matrix; + typedef typename LAd::Vector Vec; + typename Get_functor::type sp(this->kernel()); + int k=std::distance(f,e); + int d=pd(p0); + Matrix m(k,k); + Vec b(k); + Vec l(k); + int j,i=0; + for(Iter f2=f;f2!=e;++f2,++i){ + b(i)=m(i,i)=sdo(*f2); + j=0; + for(Iter f3=f;f3!=e;++f3,++j){ + m(j,i)=m(i,j)=sp(*f2,*f3); + } + } + for(i=1;i),(Point_tag),(Construct_ttag,Compute_point_cartesian_coordinate_tag,Scalar_product_tag,Squared_distance_to_origin_tag,Point_dimension_tag)); + +namespace CartesianDKernelFunctors { +template struct Squared_circumradius : Store_kernel { + CGAL_FUNCTOR_INIT_STORE(Squared_circumradius) + typedef typename Get_type::type result_type; + template + result_type operator()(Iter f, Iter e)const{ + typename Get_functor::type cc(this->kernel()); + typename Get_functor::type sd(this->kernel()); + return sd(cc(f, e), *f); + } +}; +} + +CGAL_KD_DEFAULT_FUNCTOR(Squared_circumradius_tag,(CartesianDKernelFunctors::Squared_circumradius),(Point_tag),(Construct_circumcenter_tag,Squared_distance_tag)); + namespace CartesianDKernelFunctors { // TODO: implement it directly, it should be at least as fast as Side_of_oriented_sphere. template struct Side_of_bounded_sphere : private Store_kernel { @@ -611,6 +728,9 @@ template struct Side_of_bounded_sphere : private Store_kernel { template result_type operator()(Iter f, Iter const& e) const { Point const& p0 = *f++; // *--e ? + typename Get_functor::type pd(this->kernel()); + //FIXME: Doesn't work for non-full dimension. + CGAL_assertion (std::distance(f,e) == pd(p0)+1); return operator() (f, e, p0); } @@ -641,78 +761,22 @@ template struct Side_of_bounded_sphere : private Store_kernel { CGAL_KD_DEFAULT_FUNCTOR(Side_of_bounded_sphere_tag,(CartesianDKernelFunctors::Side_of_bounded_sphere),(Point_tag),(Side_of_oriented_sphere_tag,Orientation_of_points_tag)); namespace CartesianDKernelFunctors { -template struct Side_of_bounded_diametral_sphere : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Side_of_bounded_diametral_sphere) - typedef R_ R; - typedef typename Get_type::type Point; - typedef typename Get_type::type result_type; - typedef typename Get_functor >::type CP; - typedef typename Get_functor::type CD; - typedef typename R::Max_ambient_dimension D2; - typedef typename R::LA::template Rebind_dimension::Other LA; - typedef typename LA::Square_matrix Matrix; - typedef typename LA::Vector Vec; +template struct Side_of_bounded_circumsphere : private Store_kernel { + CGAL_FUNCTOR_INIT_STORE(Side_of_bounded_circumsphere) + typedef typename Get_type::type result_type; - template - result_type operator()(Iter f, Iter const& e, Point const& p0) const { - typename Get_functor::type sp(this->kernel()); - typename Get_functor::type sqdo(this->kernel()); - typename Get_functor::type c(this->kernel()); - typename Get_functor::type pd(this->kernel()); + template + result_type operator()(Iter f, Iter const& e, P const& p0) const { + // TODO: Special case when the dimension is full. + typename Get_functor::type cc(this->kernel()); + typename Get_functor::type cd(this->kernel()); - /* - * Matrix P=(p1, p2, ...) (each point as a column) - * Matrix Q=2*t(p2-p1,p3-p1, ...) (each vector as a line) - * Matrix M: QP, adding a line of 1 at the top - * Vector B: (1, p2^2-p1^2, p3^2-p1^2, ...) - * Solve ML=B, the center of the sphere is PL - * - * It would likely be faster to write P then transpose, multiply, - * etc instead of doing it by hand. - */ - // TODO: split the main code into Center_of_diametral_sphere - // TODO: check for degenerate cases - - int k=std::distance(f,e); - int d=pd(p0); - Matrix m(k,k); - Vec b(k); - Vec l(k); - int j,i=0; - for(Iter f2=f;f2!=e;++f2,++i){ - b(i)=m(i,i)=sqdo(*f2); - j=0; - for(Iter f3=f;f3!=e;++f3,++j){ - m(j,i)=m(i,j)=sp(*f2,*f3); - } - } - for(i=1;ikernel())(R::LA::vector_begin(center),R::LA::vector_end(center)); - return enum_cast(CD(this->kernel())(cent,*f,p0)); + return enum_cast(cd(cc(f, e), *f, p0)); } }; } -CGAL_KD_DEFAULT_FUNCTOR(Side_of_bounded_diametral_sphere_tag,(CartesianDKernelFunctors::Side_of_bounded_diametral_sphere),(Point_tag),(Point_dimension_tag,Squared_distance_to_origin_tag,Compute_point_cartesian_coordinate_tag,Side_of_bounded_sphere_tag)); +CGAL_KD_DEFAULT_FUNCTOR(Side_of_bounded_circumsphere_tag,(CartesianDKernelFunctors::Side_of_bounded_circumsphere),(Point_tag),(Squared_distance_tag,Construct_circumcenter_tag)); namespace CartesianDKernelFunctors { template struct Point_to_vector : private Store_kernel { diff --git a/NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h b/NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h index b8d9d856af2..49daeb1df0e 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h @@ -210,6 +210,7 @@ namespace CGAL { CGAL_DECL_COMPUTE(Squared_distance_to_origin); CGAL_DECL_COMPUTE(Squared_length); CGAL_DECL_COMPUTE(Squared_radius); + CGAL_DECL_COMPUTE(Squared_circumradius); CGAL_DECL_COMPUTE(Scalar_product); CGAL_DECL_COMPUTE(Hyperplane_translation); CGAL_DECL_COMPUTE(Value_at); @@ -262,6 +263,7 @@ namespace CGAL { CGAL_DECL_CONSTRUCT(Translated_point,Point); CGAL_DECL_CONSTRUCT(Point_to_vector,Vector); CGAL_DECL_CONSTRUCT(Vector_to_point,Point); + CGAL_DECL_CONSTRUCT(Construct_circumcenter,Point); #undef CGAL_DECL_CONSTRUCT #if 0 #define CGAL_DECL_ITER_CONSTRUCT(X,Y) struct X##_tag {}; \ @@ -291,7 +293,7 @@ namespace CGAL { CGAL_DECL_PREDICATE(Orientation_of_vectors); CGAL_DECL_PREDICATE(Side_of_oriented_sphere); CGAL_DECL_PREDICATE(Side_of_bounded_sphere); - CGAL_DECL_PREDICATE(Side_of_bounded_diametral_sphere); + CGAL_DECL_PREDICATE(Side_of_bounded_circumsphere); CGAL_DECL_PREDICATE(Contained_in_affine_hull); CGAL_DECL_PREDICATE(In_flat_orientation); CGAL_DECL_PREDICATE(In_flat_side_of_oriented_sphere); diff --git a/NewKernel_d/test/NewKernel_d/Epick_d.cpp b/NewKernel_d/test/NewKernel_d/Epick_d.cpp index 29effafa0e0..e3c79823950 100644 --- a/NewKernel_d/test/NewKernel_d/Epick_d.cpp +++ b/NewKernel_d/test/NewKernel_d/Epick_d.cpp @@ -80,6 +80,7 @@ void test2(){ typedef typename K1::Construct_sphere_d CSp; typedef typename CGAL::Get_functor::type CSE; typedef typename K1::Construct_cartesian_const_iterator_d CCI; + typedef typename K1::Construct_circumcenter_d CCc; typedef typename K1::Linear_base_d LB; typedef typename K1::Orientation_d PO; typedef typename K1::Side_of_oriented_sphere_d SOS; @@ -115,6 +116,7 @@ void test2(){ typedef typename K1::Position_on_line_d PoL; typedef typename K1::Equal_d E; typedef typename K1::Squared_distance_d SD; + typedef typename K1::Compute_squared_radius_d SR; CGAL_USE_TYPE(AT); CGAL_USE_TYPE(D); @@ -131,6 +133,7 @@ void test2(){ CV cv Kinit(construct_vector_d_object); CCI ci Kinit(construct_cartesian_const_iterator_d_object); CC cc Kinit(compute_coordinate_d_object); + CCc ccc Kinit(construct_circumcenter_d_object); PO po Kinit(orientation_d_object); CS cs Kinit(construct_segment_d_object); CSp csp Kinit(construct_sphere_d_object); @@ -168,6 +171,7 @@ void test2(){ PoL pol Kinit(position_on_line_d_object); E ed Kinit(equal_d_object); SD sd Kinit(squared_distance_d_object); + SR sr Kinit(compute_squared_radius_d_object); CGAL_USE(bc); CGAL_USE(pol); @@ -217,6 +221,12 @@ void test2(){ assert(sos(tabn+0,tabn+3,P(3,3))==CGAL::ON_POSITIVE_SIDE); assert(sbs(tabp+0,tabp+3,P(3,3))==CGAL::ON_UNBOUNDED_SIDE); assert(sbs(tabn+0,tabn+3,P(3,3))==CGAL::ON_UNBOUNDED_SIDE); + assert(sbs(tabp+1,tabp+3,P(1,1))==CGAL::ON_BOUNDARY); + assert(ccc(tabp+1,tabp+2)==tabp[1]); + assert(ccc(tabn+0,tabn+2)==P(0,.5)); + assert(sr(tabp+2,tabp+3)==0); + assert(sr(tabp+1,tabp+3)==.5); + assert(sbs(tabp+1,tabp+3,P(10,-1))==CGAL::ON_UNBOUNDED_SIDE); assert(sos(tabp+0,tabp+3,P(.5,.5))==CGAL::ON_POSITIVE_SIDE); assert(sos(tabn+0,tabn+3,P(.5,.5))==CGAL::ON_NEGATIVE_SIDE); assert(sbs(tabp+0,tabp+3,P(.5,.5))==CGAL::ON_BOUNDED_SIDE); @@ -372,7 +382,7 @@ void test3(){ typedef typename K1::Squared_distance_d SD; typedef typename K1::Point_dimension_d PD; typedef typename K1::Affinely_independent_d AI; - typedef typename CGAL::Get_functor::type SBDS; + typedef typename CGAL::Get_functor::type SBDS; Ker k #if 1 @@ -431,7 +441,7 @@ void test3(){ P tab[]={a,b,c,d,e}; std::cout << po (&tab[0],tab+4) << ' '; std::cout << sos(&tab[0],tab+5) << ' '; - std::cout << sbs(&tab[0],tab+5) << std::endl; + std::cout << sbs(tab+1,tab+5,tab[0]) << std::endl; FO fo=cfo(&tab[0],tab+3); std::cout << fo; P x[]={cp(2,2,3),cp(2,2,0),cp(1,2,1)}; From 10ed4a29915d6d9a14db293d7eab6174cd6b80c6 Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Tue, 12 May 2015 18:09:41 +0200 Subject: [PATCH 4/5] Rename functor in the test. --- NewKernel_d/test/NewKernel_d/Epick_d.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NewKernel_d/test/NewKernel_d/Epick_d.cpp b/NewKernel_d/test/NewKernel_d/Epick_d.cpp index ffdeeade137..860f90670c8 100644 --- a/NewKernel_d/test/NewKernel_d/Epick_d.cpp +++ b/NewKernel_d/test/NewKernel_d/Epick_d.cpp @@ -411,7 +411,7 @@ void test3(){ typedef typename K1::Point_dimension_d PD; typedef typename K1::Affinely_independent_d AI; typedef typename K1::Scaled_vector_d SV; - typedef typename CGAL::Get_functor::type SBDS; + typedef typename K1::Side_of_bounded_sphere_d SBDS; Ker k #if 1 @@ -443,7 +443,7 @@ void test3(){ SD sd Kinit(squared_distance_d_object); PD pd Kinit(point_dimension_d_object); AI ai Kinit(affinely_independent_d_object); - SBDS sbds (k); + SBDS sbds Kinit(side_of_bounded_sphere_d_object); P a; // Triangulation needs this :-( a=cp(2,3,4); assert(pd(a)==3); From 3a322b76e5a69465a12c77a2d7adb94c4f3380d4 Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Wed, 13 May 2015 16:18:38 +0200 Subject: [PATCH 5/5] Explicit cast to make VS quiet (?) --- .../include/CGAL/NewKernel_d/function_objects_cartesian.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 1395e28e778..78602acfade 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h @@ -681,7 +681,7 @@ template struct Construct_circumcenter : Store_kernel { typedef typename LAd::Square_matrix Matrix; typedef typename LAd::Vector Vec; typename Get_functor::type sp(this->kernel()); - int k=std::distance(f,e); + int k=static_cast(std::distance(f,e)); int d=pd(p0); Matrix m(k,k); Vec b(k);