diff options
author | Gard Spreemann <gspreemann@gmail.com> | 2018-03-11 18:13:21 +0100 |
---|---|---|
committer | Gard Spreemann <gspreemann@gmail.com> | 2018-03-11 18:13:21 +0100 |
commit | 41a1b8c2728e212c832c0384c8bb424139a247cf (patch) | |
tree | 226a1b466af789b259228b31646dbfbaa23e6dc4 /include/gudhi_patches/CGAL/NewKernel_d/Types | |
parent | 8e51c74d8855a641c006765ee246402e218828f3 (diff) |
Remove CGAL patches so as not to complicate copyright information.
Diffstat (limited to 'include/gudhi_patches/CGAL/NewKernel_d/Types')
8 files changed, 0 insertions, 896 deletions
diff --git a/include/gudhi_patches/CGAL/NewKernel_d/Types/Aff_transformation.h b/include/gudhi_patches/CGAL/NewKernel_d/Types/Aff_transformation.h deleted file mode 100644 index 6d9f070f..00000000 --- a/include/gudhi_patches/CGAL/NewKernel_d/Types/Aff_transformation.h +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2014 -// INRIA Saclay-Ile de France (France) -// -// This file is part of CGAL (www.cgal.org); you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation; either version 3 of the License, -// or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// Author(s) : Marc Glisse - -#ifndef CGAL_KD_TYPE_AFF_TRANSFORMATION_H -#define CGAL_KD_TYPE_AFF_TRANSFORMATION_H -#include <CGAL/config.h> -#include <CGAL/NewKernel_d/store_kernel.h> -#include <boost/preprocessor/repetition.hpp> - -// Dummy, that's all the Kernel_d concept requires, so a useful class will wait. - -namespace CGAL { -template<class R_> -struct Aff_transformation { - typedef R_ R; -}; -namespace CartesianDKernelFunctors { -template<class R_> struct Construct_aff_transformation { - CGAL_FUNCTOR_INIT_IGNORE(Construct_aff_transformation) - typedef R_ R; - typedef typename Get_type<R, Aff_transformation_tag>::type result_type; -#ifdef CGAL_CXX11 - template<class...T> - result_type operator()(T&&...)const{return result_type();} -#else - result_type operator()()const{ - return result_type(); - } -#define CGAL_CODE(Z,N,_) template<BOOST_PP_ENUM_PARAMS(N,class U)> \ - result_type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,U,const& BOOST_PP_INTERCEPT))const{ \ - return result_type(); \ - } - BOOST_PP_REPEAT_FROM_TO(1, 9, CGAL_CODE, _ ) -#undef CGAL_CODE - -#endif -}; -} -CGAL_KD_DEFAULT_TYPE(Aff_transformation_tag,(CGAL::Aff_transformation<K>),(),()); -CGAL_KD_DEFAULT_FUNCTOR(Construct_ttag<Aff_transformation_tag>,(CartesianDKernelFunctors::Construct_aff_transformation<K>),(Aff_transformation_tag),()); - -} -#endif diff --git a/include/gudhi_patches/CGAL/NewKernel_d/Types/Hyperplane.h b/include/gudhi_patches/CGAL/NewKernel_d/Types/Hyperplane.h deleted file mode 100644 index 14e35b01..00000000 --- a/include/gudhi_patches/CGAL/NewKernel_d/Types/Hyperplane.h +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (c) 2014 -// INRIA Saclay-Ile de France (France) -// -// This file is part of CGAL (www.cgal.org); you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation; either version 3 of the License, -// or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// Author(s) : Marc Glisse - -#ifndef CGAL_KD_TYPE_HYPERPLANE_H -#define CGAL_KD_TYPE_HYPERPLANE_H -#include <CGAL/enum.h> -#include <CGAL/number_utils.h> -#include <CGAL/NewKernel_d/store_kernel.h> -#include <boost/iterator/transform_iterator.hpp> -#include <boost/iterator/counting_iterator.hpp> -namespace CGAL { -template <class R_> class Hyperplane { - typedef typename Get_type<R_, FT_tag>::type FT_; - typedef typename Get_type<R_, Vector_tag>::type Vector_; - Vector_ v_; - FT_ s_; - - public: - Hyperplane(Vector_ const&v, FT_ const&s): v_(v), s_(s) {} - // TODO: Add a piecewise constructor? - - Vector_ const& orthogonal_vector()const{return v_;} - FT_ translation()const{return s_;} -}; -namespace CartesianDKernelFunctors { -template <class R_> struct Construct_hyperplane : Store_kernel<R_> { - CGAL_FUNCTOR_INIT_STORE(Construct_hyperplane) - typedef typename Get_type<R_, Hyperplane_tag>::type result_type; - typedef typename Get_type<R_, Point_tag>::type Point; - typedef typename Get_type<R_, Vector_tag>::type Vector; - typedef typename Get_type<R_, FT_tag>::type FT; - private: - struct One { - typedef int result_type; - template<class T>int const& operator()(T const&)const{ - static const int one = 1; - return one; - } - }; - public: - - result_type operator()(Vector const&a, FT const&b)const{ - return result_type(a,b); - } - // Not really needed - result_type operator()()const{ - typename Get_functor<R_, Construct_ttag<Vector_tag> >::type cv(this->kernel()); - return result_type(cv(),0); - } - - template <class Iter> - result_type through(Iter f, Iter e)const{ - typedef typename R_::LA LA; - typedef typename R_::Default_ambient_dimension D1; - typedef typename R_::Max_ambient_dimension D2; - typedef typename Increment_dimension<D1>::type D1i; - typedef typename Increment_dimension<D2>::type D2i; - - typedef Eigen::Matrix<FT, Eigen_dimension<D1>::value, Eigen_dimension<D1i>::value, - Eigen::ColMajor|Eigen::AutoAlign, Eigen_dimension<D2>::value, Eigen_dimension<D2i>::value> Matrix; - typedef Eigen::Matrix<FT, Eigen_dimension<D1i>::value, 1, - Eigen::ColMajor|Eigen::AutoAlign, Eigen_dimension<D2i>::value, 1> Vec; - typename Get_functor<R_, Compute_point_cartesian_coordinate_tag>::type c(this->kernel()); - typename Get_functor<R_, Construct_ttag<Vector_tag> >::type cv(this->kernel()); - typename Get_functor<R_, Point_dimension_tag>::type pd(this->kernel()); - - Point const& p0=*f; - int d = pd(p0); - Matrix m(d,d+1); - for(int j=0;j<d;++j) - m(0,j)=c(p0,j); - // Write the point coordinates in lines. - int i; - for (i=1; ++f!=e; ++i) { - Point const& p=*f; - for(int j=0;j<d;++j) - m(i,j)=c(p,j); - } - CGAL_assertion (i == d); - for(i=0;i<d;++i) - m(i,d)=-1; - Eigen::FullPivLU<Matrix> lu(m); - Vec res = lu.kernel().col(0); - return this->operator()(cv(d,LA::vector_begin(res),LA::vector_end(res)-1),res(d)); - } - template <class Iter> - result_type operator()(Iter f, Iter e, Point const&p, CGAL::Oriented_side s=ON_ORIENTED_BOUNDARY)const{ - result_type ret = through(f, e); - // I don't really like using ON_ORIENTED_BOUNDARY to mean that we don't care, we might as well not pass 'p' at all. - if (s == ON_ORIENTED_BOUNDARY) - return ret; - typename Get_functor<R_, Oriented_side_tag>::type os(this->kernel()); - CGAL::Oriented_side o = os(ret, p); - if (o == ON_ORIENTED_BOUNDARY || o == s) - return ret; - typename Get_functor<R_, Opposite_vector_tag>::type ov(this->kernel()); - typename Get_functor<R_, Construct_ttag<Vector_tag> >::type cv(this->kernel()); - return this->operator()(ov(ret.orthogonal_vector()), -ret.translation()); - } -}; -template <class R_> struct Orthogonal_vector { - CGAL_FUNCTOR_INIT_IGNORE(Orthogonal_vector) - typedef typename Get_type<R_, Hyperplane_tag>::type Hyperplane; - typedef typename Get_type<R_, Vector_tag>::type const& result_type; - result_type operator()(Hyperplane const&s)const{ - return s.orthogonal_vector(); - } -}; -template <class R_> struct Hyperplane_translation { - CGAL_FUNCTOR_INIT_IGNORE(Hyperplane_translation) - typedef typename Get_type<R_, Hyperplane_tag>::type Hyperplane; - typedef typename Get_type<R_, FT_tag>::type result_type; - // TODO: Is_exact? - result_type operator()(Hyperplane const&s)const{ - return s.translation(); - } -}; -template <class R_> struct Value_at : Store_kernel<R_> { - CGAL_FUNCTOR_INIT_STORE(Value_at) - typedef typename Get_type<R_, Hyperplane_tag>::type Hyperplane; - typedef typename Get_type<R_, Vector_tag>::type Vector; - typedef typename Get_type<R_, Point_tag>::type Point; - typedef typename Get_type<R_, FT_tag>::type FT; - typedef FT result_type; - typedef typename Get_functor<R_, Scalar_product_tag>::type Dot; - typedef typename Get_functor<R_, Point_to_vector_tag>::type P2V; - result_type operator()(Hyperplane const&h, Point const&p)const{ - Dot dot(this->kernel()); - P2V p2v(this->kernel()); - return dot(h.orthogonal_vector(),p2v(p)); - // Use Orthogonal_vector to make it generic? - // Copy the code from Scalar_product to avoid p2v? - } -}; -} -//TODO: Add a condition that the hyperplane type is the one from this file. -CGAL_KD_DEFAULT_TYPE(Hyperplane_tag,(CGAL::Hyperplane<K>),(Vector_tag),()); -CGAL_KD_DEFAULT_FUNCTOR(Construct_ttag<Hyperplane_tag>,(CartesianDKernelFunctors::Construct_hyperplane<K>),(Vector_tag,Hyperplane_tag),(Opposite_vector_tag,Oriented_side_tag)); -CGAL_KD_DEFAULT_FUNCTOR(Orthogonal_vector_tag,(CartesianDKernelFunctors::Orthogonal_vector<K>),(Vector_tag,Hyperplane_tag),()); -CGAL_KD_DEFAULT_FUNCTOR(Hyperplane_translation_tag,(CartesianDKernelFunctors::Hyperplane_translation<K>),(Hyperplane_tag),()); -CGAL_KD_DEFAULT_FUNCTOR(Value_at_tag,(CartesianDKernelFunctors::Value_at<K>),(Point_tag,Vector_tag,Hyperplane_tag),(Scalar_product_tag,Point_to_vector_tag)); -} // namespace CGAL -#endif diff --git a/include/gudhi_patches/CGAL/NewKernel_d/Types/Iso_box.h b/include/gudhi_patches/CGAL/NewKernel_d/Types/Iso_box.h deleted file mode 100644 index d053f351..00000000 --- a/include/gudhi_patches/CGAL/NewKernel_d/Types/Iso_box.h +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) 2014 -// INRIA Saclay-Ile de France (France) -// -// This file is part of CGAL (www.cgal.org); you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation; either version 3 of the License, -// or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// Author(s) : Marc Glisse - -#ifndef CGAL_KERNELD_TYPES_ISO_BOX_H -#define CGAL_KERNELD_TYPES_ISO_BOX_H -#include <utility> -#include <CGAL/basic.h> -#include <CGAL/NewKernel_d/functor_tags.h> -#include <CGAL/Kernel/mpl.h> -#include <CGAL/transforming_pair_iterator.h> -namespace CGAL { -template <class R_> class Iso_box { - typedef typename Get_type<R_, FT_tag>::type FT_; - typedef typename Get_type<R_, Point_tag>::type Point_; - typedef std::pair<Point_,Point_> Data_; - Data_ data; - public: - Iso_box(){} - Iso_box(Point_ const&a, Point_ const&b): data(a,b) {} - Point_ min BOOST_PREVENT_MACRO_SUBSTITUTION ()const{ - return data.first; - } - Point_ max BOOST_PREVENT_MACRO_SUBSTITUTION ()const{ - return data.second; - } -}; -namespace CartesianDKernelFunctors { - template <class R_> struct Construct_iso_box : Store_kernel<R_> { - CGAL_FUNCTOR_INIT_STORE(Construct_iso_box) - typedef typename Get_type<R_, Iso_box_tag>::type result_type; - typedef typename Get_type<R_, RT_tag>::type RT; - typedef typename Get_type<R_, Point_tag>::type Point; - typedef typename Get_functor<R_, Construct_ttag<Point_tag> >::type Cp_; - typedef typename Get_functor<R_, Construct_ttag<Point_cartesian_const_iterator_tag> >::type Ci_; - result_type operator()(Point const&a, Point const&b)const{ - Cp_ cp(this->kernel()); - Ci_ ci(this->kernel()); - return result_type(cp( - make_transforming_pair_iterator(ci(a,Begin_tag()), ci(b,Begin_tag()), Min<RT>()), - make_transforming_pair_iterator(ci(a,End_tag()), ci(b,End_tag()), Min<RT>())), - cp( - make_transforming_pair_iterator(ci(a,Begin_tag()), ci(b,Begin_tag()), Max<RT>()), - make_transforming_pair_iterator(ci(a,End_tag()), ci(b,End_tag()), Max<RT>()))); - } - }; - - template <class R_> struct Construct_min_vertex { - CGAL_FUNCTOR_INIT_IGNORE(Construct_min_vertex) - typedef typename Get_type<R_, Iso_box_tag>::type argument_type; - //TODO: make result_type a reference - typedef typename Get_type<R_, Point_tag>::type result_type; - result_type operator()(argument_type const&b)const{ - return b.min BOOST_PREVENT_MACRO_SUBSTITUTION (); - } - }; - template <class R_> struct Construct_max_vertex { - CGAL_FUNCTOR_INIT_IGNORE(Construct_max_vertex) - typedef typename Get_type<R_, Iso_box_tag>::type argument_type; - typedef typename Get_type<R_, Point_tag>::type result_type; - result_type operator()(argument_type const&b)const{ - return b.max BOOST_PREVENT_MACRO_SUBSTITUTION (); - } - }; -} -//TODO (other types as well) only enable these functors if the Iso_box type is the one defined in this file... -CGAL_KD_DEFAULT_TYPE(Iso_box_tag,(CGAL::Iso_box<K>),(Point_tag),()); -CGAL_KD_DEFAULT_FUNCTOR(Construct_ttag<Iso_box_tag>,(CartesianDKernelFunctors::Construct_iso_box<K>),(Iso_box_tag,Point_tag),(Construct_ttag<Point_cartesian_const_iterator_tag>,Construct_ttag<Point_tag>)); -CGAL_KD_DEFAULT_FUNCTOR(Construct_min_vertex_tag,(CartesianDKernelFunctors::Construct_min_vertex<K>),(Iso_box_tag),()); -CGAL_KD_DEFAULT_FUNCTOR(Construct_max_vertex_tag,(CartesianDKernelFunctors::Construct_max_vertex<K>),(Iso_box_tag),()); -} // namespace CGAL - -#endif // CGAL_KERNELD_TYPES_ISO_BOX_H diff --git a/include/gudhi_patches/CGAL/NewKernel_d/Types/Line.h b/include/gudhi_patches/CGAL/NewKernel_d/Types/Line.h deleted file mode 100644 index 6a09571c..00000000 --- a/include/gudhi_patches/CGAL/NewKernel_d/Types/Line.h +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2014 -// INRIA Saclay-Ile de France (France) -// -// This file is part of CGAL (www.cgal.org); you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation; either version 3 of the License, -// or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// Author(s) : Marc Glisse - -#ifndef CGAL_KERNELD_TYPES_LINE_H -#define CGAL_KERNELD_TYPES_LINE_H -#include <utility> -#include <CGAL/NewKernel_d/functor_tags.h> -#include <CGAL/Kernel/mpl.h> -namespace CGAL { -template <class R_> class Line { - typedef typename Get_type<R_, FT_tag>::type FT_; - typedef typename Get_type<R_, Point_tag>::type Point_; - typedef std::pair<Point_,Point_> Data_; - Data_ data; - public: - Line(){} - Line(Point_ const&a, Point_ const&b): data(a,b) {} - Point_ point(int i)const{ - if(i==0) return data.first; - if(i==1) return data.second; - throw "not implemented"; - } - Line opposite()const{ - return Line(data.second,data.first); - } -}; -namespace CartesianDKernelFunctors { - template <class R_> struct Construct_line : Store_kernel<R_> { - CGAL_FUNCTOR_INIT_STORE(Construct_line) - typedef typename Get_type<R_, Line_tag>::type result_type; - typedef typename Get_type<R_, Point_tag>::type Point; - typedef typename Get_type<R_, Vector_tag>::type Vector; - typedef typename Get_functor<R_, Translated_point_tag>::type Tp_; - //typedef typename Get_functor<R_, Difference_of_points_tag>::type Dp_; - //typedef typename Get_functor<R_, Scaled_vector_tag>::type Sv_; - result_type operator()(Point const&a, Point const&b)const{ - return result_type(a,b); - } - result_type operator()(Point const&a, typename First_if_different<Vector,Point>::Type const&b)const{ - Tp_ tp(this->kernel()); - return result_type(a,tp(a,b)); - } - }; -} -CGAL_KD_DEFAULT_TYPE(Line_tag,(CGAL::Line<K>),(Point_tag),()); -CGAL_KD_DEFAULT_FUNCTOR(Construct_ttag<Line_tag>,(CartesianDKernelFunctors::Construct_line<K>),(Line_tag,Point_tag,Vector_tag),(Translated_point_tag)); - -} // namespace CGAL - -#endif // CGAL_KERNELD_TYPES_LINE_H diff --git a/include/gudhi_patches/CGAL/NewKernel_d/Types/Ray.h b/include/gudhi_patches/CGAL/NewKernel_d/Types/Ray.h deleted file mode 100644 index be845e76..00000000 --- a/include/gudhi_patches/CGAL/NewKernel_d/Types/Ray.h +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2014 -// INRIA Saclay-Ile de France (France) -// -// This file is part of CGAL (www.cgal.org); you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation; either version 3 of the License, -// or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// Author(s) : Marc Glisse - -#ifndef CGAL_KERNELD_TYPES_RAY_H -#define CGAL_KERNELD_TYPES_RAY_H -#include <utility> -#include <CGAL/NewKernel_d/functor_tags.h> -#include <CGAL/Kernel/mpl.h> -namespace CGAL { -template <class R_> class Ray { - typedef typename Get_type<R_, FT_tag>::type FT_; - typedef typename Get_type<R_, Point_tag>::type Point_; - typedef typename Get_type<R_, Vector_tag>::type Vector_; - typedef std::pair<Point_,Vector_> Data_; - Data_ data; - public: - Ray(){} - Ray(Point_ const&a, Vector_ const&b): data(a,b) {} - Point_ source()const{ - return data.first; - } - // FIXME: return a R_::Direction? - Vector_ direction()const{ - return data.second; - } -}; -namespace CartesianDKernelFunctors { - template <class R_> struct Construct_ray : Store_kernel<R_> { - CGAL_FUNCTOR_INIT_STORE(Construct_ray) - typedef typename Get_type<R_, Ray_tag>::type result_type; - typedef typename Get_type<R_, Point_tag>::type Point; - typedef typename Get_type<R_, Vector_tag>::type Vector; - typedef typename Get_functor<R_, Difference_of_points_tag>::type Dp_; - //typedef typename Get_functor<R_, Translated_point_tag>::type Tp_; - //typedef typename Get_functor<R_, Scaled_vector_tag>::type Sv_; - result_type operator()(Point const&a, Vector const&b)const{ - return result_type(a,b); - } - result_type operator()(Point const&a, typename First_if_different<Point,Vector>::Type const&b)const{ - Dp_ dp(this->kernel()); - return result_type(a,dp(b,a)); - } - }; -} -CGAL_KD_DEFAULT_TYPE(Ray_tag,(CGAL::Ray<K>),(Point_tag,Vector_tag),()); -CGAL_KD_DEFAULT_FUNCTOR(Construct_ttag<Ray_tag>,(CartesianDKernelFunctors::Construct_ray<K>),(Point_tag,Ray_tag,Vector_tag),(Difference_of_points_tag)); - -} // namespace CGAL - -#endif // CGAL_KERNELD_TYPES_RAY_H diff --git a/include/gudhi_patches/CGAL/NewKernel_d/Types/Segment.h b/include/gudhi_patches/CGAL/NewKernel_d/Types/Segment.h deleted file mode 100644 index 38361c2b..00000000 --- a/include/gudhi_patches/CGAL/NewKernel_d/Types/Segment.h +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) 2014 -// INRIA Saclay-Ile de France (France) -// -// This file is part of CGAL (www.cgal.org); you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation; either version 3 of the License, -// or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// Author(s) : Marc Glisse - -#ifndef CGAL_KERNELD_SEGMENTD_H -#define CGAL_KERNELD_SEGMENTD_H -#include <CGAL/config.h> -#include <utility> -#include <CGAL/NewKernel_d/functor_tags.h> -namespace CGAL { -template <class R_> class Segment { - typedef typename Get_type<R_, FT_tag>::type FT_; - typedef typename Get_type<R_, Point_tag>::type Point_; - //typedef typename R_::Vector Vector_; - //typedef typename Get_functor<R_, Construct_ttag<Vector_tag> >::type Cv_; -// typedef typename R_::Squared_distance Csd_; - typedef std::pair<Point_,Point_> Data_; - Data_ data; - public: - //typedef Segmentd<R_> Segment; -#ifdef CGAL_CXX11 - //FIXME: don't forward directly, piecewise_constuct should call the point construction functor (I guess? or is it unnecessary?) - template<class...U,class=typename std::enable_if<!std::is_same<std::tuple<typename std::decay<U>::type...>,std::tuple<Segment>>::value>::type> - Segment(U&&...u):data(std::forward<U>(u)...){} -#else - Segment(){} - Segment(Point_ const&a, Point_ const&b): data(a,b) {} - //template<class A,class T1,class T2> - //Segment(A const&,T1 const&t1,T2 const&t2) -#endif - Point_ source()const{return data.first;} - Point_ target()const{return data.second;} - Point_ operator[](int i)const{ - if((i%2)==0) - return source(); - else - return target(); - } - Segment opposite()const{ - return Segment(target(),source()); - } - //Vector_ vector()const{ - // return Cv_()(data.first,data.second); - //} -// FT_ squared_length()const{ -// return Csd_()(data.first,data.second); -// } -}; - -namespace CartesianDKernelFunctors { - -template<class R_> struct Construct_segment : Store_kernel<R_> { - CGAL_FUNCTOR_INIT_STORE(Construct_segment) - typedef R_ R; - typedef typename Get_type<R_, Point_tag>::type Point; - typedef typename Get_type<R_, Segment_tag>::type Segment; - typedef typename Get_functor<R_, Construct_ttag<Point_tag> >::type CP; - typedef Segment result_type; - result_type operator()(Point const&a, Point const&b)const{ - return result_type(a,b); - } - // Not really needed, especially since it forces us to store the kernel - result_type operator()()const{ - Point p = typename Get_functor<R_, Construct_ttag<Point_tag> >::type (this->kernel()) (); - return result_type (p, p); - } - // T should only be std::piecewise_construct_t, but we shouldn't fail if it doesn't exist. - template<class T,class U,class V> - result_type operator()(CGAL_FORWARDABLE(T),CGAL_FORWARDABLE(U) u,CGAL_FORWARDABLE(V) v)const{ - CP cp(this->kernel()); - result_type r = {{ - call_on_tuple_elements<Point>(cp, CGAL_FORWARD(U,u)), - call_on_tuple_elements<Point>(cp, CGAL_FORWARD(V,v)) }}; - return r; - } -}; - -// This should be part of Construct_point, according to Kernel_23 conventions -template<class R_> struct Segment_extremity { - CGAL_FUNCTOR_INIT_IGNORE(Segment_extremity) - typedef R_ R; - typedef typename Get_type<R_, Point_tag>::type Point; - typedef typename Get_type<R_, Segment_tag>::type Segment; - typedef Point result_type; - result_type operator()(Segment const&s, int i)const{ - if(i==0) return s.source(); - CGAL_assertion(i==1); - return s.target(); - } -#ifdef CGAL_CXX11 - result_type operator()(Segment &&s, int i)const{ - if(i==0) return std::move(s.source()); - CGAL_assertion(i==1); - return std::move(s.target()); - } -#endif -}; -} // CartesianDKernelFunctors - -CGAL_KD_DEFAULT_TYPE(Segment_tag,(CGAL::Segment<K>),(Point_tag),()); -CGAL_KD_DEFAULT_FUNCTOR(Construct_ttag<Segment_tag>,(CartesianDKernelFunctors::Construct_segment<K>),(Segment_tag,Point_tag),(Construct_ttag<Point_tag>)); -CGAL_KD_DEFAULT_FUNCTOR(Segment_extremity_tag,(CartesianDKernelFunctors::Segment_extremity<K>),(Segment_tag,Point_tag),()); - -} // namespace CGAL - -#endif // CGAL_KERNELD_SEGMENTD_H diff --git a/include/gudhi_patches/CGAL/NewKernel_d/Types/Sphere.h b/include/gudhi_patches/CGAL/NewKernel_d/Types/Sphere.h deleted file mode 100644 index 114410b4..00000000 --- a/include/gudhi_patches/CGAL/NewKernel_d/Types/Sphere.h +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) 2014 -// INRIA Saclay-Ile de France (France) -// -// This file is part of CGAL (www.cgal.org); you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation; either version 3 of the License, -// or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// Author(s) : Marc Glisse - -#ifndef CGAL_KD_TYPE_SPHERE_H -#define CGAL_KD_TYPE_SPHERE_H -#include <CGAL/NewKernel_d/store_kernel.h> -#include <boost/iterator/counting_iterator.hpp> -namespace CGAL { -template <class R_> class Sphere { - typedef typename Get_type<R_, FT_tag>::type FT_; - typedef typename Get_type<R_, Point_tag>::type Point_; - Point_ c_; - FT_ r2_; - - public: - Sphere(Point_ const&p, FT_ const&r2): c_(p), r2_(r2) {} - // TODO: Add a piecewise constructor? - - Point_ const& center()const{return c_;} - FT_ const& squared_radius()const{return r2_;} -}; - -namespace CartesianDKernelFunctors { -template <class R_> struct Construct_sphere : Store_kernel<R_> { - CGAL_FUNCTOR_INIT_STORE(Construct_sphere) - typedef typename Get_type<R_, Sphere_tag>::type result_type; - typedef typename Get_type<R_, Point_tag>::type Point; - typedef typename Get_type<R_, FT_tag>::type FT; - result_type operator()(Point const&a, FT const&b)const{ - return result_type(a,b); - } - // Not really needed - result_type operator()()const{ - typename Get_functor<R_, Construct_ttag<Point_tag> >::type cp(this->kernel()); - return result_type(cp(),0); - } - template <class Iter> - result_type operator()(Iter f, Iter e)const{ - typename Get_functor<R_, Construct_circumcenter_tag>::type cc(this->kernel()); - typename Get_functor<R_, Squared_distance_tag>::type sd(this->kernel()); - - // It should be possible to avoid copying the center by moving this code to a constructor. - Point center = cc(f, e); - FT const& r2 = sd(center, *f); - return this->operator()(CGAL_MOVE(center), r2); - } -}; - -template <class R_> struct Center_of_sphere : private Store_kernel<R_> { - CGAL_FUNCTOR_INIT_STORE(Center_of_sphere) - typedef typename Get_type<R_, Sphere_tag>::type Sphere; - // No reference because of the second overload - typedef typename Get_type<R_, Point_tag>::type result_type; - - result_type const& operator()(Sphere const&s)const{ - return s.center(); - } - - template<class Iter> - result_type operator()(Iter b, Iter e)const{ - typename Get_functor<R_, Construct_ttag<Sphere_tag> >::type cs(this->kernel()); - return operator()(cs(b,e)); // computes the radius needlessly - } -}; - -template <class R_> struct Squared_radius { - CGAL_FUNCTOR_INIT_IGNORE(Squared_radius) - typedef typename Get_type<R_, Sphere_tag>::type Sphere; - typedef typename Get_type<R_, FT_tag>::type const& result_type; - // TODO: Is_exact? - result_type operator()(Sphere const&s)const{ - return s.squared_radius(); - } -}; - -// FIXME: Move it to the generic functors, using the two above and conditional to the existence of sqrt(FT) -template<class R_> struct Point_of_sphere : private Store_kernel<R_> { - CGAL_FUNCTOR_INIT_STORE(Point_of_sphere) - typedef R_ R; - typedef typename Get_type<R, FT_tag>::type FT; - typedef typename Get_type<R, RT_tag>::type RT; - typedef typename Get_type<R, Point_tag>::type Point; - typedef typename Get_type<R, Sphere_tag>::type Sphere; - typedef typename Get_functor<R, Construct_ttag<Point_tag> >::type CP; - typedef typename Get_functor<R, Construct_ttag<Point_cartesian_const_iterator_tag> >::type CI; - typedef typename Get_functor<R, Point_dimension_tag>::type PD; - typedef Point result_type; - typedef Sphere first_argument_type; - typedef int second_argument_type; - struct Trans : std::binary_function<FT,int,FT> { - FT const& r_; int idx; bool sgn; - Trans (int n, FT const& r, bool b) : r_(r), idx(n), sgn(b) {} - FT operator()(FT const&x, int i)const{ - return (i == idx) ? sgn ? x + r_ : x - r_ : x; - } - }; - result_type operator()(Sphere const&s, int i)const{ - CI ci(this->kernel()); - PD pd(this->kernel()); - typedef boost::counting_iterator<int,std::random_access_iterator_tag> Count; - Point const&c = s.center(); - int d=pd(c); - bool last = (i == d); - FT r = sqrt(s.squared_radius()); - Trans t(last ? 0 : i, r, !last); - return CP(this->kernel())(make_transforming_pair_iterator(ci(c,Begin_tag()),Count(0),t),make_transforming_pair_iterator(ci(c,End_tag()),Count(d),t)); - } -}; -} -CGAL_KD_DEFAULT_TYPE(Sphere_tag,(CGAL::Sphere<K>),(Point_tag),()); -CGAL_KD_DEFAULT_FUNCTOR(Construct_ttag<Sphere_tag>,(CartesianDKernelFunctors::Construct_sphere<K>),(Sphere_tag,Point_tag),(Construct_ttag<Point_tag>,Compute_point_cartesian_coordinate_tag,Squared_distance_tag,Squared_distance_to_origin_tag,Point_dimension_tag)); -CGAL_KD_DEFAULT_FUNCTOR(Center_of_sphere_tag,(CartesianDKernelFunctors::Center_of_sphere<K>),(Sphere_tag,Point_tag),(Construct_ttag<Sphere_tag>)); -CGAL_KD_DEFAULT_FUNCTOR(Squared_radius_tag,(CartesianDKernelFunctors::Squared_radius<K>),(Sphere_tag),()); -CGAL_KD_DEFAULT_FUNCTOR(Point_of_sphere_tag,(CartesianDKernelFunctors::Point_of_sphere<K>),(Sphere_tag,Point_tag),(Construct_ttag<Point_tag>, Construct_ttag<Point_cartesian_const_iterator_tag>)); -} // namespace CGAL -#endif diff --git a/include/gudhi_patches/CGAL/NewKernel_d/Types/Weighted_point.h b/include/gudhi_patches/CGAL/NewKernel_d/Types/Weighted_point.h deleted file mode 100644 index 1caf8701..00000000 --- a/include/gudhi_patches/CGAL/NewKernel_d/Types/Weighted_point.h +++ /dev/null @@ -1,205 +0,0 @@ -// Copyright (c) 2014 -// INRIA Saclay-Ile de France (France) -// -// This file is part of CGAL (www.cgal.org); you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation; either version 3 of the License, -// or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// Author(s) : Marc Glisse - -#ifndef CGAL_KD_TYPE_WP_H -#define CGAL_KD_TYPE_WP_H -#include <CGAL/NewKernel_d/store_kernel.h> -#include <boost/iterator/counting_iterator.hpp> -namespace CGAL { -namespace KerD { -template <class R_> class Weighted_point { - typedef typename Get_type<R_, FT_tag>::type FT_; - typedef typename Get_type<R_, Point_tag>::type Point_; - Point_ c_; - FT_ w_; - - public: - Weighted_point(Point_ const&p, FT_ const&w): c_(p), w_(w) {} - // TODO: Add a piecewise constructor? - - Point_ const& point()const{return c_;} - FT_ const& weight()const{return w_;} -}; -} - -namespace CartesianDKernelFunctors { -template <class R_> struct Construct_weighted_point : Store_kernel<R_> { - CGAL_FUNCTOR_INIT_STORE(Construct_weighted_point) - typedef typename Get_type<R_, Weighted_point_tag>::type result_type; - typedef typename Get_type<R_, Point_tag>::type Point; - typedef typename Get_type<R_, FT_tag>::type FT; - result_type operator()(Point const&a, FT const&b)const{ - return result_type(a,b); - } - // Not really needed - result_type operator()()const{ - typename Get_functor<R_, Construct_ttag<Point_tag> >::type cp(this->kernel()); - return result_type(cp(),0); - } -}; - -template <class R_> struct Point_drop_weight { - CGAL_FUNCTOR_INIT_IGNORE(Point_drop_weight) - typedef typename Get_type<R_, Weighted_point_tag>::type argument_type; - typedef typename Get_type<R_, Point_tag>::type const& result_type; - // Returning a reference is fragile - - result_type operator()(argument_type const&s)const{ - return s.point(); - } -}; - -template <class R_> struct Point_weight { - CGAL_FUNCTOR_INIT_IGNORE(Point_weight) - typedef typename Get_type<R_, Weighted_point_tag>::type argument_type; - typedef typename Get_type<R_, FT_tag>::type result_type; - - result_type operator()(argument_type const&s)const{ - return s.weight(); - } -}; - -template <class R_> struct Power_distance : private Store_kernel<R_> { - CGAL_FUNCTOR_INIT_STORE(Power_distance) - typedef typename Get_type<R_, Weighted_point_tag>::type first_argument_type; - typedef first_argument_type second_argument_type; - typedef typename Get_type<R_, FT_tag>::type result_type; - - result_type operator()(first_argument_type const&a, second_argument_type const&b)const{ - typename Get_functor<R_, Point_drop_weight_tag>::type pdw(this->kernel()); - typename Get_functor<R_, Point_weight_tag>::type pw(this->kernel()); - typename Get_functor<R_, Squared_distance_tag>::type sd(this->kernel()); - return sd(pdw(a),pdw(b))-pw(a)-pw(b); - } -}; -template <class R_> struct Power_distance_to_point : private Store_kernel<R_> { - CGAL_FUNCTOR_INIT_STORE(Power_distance_to_point) - typedef typename Get_type<R_, Weighted_point_tag>::type first_argument_type; - typedef typename Get_type<R_, Point_tag>::type second_argument_type; - typedef typename Get_type<R_, FT_tag>::type result_type; - - result_type operator()(first_argument_type const&a, second_argument_type const&b)const{ - typename Get_functor<R_, Point_drop_weight_tag>::type pdw(this->kernel()); - typename Get_functor<R_, Point_weight_tag>::type pw(this->kernel()); - typename Get_functor<R_, Squared_distance_tag>::type sd(this->kernel()); - return sd(pdw(a),b)-pw(a); - } -}; - -template<class R_> struct Power_side_of_power_sphere : private Store_kernel<R_> { - CGAL_FUNCTOR_INIT_STORE(Power_side_of_power_sphere) - typedef R_ R; - typedef typename Get_type<R, Oriented_side_tag>::type result_type; - - template<class Iter, class Pt> - result_type operator()(Iter const& f, Iter const& e, Pt const& p0) const { - typename Get_functor<R, Power_side_of_power_sphere_raw_tag>::type ptr(this->kernel()); - typename Get_functor<R, Point_drop_weight_tag>::type pdw(this->kernel()); - typename Get_functor<R, Point_weight_tag>::type pw(this->kernel()); - return ptr ( - make_transforming_iterator (f, pdw), - make_transforming_iterator (e, pdw), - make_transforming_iterator (f, pw), - pdw (p0), - pw (p0)); - } -}; - -template<class R_> struct In_flat_power_side_of_power_sphere : private Store_kernel<R_> { - CGAL_FUNCTOR_INIT_STORE(In_flat_power_side_of_power_sphere) - typedef R_ R; - typedef typename Get_type<R, Oriented_side_tag>::type result_type; - - template<class Fo, class Iter, class Pt> - result_type operator()(Fo const& fo, Iter const& f, Iter const& e, Pt const& p0) const { - typename Get_functor<R, In_flat_power_side_of_power_sphere_raw_tag>::type ptr(this->kernel()); - typename Get_functor<R, Point_drop_weight_tag>::type pdw(this->kernel()); - typename Get_functor<R, Point_weight_tag>::type pw(this->kernel()); - return ptr ( - fo, - make_transforming_iterator (f, pdw), - make_transforming_iterator (e, pdw), - make_transforming_iterator (f, pw), - pdw (p0), - pw (p0)); - } -}; - -// Construct a point at (weighted) distance 0 from all the input -template <class R_> struct Power_center : Store_kernel<R_> { - CGAL_FUNCTOR_INIT_STORE(Power_center) - typedef typename Get_type<R_, Weighted_point_tag>::type WPoint; - typedef WPoint result_type; - typedef typename Get_type<R_, Point_tag>::type Point; - typedef typename Get_type<R_, FT_tag>::type FT; - template <class Iter> - result_type operator()(Iter f, Iter e)const{ - // 2*(x-y).c == (x^2-wx^2)-(y^2-wy^2) - typedef typename R_::LA LA; - typedef typename LA::Square_matrix Matrix; - typedef typename LA::Vector Vec; - typedef typename LA::Construct_vector CVec; - typename Get_functor<R_, Compute_point_cartesian_coordinate_tag>::type c(this->kernel()); - typename Get_functor<R_, Construct_ttag<Point_tag> >::type cp(this->kernel()); - typename Get_functor<R_, Point_dimension_tag>::type pd(this->kernel()); - typename Get_functor<R_, Squared_distance_to_origin_tag>::type sdo(this->kernel()); - typename Get_functor<R_, Power_distance_to_point_tag>::type pdp(this->kernel()); - typename Get_functor<R_, Point_drop_weight_tag>::type pdw(this->kernel()); - typename Get_functor<R_, Point_weight_tag>::type pw(this->kernel()); - typename Get_functor<R_, Construct_ttag<Weighted_point_tag> >::type cwp(this->kernel()); - - WPoint const& wp0 = *f; - Point const& p0 = pdw(wp0); - int d = pd(p0); - FT const& n0 = sdo(p0) - pw(wp0); - Matrix m(d,d); - Vec b = typename CVec::Dimension()(d); - // Write the point coordinates in lines. - int i; - for(i=0; ++f!=e; ++i) { - WPoint const& wp=*f; - Point const& p=pdw(wp); - FT const& np = sdo(p) - pw(wp); - for(int j=0;j<d;++j) { - m(i,j)=2*(c(p,j)-c(p0,j)); - b[i] = np - n0; - } - } - CGAL_assertion (i == d); - Vec res = typename CVec::Dimension()(d);; - //std::cout << "Mat: " << m << "\n Vec: " << one << std::endl; - LA::solve(res, CGAL_MOVE(m), CGAL_MOVE(b)); - //std::cout << "Sol: " << res << std::endl; - Point center = cp(d,LA::vector_begin(res),LA::vector_end(res)); - FT const& r2 = pdp (wp0, center); - return cwp(CGAL_MOVE(center), r2); - } -}; -} -CGAL_KD_DEFAULT_TYPE(Weighted_point_tag,(CGAL::KerD::Weighted_point<K>),(Point_tag),()); -CGAL_KD_DEFAULT_FUNCTOR(Construct_ttag<Weighted_point_tag>,(CartesianDKernelFunctors::Construct_weighted_point<K>),(Weighted_point_tag,Point_tag),()); -CGAL_KD_DEFAULT_FUNCTOR(Point_drop_weight_tag,(CartesianDKernelFunctors::Point_drop_weight<K>),(Weighted_point_tag,Point_tag),()); -CGAL_KD_DEFAULT_FUNCTOR(Point_weight_tag,(CartesianDKernelFunctors::Point_weight<K>),(Weighted_point_tag,Point_tag),()); -CGAL_KD_DEFAULT_FUNCTOR(Power_side_of_power_sphere_tag,(CartesianDKernelFunctors::Power_side_of_power_sphere<K>),(Weighted_point_tag),(Power_side_of_power_sphere_raw_tag,Point_drop_weight_tag,Point_weight_tag)); -CGAL_KD_DEFAULT_FUNCTOR(In_flat_power_side_of_power_sphere_tag,(CartesianDKernelFunctors::In_flat_power_side_of_power_sphere<K>),(Weighted_point_tag),(In_flat_power_side_of_power_sphere_raw_tag,Point_drop_weight_tag,Point_weight_tag)); -CGAL_KD_DEFAULT_FUNCTOR(Power_distance_tag,(CartesianDKernelFunctors::Power_distance<K>),(Weighted_point_tag,Point_tag),(Squared_distance_tag,Point_drop_weight_tag,Point_weight_tag)); -CGAL_KD_DEFAULT_FUNCTOR(Power_distance_to_point_tag,(CartesianDKernelFunctors::Power_distance_to_point<K>),(Weighted_point_tag,Point_tag),(Squared_distance_tag,Point_drop_weight_tag,Point_weight_tag)); -CGAL_KD_DEFAULT_FUNCTOR(Power_center_tag,(CartesianDKernelFunctors::Power_center<K>),(Weighted_point_tag,Point_tag),(Compute_point_cartesian_coordinate_tag,Construct_ttag<Point_tag>,Construct_ttag<Weighted_point_tag>,Point_dimension_tag,Squared_distance_to_origin_tag,Point_drop_weight_tag,Point_weight_tag,Power_distance_to_point_tag)); -} // namespace CGAL -#endif |