From 6eeb2259a439cda87fdceb44ade22355a61f1043 Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Tue, 10 May 2011 15:47:00 +0000 Subject: [PATCH] Why shouldn't I use empty commit messages? --- .../CGAL/Kernel_d/Cartesian_converter.h | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 NewKernel_d/include/CGAL/Kernel_d/Cartesian_converter.h diff --git a/NewKernel_d/include/CGAL/Kernel_d/Cartesian_converter.h b/NewKernel_d/include/CGAL/Kernel_d/Cartesian_converter.h new file mode 100644 index 00000000000..a9c2948f240 --- /dev/null +++ b/NewKernel_d/include/CGAL/Kernel_d/Cartesian_converter.h @@ -0,0 +1,68 @@ +#ifndef CGAL_KERNEL_D_CARTESIAN_CONVERTER_H +#define CGAL_KERNEL_D_CARTESIAN_CONVERTER_H + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace CGAL { +template class CartesianD_converter { + typedef typename K1::FT FT1; + typedef typename K2::FT FT2; + typedef NT_converter NTc; + NTc c; + // TODO: store a K1 and a K2 and have a suitable constructor + public: + Origin operator()(Origin const&o)const{return o;} + Null_vector operator()(Null_vector const&v)const{return v;} + FT2 operator()(FT1 const&x)const{return c(x);} + //RT2 operator()(typename First_if_different::Type const&x)const{return cr(x);} + + template + transforming_iterator,It>::type> + operator()(It const& it)const { + return make_transforming_iterator(it,c); + } + + typename K2::Point operator()(typename K1::Point const& p){ + typename K1::template Construct::type i; + return K2::template Construct::type()(operator()(i.begin(p)),operator()(i.end(p))); + } + + typename K2::Vector operator()(typename First_if_different::Type const& p){ + typename K1::template Construct::type i; + return K2::template Construct::type()(operator()(i.begin(p)),operator()(i.end(p))); + } + + typename K2::Object_2 + operator()(const typename K1::Object_2 &obj) const + { +#define CGAL_Kernel_obj(X) \ + if (const typename K1::X * ptr = object_cast(&obj)) \ + return make_object(operator()(*ptr)); + +#include + /* + if (const std::vector * ptr = object_cast >(&obj)) { + std::vector res ( + operator()(ptr->begin()), + operator()(ptr->end()) ); + return make_object(res); + } + */ + + CGAL_error_msg("Cartesiand_converter is unable to determine what is wrapped in the Object"); + return Object(); + } + + +}; + +} //namespace CGAL + +#endif // CGAL_KERNEL_D_CARTESIAN_CONVERTER_H