mirror of https://github.com/CGAL/cgal
Merge pull request #3660 from mglisse/NewKernel_d-lazy_Epeck_d-glisse
Epeck_d
This commit is contained in:
commit
39a245220a
|
|
@ -64,7 +64,7 @@ before_script:
|
|||
- sudo chmod +x /usr/bin/doxygen
|
||||
- mkdir -p build
|
||||
- cd build
|
||||
- /usr/bin/time -f 'Spend time of %C -- %E (real)' cmake -DCMAKE_CXX_FLAGS="-std=c++11" -DCGAL_HEADER_ONLY=ON -DCMAKE_CXX_FLAGS_RELEASE=-DCGAL_NDEBUG -DWITH_examples=ON -DWITH_demos=ON -DWITH_tests=ON ..
|
||||
- /usr/bin/time -f 'Spend time of %C -- %E (real)' cmake -DCMAKE_CXX_FLAGS="-std=c++1y" -DCGAL_HEADER_ONLY=ON -DCMAKE_CXX_FLAGS_RELEASE=-DCGAL_NDEBUG -DWITH_examples=ON -DWITH_demos=ON -DWITH_tests=ON ..
|
||||
- /usr/bin/time -f 'Spend time of %C -- %E (real)' make
|
||||
- /usr/bin/time -f 'Spend time of %C -- %E (real)' sudo make install &>/dev/null
|
||||
- cd ..
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ before_script:
|
|||
- sudo chmod +x /usr/bin/doxygen
|
||||
- mkdir -p build
|
||||
- cd build
|
||||
- /usr/bin/time -f 'Spend time of %C -- %E (real)' cmake -DCMAKE_CXX_FLAGS="-std=c++11" -DCGAL_HEADER_ONLY=ON -DCMAKE_CXX_FLAGS_RELEASE=-DCGAL_NDEBUG -DWITH_examples=ON -DWITH_demos=ON -DWITH_tests=ON ..
|
||||
- /usr/bin/time -f 'Spend time of %C -- %E (real)' cmake -DCMAKE_CXX_FLAGS="-std=c++1y" -DCGAL_HEADER_ONLY=ON -DCMAKE_CXX_FLAGS_RELEASE=-DCGAL_NDEBUG -DWITH_examples=ON -DWITH_demos=ON -DWITH_tests=ON ..
|
||||
- /usr/bin/time -f 'Spend time of %C -- %E (real)' make
|
||||
- /usr/bin/time -f 'Spend time of %C -- %E (real)' sudo make install &>/dev/null
|
||||
- cd ..
|
||||
|
|
|
|||
|
|
@ -35,8 +35,11 @@
|
|||
#include <CGAL/Bbox_2.h>
|
||||
#include <CGAL/Bbox_3.h>
|
||||
#include <vector>
|
||||
#include <type_traits>
|
||||
#include <CGAL/Default.h>
|
||||
#include<CGAL/tss.h>
|
||||
#include <CGAL/is_iterator.h>
|
||||
#include <CGAL/transforming_iterator.h>
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/variant.hpp>
|
||||
|
|
@ -61,42 +64,42 @@ template <class E,
|
|||
class K>
|
||||
class Lazy_kernel_base;
|
||||
|
||||
template <typename AT, typename ET, typename EFT, typename E2A> class Lazy;
|
||||
template <typename AT, typename ET, typename E2A> class Lazy;
|
||||
|
||||
template <typename ET_>
|
||||
class Lazy_exact_nt;
|
||||
|
||||
template <typename AT, typename ET, typename EFT, typename E2A>
|
||||
template <typename AT, typename ET, typename E2A>
|
||||
inline
|
||||
const AT&
|
||||
approx(const Lazy<AT,ET, EFT, E2A>& l)
|
||||
approx(const Lazy<AT,ET,E2A>& l)
|
||||
{
|
||||
return l.approx();
|
||||
}
|
||||
|
||||
// Where is this one (non-const) needed ? Is it ?
|
||||
template <typename AT, typename ET, typename EFT, typename E2A>
|
||||
template <typename AT, typename ET, typename E2A>
|
||||
inline
|
||||
AT&
|
||||
approx(Lazy<AT,ET, EFT, E2A>& l)
|
||||
approx(Lazy<AT,ET,E2A>& l)
|
||||
{
|
||||
return l.approx();
|
||||
}
|
||||
|
||||
|
||||
template <typename AT, typename ET, typename EFT, typename E2A>
|
||||
template <typename AT, typename ET, typename E2A>
|
||||
inline
|
||||
const ET&
|
||||
exact(const Lazy<AT,ET,EFT,E2A>& l)
|
||||
exact(const Lazy<AT,ET,E2A>& l)
|
||||
{
|
||||
return l.exact();
|
||||
}
|
||||
|
||||
|
||||
template <typename AT, typename ET, typename EFT, typename E2A>
|
||||
template <typename AT, typename ET, typename E2A>
|
||||
inline
|
||||
unsigned
|
||||
depth(const Lazy<AT,ET,EFT,E2A>& l)
|
||||
depth(const Lazy<AT,ET,E2A>& l)
|
||||
{
|
||||
return l.depth();
|
||||
}
|
||||
|
|
@ -107,27 +110,27 @@ depth(const Lazy<AT,ET,EFT,E2A>& l)
|
|||
inline const T & exact (const T& d) { return d; } \
|
||||
inline unsigned depth (const T& ) { return 0; }
|
||||
|
||||
|
||||
CGAL_LAZY_FORWARD(long double)
|
||||
CGAL_LAZY_FORWARD(double)
|
||||
CGAL_LAZY_FORWARD(float)
|
||||
CGAL_LAZY_FORWARD(int)
|
||||
CGAL_LAZY_FORWARD(unsigned int)
|
||||
CGAL_LAZY_FORWARD(long)
|
||||
CGAL_LAZY_FORWARD(unsigned long)
|
||||
#ifdef CGAL_USE_LONG_LONG
|
||||
CGAL_LAZY_FORWARD(long long)
|
||||
CGAL_LAZY_FORWARD(unsigned long long)
|
||||
#endif
|
||||
CGAL_LAZY_FORWARD(Return_base_tag)
|
||||
CGAL_LAZY_FORWARD(Null_vector)
|
||||
CGAL_LAZY_FORWARD(Origin)
|
||||
CGAL_LAZY_FORWARD(Orientation)
|
||||
CGAL_LAZY_FORWARD(Bbox_2)
|
||||
CGAL_LAZY_FORWARD(Bbox_3)
|
||||
|
||||
#undef CGAL_LAZY_FORWARD
|
||||
|
||||
template<class T>inline std::enable_if_t<std::is_arithmetic<T>::value||std::is_enum<T>::value, T> approx(T d){return d;}
|
||||
template<class T>inline std::enable_if_t<std::is_arithmetic<T>::value||std::is_enum<T>::value, T> exact (T d){return d;}
|
||||
template<class T>inline std::enable_if_t<std::is_arithmetic<T>::value||std::is_enum<T>::value, unsigned> depth(T){return 0;}
|
||||
|
||||
// For tag classes: Return_base_tag, Homogeneous_tag, Null_vector, Origin
|
||||
template<class T>inline std::enable_if_t<std::is_empty<T>::value, T> exact(T){return {};}
|
||||
template<class T>inline std::enable_if_t<std::is_empty<T>::value, T> approx(T){return {};}
|
||||
template<class T>inline std::enable_if_t<std::is_empty<T>::value, unsigned> depth(T){return 0;}
|
||||
|
||||
// For an iterator, exact/approx applies to the objects it points to
|
||||
template <class T, class=std::enable_if_t<is_iterator_type<T,std::input_iterator_tag>::value>>
|
||||
auto exact(T const& t) {return make_transforming_iterator(t,[](auto const&u){return CGAL::exact(u);});}
|
||||
template <class T, class=std::enable_if_t<is_iterator_type<T,std::input_iterator_tag>::value>>
|
||||
auto approx(T const& t) {return make_transforming_iterator(t,[](auto const&u){return CGAL::approx(u);});}
|
||||
template <class T, class=std::enable_if_t<is_iterator_type<T,std::input_iterator_tag>::value>>
|
||||
unsigned depth(T const&) {return 1;} // FIXME: depth(*t) would be better when t is valid, but not for end iterators, and the true answer would iterate on the range, but we can't do that with only one iterator... We need to replace iterators with ranges to solve that.
|
||||
|
||||
#ifdef CGAL_LAZY_KERNEL_DEBUG
|
||||
template <class T>
|
||||
void
|
||||
|
|
@ -158,10 +161,10 @@ print_at(std::ostream& os, const std::pair<T1,T2> & at)
|
|||
}
|
||||
|
||||
|
||||
template <typename AT, typename ET, typename EFT, typename E2A>
|
||||
template <typename AT, typename ET, typename E2A>
|
||||
inline
|
||||
void
|
||||
print_dag(const Lazy<AT,ET,EFT,E2A>& l, std::ostream& os, int level = 0)
|
||||
print_dag(const Lazy<AT,ET,E2A>& l, std::ostream& os, int level = 0)
|
||||
{
|
||||
l.print_dag(os, level);
|
||||
}
|
||||
|
|
@ -235,7 +238,7 @@ struct Depth_base {
|
|||
template <typename AT_, typename ET, typename E2A>
|
||||
class Lazy_rep : public Rep, public Depth_base
|
||||
{
|
||||
Lazy_rep (const Lazy_rep&); // cannot be copied.
|
||||
Lazy_rep (const Lazy_rep&) = delete; // cannot be copied.
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -247,11 +250,13 @@ public:
|
|||
Lazy_rep ()
|
||||
: at(), et(nullptr){}
|
||||
|
||||
Lazy_rep (const AT& a)
|
||||
: at(a), et(nullptr){}
|
||||
template<class A>
|
||||
Lazy_rep (A&& a)
|
||||
: at(std::forward<A>(a)), et(nullptr){}
|
||||
|
||||
Lazy_rep (const AT& a, const ET& e)
|
||||
: at(a), et(new ET(e)) {}
|
||||
template<class A, class E>
|
||||
Lazy_rep (A&& a, E&& e)
|
||||
: at(std::forward<A>(a)), et(new ET(std::forward<E>(e))) {}
|
||||
|
||||
const AT& approx() const
|
||||
{
|
||||
|
|
@ -311,6 +316,52 @@ public:
|
|||
};
|
||||
|
||||
|
||||
template<typename AT, typename ET, typename AC, typename EC, typename E2A, typename...L>
|
||||
class Lazy_rep_n :
|
||||
public Lazy_rep< AT, ET, E2A >, private EC
|
||||
{
|
||||
// Lazy_rep_0 does not inherit from EC or take a parameter AC. It has different constructors.
|
||||
static_assert(sizeof...(L)>0, "Use Lazy_rep_0 instead");
|
||||
template <class Ei, class Ai, class E2Ai, class Ki> friend class Lazy_kernel_base;
|
||||
mutable std::tuple<L...> l; // L...l; is not yet allowed.
|
||||
const EC& ec() const { return *this; }
|
||||
template<std::size_t...I>
|
||||
void update_exact_helper(std::index_sequence<I...>) const {
|
||||
this->et = new ET(ec()( CGAL::exact( std::get<I>(l) ) ... ) );
|
||||
this->at = E2A()(*(this->et));
|
||||
l = std::tuple<L...>{};
|
||||
}
|
||||
public:
|
||||
void update_exact() const {
|
||||
update_exact_helper(std::make_index_sequence<sizeof...(L)>{});
|
||||
}
|
||||
template<class...LL>
|
||||
Lazy_rep_n(const AC& ac, const EC& ec, LL&&...ll) :
|
||||
Lazy_rep<AT, ET, E2A>(ac(CGAL::approx(ll)...)), EC(ec), l(std::forward<LL>(ll)...)
|
||||
{
|
||||
this->set_depth((std::max)({ -1, (int)CGAL::depth(ll)...}) + 1);
|
||||
}
|
||||
#ifdef CGAL_LAZY_KERNEL_DEBUG
|
||||
private:
|
||||
template<std::size_t...I>
|
||||
void print_dag_helper(std::ostream& os, int level, std::index_sequence<I...>) const {
|
||||
this->print_at_et(os, level);
|
||||
if(this->is_lazy()){
|
||||
# ifdef CGAL_LAZY_KERNEL_DEBUG_SHOW_TYPEID
|
||||
CGAL::msg(os, level, typeid(AC).name());
|
||||
# endif
|
||||
CGAL::msg(os, level, "DAG with " "3" " child nodes:");
|
||||
using expander = int[];
|
||||
expander{0,(CGAL::print_dag(std::get<I>(l), os, level+1),0)...};
|
||||
}
|
||||
}
|
||||
public:
|
||||
void print_dag(std::ostream& os, int level) const {
|
||||
print_dag_helper(os, level, std::make_index_sequence<sizeof...L>{});
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
//____________________________________________________________
|
||||
// The rep for the leaf node
|
||||
|
||||
|
|
@ -330,14 +381,23 @@ public:
|
|||
Lazy_rep_0()
|
||||
: Lazy_rep<AT,ET, E2A>() {}
|
||||
|
||||
Lazy_rep_0(const AT& a, const ET& e)
|
||||
: Lazy_rep<AT,ET,E2A>(a, e) {}
|
||||
template<class A, class E>
|
||||
Lazy_rep_0(A&& a, E&& e)
|
||||
: Lazy_rep<AT,ET,E2A>(std::forward<A>(a), std::forward<E>(e)) {}
|
||||
|
||||
#if 0
|
||||
// unused. Find a less ambiguous placeholder if necessary
|
||||
Lazy_rep_0(const AT& a, void*)
|
||||
: Lazy_rep<AT,ET,E2A>(a) {}
|
||||
#endif
|
||||
|
||||
Lazy_rep_0(const ET& e)
|
||||
: Lazy_rep<AT,ET,E2A>(E2A()(e), e) {}
|
||||
// E2A()(e) and std::forward<E>(e) could be evaluated in any order, but
|
||||
// that's ok, "forward" itself does not modify e, it may only mark it as
|
||||
// modifyable by the outer call, which is obviously sequenced after the inner
|
||||
// call E2A()(e).
|
||||
template<class E>
|
||||
Lazy_rep_0(E&& e)
|
||||
: Lazy_rep<AT,ET,E2A>(E2A()(e), std::forward<E>(e)) {}
|
||||
|
||||
void
|
||||
print_dag(std::ostream& os, int level) const
|
||||
|
|
@ -352,116 +412,6 @@ public:
|
|||
#define CGAL_LEXACT(z,n,t) CGAL::exact( l##n )
|
||||
#define CGAL_LARGS(z, n, t) L##n const& l##n
|
||||
|
||||
#define CGAL_TMAP(z, n, d) typename Type_mapper< L##n, d##K, LK >::type
|
||||
#define CGAL_PRUNE_TREE(z, n, d) l##n = L##n ();
|
||||
#define CGAL_LINIT(z, n, d) l##n(l##n)
|
||||
#define CGAL_LN(z, n, d) d(l##n)
|
||||
#define CGAL_MLIST(z, n, d) mutable L##n l##n;
|
||||
|
||||
//____________________________________________________________
|
||||
|
||||
template <typename AT, typename ET, typename AC, typename EC, typename E2A, typename L1>
|
||||
class Lazy_rep_1
|
||||
: public Lazy_rep<AT, ET, E2A>
|
||||
, private EC
|
||||
{
|
||||
typedef Lazy_rep<AT, ET, E2A> Base;
|
||||
|
||||
mutable L1 l1_;
|
||||
|
||||
const EC& ec() const { return *this; }
|
||||
|
||||
public:
|
||||
|
||||
void
|
||||
update_exact() const
|
||||
{
|
||||
this->et = new ET(ec()(CGAL::exact(l1_)));
|
||||
this->at = E2A()(*(this->et));
|
||||
// Prune lazy tree
|
||||
l1_ = L1();
|
||||
}
|
||||
|
||||
Lazy_rep_1(const AC& ac, const EC& ec, const L1& l1)
|
||||
: Lazy_rep<AT,ET, E2A>(ac(CGAL::approx(l1))), EC(ec), l1_(l1)
|
||||
{
|
||||
this->set_depth(CGAL::depth(l1_) + 1);
|
||||
}
|
||||
|
||||
#ifdef CGAL_LAZY_KERNEL_DEBUG_SHOW_TYPEID
|
||||
# define CGAL_LAZY_PRINT_TYPEID CGAL::msg(os, level, typeid(AC).name());
|
||||
#else // not CGAL_LAZY_KERNEL_DEBUG_SHOW_TYPEID
|
||||
# define CGAL_LAZY_PRINT_TYPEID
|
||||
#endif // not CGAL_LAZY_KERNEL_DEBUG_SHOW_TYPEID
|
||||
|
||||
#ifdef CGAL_LAZY_KERNEL_DEBUG
|
||||
void
|
||||
print_dag(std::ostream& os, int level) const
|
||||
{
|
||||
this->print_at_et(os, level);
|
||||
if(this->is_lazy()){
|
||||
CGAL_LAZY_PRINT_TYPEID
|
||||
CGAL::msg(os, level, "DAG with one child node:");
|
||||
CGAL::print_dag(l1_, os, level+1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef CGAL_LAZY_KERNEL_DEBUG
|
||||
# define CGAL_PRINT_DAG_LN(z, n, d) \
|
||||
CGAL::print_dag(l##n, os, level+1);
|
||||
# define CGAL_LAZY_REP_PRINT_DAG(n) \
|
||||
void print_dag(std::ostream& os, int level) const { \
|
||||
this->print_at_et(os, level); \
|
||||
if(this->is_lazy()){ \
|
||||
CGAL_LAZY_PRINT_TYPEID \
|
||||
CGAL::msg(os, level, "DAG with " #n " child nodes:"); \
|
||||
BOOST_PP_REPEAT(n, CGAL_PRINT_DAG_LN, _) \
|
||||
} \
|
||||
}
|
||||
#else // not CGAL_LAZY_KERNEL_DEBUG
|
||||
# define CGAL_LAZY_REP_PRINT_DAG(n)
|
||||
#endif // not CGAL_LAZY_KERNEL_DEBUG
|
||||
|
||||
#define CGAL_LAZY_REP(z, n, d) \
|
||||
template< typename AT, typename ET, typename AC, typename EC, typename E2A, BOOST_PP_ENUM_PARAMS(n, typename L)> \
|
||||
class Lazy_rep_##n :public Lazy_rep< AT, \
|
||||
ET, \
|
||||
E2A >, \
|
||||
private EC \
|
||||
{ \
|
||||
\
|
||||
template <class Ei, \
|
||||
class Ai, \
|
||||
class E2Ai,\
|
||||
class Ki> \
|
||||
friend class Lazy_kernel_base; \
|
||||
BOOST_PP_REPEAT(n, CGAL_MLIST, _) \
|
||||
const EC& ec() const { return *this; } \
|
||||
public: \
|
||||
void update_exact() const { \
|
||||
this->et = new ET(ec()( BOOST_PP_ENUM(n, CGAL_LEXACT, _) ) ); \
|
||||
this->at = E2A()(*(this->et)); \
|
||||
BOOST_PP_REPEAT(n, CGAL_PRUNE_TREE, _) \
|
||||
} \
|
||||
Lazy_rep_##n(const AC& ac, const EC&, BOOST_PP_ENUM(n, CGAL_LARGS, _)) \
|
||||
: Lazy_rep<AT, ET, E2A>(ac( BOOST_PP_ENUM(n, CGAL_LN, CGAL::approx) )), BOOST_PP_ENUM(n, CGAL_LINIT, _) \
|
||||
{ this->set_depth(max_n( BOOST_PP_ENUM(n, CGAL_LN, CGAL::depth) ) + 1); } \
|
||||
\
|
||||
CGAL_LAZY_REP_PRINT_DAG(n) \
|
||||
};
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(2, 9, CGAL_LAZY_REP, _)
|
||||
|
||||
#undef CGAL_TMAP
|
||||
#undef CGAL_PRUNE_TREE
|
||||
#undef CGAL_LINIT
|
||||
#undef CGAL_LAZY_REP
|
||||
#undef CGAL_LN
|
||||
#undef CGAL_MLIST
|
||||
#undef CGAL_PRINT_DAG_LN
|
||||
#undef CGAL_LAZY_REP_PRINT_DAG
|
||||
#undef CGAL_LAZY_PRINT_TYPEID
|
||||
|
||||
template < typename K1, typename K2 >
|
||||
|
|
@ -723,7 +673,7 @@ public:
|
|||
|
||||
//____________________________________________________________
|
||||
// The handle class
|
||||
template <typename AT_, typename ET_, typename EFT, typename E2A>
|
||||
template <typename AT_, typename ET_, typename E2A>
|
||||
class Lazy : public Handle
|
||||
{
|
||||
template <class Exact_kernel_,
|
||||
|
|
@ -739,7 +689,7 @@ class Lazy : public Handle
|
|||
|
||||
public :
|
||||
|
||||
typedef Lazy<AT_, ET_, EFT, E2A> Self;
|
||||
typedef Lazy<AT_, ET_, E2A> Self;
|
||||
typedef Lazy_rep<AT_, ET_, E2A> Self_rep;
|
||||
|
||||
typedef AT_ AT; // undocumented
|
||||
|
|
@ -785,6 +735,11 @@ public :
|
|||
PTR = new Lazy_rep_0<AT,ET,E2A>(e);
|
||||
}
|
||||
|
||||
Lazy(ET&& e)
|
||||
{
|
||||
PTR = new Lazy_rep_0<AT,ET,E2A>(std::move(e));
|
||||
}
|
||||
|
||||
const AT& approx() const
|
||||
{ return ptr()->approx(); }
|
||||
|
||||
|
|
@ -832,8 +787,8 @@ struct Lazy_construction_bbox
|
|||
typedef typename LK::Exact_kernel EK;
|
||||
typedef typename AC::result_type result_type;
|
||||
|
||||
AC ac;
|
||||
EC ec;
|
||||
CGAL_NO_UNIQUE_ADDRESS AC ac;
|
||||
CGAL_NO_UNIQUE_ADDRESS EC ec;
|
||||
|
||||
template <typename L1>
|
||||
result_type operator()(const L1& l1) const
|
||||
|
|
@ -854,6 +809,8 @@ struct Lazy_construction_bbox
|
|||
|
||||
template <typename LK, typename AC, typename EC>
|
||||
struct Lazy_construction_nt {
|
||||
Lazy_construction_nt(){}
|
||||
Lazy_construction_nt(LK const&){}
|
||||
|
||||
static const bool Protection = true;
|
||||
|
||||
|
|
@ -861,8 +818,8 @@ struct Lazy_construction_nt {
|
|||
typedef typename LK::Exact_kernel EK;
|
||||
typedef typename LK::E2A E2A;
|
||||
|
||||
AC ac;
|
||||
EC ec;
|
||||
CGAL_NO_UNIQUE_ADDRESS AC ac;
|
||||
CGAL_NO_UNIQUE_ADDRESS EC ec;
|
||||
|
||||
template<typename>
|
||||
struct result { };
|
||||
|
|
@ -878,30 +835,23 @@ struct Lazy_construction_nt {
|
|||
|
||||
BOOST_PP_REPEAT_FROM_TO(1, 6, CGAL_RESULT_NT, _)
|
||||
|
||||
#define CGAL_NT_OPERATOR(z, n, d) \
|
||||
template<BOOST_PP_ENUM_PARAMS(n, class L)> \
|
||||
typename cpp11::result_of<Lazy_construction_nt(BOOST_PP_ENUM_PARAMS(n, L))>::type \
|
||||
operator()( BOOST_PP_ENUM(n, CGAL_LARGS, _) ) const { \
|
||||
BOOST_PP_REPEAT(n, CGAL_TYPEMAP_EC, L) \
|
||||
BOOST_PP_REPEAT(n, CGAL_TYPEMAP_AC, L) \
|
||||
typedef typename boost::remove_cv< typename boost::remove_reference < \
|
||||
typename cpp11::result_of< EC(BOOST_PP_ENUM_PARAMS(n, E)) >::type >::type >::type ET; \
|
||||
typedef typename boost::remove_cv< typename boost::remove_reference < \
|
||||
typename cpp11::result_of< AC(BOOST_PP_ENUM_PARAMS(n, A)) >::type >::type >::type AT; \
|
||||
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); \
|
||||
Protect_FPU_rounding<Protection> P; \
|
||||
try { \
|
||||
return new Lazy_rep_##n<AT, ET, AC, EC, To_interval<ET>, BOOST_PP_ENUM_PARAMS(n, L) >(ac, ec, BOOST_PP_ENUM_PARAMS(n, l)); \
|
||||
} catch (Uncertain_conversion_exception&) { \
|
||||
CGAL_BRANCH_PROFILER_BRANCH(tmp); \
|
||||
Protect_FPU_rounding<!Protection> P2(CGAL_FE_TONEAREST); \
|
||||
return new Lazy_rep_0<AT,ET,To_interval<ET> >(ec( BOOST_PP_ENUM(n, CGAL_LEXACT, _) )); \
|
||||
} \
|
||||
} \
|
||||
template<class...L>
|
||||
auto operator()(L const&...l) const ->
|
||||
Lazy_exact_nt<std::remove_cv_t<std::remove_reference_t<decltype(ec(CGAL::exact(l)...))>>>
|
||||
{
|
||||
typedef std::remove_cv_t<std::remove_reference_t<decltype(ec(CGAL::exact(l)...))>> ET;
|
||||
typedef std::remove_cv_t<std::remove_reference_t<decltype(ac(CGAL::approx(l)...))>> AT;
|
||||
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
|
||||
Protect_FPU_rounding<Protection> P;
|
||||
try {
|
||||
return new Lazy_rep_n<AT, ET, AC, EC, To_interval<ET>, L... >(ac, ec, l...);
|
||||
} catch (Uncertain_conversion_exception&) {
|
||||
CGAL_BRANCH_PROFILER_BRANCH(tmp);
|
||||
Protect_FPU_rounding<!Protection> P2(CGAL_FE_TONEAREST);
|
||||
return new Lazy_rep_0<AT,ET,To_interval<ET> >(ec( CGAL::exact(l)... ));
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(1, 6, CGAL_NT_OPERATOR, _)
|
||||
|
||||
#undef INTERVAL_OPERATOR
|
||||
#undef CGAL_RESULT_NT
|
||||
};
|
||||
|
||||
|
|
@ -1043,8 +993,8 @@ struct Lazy_cartesian_const_iterator_2
|
|||
typedef typename LK::Exact_kernel EK;
|
||||
typedef typename LK::Cartesian_const_iterator_2 result_type;
|
||||
|
||||
AC ac;
|
||||
EC ec;
|
||||
CGAL_NO_UNIQUE_ADDRESS AC ac;
|
||||
CGAL_NO_UNIQUE_ADDRESS EC ec;
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -1072,8 +1022,8 @@ struct Lazy_cartesian_const_iterator_3
|
|||
typedef typename LK::Exact_kernel EK;
|
||||
typedef typename LK::Cartesian_const_iterator_3 result_type;
|
||||
|
||||
AC ac;
|
||||
EC ec;
|
||||
CGAL_NO_UNIQUE_ADDRESS AC ac;
|
||||
CGAL_NO_UNIQUE_ADDRESS EC ec;
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -1098,14 +1048,14 @@ public:
|
|||
// In a first version we assume that the references are of type Lazy<Something>,
|
||||
// and that the result type is void
|
||||
|
||||
template <typename LK, typename AK, typename EK, typename AC, typename EC, typename EFT, typename E2A>
|
||||
template <typename AC, typename EC, typename E2A>
|
||||
struct Lazy_functor_2_1
|
||||
{
|
||||
static const bool Protection = true;
|
||||
typedef void result_type;
|
||||
|
||||
AC ac;
|
||||
EC ec;
|
||||
CGAL_NO_UNIQUE_ADDRESS AC ac;
|
||||
CGAL_NO_UNIQUE_ADDRESS EC ec;
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -1166,11 +1116,10 @@ struct Lazy_functor_2_2
|
|||
typedef void result_type;
|
||||
typedef typename LK::Approximate_kernel AK;
|
||||
typedef typename LK::Exact_kernel EK;
|
||||
typedef typename EK::FT EFT;
|
||||
typedef typename LK::E2A E2A;
|
||||
|
||||
AC ac;
|
||||
EC ec;
|
||||
CGAL_NO_UNIQUE_ADDRESS AC ac;
|
||||
CGAL_NO_UNIQUE_ADDRESS EC ec;
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -1178,16 +1127,16 @@ public:
|
|||
void
|
||||
operator()(const L1& l1, const L2& l2, R1& r1, R2& r2) const
|
||||
{
|
||||
typedef Lazy<typename R1::AT, typename R1::ET, EFT, E2A> Handle_1;
|
||||
typedef Lazy<typename R2::AT, typename R2::ET, EFT, E2A> Handle_2;
|
||||
typedef Lazy<typename R1::AT, typename R1::ET, E2A> Handle_1;
|
||||
typedef Lazy<typename R2::AT, typename R2::ET, E2A> Handle_2;
|
||||
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
|
||||
Protect_FPU_rounding<Protection> P;
|
||||
try {
|
||||
typedef Lazy<std::pair<typename R1::AT, typename R2::AT>, std::pair<typename R1::ET, typename R2::ET>, EFT, E2A> Lazy_pair;
|
||||
typedef Lazy<std::pair<typename R1::AT, typename R2::AT>, std::pair<typename R1::ET, typename R2::ET>, E2A> Lazy_pair;
|
||||
Lazy_pair lv(new Lazy_rep_2_2<AC, EC, E2A, L1, L2, R1, R2>(ac, ec, l1, l2));
|
||||
// lv->approx() is a std::pair<R1::AT, R2::AT>;
|
||||
r1 = R1(Handle_1(new Lazy_rep_1<void, void, First<std::pair<typename R1::AT, typename R2::AT> >, First<std::pair<typename R1::ET, typename R2::ET> >, E2A, Lazy_pair>(First<std::pair<typename R1::AT, typename R2::AT> >(), First<std::pair<typename R1::ET, typename R2::ET> >(), lv)));
|
||||
r2 = R2(Handle_2(new Lazy_rep_1<void, void, Second<std::pair<typename R1::AT, typename R2::AT> >, Second<std::pair<typename R1::ET, typename R2::ET> >, E2A, Lazy_pair>(Second<std::pair<typename R1::AT, typename R2::AT> >(), Second<std::pair<typename R1::ET, typename R2::ET> >(), lv)));
|
||||
r1 = R1(Handle_1(new Lazy_rep_n<void, void, First<std::pair<typename R1::AT, typename R2::AT> >, First<std::pair<typename R1::ET, typename R2::ET> >, E2A, Lazy_pair>(First<std::pair<typename R1::AT, typename R2::AT> >(), First<std::pair<typename R1::ET, typename R2::ET> >(), lv)));
|
||||
r2 = R2(Handle_2(new Lazy_rep_n<void, void, Second<std::pair<typename R1::AT, typename R2::AT> >, Second<std::pair<typename R1::ET, typename R2::ET> >, E2A, Lazy_pair>(Second<std::pair<typename R1::AT, typename R2::AT> >(), Second<std::pair<typename R1::ET, typename R2::ET> >(), lv)));
|
||||
} catch (Uncertain_conversion_exception&) {
|
||||
CGAL_BRANCH_PROFILER_BRANCH(tmp);
|
||||
Protect_FPU_rounding<!Protection> P2(CGAL_FE_TONEAREST);
|
||||
|
|
@ -1208,14 +1157,13 @@ struct Lazy_intersect_with_iterators
|
|||
static const bool Protection = true;
|
||||
typedef typename LK::Approximate_kernel AK;
|
||||
typedef typename LK::Exact_kernel EK;
|
||||
typedef typename EK::FT EFT;
|
||||
typedef typename LK::E2A E2A;
|
||||
typedef void result_type;
|
||||
typedef Lazy<Object, Object, EFT, E2A> Lazy_object;
|
||||
typedef Lazy<std::vector<Object>, std::vector<Object>, EFT, E2A> Lazy_vector;
|
||||
typedef Lazy<Object, Object, E2A> Lazy_object;
|
||||
typedef Lazy<std::vector<Object>, std::vector<Object>, E2A> Lazy_vector;
|
||||
|
||||
AC ac;
|
||||
EC ec;
|
||||
CGAL_NO_UNIQUE_ADDRESS AC ac;
|
||||
CGAL_NO_UNIQUE_ADDRESS EC ec;
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -1234,7 +1182,7 @@ public:
|
|||
for (unsigned int i = 0; i < lv.approx().size(); i++) {
|
||||
// FIXME : I'm not sure how this work...
|
||||
#define CGAL_Kernel_obj(X) if (object_cast<typename AK::X>(& (lv.approx()[i]))) { \
|
||||
*it++ = make_object(typename LK::X(new Lazy_rep_1<typename AK::X, typename EK::X, Ith<typename AK::X>, \
|
||||
*it++ = make_object(typename LK::X(new Lazy_rep_n<typename AK::X, typename EK::X, Ith<typename AK::X>, \
|
||||
Ith<typename EK::X>, E2A, Lazy_vector> \
|
||||
(Ith<typename AK::X>(i), Ith<typename EK::X>(i), lv))); \
|
||||
continue; \
|
||||
|
|
@ -1287,16 +1235,15 @@ struct Lazy_construction_object
|
|||
|
||||
typedef typename LK::Approximate_kernel AK;
|
||||
typedef typename LK::Exact_kernel EK;
|
||||
typedef typename EK::FT EFT;
|
||||
typedef typename LK::E2A E2A;
|
||||
typedef typename AC::result_type AT;
|
||||
typedef typename EC::result_type ET;
|
||||
typedef Object result_type;
|
||||
|
||||
typedef Lazy<Object, Object, EFT, E2A> Lazy_object;
|
||||
typedef Lazy<Object, Object, E2A> Lazy_object;
|
||||
|
||||
AC ac;
|
||||
EC ec;
|
||||
CGAL_NO_UNIQUE_ADDRESS AC ac;
|
||||
CGAL_NO_UNIQUE_ADDRESS EC ec;
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -1307,14 +1254,14 @@ public:
|
|||
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
|
||||
Protect_FPU_rounding<Protection> P;
|
||||
try {
|
||||
Lazy_object lo(new Lazy_rep_1<result_type, result_type, AC, EC, E2A, L1>(ac, ec, l1));
|
||||
Lazy_object lo(new Lazy_rep_n<result_type, result_type, AC, EC, E2A, L1>(ac, ec, l1));
|
||||
|
||||
if(lo.approx().is_empty())
|
||||
return Object();
|
||||
|
||||
#define CGAL_Kernel_obj(X) \
|
||||
if (object_cast<typename AK::X>(& (lo.approx()))) { \
|
||||
typedef Lazy_rep_1< typename AK::X, typename EK::X, Object_cast<typename AK::X>, Object_cast<typename EK::X>, E2A, Lazy_object> Lcr; \
|
||||
typedef Lazy_rep_n< typename AK::X, typename EK::X, Object_cast<typename AK::X>, Object_cast<typename EK::X>, E2A, Lazy_object> Lcr; \
|
||||
Lcr * lcr = new Lcr(Object_cast<typename AK::X>(), Object_cast<typename EK::X>(), lo); \
|
||||
return make_object(typename LK::X(lcr)); \
|
||||
}
|
||||
|
|
@ -1340,14 +1287,14 @@ public:
|
|||
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
|
||||
Protect_FPU_rounding<Protection> P;
|
||||
try {
|
||||
Lazy_object lo(new Lazy_rep_2<result_type, result_type, AC, EC, E2A, L1, L2>(ac, ec, l1, l2));
|
||||
Lazy_object lo(new Lazy_rep_n<result_type, result_type, AC, EC, E2A, L1, L2>(ac, ec, l1, l2));
|
||||
|
||||
if(lo.approx().is_empty())
|
||||
return Object();
|
||||
|
||||
#define CGAL_Kernel_obj(X) \
|
||||
if (object_cast<typename AK::X>(& (lo.approx()))) { \
|
||||
typedef Lazy_rep_1<typename AK::X, typename EK::X, Object_cast<typename AK::X>, Object_cast<typename EK::X>, E2A, Lazy_object> Lcr; \
|
||||
typedef Lazy_rep_n<typename AK::X, typename EK::X, Object_cast<typename AK::X>, Object_cast<typename EK::X>, E2A, Lazy_object> Lcr; \
|
||||
Lcr * lcr = new Lcr(Object_cast<typename AK::X>(), Object_cast<typename EK::X>(), lo); \
|
||||
return make_object(typename LK::X(lcr)); \
|
||||
}
|
||||
|
|
@ -1363,7 +1310,7 @@ public:
|
|||
std::vector<typename LK::X> V;\
|
||||
V.resize(v_ptr->size()); \
|
||||
for (unsigned int i = 0; i < v_ptr->size(); i++) { \
|
||||
V[i] = typename LK::X(new Lazy_rep_1<typename AK::X, typename EK::X, Ith_for_intersection<typename AK::X>, \
|
||||
V[i] = typename LK::X(new Lazy_rep_n<typename AK::X, typename EK::X, Ith_for_intersection<typename AK::X>, \
|
||||
Ith_for_intersection<typename EK::X>, E2A, Lazy_object> \
|
||||
(Ith_for_intersection<typename AK::X>(i), Ith_for_intersection<typename EK::X>(i), lo)); \
|
||||
} \
|
||||
|
|
@ -1394,14 +1341,14 @@ CGAL_Kernel_obj(Point_3)
|
|||
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
|
||||
Protect_FPU_rounding<Protection> P;
|
||||
try {
|
||||
Lazy_object lo(new Lazy_rep_3<result_type, result_type, AC, EC, E2A, L1, L2, L3>(ac, ec, l1, l2, l3));
|
||||
Lazy_object lo(new Lazy_rep_n<result_type, result_type, AC, EC, E2A, L1, L2, L3>(ac, ec, l1, l2, l3));
|
||||
|
||||
if(lo.approx().is_empty())
|
||||
return Object();
|
||||
|
||||
#define CGAL_Kernel_obj(X) \
|
||||
if (object_cast<typename AK::X>(& (lo.approx()))) { \
|
||||
typedef Lazy_rep_1<typename AK::X, typename EK::X, Object_cast<typename AK::X>, Object_cast<typename EK::X>, E2A, Lazy_object> Lcr; \
|
||||
typedef Lazy_rep_n<typename AK::X, typename EK::X, Object_cast<typename AK::X>, Object_cast<typename EK::X>, E2A, Lazy_object> Lcr; \
|
||||
Lcr * lcr = new Lcr(Object_cast<typename AK::X>(), Object_cast<typename EK::X>(), lo); \
|
||||
return make_object(typename LK::X(lcr)); \
|
||||
}
|
||||
|
|
@ -1472,7 +1419,7 @@ struct Fill_lazy_variant_visitor_2 : boost::static_visitor<> {
|
|||
typedef typename Type_mapper<AKT, AK, EK>::type EKT;
|
||||
typedef typename Type_mapper<AKT, AK, LK>::type LKT;
|
||||
|
||||
typedef Lazy_rep_1<AKT, EKT, Variant_cast<AKT>, Variant_cast<EKT>, typename LK::E2A, Origin> Lcr;
|
||||
typedef Lazy_rep_n<AKT, EKT, Variant_cast<AKT>, Variant_cast<EKT>, typename LK::E2A, Origin> Lcr;
|
||||
Lcr * lcr = new Lcr(Variant_cast<AKT>(), Variant_cast<EKT>(), *o);
|
||||
|
||||
*r = LKT(lcr);
|
||||
|
|
@ -1487,7 +1434,7 @@ struct Fill_lazy_variant_visitor_2 : boost::static_visitor<> {
|
|||
std::vector<LKT> V;
|
||||
V.resize(t.size());
|
||||
for (unsigned int i = 0; i < t.size(); i++) {
|
||||
V[i] = LKT(new Lazy_rep_1<AKT, EKT, Ith_for_intersection<AKT>,
|
||||
V[i] = LKT(new Lazy_rep_n<AKT, EKT, Ith_for_intersection<AKT>,
|
||||
Ith_for_intersection<EKT>, typename LK::E2A, Origin>
|
||||
(Ith_for_intersection<AKT>(i), Ith_for_intersection<EKT>(i), *o));
|
||||
}
|
||||
|
|
@ -1535,7 +1482,6 @@ struct Lazy_construction_variant {
|
|||
|
||||
typedef typename LK::Approximate_kernel AK;
|
||||
typedef typename LK::Exact_kernel EK;
|
||||
typedef typename EK::FT EFT;
|
||||
typedef typename LK::E2A E2A;
|
||||
|
||||
|
||||
|
|
@ -1569,7 +1515,7 @@ struct Lazy_construction_variant {
|
|||
Protect_FPU_rounding<Protection> P;
|
||||
|
||||
try {
|
||||
Lazy<AT, ET, EFT, E2A> lazy(new Lazy_rep_2<AT, ET, AC, EC, E2A, L1, L2>(AC(), EC(), l1, l2));
|
||||
Lazy<AT, ET, E2A> lazy(new Lazy_rep_n<AT, ET, AC, EC, E2A, L1, L2>(AC(), EC(), l1, l2));
|
||||
|
||||
// the approximate result requires the trait with types from the AK
|
||||
AT approx_v = lazy.approx();
|
||||
|
|
@ -1582,7 +1528,7 @@ struct Lazy_construction_variant {
|
|||
}
|
||||
|
||||
// the static visitor fills the result_type with the correct unwrapped type
|
||||
internal::Fill_lazy_variant_visitor_2< result_type, AK, LK, EK, Lazy<AT, ET, EFT, E2A> > visitor(res, lazy);
|
||||
internal::Fill_lazy_variant_visitor_2< result_type, AK, LK, EK, Lazy<AT, ET, E2A> > visitor(res, lazy);
|
||||
boost::apply_visitor(visitor, *approx_v);
|
||||
|
||||
return res;
|
||||
|
|
@ -1618,7 +1564,7 @@ struct Lazy_construction_variant {
|
|||
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
|
||||
Protect_FPU_rounding<Protection> P;
|
||||
try {
|
||||
Lazy<AT, ET, EFT, E2A> lazy(new Lazy_rep_3<AT, ET, AC, EC, E2A, L1, L2, L3>(AC(), EC(), l1, l2, l3));
|
||||
Lazy<AT, ET, E2A> lazy(new Lazy_rep_n<AT, ET, AC, EC, E2A, L1, L2, L3>(AC(), EC(), l1, l2, l3));
|
||||
|
||||
// the approximate result requires the trait with types from the AK
|
||||
AT approx_v = lazy.approx();
|
||||
|
|
@ -1631,7 +1577,7 @@ struct Lazy_construction_variant {
|
|||
}
|
||||
|
||||
// the static visitor fills the result_type with the correct unwrapped type
|
||||
internal::Fill_lazy_variant_visitor_2< result_type, AK, LK, EK, Lazy<AT, ET, EFT, E2A> > visitor(res, lazy);
|
||||
internal::Fill_lazy_variant_visitor_2< result_type, AK, LK, EK, Lazy<AT, ET, E2A> > visitor(res, lazy);
|
||||
boost::apply_visitor(visitor, *approx_v);
|
||||
|
||||
return res;
|
||||
|
|
@ -1670,23 +1616,22 @@ struct Lazy_construction<LK, AC, EC, E2A_, true> {
|
|||
typedef typename boost::remove_cv<
|
||||
typename boost::remove_reference < typename EC::result_type >::type >::type ET;
|
||||
|
||||
typedef typename EK::FT EFT;
|
||||
typedef typename Default::Get<E2A_, typename LK::E2A>::type E2A;
|
||||
|
||||
typedef typename Type_mapper<AT, AK, LK>::type result_type;
|
||||
|
||||
AC ac;
|
||||
EC ec;
|
||||
CGAL_NO_UNIQUE_ADDRESS AC ac;
|
||||
CGAL_NO_UNIQUE_ADDRESS EC ec;
|
||||
|
||||
#define CGAL_CONSTRUCTION_OPERATOR(z, n, d ) \
|
||||
template<BOOST_PP_ENUM_PARAMS(n, class L)> \
|
||||
result_type \
|
||||
operator()( BOOST_PP_ENUM(n, CGAL_LARGS, _) ) const { \
|
||||
typedef Lazy< AT, ET, EFT, E2A> Handle; \
|
||||
typedef Lazy< AT, ET, E2A> Handle; \
|
||||
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); \
|
||||
Protect_FPU_rounding<Protection> P; \
|
||||
try { \
|
||||
return result_type( Handle(new Lazy_rep_##n<AT, ET, AC, EC, E2A, BOOST_PP_ENUM_PARAMS(n, L)>(ac, ec, BOOST_PP_ENUM_PARAMS(n, l)))); \
|
||||
return result_type( Handle(new Lazy_rep_n<AT, ET, AC, EC, E2A, BOOST_PP_ENUM_PARAMS(n, L)>(ac, ec, BOOST_PP_ENUM_PARAMS(n, l)))); \
|
||||
} catch (Uncertain_conversion_exception&) { \
|
||||
CGAL_BRANCH_PROFILER_BRANCH(tmp); \
|
||||
Protect_FPU_rounding<!Protection> P2(CGAL_FE_TONEAREST); \
|
||||
|
|
@ -1701,7 +1646,7 @@ struct Lazy_construction<LK, AC, EC, E2A_, true> {
|
|||
result_type
|
||||
operator()() const
|
||||
{
|
||||
typedef Lazy<AT, ET, EFT, E2A> Handle;
|
||||
typedef Lazy<AT, ET, E2A> Handle;
|
||||
return result_type( Handle(new Lazy_rep_0<AT,ET,E2A>()) );
|
||||
}
|
||||
|
||||
|
|
@ -1717,7 +1662,6 @@ struct Lazy_construction<LK, AC, EC, E2A_, false>
|
|||
|
||||
typedef typename LK::Approximate_kernel AK;
|
||||
typedef typename LK::Exact_kernel EK;
|
||||
typedef typename EK::FT EFT;
|
||||
typedef typename Default::Get<E2A_, typename LK::E2A>::type E2A;
|
||||
|
||||
template<typename>
|
||||
|
|
@ -1726,8 +1670,8 @@ struct Lazy_construction<LK, AC, EC, E2A_, false>
|
|||
// you are on your own
|
||||
};
|
||||
|
||||
AC ac;
|
||||
EC ec;
|
||||
CGAL_NO_UNIQUE_ADDRESS AC ac;
|
||||
CGAL_NO_UNIQUE_ADDRESS EC ec;
|
||||
|
||||
// acquire the result_type of the approximate kernel, map it back to the lazy kernel object
|
||||
#define CGAL_RESULT(z, n, d) \
|
||||
|
|
@ -1749,12 +1693,12 @@ struct result<F( BOOST_PP_ENUM_PARAMS(n, T) )> { \
|
|||
typename cpp11::result_of< EC(BOOST_PP_ENUM_PARAMS(n, E)) >::type >::type >::type ET; \
|
||||
typedef typename boost::remove_cv< typename boost::remove_reference < \
|
||||
typename cpp11::result_of< AC(BOOST_PP_ENUM_PARAMS(n, A)) >::type >::type >::type AT; \
|
||||
typedef Lazy< AT, ET, EFT, E2A> Handle; \
|
||||
typedef Lazy< AT, ET, E2A> Handle; \
|
||||
typedef typename cpp11::result_of<Lazy_construction(BOOST_PP_ENUM_PARAMS(n, L))>::type result_type; \
|
||||
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); \
|
||||
Protect_FPU_rounding<Protection> P; \
|
||||
try { \
|
||||
return result_type( Handle(new Lazy_rep_##n<AT, ET, AC, EC, E2A, BOOST_PP_ENUM_PARAMS(n, L)>(ac, ec, BOOST_PP_ENUM_PARAMS(n, l)))); \
|
||||
return result_type( Handle(new Lazy_rep_n<AT, ET, AC, EC, E2A, BOOST_PP_ENUM_PARAMS(n, L)>(ac, ec, BOOST_PP_ENUM_PARAMS(n, l)))); \
|
||||
} catch (Uncertain_conversion_exception&) { \
|
||||
CGAL_BRANCH_PROFILER_BRANCH(tmp); \
|
||||
Protect_FPU_rounding<!Protection> P2(CGAL_FE_TONEAREST); \
|
||||
|
|
@ -1771,7 +1715,7 @@ struct result<F( BOOST_PP_ENUM_PARAMS(n, T) )> { \
|
|||
{
|
||||
typedef typename cpp11::result_of<AC()>::type AT;
|
||||
typedef typename cpp11::result_of<EC()>::type ET;
|
||||
typedef Lazy<AT, ET, EFT, E2A> Handle;
|
||||
typedef Lazy<AT, ET, E2A> Handle;
|
||||
typedef typename Type_mapper< typename cpp11::result_of<AC()>::type ,AK, LK>::type result_type;
|
||||
|
||||
return result_type( Handle(new Lazy_rep_0<AT,ET,E2A>()) );
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ public:
|
|||
typedef CGAL::Object Object_3;
|
||||
|
||||
#define CGAL_Kernel_obj(X) \
|
||||
typedef Lazy<typename Approximate_kernel::X, typename Exact_kernel::X, typename Exact_kernel::FT, E2A> X;
|
||||
typedef Lazy<typename Approximate_kernel::X, typename Exact_kernel::X, E2A> X;
|
||||
|
||||
CGAL_Kernel_obj(Data_accessor_2)
|
||||
CGAL_Kernel_obj(Conic_2)
|
||||
|
|
@ -325,7 +325,7 @@ public:
|
|||
FT operator()(const Weighted_point_2& p) const
|
||||
{
|
||||
|
||||
typedef Lazy_rep_3<typename Approximate_kernel::Weighted_point_2,
|
||||
typedef Lazy_rep_n<typename Approximate_kernel::Weighted_point_2,
|
||||
typename Exact_kernel::Weighted_point_2,
|
||||
typename Approximate_kernel::Construct_weighted_point_2,
|
||||
typename Exact_kernel::Construct_weighted_point_2,
|
||||
|
|
@ -338,7 +338,7 @@ public:
|
|||
|
||||
LR * lr = dynamic_cast<LR*>(p.ptr());
|
||||
if(lr && (! lr->et)){
|
||||
return lr->l2;
|
||||
return std::get<2>(lr->l);
|
||||
}
|
||||
return BaseClass().compute_weight_2_object()(p);
|
||||
}
|
||||
|
|
@ -355,7 +355,7 @@ public:
|
|||
FT operator()(const Weighted_point_3& p) const
|
||||
{
|
||||
|
||||
typedef Lazy_rep_3<typename Approximate_kernel::Weighted_point_3,
|
||||
typedef Lazy_rep_n<typename Approximate_kernel::Weighted_point_3,
|
||||
typename Exact_kernel::Weighted_point_3,
|
||||
typename Approximate_kernel::Construct_weighted_point_3,
|
||||
typename Exact_kernel::Construct_weighted_point_3,
|
||||
|
|
@ -368,7 +368,7 @@ public:
|
|||
|
||||
LR * lr = dynamic_cast<LR*>(p.ptr());
|
||||
if(lr && (! lr->et)){
|
||||
return lr->l2;
|
||||
return std::get<2>(lr->l);
|
||||
}
|
||||
return BaseClass().compute_weight_3_object()(p);
|
||||
}
|
||||
|
|
@ -403,7 +403,7 @@ public:
|
|||
|
||||
Point_2 operator()(const Weighted_point_2& p) const
|
||||
{
|
||||
typedef Lazy_rep_3<typename Approximate_kernel::Weighted_point_2,
|
||||
typedef Lazy_rep_n<typename Approximate_kernel::Weighted_point_2,
|
||||
typename Exact_kernel::Weighted_point_2,
|
||||
typename Approximate_kernel::Construct_weighted_point_2,
|
||||
typename Exact_kernel::Construct_weighted_point_2,
|
||||
|
|
@ -413,7 +413,7 @@ public:
|
|||
FT
|
||||
> LR;
|
||||
|
||||
typedef Lazy_rep_3<typename Approximate_kernel::Weighted_point_2,
|
||||
typedef Lazy_rep_n<typename Approximate_kernel::Weighted_point_2,
|
||||
typename Exact_kernel::Weighted_point_2,
|
||||
typename Approximate_kernel::Construct_weighted_point_2,
|
||||
typename Exact_kernel::Construct_weighted_point_2,
|
||||
|
|
@ -425,11 +425,11 @@ public:
|
|||
|
||||
LR * lr = dynamic_cast<LR*>(p.ptr());
|
||||
if(lr && (! lr->et)){
|
||||
return lr->l1;
|
||||
return std::get<1>(lr->l);
|
||||
} else {
|
||||
LRint* lrint = dynamic_cast<LRint*>(p.ptr());
|
||||
if(lrint && (! lrint->et)){
|
||||
return lrint->l1;
|
||||
return std::get<1>(lrint->l);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -465,7 +465,7 @@ public:
|
|||
|
||||
Point_3 operator()(const Weighted_point_3& p) const
|
||||
{
|
||||
typedef Lazy_rep_3<typename Approximate_kernel::Weighted_point_3,
|
||||
typedef Lazy_rep_n<typename Approximate_kernel::Weighted_point_3,
|
||||
typename Exact_kernel::Weighted_point_3,
|
||||
typename Approximate_kernel::Construct_weighted_point_3,
|
||||
typename Exact_kernel::Construct_weighted_point_3,
|
||||
|
|
@ -475,7 +475,7 @@ public:
|
|||
FT
|
||||
> LR;
|
||||
|
||||
typedef Lazy_rep_3<typename Approximate_kernel::Weighted_point_3,
|
||||
typedef Lazy_rep_n<typename Approximate_kernel::Weighted_point_3,
|
||||
typename Exact_kernel::Weighted_point_3,
|
||||
typename Approximate_kernel::Construct_weighted_point_3,
|
||||
typename Exact_kernel::Construct_weighted_point_3,
|
||||
|
|
@ -488,11 +488,11 @@ public:
|
|||
|
||||
LR * lr = dynamic_cast<LR*>(p.ptr());
|
||||
if(lr && (! lr->et)){
|
||||
return lr->l1;
|
||||
return std::get<1>(lr->l);
|
||||
}else{
|
||||
LRint* lrint = dynamic_cast<LRint*>(p.ptr());
|
||||
if(lrint && (! lrint->et)){
|
||||
return lrint->l1;
|
||||
return std::get<1>(lrint->l);
|
||||
}
|
||||
}
|
||||
return BaseClass().construct_point_3_object()(p);
|
||||
|
|
|
|||
|
|
@ -554,6 +554,12 @@ using std::max;
|
|||
# define CGAL_NORETURN
|
||||
#endif
|
||||
|
||||
// Macro to specify [[no_unique_address]] if supported
|
||||
#if __has_cpp_attribute(no_unique_address)
|
||||
# define CGAL_NO_UNIQUE_ADDRESS [[no_unique_address]]
|
||||
#else
|
||||
# define CGAL_NO_UNIQUE_ADDRESS
|
||||
#endif
|
||||
|
||||
// Macro CGAL_ASSUME
|
||||
// Call a builtin of the compiler to pass a hint to the compiler
|
||||
|
|
|
|||
|
|
@ -0,0 +1,139 @@
|
|||
|
||||
namespace CGAL {
|
||||
|
||||
/*!
|
||||
\ingroup PkgKernelDKernels
|
||||
|
||||
\cgalModifBegin
|
||||
A model for `Kernel_d`, minus `Kernel_d::Point_of_sphere_d`, that uses %Cartesian coordinates to represent the
|
||||
geometric objects.
|
||||
|
||||
This kernel is default constructible and copyable. It does not carry any
|
||||
state so it is possible to use objects created by one instance with
|
||||
functors created by another one.
|
||||
|
||||
This kernel supports construction of points from `double` %Cartesian
|
||||
coordinates. It provides exact geometric predicates and constructions. The
|
||||
geometric predicates are made exact without sacrificing speed thanks to the use
|
||||
of filters. The geometric constructions are made exact without sacrificing
|
||||
speed thanks to a lazy mechanism, similar to
|
||||
`Exact_predicates_exact_constructions_kernel`. A construction creates an
|
||||
approximate object, and stores a directed acyclic graph (DAG) of the operation
|
||||
and arguments used. When an operation needs more precision on an object than is
|
||||
currently available, which should be rare, %CGAL reconstructs exactly all the
|
||||
ancestors of the object and replaces this part of the graph with exact objects.
|
||||
This should be transparent for users, those details do not affect the
|
||||
functionality, but they can cause surprising running time where the costly part
|
||||
of an algorithm is not the construction itself, but a seemingly trivial use
|
||||
afterwards that causes exact reconstruction of a large part of the structure.
|
||||
|
||||
`Sphere_d` is represented internally with a center and a squared radius, and the exact type used by the kernel is a rational type. This means that `Kernel_d::Point_of_sphere_d` cannot be implemented exactly in dimensions up to 3 (higher dimensions would require a decomposition of an integer as a sum of `d` squares), so currently it is not provided at all.
|
||||
|
||||
\tparam DimensionTag is a tag representing the dimension of the
|
||||
ambient Euclidean space. It may be either `Dimension_tag<d>` where `d` is
|
||||
an integer
|
||||
or `Dynamic_dimension_tag`. In the latter case, the dimension of the space is specified for each point when it is constructed, so it does not need to be known at compile-time.
|
||||
|
||||
|
||||
\attention Only the interfaces specific to this class are listed below. Refer to the
|
||||
concepts for the rest.
|
||||
|
||||
\attention Known bugs: the functor `Kernel_d::Intersect_d` is not yet implemented. `Kernel_d::Contained_in_affine_hull` assumes that the iterators refer to an affinely independent family. `Kernel_d::Orientation_d` only works for points, not vectors. Visual Studio 2015 is not supported.
|
||||
|
||||
\attention This kernel requires the \ref thirdpartyEigen "Eigen" library.
|
||||
|
||||
|
||||
|
||||
\cgalModels `Kernel_d`
|
||||
\cgalModels `DelaunayTriangulationTraits`
|
||||
\cgalModels `RegularTriangulationTraits`
|
||||
\cgalModels `SearchTraits`
|
||||
\cgalModels `RangeSearchTraits`
|
||||
|
||||
\sa `CGAL::Cartesian_d<FieldNumberType>`
|
||||
\sa `CGAL::Homogeneous_d<RingNumberType>`
|
||||
\sa `CGAL::Epick_d<DimensionTag>`
|
||||
|
||||
*/
|
||||
template< typename DimensionTag >
|
||||
struct Epeck_d {
|
||||
/*!
|
||||
represents a point in the Euclidean space
|
||||
\cgalModels `DefaultConstructible`
|
||||
\cgalModels `Assignable`
|
||||
*/
|
||||
class Point_d {
|
||||
public:
|
||||
/*! introduces a point with coordinates (x0, x1, ...) where the number of
|
||||
coordinates matches the dimension.
|
||||
\pre `DimensionTag` is a fixed dimension, not `Dynamic_dimension_tag`. */
|
||||
Point_d(double x0, double x1, ...);
|
||||
|
||||
/*! introduces a point with coordinate set `[first,end)`.
|
||||
\pre If `DimensionTag` is a fixed dimension, it matches `distance(first,end)`.
|
||||
\tparam ForwardIterator has its value type that is convertible to `double`.
|
||||
*/
|
||||
template<typename ForwardIterator>
|
||||
Point_d(ForwardIterator first, ForwardIterator end);
|
||||
|
||||
/*! returns the i'th coordinate of a point.
|
||||
\pre `i` is non-negative and less than the dimension. */
|
||||
double operator[](int i)const;
|
||||
|
||||
/*! returns an iterator pointing to the zeroth Cartesian coordinate. */
|
||||
Cartesian_const_iterator_d cartesian_begin()const;
|
||||
/*! returns an iterator pointing beyond the last Cartesian coordinate. */
|
||||
Cartesian_const_iterator_d cartesian_end()const;
|
||||
};
|
||||
|
||||
/*!
|
||||
represents a weighted point in the Euclidean space
|
||||
\cgalModels `DefaultConstructible`
|
||||
\cgalModels `Assignable`
|
||||
*/
|
||||
class Weighted_point_d {
|
||||
public:
|
||||
/*! introduces a weighted point with point p and weight w. */
|
||||
Weighted_point_d(const Point_d& p, const double& w);
|
||||
/*! extracts the point of a weighted point. */
|
||||
Point_d point() const;
|
||||
/*! extracts the weight of a weighted point. */
|
||||
double weight() const;
|
||||
};
|
||||
|
||||
/*! \cgalModels `Kernel_d::Center_of_sphere_d`
|
||||
*/
|
||||
class Construct_circumcenter_d {
|
||||
public:
|
||||
/*! 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.
|
||||
\tparam ForwardIterator has `Epeck_d::Point_d` as value type.
|
||||
*/
|
||||
template<typename ForwardIterator>
|
||||
Point_d operator()(ForwardIterator first, ForwardIterator last);
|
||||
};
|
||||
class Compute_squared_radius_d {
|
||||
public:
|
||||
/*! 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.
|
||||
\tparam ForwardIterator has `Epeck_d::Point_d` as value type.
|
||||
*/
|
||||
template<class ForwardIterator>
|
||||
FT operator()(ForwardIterator first, ForwardIterator last);
|
||||
};
|
||||
/*! \cgalModels `Kernel_d::Side_of_bounded_sphere_d`
|
||||
*/
|
||||
class Side_of_bounded_sphere_d {
|
||||
public:
|
||||
/*! 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.
|
||||
\tparam ForwardIterator has `Epeck_d::Point_d` as value type.
|
||||
*/
|
||||
template<class ForwardIterator>
|
||||
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 Epeck_d */
|
||||
} /* end namespace CGAL */
|
||||
/// \cgalModifEnd
|
||||
|
|
@ -5,7 +5,7 @@ namespace CGAL {
|
|||
\ingroup PkgKernelDKernels
|
||||
|
||||
A model for `Kernel_d` that uses %Cartesian coordinates to represent the
|
||||
geometric objects.
|
||||
geometric objects.
|
||||
|
||||
This kernel is default constructible and copyable. It does not carry any
|
||||
state so it is possible to use objects created by one instance with
|
||||
|
|
@ -26,10 +26,7 @@ or `Dynamic_dimension_tag`. In the latter case, the dimension of the space is sp
|
|||
\attention Only the interfaces specific to this class are listed below. Refer to the
|
||||
concepts for the rest.
|
||||
|
||||
\attention Known bugs: the functor `Intersect_d` is not yet implemented. `Contained_in_affine_hull` assumes that the iterators refer to an affinely independent family. `Orientation_d` only works for points, not vectors.
|
||||
|
||||
\attention Ancient compilers like gcc-4.2 or icc 14 are not supported, but gcc-4.4 and
|
||||
icc 15 work.
|
||||
\attention Known bugs: the functor `Kernel_d::Intersect_d` is not yet implemented. `Kernel_d::Contained_in_affine_hull` assumes that the iterators refer to an affinely independent family. `Kernel_d::Orientation_d` only works for points, not vectors.
|
||||
|
||||
\attention This kernel requires the \ref thirdpartyEigen "Eigen" library.
|
||||
|
||||
|
|
@ -43,6 +40,7 @@ icc 15 work.
|
|||
|
||||
\sa `CGAL::Cartesian_d<FieldNumberType>`
|
||||
\sa `CGAL::Homogeneous_d<RingNumberType>`
|
||||
\sa `CGAL::Epeck_d<DimensionTag>`
|
||||
|
||||
*/
|
||||
template< typename DimensionTag >
|
||||
|
|
@ -109,7 +107,7 @@ public:
|
|||
\tparam ForwardIterator has `Epick_d::Point_d` as value type.
|
||||
*/
|
||||
template<class ForwardIterator>
|
||||
Point_d operator()(ForwardIterator first, ForwardIterator last);
|
||||
FT operator()(ForwardIterator first, ForwardIterator last);
|
||||
};
|
||||
/*! \cgalModels `Kernel_d::Side_of_bounded_sphere_d`
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ replacing operators, especially for equality testing.
|
|||
\cgalHasModel `CGAL::Cartesian_d<FieldNumberType>`
|
||||
\cgalHasModel `CGAL::Homogeneous_d<RingNumberType>`
|
||||
\cgalHasModel `CGAL::Epick_d<DimensionTag>`
|
||||
\cgalHasModel `CGAL::Epeck_d<DimensionTag>`
|
||||
*/
|
||||
class Kernel_d {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ type `LinearAlgebra`.
|
|||
\subsection Kernel_dEpickKernel Epick_d Kernel
|
||||
|
||||
The kernel `Epick_d<DimensionTag>`, short for <em>Exact Predicates Inexact
|
||||
Constructions Kernel</em> is a kernel particularly useful when the dimension of
|
||||
Constructions %Kernel</em> is a kernel particularly useful when the dimension of
|
||||
the space is known at compile-time; The template parameter `DimensionTag` is then
|
||||
`Dimension_tag<d>` where `d` is an integer representing the dimension. It
|
||||
may also be used with parameter `Dynamic_dimension_tag`, in which case the
|
||||
|
|
@ -224,6 +224,24 @@ Note that it provides few interfaces in addition to those documented in the
|
|||
`Kernel_d` concept. In particular, the type of a point is only available as
|
||||
`Epick_d<DimensionTag>::%Point_d`, <B>not</B> `Point_d<Epick_d<DimensionTag>>`.
|
||||
|
||||
\cgalModifBegin
|
||||
\subsection Kernel_dEpeckKernel Epeck_d Kernel
|
||||
|
||||
The kernel `Epeck_d<DimensionTag>`, short for <em>Exact Predicates Exact
|
||||
Constructions %Kernel</em> is a kernel particularly useful when the dimension of
|
||||
the space is known at compile-time; The template parameter `DimensionTag` is then
|
||||
`Dimension_tag<d>` where `d` is an integer representing the dimension. It
|
||||
may also be used with parameter `Dynamic_dimension_tag`, in which case the
|
||||
dimension does not need to be known at compile-time.
|
||||
It uses a %Cartesian representation and
|
||||
supports construction of points from `double` coordinates. It provides exact
|
||||
geometric predicates and constructions.
|
||||
|
||||
Note that it provides few interfaces in addition to those documented in the
|
||||
`Kernel_d` concept. In particular, the type of a point is only available as
|
||||
`Epeck_d<DimensionTag>::%Point_d`, <B>not</B> `Point_d<Epeck_d<DimensionTag>>`.
|
||||
\cgalModifEnd
|
||||
|
||||
|
||||
\subsection Kernel_dNamingconventions Naming Conventions
|
||||
|
||||
|
|
@ -538,7 +556,7 @@ evolution of the low-dimensional kernel. The kernel was revised
|
|||
based on suggestions by Hervé Brönnimann, Michael Hoffmann, and
|
||||
Stefan Schirra.
|
||||
|
||||
Epick_d was added by Marc Glisse in 2014.
|
||||
Marc Glisse added Epick_d in 2014 and Epeck_d in 2019.
|
||||
|
||||
\subsection Kernel_dAcknowledgments Acknowledgments
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@
|
|||
- `CGAL::Cartesian_d<FieldNumberType>`
|
||||
- `CGAL::Homogeneous_d<RingNumberType>`
|
||||
- `CGAL::Epick_d<DimensionTag>`
|
||||
- `CGAL::Epeck_d<DimensionTag>`
|
||||
|
||||
\cgalCRPSection{%Kernel Objects}
|
||||
- `CGAL::Point_d<Kernel>`
|
||||
|
|
|
|||
|
|
@ -26,19 +26,18 @@
|
|||
#include <CGAL/NewKernel_d/Cartesian_base.h>
|
||||
#include <CGAL/NewKernel_d/Wrapper/Cartesian_wrap.h>
|
||||
#include <CGAL/NewKernel_d/Kernel_d_interface.h>
|
||||
#include <CGAL/NewKernel_d/Lazy_cartesian.h>
|
||||
#include <CGAL/NewKernel_d/KernelD_converter.h>
|
||||
#include <CGAL/internal/Exact_type_selector.h>
|
||||
#include <CGAL/NewKernel_d/Types/Weighted_point.h>
|
||||
|
||||
|
||||
// TODO: add static filters somewhere
|
||||
namespace CGAL {
|
||||
#define CGAL_BASE \
|
||||
Cartesian_base_d<internal::Exact_field_selector<double>::Type, Dim>
|
||||
template<class Dim>
|
||||
struct Epeck_d_help1
|
||||
: CGAL_BASE
|
||||
{
|
||||
CGAL_CONSTEXPR Epeck_d_help1(){}
|
||||
CGAL_CONSTEXPR Epeck_d_help1(int d):CGAL_BASE(d){}
|
||||
};
|
||||
#define CGAL_KA Cartesian_base_d<Interval_nt_advanced,Dim>
|
||||
#define CGAL_KE Cartesian_base_d<internal::Exact_field_selector<double>::Type, Dim>
|
||||
template<class Dim> using Epeck_d_help1 = Lazy_cartesian<CGAL_KE, CGAL_KA, KernelD_converter<CGAL_KE, CGAL_KA>>;
|
||||
#undef CGAL_KE
|
||||
#undef CGAL_KA
|
||||
#undef CGAL_BASE
|
||||
#define CGAL_BASE \
|
||||
Kernel_d_interface< \
|
||||
|
|
@ -49,8 +48,8 @@ template<class Dim>
|
|||
struct Epeck_d
|
||||
: CGAL_BASE
|
||||
{
|
||||
CGAL_CONSTEXPR Epeck_d(){}
|
||||
CGAL_CONSTEXPR Epeck_d(int d):CGAL_BASE(d){}
|
||||
constexpr Epeck_d(){}
|
||||
constexpr Epeck_d(int d):CGAL_BASE(d){}
|
||||
};
|
||||
#undef CGAL_BASE
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ template<class Dim>
|
|||
struct Epick_d_help1
|
||||
: CGAL_BASE
|
||||
{
|
||||
CGAL_CONSTEXPR Epick_d_help1(){}
|
||||
CGAL_CONSTEXPR Epick_d_help1(int d):CGAL_BASE(d){}
|
||||
constexpr Epick_d_help1(){}
|
||||
constexpr Epick_d_help1(int d):CGAL_BASE(d){}
|
||||
};
|
||||
#undef CGAL_BASE
|
||||
#define CGAL_BASE \
|
||||
|
|
@ -54,8 +54,8 @@ template<class Dim>
|
|||
struct Epick_d_help2
|
||||
: CGAL_BASE
|
||||
{
|
||||
CGAL_CONSTEXPR Epick_d_help2(){}
|
||||
CGAL_CONSTEXPR Epick_d_help2(int d):CGAL_BASE(d){}
|
||||
constexpr Epick_d_help2(){}
|
||||
constexpr Epick_d_help2(int d):CGAL_BASE(d){}
|
||||
};
|
||||
#undef CGAL_BASE
|
||||
#define CGAL_BASE \
|
||||
|
|
@ -67,8 +67,8 @@ template<class Dim>
|
|||
struct Epick_d
|
||||
: CGAL_BASE
|
||||
{
|
||||
CGAL_CONSTEXPR Epick_d(){}
|
||||
CGAL_CONSTEXPR Epick_d(int d):CGAL_BASE(d){}
|
||||
constexpr Epick_d(){}
|
||||
constexpr Epick_d(int d):CGAL_BASE(d){}
|
||||
};
|
||||
#undef CGAL_BASE
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ struct Cartesian_LA_base_d : public Dimension_base<Dim_>
|
|||
::add<Hyperplane_tag>::type
|
||||
::add<Sphere_tag>::type
|
||||
::add<Weighted_point_tag>::type
|
||||
::add<Iso_box_tag>::type
|
||||
Object_list;
|
||||
|
||||
typedef typeset< Point_cartesian_const_iterator_tag>::type
|
||||
|
|
@ -170,8 +171,8 @@ struct Cartesian_LA_base_d : public Dimension_base<Dim_>
|
|||
typedef CartesianDVectorBase::Identity_functor<Self> type;
|
||||
};
|
||||
|
||||
CGAL_CONSTEXPR Cartesian_LA_base_d(){}
|
||||
CGAL_CONSTEXPR Cartesian_LA_base_d(int d):Dimension_base<Dim_>(d){}
|
||||
constexpr Cartesian_LA_base_d(){}
|
||||
constexpr Cartesian_LA_base_d(int d):Dimension_base<Dim_>(d){}
|
||||
};
|
||||
|
||||
} //namespace CGAL
|
||||
|
|
|
|||
|
|
@ -28,38 +28,13 @@
|
|||
#include <CGAL/transforming_iterator.h>
|
||||
#include <CGAL/NewKernel_d/store_kernel.h>
|
||||
#include <CGAL/Dimension.h>
|
||||
#include <type_traits>
|
||||
|
||||
namespace CGAL {
|
||||
namespace CartesianDVectorBase {
|
||||
#ifndef CGAL_CXX11
|
||||
namespace internal {
|
||||
template<class R_,class Dim_> struct Construct_LA_vector_ {
|
||||
struct Never_use {};
|
||||
void operator()(Never_use)const;
|
||||
};
|
||||
#define CGAL_CODE(Z,N,_) template<class R> struct Construct_LA_vector_<R,Dimension_tag<N> > { \
|
||||
typedef typename R::Constructor Constructor; \
|
||||
typedef typename Get_type<R, RT_tag>::type RT; \
|
||||
typedef typename R::Vector_ result_type; \
|
||||
result_type operator() \
|
||||
(BOOST_PP_ENUM_PARAMS(N,RT const& t)) const { \
|
||||
return typename Constructor::Values()(BOOST_PP_ENUM_PARAMS(N,t)); \
|
||||
} \
|
||||
result_type operator() \
|
||||
(BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N),RT const& t)) const { \
|
||||
return typename Constructor::Values_divide()(t##N,BOOST_PP_ENUM_PARAMS(N,t)); \
|
||||
} \
|
||||
};
|
||||
BOOST_PP_REPEAT_FROM_TO(2, 11, CGAL_CODE, _ )
|
||||
#undef CGAL_CODE
|
||||
}
|
||||
#endif
|
||||
|
||||
template<class R_,class Zero_> struct Construct_LA_vector
|
||||
: private Store_kernel<R_>
|
||||
#ifndef CGAL_CXX11
|
||||
, public internal::Construct_LA_vector_<R_,typename R_::Default_ambient_dimension>
|
||||
#endif
|
||||
{
|
||||
//CGAL_FUNCTOR_INIT_IGNORE(Construct_LA_vector)
|
||||
CGAL_FUNCTOR_INIT_STORE(Construct_LA_vector)
|
||||
|
|
@ -87,15 +62,12 @@ template<class R_,class Zero_> struct Construct_LA_vector
|
|||
result_type operator()(result_type const& v)const{
|
||||
return v;
|
||||
}
|
||||
#ifdef CGAL_CXX11
|
||||
result_type operator()(result_type&& v)const{
|
||||
return std::move(v);
|
||||
}
|
||||
#endif
|
||||
#ifdef CGAL_CXX11
|
||||
template<class...U>
|
||||
typename std::enable_if<Constructible_from_each<RT,U...>::value &&
|
||||
boost::is_same<Dimension_tag<sizeof...(U)>, Dimension>::value,
|
||||
std::is_same<Dimension_tag<sizeof...(U)>, Dimension>::value,
|
||||
result_type>::type
|
||||
operator()(U&&...u)const{
|
||||
return typename Constructor::Values()(std::forward<U>(u)...);
|
||||
|
|
@ -103,22 +75,19 @@ template<class R_,class Zero_> struct Construct_LA_vector
|
|||
//template<class...U,class=typename std::enable_if<Constructible_from_each<RT,U...>::value>::type,class=typename std::enable_if<(sizeof...(U)==static_dim+1)>::type,class=void>
|
||||
template<class...U>
|
||||
typename std::enable_if<Constructible_from_each<RT,U...>::value &&
|
||||
boost::is_same<Dimension_tag<sizeof...(U)-1>, Dimension>::value,
|
||||
std::is_same<Dimension_tag<sizeof...(U)-1>, Dimension>::value,
|
||||
result_type>::type
|
||||
operator()(U&&...u)const{
|
||||
return Apply_to_last_then_rest()(typename Constructor::Values_divide(),std::forward<U>(u)...);
|
||||
}
|
||||
#else
|
||||
using internal::Construct_LA_vector_<R_,typename R::Default_ambient_dimension>::operator();
|
||||
#endif
|
||||
template<class Iter> inline
|
||||
typename boost::enable_if<is_iterator_type<Iter,std::forward_iterator_tag>,result_type>::type operator()
|
||||
typename std::enable_if_t<is_iterator_type<Iter,std::forward_iterator_tag>::value,result_type> operator()
|
||||
(Iter f,Iter g,Cartesian_tag t)const
|
||||
{
|
||||
return this->operator()((int)std::distance(f,g),f,g,t);
|
||||
}
|
||||
template<class Iter> inline
|
||||
typename boost::enable_if<is_iterator_type<Iter,std::forward_iterator_tag>,result_type>::type operator()
|
||||
typename std::enable_if_t<is_iterator_type<Iter,std::forward_iterator_tag>::value,result_type> operator()
|
||||
(int d,Iter f,Iter g,Cartesian_tag)const
|
||||
{
|
||||
CGAL_assertion(d==std::distance(f,g));
|
||||
|
|
@ -126,28 +95,28 @@ template<class R_,class Zero_> struct Construct_LA_vector
|
|||
return typename Constructor::Iterator()(d,f,g);
|
||||
}
|
||||
template<class Iter> inline
|
||||
typename boost::enable_if<is_iterator_type<Iter,std::bidirectional_iterator_tag>,result_type>::type operator()
|
||||
typename std::enable_if_t<is_iterator_type<Iter,std::bidirectional_iterator_tag>::value,result_type> operator()
|
||||
(Iter f,Iter g,Homogeneous_tag)const
|
||||
{
|
||||
--g;
|
||||
return this->operator()((int)std::distance(f,g),f,g,*g);
|
||||
}
|
||||
template<class Iter> inline
|
||||
typename boost::enable_if<is_iterator_type<Iter,std::bidirectional_iterator_tag>,result_type>::type operator()
|
||||
typename std::enable_if_t<is_iterator_type<Iter,std::bidirectional_iterator_tag>::value,result_type> operator()
|
||||
(int d,Iter f,Iter g,Homogeneous_tag)const
|
||||
{
|
||||
--g;
|
||||
return this->operator()(d,f,g,*g);
|
||||
}
|
||||
template<class Iter> inline
|
||||
typename boost::enable_if<is_iterator_type<Iter,std::forward_iterator_tag>,result_type>::type operator()
|
||||
typename std::enable_if_t<is_iterator_type<Iter,std::forward_iterator_tag>::value,result_type> operator()
|
||||
(Iter f,Iter g)const
|
||||
{
|
||||
// Shouldn't it try comparing dist(f,g) to the dimension if it is known?
|
||||
return this->operator()(f,g,typename R::Rep_tag());
|
||||
}
|
||||
template<class Iter> inline
|
||||
typename boost::enable_if<is_iterator_type<Iter,std::forward_iterator_tag>,result_type>::type operator()
|
||||
typename std::enable_if_t<is_iterator_type<Iter,std::forward_iterator_tag>::value,result_type> operator()
|
||||
(int d,Iter f,Iter g)const
|
||||
{
|
||||
return this->operator()(d,f,g,typename R::Rep_tag());
|
||||
|
|
@ -155,7 +124,7 @@ template<class R_,class Zero_> struct Construct_LA_vector
|
|||
|
||||
// Last homogeneous coordinate given separately
|
||||
template<class Iter,class NT> inline
|
||||
typename boost::enable_if<is_iterator_type<Iter,std::forward_iterator_tag>,result_type>::type operator()
|
||||
typename std::enable_if_t<is_iterator_type<Iter,std::forward_iterator_tag>::value,result_type> operator()
|
||||
(int d,Iter f,Iter g,NT const&l)const
|
||||
{
|
||||
CGAL_assertion(d==std::distance(f,g));
|
||||
|
|
@ -164,7 +133,7 @@ template<class R_,class Zero_> struct Construct_LA_vector
|
|||
return typename Constructor::Iterator()(d,CGAL::make_transforming_iterator(f,Divide<FT,NT>(l)),CGAL::make_transforming_iterator(g,Divide<FT,NT>(l)));
|
||||
}
|
||||
template<class Iter,class NT> inline
|
||||
typename boost::enable_if<is_iterator_type<Iter,std::forward_iterator_tag>,result_type>::type operator()
|
||||
typename std::enable_if_t<is_iterator_type<Iter,std::forward_iterator_tag>::value,result_type> operator()
|
||||
(Iter f,Iter g,NT const&l)const
|
||||
{
|
||||
return this->operator()((int)std::distance(f,g),f,g,l);
|
||||
|
|
@ -178,15 +147,10 @@ template<class R_> struct Compute_cartesian_coordinate {
|
|||
typedef typename R::Vector_ first_argument_type;
|
||||
typedef int second_argument_type;
|
||||
typedef Tag_true Is_exact;
|
||||
#ifdef CGAL_CXX11
|
||||
typedef decltype(std::declval<const first_argument_type>()[0]) result_type;
|
||||
#else
|
||||
typedef RT const& result_type;
|
||||
// RT const& doesn't work with some LA (Eigen2 for instance) so we
|
||||
// should use plain RT or find a way to detect this.
|
||||
#endif
|
||||
|
||||
result_type operator()(first_argument_type const& v,int i)const{
|
||||
template <typename index_type>
|
||||
result_type operator()(first_argument_type const& v,index_type i)const{
|
||||
return v[i];
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ namespace CGAL {
|
|||
template < typename FT_, typename Dim_, typename Derived_=Default>
|
||||
struct Cartesian_base_d : public CGAL_BASE
|
||||
{
|
||||
CGAL_CONSTEXPR Cartesian_base_d(){}
|
||||
CGAL_CONSTEXPR Cartesian_base_d(int d):CGAL_BASE(d){}
|
||||
constexpr Cartesian_base_d(){}
|
||||
constexpr Cartesian_base_d(int d):CGAL_BASE(d){}
|
||||
};
|
||||
#undef CGAL_BASE
|
||||
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ template < typename Base_, typename FT_, typename LA_=CGAL::LA_eigen<FT_,typenam
|
|||
struct Cartesian_change_FT_base : public
|
||||
Base_
|
||||
{
|
||||
CGAL_CONSTEXPR Cartesian_change_FT_base(){}
|
||||
CGAL_CONSTEXPR Cartesian_change_FT_base(int d):Base_(d){}
|
||||
constexpr Cartesian_change_FT_base(){}
|
||||
constexpr Cartesian_change_FT_base(int d):Base_(d){}
|
||||
|
||||
typedef Cartesian_change_FT_base Self;
|
||||
typedef Base_ Kernel_base;
|
||||
|
|
@ -48,7 +48,7 @@ struct Cartesian_change_FT_base : public
|
|||
typedef transforming_iterator<FT_converter,typename Kernel_base::Vector_cartesian_const_iterator> Vector_cartesian_const_iterator;
|
||||
//FIXME: use Iterator_list!
|
||||
/*
|
||||
template<class T,bool=CGAL_BOOSTD is_same<typename iterator_tag_traits<T>::value_tag,FT_tag>::value>
|
||||
template<class T,bool= std::is_same<typename iterator_tag_traits<T>::value_tag,FT_tag>::value>
|
||||
struct Iterator : Get_type<Kernel_base,T> {};
|
||||
template<class T> struct Iterator<T,true> {
|
||||
typedef transforming_iterator<FT_converter,typename Get_type<Kernel_base,T>::type> type;
|
||||
|
|
@ -109,8 +109,8 @@ template < typename Base_, typename FT_>
|
|||
struct Cartesian_change_FT : public
|
||||
Cartesian_change_FT_base<Base_,FT_>
|
||||
{
|
||||
CGAL_CONSTEXPR Cartesian_change_FT(){}
|
||||
CGAL_CONSTEXPR Cartesian_change_FT(int d):Cartesian_change_FT_base<Base_,FT_>(d){}
|
||||
constexpr Cartesian_change_FT(){}
|
||||
constexpr Cartesian_change_FT(int d):Cartesian_change_FT_base<Base_,FT_>(d){}
|
||||
};
|
||||
|
||||
} //namespace CGAL
|
||||
|
|
|
|||
|
|
@ -33,12 +33,12 @@ template < typename Base_, typename AK_, typename EK_ >
|
|||
struct Cartesian_filter_K : public Base_,
|
||||
private Store_kernel<AK_>, private Store_kernel2<EK_>
|
||||
{
|
||||
CGAL_CONSTEXPR Cartesian_filter_K(){}
|
||||
CGAL_CONSTEXPR Cartesian_filter_K(int d):Base_(d){}
|
||||
constexpr Cartesian_filter_K(){}
|
||||
constexpr Cartesian_filter_K(int d):Base_(d){}
|
||||
//FIXME: or do we want an instance of AK and EK belonging to this kernel,
|
||||
//instead of a reference to external ones?
|
||||
CGAL_CONSTEXPR Cartesian_filter_K(AK_ const&a,EK_ const&b):Base_(),Store_kernel<AK_>(a),Store_kernel2<EK_>(b){}
|
||||
CGAL_CONSTEXPR Cartesian_filter_K(int d,AK_ const&a,EK_ const&b):Base_(d),Store_kernel<AK_>(a),Store_kernel2<EK_>(b){}
|
||||
constexpr Cartesian_filter_K(AK_ const&a,EK_ const&b):Base_(),Store_kernel<AK_>(a),Store_kernel2<EK_>(b){}
|
||||
constexpr Cartesian_filter_K(int d,AK_ const&a,EK_ const&b):Base_(d),Store_kernel<AK_>(a),Store_kernel2<EK_>(b){}
|
||||
typedef Base_ Kernel_base;
|
||||
typedef AK_ AK;
|
||||
typedef EK_ EK;
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ namespace CGAL {
|
|||
template < typename Base_ >
|
||||
struct Cartesian_filter_NT : public Base_
|
||||
{
|
||||
CGAL_CONSTEXPR Cartesian_filter_NT(){}
|
||||
CGAL_CONSTEXPR Cartesian_filter_NT(int d):Base_(d){}
|
||||
constexpr Cartesian_filter_NT(){}
|
||||
constexpr Cartesian_filter_NT(int d):Base_(d){}
|
||||
typedef Base_ Kernel_base;
|
||||
typedef Cartesian_change_FT<Kernel_base,Interval_nt_advanced> K1;
|
||||
typedef typename internal::Exact_field_selector<typename Get_type<Kernel_base, FT_tag>::type>::Type Exact_nt;
|
||||
|
|
@ -49,7 +49,6 @@ struct Cartesian_filter_NT : public Base_
|
|||
type(Cartesian_filter_NT const&k):p1(reinterpret_cast<K1 const&>(k)),p2(reinterpret_cast<K2 const&>(k)){}
|
||||
//FIXME: if predicate's constructor takes a kernel as argument, how do we translate that? reinterpret_cast is really ugly and possibly unsafe.
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
template<class...U> result_type operator()(U&&...u)const{
|
||||
{
|
||||
Protect_FPU_rounding<true> p;
|
||||
|
|
@ -60,31 +59,6 @@ struct Cartesian_filter_NT : public Base_
|
|||
}
|
||||
return p2(std::forward<U>(u)...);
|
||||
}
|
||||
#else
|
||||
result_type operator()()const{ // does it make sense to have 0 argument?
|
||||
{
|
||||
Protect_FPU_rounding<true> p;
|
||||
try {
|
||||
typename P1::result_type res=p1();
|
||||
if(is_certain(res)) return get_certain(res);
|
||||
} catch (Uncertain_conversion_exception&) {}
|
||||
}
|
||||
return p2();
|
||||
}
|
||||
#define CGAL_CODE(Z,N,_) template<BOOST_PP_ENUM_PARAMS(N,class T)> result_type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t))const{ \
|
||||
{ \
|
||||
Protect_FPU_rounding<true> p; \
|
||||
try { \
|
||||
typename P1::result_type res=p1(BOOST_PP_ENUM_PARAMS(N,t)); \
|
||||
if(is_certain(res)) return get_certain(res); \
|
||||
} catch (Uncertain_conversion_exception&) {} \
|
||||
} \
|
||||
return p2(BOOST_PP_ENUM_PARAMS(N,t)); \
|
||||
}
|
||||
BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_)
|
||||
#undef CGAL_CODE
|
||||
|
||||
#endif
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -69,14 +69,14 @@ template <class Base_,class R_> struct Orientation_of_points_2 : private Store_k
|
|||
|
||||
template <class Dim_ /* should be implicit */, class R_, class Derived_=Default>
|
||||
struct Cartesian_static_filters : public R_ {
|
||||
CGAL_CONSTEXPR Cartesian_static_filters(){}
|
||||
CGAL_CONSTEXPR Cartesian_static_filters(int d):R_(d){}
|
||||
constexpr Cartesian_static_filters(){}
|
||||
constexpr Cartesian_static_filters(int d):R_(d){}
|
||||
};
|
||||
|
||||
template <class R_, class Derived_>
|
||||
struct Cartesian_static_filters<Dimension_tag<2>, R_, Derived_> : public R_ {
|
||||
CGAL_CONSTEXPR Cartesian_static_filters(){}
|
||||
CGAL_CONSTEXPR Cartesian_static_filters(int d):R_(d){}
|
||||
constexpr Cartesian_static_filters(){}
|
||||
constexpr Cartesian_static_filters(int d):R_(d){}
|
||||
typedef Cartesian_static_filters<Dimension_tag<2>, R_, Derived_> Self;
|
||||
typedef typename Default::Get<Derived_,Self>::type Derived;
|
||||
template <class T, class=void> struct Functor : Inherit_functor<R_, T> {};
|
||||
|
|
|
|||
|
|
@ -37,13 +37,11 @@ struct Flat_orientation {
|
|||
// For debugging purposes
|
||||
inline std::ostream& operator<< (std::ostream& o, Flat_orientation const& f) {
|
||||
o << "Proj: ";
|
||||
for(std::vector<int>::const_iterator i=f.proj.begin();
|
||||
i!=f.proj.end(); ++i)
|
||||
o << *i << ' ';
|
||||
for(int i : f.proj)
|
||||
o << i << ' ';
|
||||
o << "\nRest: ";
|
||||
for(std::vector<int>::const_iterator i=f.rest.begin();
|
||||
i!=f.rest.end(); ++i)
|
||||
o << *i << ' ';
|
||||
for(int i : f.rest)
|
||||
o << i << ' ';
|
||||
o << "\nInv: " << f.reverse;
|
||||
return o << '\n';
|
||||
}
|
||||
|
|
@ -155,8 +153,8 @@ template<class R_> struct Contained_in_affine_hull : private Store_kernel<R_> {
|
|||
int d = (int)proj.size()+1;
|
||||
Matrix m (d, d);
|
||||
for(int i=0; i<d; ++i)
|
||||
for(int j=0; j<d-1; ++j)
|
||||
m(i,j) = coord(i, proj[j]);
|
||||
for(int j=0; j<d-1; ++j)
|
||||
m(i,j) = coord(i, proj[j]);
|
||||
for(std::vector<int>::iterator it=rest.begin();it!=rest.end();++it) {
|
||||
for(int i=0; i<d; ++i) m(i,d-1) = coord(i, *it);
|
||||
if(LA::sign_of_determinant(m)!=0) {
|
||||
|
|
@ -171,10 +169,10 @@ template<class R_> struct Contained_in_affine_hull : private Store_kernel<R_> {
|
|||
int d = (int)proj.size()+1;
|
||||
Matrix m (d, d);
|
||||
for(int i=0; i<d; ++i)
|
||||
for(int j=0; j<d-1; ++j)
|
||||
m(i,j) = coord(i, proj[j]);
|
||||
for(std::vector<int>::iterator it=rest.begin();it!=rest.end();++it) {
|
||||
for(int i=0; i<d; ++i) m(i,d-1) = coord(i, *it);
|
||||
for(int j=0; j<d-1; ++j)
|
||||
m(i,j) = coord(i, proj[j]);
|
||||
for(int j : rest) {
|
||||
for(int i=0; i<d; ++i) m(i,d-1) = coord(i, j);
|
||||
if(LA::sign_of_determinant(m)!=0) return false;
|
||||
}
|
||||
return true;
|
||||
|
|
@ -215,7 +213,7 @@ template<class R_> struct In_flat_orientation : private Store_kernel<R_> {
|
|||
if(*it != d) m(i,1+*it)=1;
|
||||
}
|
||||
|
||||
result_type ret = LA::sign_of_determinant(CGAL_MOVE(m));
|
||||
result_type ret = LA::sign_of_determinant(std::move(m));
|
||||
if(o.reverse) ret=-ret;
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -264,7 +262,7 @@ template<class R_> struct In_flat_side_of_oriented_sphere : private Store_kernel
|
|||
m(d+1,d+1)+=CGAL_NTS square(m(d+1,j+1));
|
||||
}
|
||||
|
||||
result_type ret = -LA::sign_of_determinant(CGAL_MOVE(m));
|
||||
result_type ret = -LA::sign_of_determinant(std::move(m));
|
||||
if(o.reverse) ret=-ret;
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -282,7 +280,7 @@ template<class R_> struct In_flat_power_side_of_power_sphere_raw : private Store
|
|||
typedef typename LA::Square_matrix Matrix;
|
||||
|
||||
template<class Iter, class IterW, class Wt>
|
||||
result_type operator()(Flat_orientation const&o, Iter f, Iter e, IterW fw, Point const&x, Wt const&w) const {
|
||||
result_type operator()(Flat_orientation const&o, Iter f, Iter const&e, IterW fw, IterW const&/*ew*/, Point const&x, Wt const&w) const {
|
||||
// TODO: can't work in the projection, but we should at least remove the row of 1s.
|
||||
typename Get_functor<R, Compute_point_cartesian_coordinate_tag>::type c(this->kernel());
|
||||
typename Get_functor<R, Point_dimension_tag>::type pd(this->kernel());
|
||||
|
|
@ -313,7 +311,7 @@ template<class R_> struct In_flat_power_side_of_power_sphere_raw : private Store
|
|||
m(d+1,d+1)+=CGAL_NTS square(m(d+1,j+1));
|
||||
}
|
||||
|
||||
result_type ret = -LA::sign_of_determinant(CGAL_MOVE(m));
|
||||
result_type ret = -LA::sign_of_determinant(std::move(m));
|
||||
if(o.reverse) ret=-ret;
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -321,6 +319,12 @@ template<class R_> struct In_flat_power_side_of_power_sphere_raw : private Store
|
|||
|
||||
|
||||
}
|
||||
|
||||
// For the lazy kernel
|
||||
inline CartesianDKernelFunctors::Flat_orientation const& exact(CartesianDKernelFunctors::Flat_orientation const& o){return o;}
|
||||
inline CartesianDKernelFunctors::Flat_orientation const& approx(CartesianDKernelFunctors::Flat_orientation const& o){return o;}
|
||||
inline unsigned depth(CartesianDKernelFunctors::Flat_orientation const&){return 0;}
|
||||
|
||||
CGAL_KD_DEFAULT_TYPE(Flat_orientation_tag,(CGAL::CartesianDKernelFunctors::Flat_orientation),(),());
|
||||
CGAL_KD_DEFAULT_FUNCTOR(In_flat_orientation_tag,(CartesianDKernelFunctors::In_flat_orientation<K>),(Point_tag),(Compute_point_cartesian_coordinate_tag,Point_dimension_tag));
|
||||
CGAL_KD_DEFAULT_FUNCTOR(In_flat_side_of_oriented_sphere_tag,(CartesianDKernelFunctors::In_flat_side_of_oriented_sphere<K>),(Point_tag),(Compute_point_cartesian_coordinate_tag,Point_dimension_tag));
|
||||
|
|
|
|||
|
|
@ -23,11 +23,6 @@
|
|||
#include <CGAL/config.h>
|
||||
#include <CGAL/NewKernel_d/functor_tags.h>
|
||||
#include <CGAL/typeset.h>
|
||||
#ifdef CGAL_CXX11
|
||||
#include <type_traits>
|
||||
#else
|
||||
#include <boost/type_traits.hpp>
|
||||
#endif
|
||||
|
||||
namespace CGAL {
|
||||
namespace internal {
|
||||
|
|
|
|||
|
|
@ -55,12 +55,10 @@ class Filtered_predicate2
|
|||
//TODO: pack (at least use a tuple)
|
||||
//FIXME: is it better to store those, or just store enough to recreate them
|
||||
//(i.e. possibly references to the kernels)?
|
||||
EP ep;
|
||||
AP ap;
|
||||
C2E c2e;
|
||||
C2A c2a;
|
||||
|
||||
typedef typename AP::result_type Ares;
|
||||
CGAL_NO_UNIQUE_ADDRESS EP ep;
|
||||
CGAL_NO_UNIQUE_ADDRESS AP ap;
|
||||
CGAL_NO_UNIQUE_ADDRESS C2E c2e;
|
||||
CGAL_NO_UNIQUE_ADDRESS C2A c2a;
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -81,7 +79,6 @@ public:
|
|||
: ep(k.exact_kernel()), ap(k.approximate_kernel()), c2e(k,k.exact_kernel()), c2a(k,k.approximate_kernel())
|
||||
{}
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
template <typename... Args>
|
||||
result_type
|
||||
operator()(Args&&... args) const
|
||||
|
|
@ -93,7 +90,7 @@ public:
|
|||
try
|
||||
{
|
||||
// No forward here, the arguments may still be needed
|
||||
Ares res = ap(c2a(args)...);
|
||||
auto res = ap(c2a(args)...);
|
||||
if (is_certain(res))
|
||||
return get_certain(res);
|
||||
}
|
||||
|
|
@ -103,34 +100,6 @@ public:
|
|||
Protect_FPU_rounding<!Protection> p(CGAL_FE_TONEAREST);
|
||||
return ep(c2e(std::forward<Args>(args))...);
|
||||
}
|
||||
#else
|
||||
|
||||
#define CGAL_VAR(Z,N,C) C(a##N)
|
||||
#define CGAL_CODE(Z,N,_) \
|
||||
template <BOOST_PP_ENUM_PARAMS(N,class A)> \
|
||||
result_type \
|
||||
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& a)) const \
|
||||
{ \
|
||||
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); \
|
||||
{ \
|
||||
Protect_FPU_rounding<Protection> p; \
|
||||
try \
|
||||
{ \
|
||||
Ares res = ap(BOOST_PP_ENUM(N,CGAL_VAR,c2a)); \
|
||||
if (is_certain(res)) \
|
||||
return get_certain(res); \
|
||||
} \
|
||||
catch (Uncertain_conversion_exception&) {} \
|
||||
} \
|
||||
CGAL_BRANCH_PROFILER_BRANCH(tmp); \
|
||||
Protect_FPU_rounding<!Protection> p(CGAL_FE_TONEAREST); \
|
||||
return ep(BOOST_PP_ENUM(N,CGAL_VAR,c2e)); \
|
||||
}
|
||||
BOOST_PP_REPEAT_FROM_TO(1, 10, CGAL_CODE, _ )
|
||||
#undef CGAL_CODE
|
||||
#undef CGAL_VAR
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
} //namespace CGAL
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ class KernelD_converter_
|
|||
typedef typename Get_type<K2,Tag_>::type K2_Obj;
|
||||
typedef typename Get_functor<K1, Convert_ttag<Tag_> >::type K1_Conv;
|
||||
typedef KO_converter<Tag_,K1,K2> KOC;
|
||||
typedef CGAL_BOOSTD is_same<K1_Conv, Null_functor> no_converter;
|
||||
typedef std::is_same<K1_Conv, Null_functor> no_converter;
|
||||
typedef typename internal::Map_taglist_to_typelist<K1,Rest>::type::template contains<K1_Obj> duplicate;
|
||||
|
||||
// Disable the conversion in some cases:
|
||||
|
|
@ -99,10 +99,10 @@ class KernelD_converter_
|
|||
//typedef typename KOC::result_type K2_Obj;
|
||||
public:
|
||||
using Base::operator(); // don't use directly, just make it accessible to the next level
|
||||
K2_Obj helper(K1_Obj const& o,CGAL_BOOSTD true_type)const{
|
||||
K2_Obj helper(K1_Obj const& o, std::true_type)const{
|
||||
return KOC()(this->myself().kernel(),this->myself().kernel2(),this->myself(),o);
|
||||
}
|
||||
K2_Obj helper(K1_Obj const& o,CGAL_BOOSTD false_type)const{
|
||||
K2_Obj helper(K1_Obj const& o, std::false_type)const{
|
||||
return K1_Conv(this->myself().kernel())(this->myself().kernel2(),this->myself(),o);
|
||||
}
|
||||
K2_Obj operator()(argument_type const& o)const{
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@
|
|||
|
||||
namespace CGAL {
|
||||
template <class Base_> struct Kernel_d_interface : public Base_ {
|
||||
CGAL_CONSTEXPR Kernel_d_interface(){}
|
||||
CGAL_CONSTEXPR Kernel_d_interface(int d):Base_(d){}
|
||||
constexpr Kernel_d_interface(){}
|
||||
constexpr Kernel_d_interface(int d):Base_(d){}
|
||||
|
||||
typedef Base_ Base;
|
||||
typedef Kernel_d_interface<Base> Kernel;
|
||||
|
|
@ -89,7 +89,6 @@ template <class Base_> struct Kernel_d_interface : public Base_ {
|
|||
Point_d operator()(Weighted_point_d const&wp)const{
|
||||
return typename Get_functor<Base, Point_drop_weight_tag>::type(this->kernel())(wp);
|
||||
}
|
||||
#ifdef CGAL_CXX11
|
||||
Point_d operator()(Weighted_point_d &wp)const{
|
||||
return typename Get_functor<Base, Point_drop_weight_tag>::type(this->kernel())(wp);
|
||||
}
|
||||
|
|
@ -100,26 +99,10 @@ template <class Base_> struct Kernel_d_interface : public Base_ {
|
|||
return typename Get_functor<Base, Point_drop_weight_tag>::type(this->kernel())(std::move(wp));
|
||||
}
|
||||
template<class...T>
|
||||
# if CGAL_CXX14
|
||||
decltype(auto)
|
||||
# else
|
||||
Point_d
|
||||
# endif
|
||||
operator()(T&&...t)const{
|
||||
return CP(this->kernel())(std::forward<T>(t)...);
|
||||
//return CP(this->kernel())(t...);
|
||||
}
|
||||
#else // not CGAL_CXX11
|
||||
# define CGAL_CODE(Z,N,_) template<BOOST_PP_ENUM_PARAMS(N,class T)> \
|
||||
Point_d operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t))const{ \
|
||||
return CP(this->kernel())(BOOST_PP_ENUM_PARAMS(N,t)); \
|
||||
}
|
||||
BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_)
|
||||
# undef CGAL_CODE
|
||||
Point_d operator()()const{ \
|
||||
return CP(this->kernel())(); \
|
||||
}
|
||||
#endif // not CGAL_CXX11
|
||||
};
|
||||
typedef typename Get_functor<Base, Construct_ttag<Vector_tag> >::type Construct_vector_d;
|
||||
typedef typename Get_functor<Base, Construct_ttag<Segment_tag> >::type Construct_segment_d;
|
||||
|
|
@ -151,30 +134,33 @@ template <class Base_> struct Kernel_d_interface : public Base_ {
|
|||
CGAL_FUNCTOR_INIT_STORE(Construct_cartesian_const_iterator_d)
|
||||
typedef typename Get_functor<Base, Construct_ttag<Point_cartesian_const_iterator_tag> >::type CPI;
|
||||
typedef typename Get_functor<Base, Construct_ttag<Vector_cartesian_const_iterator_tag> >::type CVI;
|
||||
// FIXME: The following sometimes breaks compilation. The typedef below forces instantiation of this, which forces Point_d, which itself (in the wrapper) needs the derived kernel to tell it what the base kernel is, and that's a cycle. The exact circumstances are not clear, g++ and clang++ are ok in both C++03 and C++11, it is only clang in C++11 without CGAL_CXX11 that breaks. For now, rely on result_type.
|
||||
// FIXME: The following sometimes breaks compilation. The typedef below forces instantiation of this, which forces Point_d, which itself (in the wrapper) needs the derived kernel to tell it what the base kernel is, and that's a cycle. The exact circumstances are not clear, g++ and clang++ are ok in both C++03 and C++11, it is only clang in C++11 without CGAL_CXX11 that breaks. Relying on CPI::result_type is great for Epick_d but not Epeck_d.
|
||||
//typedef typename CGAL::decay<typename boost::result_of<CPI(Point_d,CGAL::Begin_tag)>::type>::type result_type;
|
||||
typedef typename CGAL::decay<typename CPI::result_type>::type result_type;
|
||||
//typedef typename CGAL::decay<typename CPI::result_type>::type result_type;
|
||||
//typedef decltype(std::declval<CPI>()(std::declval<Point_d>(),Begin_tag{})) result_type;
|
||||
// HACK
|
||||
typedef typename Base::Point_cartesian_const_iterator result_type;
|
||||
// Kernel_d requires a common iterator type for points and vectors
|
||||
// TODO: provide this mixed functor in preKernel?
|
||||
//CGAL_static_assertion((boost::is_same<typename CGAL::decay<typename boost::result_of<CVI(Vector_d,CGAL::Begin_tag)>::type>::type, result_type>::value));
|
||||
CGAL_static_assertion((boost::is_same<typename CGAL::decay<typename CVI::result_type>::type, result_type>::value));
|
||||
//CGAL_static_assertion((boost::is_same<typename CGAL::decay<typename CVI::result_type>::type, result_type>::value));
|
||||
template <class Tag_>
|
||||
result_type operator()(Point_d const&p, Tag_ t)const{
|
||||
auto operator()(Point_d const&p, Tag_ t)const{
|
||||
return CPI(this->kernel())(p,t);
|
||||
}
|
||||
template <class Tag_>
|
||||
result_type operator()(typename First_if_different<Vector_d,Point_d>::Type const&v, Tag_ t)const{
|
||||
auto operator()(typename First_if_different<Vector_d,Point_d>::Type const&v, Tag_ t)const{
|
||||
return CVI(this->kernel())(v,t);
|
||||
}
|
||||
|
||||
template <class Obj>
|
||||
result_type operator()(Obj const&o)const{
|
||||
auto operator()(Obj const&o)const{
|
||||
return operator()(o, Begin_tag());
|
||||
}
|
||||
result_type operator()(Point_d const&p, int)const{
|
||||
auto operator()(Point_d const&p, int)const{
|
||||
return operator()(p, End_tag());
|
||||
}
|
||||
result_type operator()(typename First_if_different<Vector_d,Point_d>::Type const&v, int)const{
|
||||
auto operator()(typename First_if_different<Vector_d,Point_d>::Type const&v, int)const{
|
||||
return operator()(v, End_tag());
|
||||
}
|
||||
};
|
||||
|
|
@ -182,8 +168,8 @@ template <class Base_> struct Kernel_d_interface : public Base_ {
|
|||
typedef Kernel R_; // for the macro
|
||||
CGAL_FUNCTOR_INIT_STORE(Compute_squared_radius_d)
|
||||
typedef FT result_type;
|
||||
template<class S> FT operator()(CGAL_FORWARDABLE(S) s)const{
|
||||
return typename Get_functor<Base, Squared_radius_tag>::type(this->kernel())(CGAL_FORWARD(S,s));
|
||||
template<class S> FT operator()(S&& s)const{
|
||||
return typename Get_functor<Base, Squared_radius_tag>::type(this->kernel())(std::forward<S>(s));
|
||||
}
|
||||
template<class I> FT operator()(I b, I e)const{
|
||||
return typename Get_functor<Base, Squared_circumradius_tag>::type(this->kernel())(b,e);
|
||||
|
|
|
|||
|
|
@ -42,25 +42,24 @@ struct Point_converter_help {
|
|||
return cp(conv(i(p,Begin_tag())),conv(i(p,End_tag())));
|
||||
}
|
||||
};
|
||||
#ifdef CGAL_CXX11
|
||||
|
||||
// This doesn't seem so useful, the compiler should be able to handle
|
||||
// the iterators just as efficiently.
|
||||
template <int d, class K1, class K2>
|
||||
struct Point_converter_help<Dimension_tag<d>,K1,K2> {
|
||||
typedef typename Get_type<K1, Point_tag>::type argument_type;
|
||||
typedef typename Get_type<K2, Point_tag>::type result_type;
|
||||
template <class C,int...I>
|
||||
result_type help(Indices<I...>, K1 const& k1, K2 const& k2, C const& conv, argument_type const& p) const {
|
||||
template <class C,std::size_t...I>
|
||||
result_type help(std::index_sequence<I...>, K1 const& k1, K2 const& k2, C const& conv, argument_type const& p) const {
|
||||
typename Get_functor<K1, Compute_point_cartesian_coordinate_tag>::type cc(k1);
|
||||
typename Get_functor<K2, Construct_ttag<Point_tag> >::type cp(k2);
|
||||
return cp(conv(cc(p,I))...);
|
||||
}
|
||||
template <class C>
|
||||
result_type operator()(K1 const& k1, K2 const& k2, C const& conv, argument_type const& p) const {
|
||||
return help(typename N_increasing_indices<d>::type(),k1,k2,conv,p);
|
||||
return help(std::make_index_sequence<d>(),k1,k2,conv,p);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
}
|
||||
template <class K1, class K2> struct KO_converter<Point_tag,K1,K2>
|
||||
: internal::Point_converter_help<typename K1::Default_ambient_dimension,K1,K2>
|
||||
|
|
@ -95,6 +94,18 @@ template <class K1, class K2> struct KO_converter<Segment_tag,K1,K2>{
|
|||
}
|
||||
};
|
||||
|
||||
template <class K1, class K2> struct KO_converter<Iso_box_tag,K1,K2>{
|
||||
typedef typename Get_type<K1, Iso_box_tag>::type argument_type;
|
||||
typedef typename Get_type<K2, Iso_box_tag>::type result_type;
|
||||
template <class C>
|
||||
result_type operator()(K1 const& k1, K2 const& k2, C const& conv, argument_type const& s) const {
|
||||
typename Get_functor<K1, Construct_min_vertex_tag>::type f(k1);
|
||||
typename Get_functor<K1, Construct_max_vertex_tag>::type g(k1);
|
||||
typename Get_functor<K2, Construct_ttag<Iso_box_tag> >::type cib(k2);
|
||||
return cib(conv(f(s)),conv(g(s)));
|
||||
}
|
||||
};
|
||||
|
||||
template <class K1, class K2> struct KO_converter<Hyperplane_tag,K1,K2>{
|
||||
typedef typename Get_type<K1, Hyperplane_tag>::type argument_type;
|
||||
typedef typename Get_type<K2, Hyperplane_tag>::type result_type;
|
||||
|
|
|
|||
|
|
@ -58,11 +58,7 @@ template<class NT_,class Dim_,class Max_dim_=Dim_> struct LA_eigen {
|
|||
#if (EIGEN_WORLD_VERSION>=3)
|
||||
typedef NT const* Vector_const_iterator;
|
||||
#else
|
||||
typedef Iterator_from_indices<const type,const NT
|
||||
#ifndef CGAL_CXX11
|
||||
,NT
|
||||
#endif
|
||||
> Vector_const_iterator;
|
||||
typedef Iterator_from_indices<const type,const NT> Vector_const_iterator;
|
||||
#endif
|
||||
|
||||
template<class Vec_>static Vector_const_iterator vector_begin(Vec_ const&a){
|
||||
|
|
|
|||
|
|
@ -89,17 +89,16 @@ namespace CGAL {
|
|||
|
||||
struct Iterator_and_last {
|
||||
template<typename Iter,typename T>
|
||||
result_type operator()(int d,Iter const& f,Iter const& e,CGAL_FORWARDABLE(T) t) const {
|
||||
result_type operator()(int d,Iter const& f,Iter const& e,T&& t) const {
|
||||
check_dim(d);
|
||||
CGAL_assertion(d==std::distance(f,e)+1);
|
||||
result_type a(d);
|
||||
std::copy(f,e,&a[0]);
|
||||
a[d-1]=CGAL_FORWARD(T,t);
|
||||
a[d-1]=std::forward<T>(t);
|
||||
return a;
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
struct Initializer_list {
|
||||
// Fix T==NT?
|
||||
template<class T>
|
||||
|
|
@ -107,7 +106,6 @@ namespace CGAL {
|
|||
return Iterator()(l.size(),l.begin(),l.end());
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
struct Values {
|
||||
#ifdef CGAL_CXX11
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include <CGAL/NewKernel_d/Filtered_predicate2.h>
|
||||
#include <CGAL/iterator_from_indices.h>
|
||||
#include <CGAL/NewKernel_d/Define_kernel_types.h>
|
||||
#include <boost/function_output_iterator.hpp>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
|
|
@ -36,9 +37,9 @@ struct Nth_iterator_element : private Store_kernel<K> {
|
|||
Nth_iterator_element(){}
|
||||
Nth_iterator_element(K const&k):Store_kernel<K>(k){}
|
||||
typedef typename Get_type<K, typename iterator_tag_traits<T>::value_tag>::type result_type;
|
||||
template<class U> result_type operator()(CGAL_FORWARDABLE(U) u, int i) const {
|
||||
template<class U> result_type operator()(U&& u, int i) const {
|
||||
typename Get_functor<K, Construct_ttag<T> >::type ci(this->kernel());
|
||||
return *std::next(ci(CGAL_FORWARD(U,u),Begin_tag()),i);
|
||||
return *cpp0x::next(ci(std::forward<U>(u),Begin_tag()),i);
|
||||
}
|
||||
};
|
||||
//typedef typename Functor<typename iterator_tag_traits<T>::nth_element>::type nth_elem;
|
||||
|
|
@ -61,6 +62,140 @@ namespace internal {
|
|||
};
|
||||
}
|
||||
|
||||
// Whenever a construction takes iterator pairs as input, whether they point to double of Lazy objects, copy the ranges inside the lazy result so they are available for update_exact(). We analyze the input to try and guess where iterator pairs are. I would prefer if each functor had a specific signature (no overload in this layer) so we wouldn't have to guess.
|
||||
namespace Lazy_internal {
|
||||
template<class...>struct typelist{};
|
||||
template<int>struct arg_i{};
|
||||
template<int>struct arg_i_begin{};
|
||||
template<int>struct arg_i_end{};
|
||||
template<int>struct arg_i_ip1_range{};
|
||||
template<class,class,class,class=void>struct analyze_args;
|
||||
template<class T,class U>struct analyze_args<T,U,typelist<>> {
|
||||
typedef T creator;
|
||||
typedef U reader;
|
||||
};
|
||||
template<class...T,class...U,class V,class...W>
|
||||
struct analyze_args<typelist<T...>,typelist<U...>,typelist<V,W...>,std::enable_if_t<!is_iterator_type<V,std::input_iterator_tag>::value>> :
|
||||
analyze_args<typelist<T...,arg_i<sizeof...(U)>>,typelist<U...,arg_i<sizeof...(T)>>,typelist<W...>> {};
|
||||
template<class...T,class...U,class It,class...W>
|
||||
struct analyze_args<typelist<T...>,typelist<U...>,typelist<It,It,W...>,std::enable_if_t<is_iterator_type<It,std::input_iterator_tag>::value>> :
|
||||
analyze_args<typelist<T...,arg_i_ip1_range<sizeof...(U)>>,typelist<U...,arg_i_begin<sizeof...(T)>,arg_i_end<sizeof...(T)>>,typelist<W...>> {};
|
||||
template<class...T> using analyze_args_for_lazy = analyze_args<typelist<>,typelist<>,typelist<T...>>;
|
||||
template<class,class>struct extract1;
|
||||
template<int i,class T>struct extract1<arg_i<i>,T>:std::tuple_element<i,T>{};
|
||||
template<int i,class T>struct extract1<arg_i_ip1_range<i>,T>{
|
||||
typedef std::tuple_element_t<i,T> E;
|
||||
typedef std::remove_cv_t<std::remove_reference_t<E>> It;
|
||||
typedef typename std::iterator_traits<It>::value_type element_type;
|
||||
// TODO: find a way to use an array of the right size, at least for the most frequent constructions
|
||||
typedef std::vector<element_type> type;
|
||||
};
|
||||
template<int i,class...T>decltype(auto)
|
||||
do_extract(arg_i<i>,std::tuple<T...>const&t)
|
||||
{return std::get<i>(t);}
|
||||
template<int i,class...T>decltype(auto)
|
||||
do_extract(arg_i_begin<i>,std::tuple<T...>const&t)
|
||||
{return std::begin(std::get<i>(t));}
|
||||
template<int i,class...T>decltype(auto)
|
||||
do_extract(arg_i_end<i>,std::tuple<T...>const&t)
|
||||
{return std::end(std::get<i>(t));}
|
||||
template<int i,class...T>decltype(auto)
|
||||
do_extract(arg_i_ip1_range<i>,std::tuple<T...>const&t)
|
||||
{
|
||||
typedef std::tuple<T...> L;
|
||||
typedef std::tuple_element_t<i,L> E;
|
||||
typedef std::remove_cv_t<std::remove_reference_t<E>> It;
|
||||
typedef typename std::iterator_traits<It>::value_type element_type;
|
||||
typedef std::vector<element_type> type;
|
||||
return type(std::get<i>(t),std::get<i+1>(t));
|
||||
}
|
||||
template<class,class>struct data_from_input;
|
||||
template<class...T,class U>struct data_from_input<typelist<T...>,U> {
|
||||
typedef std::tuple<typename extract1<T,U>::type...> type;
|
||||
};
|
||||
}
|
||||
template<typename AT, typename ET, typename AC, typename EC, typename E2A, typename...L>
|
||||
class Lazy_rep_XXX :
|
||||
public Lazy_rep< AT, ET, E2A >, private EC
|
||||
{
|
||||
// Lazy_rep_0 does not inherit from EC or take a parameter AC. It has different constructors.
|
||||
static_assert(sizeof...(L)>0, "Use Lazy_rep_0 instead");
|
||||
template <class Ei, class Ai, class E2Ai, class Ki> friend class Lazy_kernel_base;
|
||||
typedef Lazy_internal::analyze_args_for_lazy<L...> Args;
|
||||
// How to go from l to Lazy_rep's data
|
||||
typedef typename Args::creator Creator;
|
||||
// How to go back
|
||||
typedef typename Args::reader Reader;
|
||||
// what Lazy_rep should store
|
||||
typedef typename Lazy_internal::data_from_input<Creator, std::tuple<L...>>::type LL;
|
||||
mutable LL l; // L...l; is not yet allowed.
|
||||
const EC& ec() const { return *this; }
|
||||
template<class...T>
|
||||
void update_exact_helper(Lazy_internal::typelist<T...>) const {
|
||||
this->et = new ET(ec()( CGAL::exact( Lazy_internal::do_extract(T{},l) ) ... ) );
|
||||
this->at = E2A()(*(this->et));
|
||||
l = LL(); // There should be a nicer way to clear. Destruction for instance. With this->et as a witness of whether l has already been destructed.
|
||||
}
|
||||
public:
|
||||
void update_exact() const {
|
||||
update_exact_helper(Reader{});
|
||||
}
|
||||
template<class...LL>
|
||||
Lazy_rep_XXX(const AC& ac, const EC& ec, LL const&...ll) :
|
||||
Lazy_rep_XXX(Creator{},ac,ec,std::forward_as_tuple(ll...),ll...){};
|
||||
private:
|
||||
// Currently we construct the vectors, then move them into the tuple. It would be nicer to construct them in their final destination, because eventually we will also have arrays instead of vectors.
|
||||
template<class...T,class LLL,class...LL>
|
||||
Lazy_rep_XXX(Lazy_internal::typelist<T...>, const AC& ac, const EC& ec, LLL const&lll, LL const&...ll) :
|
||||
Lazy_rep<AT, ET, E2A>(ac(CGAL::approx(ll)...)), EC(ec), l(Lazy_internal::do_extract(T{},lll)...)
|
||||
{
|
||||
//this->set_depth(std::max({ -1, (int)CGAL::depth(ll)...}) + 1);
|
||||
this->set_depth(1); // FIXME: now that we have ranges, we could actually compute the depth if we cared...
|
||||
}
|
||||
// TODO: print_dag needs a specific implementation for Lazy_rep_XXX
|
||||
};
|
||||
template<class Tag, class LK, class ET>struct Select_converter { typedef typename LK::E2A type; };
|
||||
template<class LK, class ET>struct Select_converter<Compute_tag,LK,ET> { typedef To_interval<ET> type; };
|
||||
template<typename T, typename LK>
|
||||
struct Lazy_construction2 {
|
||||
static const bool Protection = true;
|
||||
|
||||
typedef typename LK::Approximate_kernel AK;
|
||||
typedef typename LK::Exact_kernel EK;
|
||||
typedef typename Get_functor<AK, T>::type AC;
|
||||
typedef typename Get_functor<EK, T>::type EC;
|
||||
typedef typename map_result_tag<T>::type result_tag;
|
||||
typedef typename Get_type<AK, result_tag>::type AT;
|
||||
typedef typename Get_type<EK, result_tag>::type ET;
|
||||
typedef typename Get_type<LK, result_tag>::type result_type;
|
||||
// same as Handle = Lazy< AT, ET, E2A>
|
||||
typedef typename Select_converter<typename Get_functor_category<LK,T>::type, LK, ET>::type E2A;
|
||||
|
||||
Lazy_construction2(){}
|
||||
Lazy_construction2(LK const&k):ac(k.approximate_kernel()),ec(k.exact_kernel()){}
|
||||
CGAL_NO_UNIQUE_ADDRESS AC ac;
|
||||
CGAL_NO_UNIQUE_ADDRESS EC ec;
|
||||
|
||||
template<class...L>
|
||||
std::enable_if_t<(sizeof...(L)>0), result_type> operator()(L const&...l) const {
|
||||
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
|
||||
Protect_FPU_rounding<Protection> P;
|
||||
try {
|
||||
return new Lazy_rep_XXX<AT, ET, AC, EC, E2A, L...>(ac, ec, l...);
|
||||
} catch (Uncertain_conversion_exception&) {
|
||||
CGAL_BRANCH_PROFILER_BRANCH(tmp);
|
||||
Protect_FPU_rounding<!Protection> P2(CGAL_FE_TONEAREST);
|
||||
return new Lazy_rep_0<AT,ET,E2A>(ec(CGAL::exact(l)...));
|
||||
}
|
||||
}
|
||||
// FIXME: this forces us to have default constructors for all types, try to make its instantiation lazier
|
||||
// Actually, that may be the clearing in update_exact().
|
||||
result_type operator()() const
|
||||
{
|
||||
return new Lazy_rep_0<AT,ET,E2A>();
|
||||
}
|
||||
};
|
||||
|
||||
template <class EK_, class AK_, class E2A_, class Kernel_>
|
||||
struct Lazy_cartesian_types
|
||||
{
|
||||
|
|
@ -79,7 +214,6 @@ struct Lazy_cartesian_types
|
|||
typedef Lazy<
|
||||
typename Get_type<AK_,T>::type,
|
||||
typename Get_type<EK_,T>::type,
|
||||
typename Get_type<EK_, FT_tag>::type,
|
||||
E2A_> type;
|
||||
};
|
||||
template <class T> struct Type<T,Number_tag> {
|
||||
|
|
@ -92,6 +226,7 @@ struct Lazy_cartesian_types
|
|||
typedef typename Select_nth_element_functor<AK_,T>::type AF;
|
||||
typedef typename Select_nth_element_functor<EK_,T>::type EF;
|
||||
|
||||
// TODO: we should use Lazy_construction2, but this seems ok for now, we never construct iterators from iterators.
|
||||
typedef typename internal::Lazy_construction_maybe_nt<
|
||||
Kernel_, AF, EF, is_NT_tag<Vt>::value
|
||||
>::type nth_elem;
|
||||
|
|
@ -104,20 +239,30 @@ struct Lazy_cartesian_types
|
|||
};
|
||||
|
||||
template <class EK_, class AK_, class E2A_/*, class Kernel_=Default*/>
|
||||
struct Lazy_cartesian : Dimension_base<typename EK_::Default_ambient_dimension>,
|
||||
struct Lazy_cartesian :
|
||||
Lazy_cartesian_types<EK_,AK_,E2A_,Lazy_cartesian<EK_,AK_,E2A_> >
|
||||
{
|
||||
//CGAL_CONSTEXPR Lazy_cartesian(){}
|
||||
//CGAL_CONSTEXPR Lazy_cartesian(int d):Base_(d){}
|
||||
constexpr Lazy_cartesian(){}
|
||||
constexpr Lazy_cartesian(int d):ak(d),ek(d){}
|
||||
|
||||
//TODO: Do we want to store an AK and an EK? Or just references?
|
||||
//FIXME: references would be better I guess.
|
||||
//TODO: In any case, make sure that we don't end up storing this kernel for
|
||||
//nothing (it is not empty but references empty kernels or something)
|
||||
AK_ ak; EK_ ek;
|
||||
CGAL_NO_UNIQUE_ADDRESS AK_ ak;
|
||||
CGAL_NO_UNIQUE_ADDRESS EK_ ek;
|
||||
AK_ const& approximate_kernel()const{return ak;}
|
||||
EK_ const& exact_kernel()const{return ek;}
|
||||
|
||||
int dimension()const{return ak.dimension();}
|
||||
void set_dimension(int dim){ak.set_dimension(dim);ek.set_dimension(dim);}
|
||||
|
||||
// For compilers that do not handle [[no_unique_address]]
|
||||
typedef boost::mpl::and_<
|
||||
internal::Do_not_store_kernel<AK_>,
|
||||
internal::Do_not_store_kernel<EK_> > Do_not_store_kernel;
|
||||
|
||||
typedef typename EK_::Dimension Dimension; // ?
|
||||
typedef Lazy_cartesian Self;
|
||||
typedef Lazy_cartesian_types<EK_,AK_,E2A_,Self> Base;
|
||||
//typedef typename Default::Get<Kernel_,Self>::type Kernel;
|
||||
|
|
@ -125,8 +270,18 @@ struct Lazy_cartesian : Dimension_base<typename EK_::Default_ambient_dimension>,
|
|||
typedef AK_ Approximate_kernel;
|
||||
typedef EK_ Exact_kernel;
|
||||
typedef E2A_ E2A;
|
||||
typedef Approx_converter<Kernel, Approximate_kernel> C2A;
|
||||
typedef Exact_converter<Kernel, Exact_kernel> C2E;
|
||||
//typedef Approx_converter<Kernel, Approximate_kernel> C2A;
|
||||
//typedef Exact_converter<Kernel, Exact_kernel> C2E;
|
||||
struct C2A {
|
||||
C2A(){}
|
||||
C2A(Kernel const&, Approximate_kernel const&){}
|
||||
template<class T>decltype(auto)operator()(T const&t)const{return CGAL::approx(t);}
|
||||
};
|
||||
struct C2E {
|
||||
C2E(){}
|
||||
C2E(Kernel const&, Exact_kernel const&){}
|
||||
template<class T>decltype(auto)operator()(T const&t)const{return CGAL::exact(t);}
|
||||
};
|
||||
|
||||
typedef typename Exact_kernel::Rep_tag Rep_tag;
|
||||
typedef typename Exact_kernel::Kernel_tag Kernel_tag;
|
||||
|
|
@ -145,19 +300,61 @@ struct Lazy_cartesian : Dimension_base<typename EK_::Default_ambient_dimension>,
|
|||
typedef Filtered_predicate2<FE,FA,C2E,C2A> type;
|
||||
};
|
||||
template<class T,class D> struct Functor<T,D,Compute_tag> {
|
||||
typedef typename Get_functor<Approximate_kernel, T>::type FA;
|
||||
typedef typename Get_functor<Exact_kernel, T>::type FE;
|
||||
typedef Lazy_construction_nt<Kernel,FA,FE> type;
|
||||
typedef Lazy_construction2<T,Kernel> type;
|
||||
};
|
||||
template<class T,class D> struct Functor<T,D,Construct_tag> {
|
||||
typedef typename Get_functor<Approximate_kernel, T>::type FA;
|
||||
typedef typename Get_functor<Exact_kernel, T>::type FE;
|
||||
typedef Lazy_construction<Kernel,FA,FE> type;
|
||||
typedef Lazy_construction2<T,Kernel> type;
|
||||
};
|
||||
template<class D> struct Functor<Point_dimension_tag,D,Misc_tag> {
|
||||
typedef typename Get_functor<Approximate_kernel, Point_dimension_tag>::type FA;
|
||||
struct type {
|
||||
FA fa;
|
||||
type(){}
|
||||
type(Kernel const&k):fa(k.approximate_kernel()){}
|
||||
template<class P>
|
||||
int operator()(P const&p)const{return fa(CGAL::approx(p));}
|
||||
};
|
||||
};
|
||||
template<class D> struct Functor<Vector_dimension_tag,D,Misc_tag> {
|
||||
typedef typename Get_functor<Approximate_kernel, Vector_dimension_tag>::type FA;
|
||||
struct type {
|
||||
FA fa;
|
||||
type(){}
|
||||
type(Kernel const&k):fa(k.approximate_kernel()){}
|
||||
template<class V>
|
||||
int operator()(V const&v)const{return fa(CGAL::approx(v));}
|
||||
};
|
||||
};
|
||||
template<class D> struct Functor<Linear_base_tag,D,Misc_tag> {
|
||||
// Don't filter that one, as there is no guarantee that the interval
|
||||
// basis would be in any way related to the exact basis, the most obvious
|
||||
// difference being the order of the vectors.
|
||||
// Don't try to be generic until we have more than just this one.
|
||||
typedef typename Get_functor<Exact_kernel, Linear_base_tag>::type FE;
|
||||
typedef typename Get_type<Approximate_kernel, Vector_tag>::type AT;
|
||||
typedef typename Get_type<Exact_kernel, Vector_tag>::type ET;
|
||||
typedef typename Base::template Type<Vector_tag>::type V; // Lazy<AT, ET, E2A>
|
||||
struct type {
|
||||
FE fe;
|
||||
type(){}
|
||||
type(Kernel const&k):fe(k.exact_kernel()){}
|
||||
template<class Iter, class Oter>
|
||||
void operator()(Iter i, Iter e, Oter o)const{
|
||||
fe(CGAL::exact(i), CGAL::exact(e),
|
||||
boost::make_function_output_iterator(
|
||||
[&o](ET const&v){
|
||||
*o++ = V(new Lazy_rep_0<AT,ET,E2A>(v));
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
//typedef typename Iterator<Point_cartesian_const_iterator_tag>::type Point_cartesian_const_iterator;
|
||||
//typedef typename Iterator<Vector_cartesian_const_iterator_tag>::type Vector_cartesian_const_iterator;
|
||||
typedef typename Base::template Iterator<Point_cartesian_const_iterator_tag>::type Point_cartesian_const_iterator;
|
||||
typedef typename Base::template Iterator<Vector_cartesian_const_iterator_tag>::type Vector_cartesian_const_iterator;
|
||||
|
||||
// This is really specific to point/vector coordinate iterators
|
||||
template<class U>
|
||||
struct Construct_iter : private Store_kernel<Kernel> {
|
||||
Construct_iter(){}
|
||||
|
|
@ -170,7 +367,8 @@ struct Lazy_cartesian : Dimension_base<typename EK_::Default_ambient_dimension>,
|
|||
}
|
||||
template<class T>
|
||||
result_type operator()(T const& t,End_tag)const{
|
||||
return result_type(t,Self().dimension(),this->kernel());
|
||||
typedef typename Get_functor<Approximate_kernel, Point_dimension_tag>::type PD;
|
||||
return result_type(t,PD(this->kernel().approximate_kernel())(CGAL::approx(t)),this->kernel());
|
||||
}
|
||||
};
|
||||
template<class T,class D> struct Functor<T,D,Construct_iterator_tag> {
|
||||
|
|
|
|||
|
|
@ -36,21 +36,8 @@ 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>),(),());
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ template <class R_> class Hyperplane {
|
|||
FT_ s_;
|
||||
|
||||
public:
|
||||
Hyperplane(){}
|
||||
Hyperplane(Vector_ const&v, FT_ const&s): v_(v), s_(s) {}
|
||||
// TODO: Add a piecewise constructor?
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ template <class R_> class Segment {
|
|||
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?)
|
||||
//FIXME: don't forward directly, piecewise_construct 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
|
||||
|
|
@ -89,11 +89,11 @@ template<class R_> struct Construct_segment : Store_kernel<R_> {
|
|||
}
|
||||
// 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{
|
||||
result_type operator()(T&&, U&& u, 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)) }};
|
||||
call_on_tuple_elements(cp, std::forward<U>(u)),
|
||||
call_on_tuple_elements(cp, std::forward<V>(v)) }};
|
||||
return r;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ template <class R_> class Sphere {
|
|||
FT_ r2_;
|
||||
|
||||
public:
|
||||
Sphere(){}
|
||||
Sphere(Point_ const&p, FT_ const&r2): c_(p), r2_(r2) {}
|
||||
// TODO: Add a piecewise constructor?
|
||||
|
||||
|
|
@ -66,7 +67,7 @@ template <class R_> struct Construct_sphere : Store_kernel<R_> {
|
|||
// 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);
|
||||
return this->operator()(std::move(center), r2);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ template <class R_> class Weighted_point {
|
|||
FT_ w_;
|
||||
|
||||
public:
|
||||
Weighted_point(){}
|
||||
Weighted_point(Point_ const&p, FT_ const&w): c_(p), w_(w) {}
|
||||
// TODO: Add a piecewise constructor?
|
||||
|
||||
|
|
@ -124,6 +125,7 @@ template<class R_> struct Power_side_of_power_sphere : private Store_kernel<R_>
|
|||
make_transforming_iterator (f, pdw),
|
||||
make_transforming_iterator (e, pdw),
|
||||
make_transforming_iterator (f, pw),
|
||||
make_transforming_iterator (e, pw),
|
||||
pdw (p0),
|
||||
pw (p0));
|
||||
}
|
||||
|
|
@ -144,6 +146,7 @@ template<class R_> struct In_flat_power_side_of_power_sphere : private Store_ker
|
|||
make_transforming_iterator (f, pdw),
|
||||
make_transforming_iterator (e, pdw),
|
||||
make_transforming_iterator (f, pw),
|
||||
make_transforming_iterator (e, pw),
|
||||
pdw (p0),
|
||||
pw (p0));
|
||||
}
|
||||
|
|
@ -192,11 +195,11 @@ template <class R_> struct Power_center : Store_kernel<R_> {
|
|||
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));
|
||||
LA::solve(res, std::move(m), std::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);
|
||||
return cwp(std::move(center), r2);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,60 +93,33 @@ template<class NT_,class Dim_,class Max_dim_=Dim_> struct Array_vector {
|
|||
|
||||
struct Iterator_and_last {
|
||||
template<typename Iter,typename T>
|
||||
Vector operator()(unsigned CGAL_assertion_code(d),Iter const& f,Iter const& e,CGAL_FORWARDABLE(T) t) const {
|
||||
Vector operator()(unsigned CGAL_assertion_code(d),Iter const& f,Iter const& e,T&& t) const {
|
||||
CGAL_assertion(d==std::distance(f,e)+1);
|
||||
CGAL_assertion(d<=d_);
|
||||
//TODO: optimize for forward iterators
|
||||
Vector a;
|
||||
std::copy(f,e,a.begin());
|
||||
a.back()=CGAL_FORWARD(T,t);
|
||||
a.back()=std::forward<T>(t);
|
||||
return a;
|
||||
}
|
||||
};
|
||||
|
||||
struct Values {
|
||||
#ifdef CGAL_CXX11
|
||||
template<class...U>
|
||||
Vector operator()(U&&...u) const {
|
||||
static_assert(sizeof...(U)<=d_,"too many arguments");
|
||||
Vector a={{forward_safe<NT,U>(u)...}};
|
||||
return a;
|
||||
}
|
||||
#else
|
||||
|
||||
#define CGAL_CODE(Z,N,_) Vector operator()(BOOST_PP_ENUM_PARAMS(N,NT const& t)) const { \
|
||||
CGAL_assertion(N<=d_); \
|
||||
Vector a={{BOOST_PP_ENUM_PARAMS(N,t)}}; \
|
||||
return a; \
|
||||
}
|
||||
BOOST_PP_REPEAT_FROM_TO(1, 11, CGAL_CODE, _ )
|
||||
#undef CGAL_CODE
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
struct Values_divide {
|
||||
#ifdef CGAL_CXX11
|
||||
template<class H,class...U>
|
||||
Vector operator()(H const& h,U&&...u) const {
|
||||
static_assert(sizeof...(U)<=d_,"too many arguments");
|
||||
Vector a={{Rational_traits<NT>().make_rational(std::forward<U>(u),h)...}};
|
||||
return a;
|
||||
}
|
||||
#else
|
||||
|
||||
#define CGAL_VAR(Z,N,_) Rational_traits<NT>().make_rational( t##N , h)
|
||||
#define CGAL_CODE(Z,N,_) template <class H> Vector \
|
||||
operator()(H const&h, BOOST_PP_ENUM_PARAMS(N,NT const& t)) const { \
|
||||
CGAL_assertion(N<=d_); \
|
||||
Vector a={{BOOST_PP_ENUM(N,CGAL_VAR,_)}}; \
|
||||
return a; \
|
||||
}
|
||||
BOOST_PP_REPEAT_FROM_TO(1, 11, CGAL_CODE, _ )
|
||||
#undef CGAL_CODE
|
||||
#undef CGAL_VAR
|
||||
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -162,6 +135,8 @@ BOOST_PP_REPEAT_FROM_TO(1, 11, CGAL_CODE, _ )
|
|||
}
|
||||
|
||||
};
|
||||
// Do not try to instantiate the above
|
||||
template<class NT_,class Max_dim_> struct Array_vector<NT_,Dynamic_dimension_tag,Max_dim_> {};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ struct Mix_vector
|
|||
};
|
||||
};
|
||||
|
||||
// FIXME: shouldn't we dispatch based on Max_dim_ instead?
|
||||
template <class Static_, class Dynamic_, class NT_, int d, class Max_dim_>
|
||||
struct Mix_vector<Static_, Dynamic_, NT_, Dimension_tag<d>, Max_dim_>
|
||||
: Static_::template Rebind_dimension<Dimension_tag<d>, Max_dim_>::Other
|
||||
|
|
|
|||
|
|
@ -73,12 +73,12 @@ template<class NT_,class Dim_,class Max_dim_=Dim_> struct Vector_vector {
|
|||
|
||||
struct Iterator_and_last {
|
||||
template<typename Iter,typename T>
|
||||
Vector operator()(int d,Iter const& f,Iter const& e,CGAL_FORWARDABLE(T) t) const {
|
||||
Vector operator()(int d,Iter const& f,Iter const& e,T&& t) const {
|
||||
CGAL_assertion(d==std::distance(f,e)+1);
|
||||
Vector a;
|
||||
a.reserve(d+1);
|
||||
a.insert(a.end(),f,e);
|
||||
a.push_back(CGAL_FORWARD(T,t));
|
||||
a.push_back(std::forward<T>(t));
|
||||
return a;
|
||||
}
|
||||
};
|
||||
|
|
@ -100,31 +100,15 @@ template<class NT_,class Dim_,class Max_dim_=Dim_> struct Vector_vector {
|
|||
#endif
|
||||
|
||||
struct Values {
|
||||
#ifdef CGAL_CXX11
|
||||
template<class...U>
|
||||
Vector operator()(U&&...u) const {
|
||||
//TODO: check the right number of {}, g++ accepts one and two
|
||||
Vector a={forward_safe<NT,U>(u)...};
|
||||
return a;
|
||||
}
|
||||
#else
|
||||
|
||||
#define CGAL_VAR(Z,N,_) a.push_back(t##N);
|
||||
#define CGAL_CODE(Z,N,_) Vector operator()(BOOST_PP_ENUM_PARAMS(N,NT const& t)) const { \
|
||||
Vector a; \
|
||||
a.reserve(N); \
|
||||
BOOST_PP_REPEAT(N,CGAL_VAR,) \
|
||||
return a; \
|
||||
}
|
||||
BOOST_PP_REPEAT_FROM_TO(1, 11, CGAL_CODE, _ )
|
||||
#undef CGAL_CODE
|
||||
#undef CGAL_VAR
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
struct Values_divide {
|
||||
#ifdef CGAL_CXX11
|
||||
template<class H,class...U>
|
||||
Vector operator()(H const&h,U&&...u) const {
|
||||
//TODO: do we want to cast at some point?
|
||||
|
|
@ -133,21 +117,6 @@ BOOST_PP_REPEAT_FROM_TO(1, 11, CGAL_CODE, _ )
|
|||
Vector a={Rational_traits<NT>().make_rational(std::forward<U>(u),h)...};
|
||||
return a;
|
||||
}
|
||||
#else
|
||||
|
||||
#define CGAL_VAR(Z,N,_) a.push_back(Rational_traits<NT>().make_rational( t##N ,h));
|
||||
#define CGAL_CODE(Z,N,_) template<class H> Vector \
|
||||
operator()(H const&h, BOOST_PP_ENUM_PARAMS(N,NT const& t)) const { \
|
||||
Vector a; \
|
||||
a.reserve(N); \
|
||||
BOOST_PP_REPEAT(N,CGAL_VAR,) \
|
||||
return a; \
|
||||
}
|
||||
BOOST_PP_REPEAT_FROM_TO(1, 11, CGAL_CODE, _ )
|
||||
#undef CGAL_CODE
|
||||
#undef CGAL_VAR
|
||||
|
||||
#endif
|
||||
};
|
||||
};
|
||||
typedef typename Vector::const_iterator Vector_const_iterator;
|
||||
|
|
|
|||
|
|
@ -122,8 +122,8 @@ CGAL_REGISTER_OBJECT_WRAPPER(Weighted_point);
|
|||
template < typename Base_ , typename Derived_ = Default >
|
||||
struct Cartesian_wrap : public Base_
|
||||
{
|
||||
CGAL_CONSTEXPR Cartesian_wrap(){}
|
||||
CGAL_CONSTEXPR Cartesian_wrap(int d):Base_(d){}
|
||||
constexpr Cartesian_wrap(){}
|
||||
constexpr Cartesian_wrap(int d):Base_(d){}
|
||||
typedef Base_ Kernel_base;
|
||||
typedef Cartesian_wrap Self;
|
||||
// TODO: pass the 2 types Self and Derived to the wrappers, they can use Self for most purposes and Derived only for Kernel_traits' typedef R.
|
||||
|
|
@ -145,30 +145,9 @@ struct Cartesian_wrap : public Base_
|
|||
B b;
|
||||
type(){}
|
||||
type(Self const&k):b(k){}
|
||||
typedef typename B::result_type result_type;
|
||||
#ifdef CGAL_CXX11
|
||||
template<class...U> result_type operator()(U&&...u)const{
|
||||
template<class...U> decltype(auto) operator()(U&&...u)const{
|
||||
return b(internal::Forward_rep()(u)...);
|
||||
}
|
||||
#else
|
||||
#define CGAL_VAR(Z,N,_) internal::Forward_rep()(u##N)
|
||||
#define CGAL_CODE(Z,N,_) template<BOOST_PP_ENUM_PARAMS(N,class U)> result_type \
|
||||
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,U,const&u))const{ \
|
||||
return b(BOOST_PP_ENUM(N,CGAL_VAR,)); \
|
||||
}
|
||||
BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_)
|
||||
#undef CGAL_CODE
|
||||
#undef CGAL_VAR
|
||||
// In case the last argument needs to be non-const. Fragile...
|
||||
#define CGAL_VAR(Z,N,_) internal::Forward_rep()(u##N)
|
||||
#define CGAL_CODE(Z,N,_) template<BOOST_PP_ENUM_PARAMS(N,class U),class V> result_type \
|
||||
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,U,const&u),V&v)const{ \
|
||||
return b(BOOST_PP_ENUM(N,CGAL_VAR,),internal::Forward_rep()(v)); \
|
||||
}
|
||||
BOOST_PP_REPEAT_FROM_TO(1,8,CGAL_CODE,_)
|
||||
#undef CGAL_CODE
|
||||
#undef CGAL_VAR
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -188,20 +167,9 @@ struct Cartesian_wrap : public Base_
|
|||
typedef typename map_result_tag<T>::type result_tag;
|
||||
// FIXME: Self or Derived?
|
||||
typedef typename Get_type<Self,result_tag>::type result_type;
|
||||
#ifdef CGAL_CXX11
|
||||
template<class...U> result_type operator()(U&&...u)const{
|
||||
return result_type(Eval_functor(),b,internal::Forward_rep()(u)...);
|
||||
}
|
||||
#else
|
||||
#define CGAL_VAR(Z,N,_) internal::Forward_rep()(u##N)
|
||||
#define CGAL_CODE(Z,N,_) template<BOOST_PP_ENUM_PARAMS(N,class U)> result_type \
|
||||
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,U,const&u))const{ \
|
||||
return result_type(Eval_functor(),b,BOOST_PP_ENUM(N,CGAL_VAR,)); \
|
||||
}
|
||||
BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_)
|
||||
#undef CGAL_CODE
|
||||
#undef CGAL_VAR
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -210,8 +178,8 @@ struct Cartesian_wrap : public Base_
|
|||
template < typename Base_ >
|
||||
struct Cartesian_refcount : public Base_
|
||||
{
|
||||
CGAL_CONSTEXPR Cartesian_refcount(){}
|
||||
CGAL_CONSTEXPR Cartesian_refcount(int d):Base_(d){}
|
||||
constexpr Cartesian_refcount(){}
|
||||
constexpr Cartesian_refcount(int d):Base_(d){}
|
||||
typedef Base_ Kernel_base;
|
||||
typedef Cartesian_refcount Self;
|
||||
|
||||
|
|
@ -242,23 +210,9 @@ struct Cartesian_refcount : public Base_
|
|||
type(){}
|
||||
type(Self const&k):b(k){}
|
||||
typedef typename B::result_type result_type;
|
||||
#ifdef CGAL_CXX11
|
||||
template<class...U> result_type operator()(U&&...u)const{
|
||||
return b(internal::Forward_rep()(u)...);
|
||||
}
|
||||
#else
|
||||
result_type operator()()const{
|
||||
return b();
|
||||
}
|
||||
#define CGAL_VAR(Z,N,_) internal::Forward_rep()(u##N)
|
||||
#define CGAL_CODE(Z,N,_) template<BOOST_PP_ENUM_PARAMS(N,class U)> result_type \
|
||||
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,U,const&u))const{ \
|
||||
return b(BOOST_PP_ENUM(N,CGAL_VAR,)); \
|
||||
}
|
||||
BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_)
|
||||
#undef CGAL_CODE
|
||||
#undef CGAL_VAR
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -275,23 +229,9 @@ struct Cartesian_refcount : public Base_
|
|||
type(Self const&k):b(k){}
|
||||
typedef typename map_result_tag<T>::type result_tag;
|
||||
typedef typename Get_type<Self,result_tag>::type result_type;
|
||||
#ifdef CGAL_CXX11
|
||||
template<class...U> result_type operator()(U&&...u)const{
|
||||
return result_type(Eval_functor(),b,internal::Forward_rep()(u)...);
|
||||
}
|
||||
#else
|
||||
result_type operator()()const{
|
||||
return result_type(Eval_functor(),b);
|
||||
}
|
||||
#define CGAL_VAR(Z,N,_) internal::Forward_rep()(u##N)
|
||||
#define CGAL_CODE(Z,N,_) template<BOOST_PP_ENUM_PARAMS(N,class U)> result_type \
|
||||
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,U,const&u))const{ \
|
||||
return result_type(Eval_functor(),b,BOOST_PP_ENUM(N,CGAL_VAR,)); \
|
||||
}
|
||||
BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_)
|
||||
#undef CGAL_CODE
|
||||
#undef CGAL_VAR
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -26,10 +26,6 @@
|
|||
#include <boost/type_traits.hpp>
|
||||
#include <CGAL/Kernel/Return_base_tag.h>
|
||||
#include <CGAL/Dimension.h>
|
||||
#ifndef CGAL_CXX11
|
||||
#include <boost/preprocessor/repetition.hpp>
|
||||
#endif
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
namespace CGAL {
|
||||
namespace Wrap {
|
||||
|
|
@ -67,7 +63,6 @@ public:
|
|||
|
||||
typedef R_ R;
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
template<class...U,class=typename std::enable_if<!std::is_same<std::tuple<typename std::decay<U>::type...>,std::tuple<Hyperplane_d> >::value>::type> explicit Hyperplane_d(U&&...u)
|
||||
: Rep(CHBase()(std::forward<U>(u)...)){}
|
||||
|
||||
|
|
@ -89,30 +84,6 @@ public:
|
|||
Hyperplane_d(Rep& v) : Rep(static_cast<Rep const&>(v)) {}
|
||||
Hyperplane_d(Rep&& v) : Rep(std::move(v)) {}
|
||||
|
||||
#else
|
||||
|
||||
Hyperplane_d() : Rep(CHBase()()) {}
|
||||
|
||||
Hyperplane_d(Rep const& v) : Rep(v) {} // try not to use it
|
||||
|
||||
#define CGAL_CODE(Z,N,_) template<BOOST_PP_ENUM_PARAMS(N,class T)> \
|
||||
explicit Hyperplane_d(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \
|
||||
: Rep(CHBase()( \
|
||||
BOOST_PP_ENUM_PARAMS(N,t))) {} \
|
||||
\
|
||||
template<class F,BOOST_PP_ENUM_PARAMS(N,class T)> \
|
||||
Hyperplane_d(Eval_functor,F const& f,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \
|
||||
: Rep(f(BOOST_PP_ENUM_PARAMS(N,t))) {}
|
||||
/*
|
||||
template<BOOST_PP_ENUM_PARAMS(N,class T)> \
|
||||
Point_d(Eval_functor,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \
|
||||
: Rep(Eval_functor(), BOOST_PP_ENUM_PARAMS(N,t)) {}
|
||||
*/
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_)
|
||||
#undef CGAL_CODE
|
||||
|
||||
#endif
|
||||
|
||||
//TODO: if OVBase returns a reference to a base vector, cast it to a
|
||||
//reference to a wrapper vector. Ugly but should be safe.
|
||||
|
|
|
|||
|
|
@ -30,10 +30,6 @@
|
|||
#include <boost/type_traits.hpp>
|
||||
#include <CGAL/Kernel/Return_base_tag.h>
|
||||
#include <CGAL/Dimension.h>
|
||||
#ifndef CGAL_CXX11
|
||||
#include <boost/preprocessor/repetition.hpp>
|
||||
#endif
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
namespace CGAL {
|
||||
namespace Wrap {
|
||||
|
|
@ -76,7 +72,6 @@ public:
|
|||
|
||||
typedef R_ R;
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC == 1900)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4309)
|
||||
|
|
@ -115,47 +110,19 @@ public:
|
|||
Point_d(Origin&& v)
|
||||
: Rep(CPBase()(std::move(v))) {}
|
||||
|
||||
#else
|
||||
|
||||
Point_d() : Rep(CPBase()()) {}
|
||||
|
||||
Point_d(Rep const& v) : Rep(v) {} // try not to use it
|
||||
|
||||
#define CGAL_CODE(Z,N,_) template<BOOST_PP_ENUM_PARAMS(N,class T)> \
|
||||
explicit Point_d(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \
|
||||
: Rep(CPBase()( \
|
||||
BOOST_PP_ENUM_PARAMS(N,t))) {} \
|
||||
\
|
||||
template<class F,BOOST_PP_ENUM_PARAMS(N,class T)> \
|
||||
Point_d(Eval_functor,F const& f,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \
|
||||
: Rep(f(BOOST_PP_ENUM_PARAMS(N,t))) {}
|
||||
/*
|
||||
template<BOOST_PP_ENUM_PARAMS(N,class T)> \
|
||||
Point_d(Eval_functor,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \
|
||||
: Rep(Eval_functor(), BOOST_PP_ENUM_PARAMS(N,t)) {}
|
||||
*/
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_)
|
||||
#undef CGAL_CODE
|
||||
|
||||
// this one should be implicit
|
||||
Point_d(Origin const& o)
|
||||
: Rep(CPBase()(o)) {}
|
||||
|
||||
#endif
|
||||
|
||||
typename boost::result_of<CCBase(Rep,int)>::type cartesian(int i)const{
|
||||
decltype(auto) cartesian(int i)const{
|
||||
return CCBase()(rep(),i);
|
||||
}
|
||||
typename boost::result_of<CCBase(Rep,int)>::type operator[](int i)const{
|
||||
decltype(auto) operator[](int i)const{
|
||||
return CCBase()(rep(),i);
|
||||
}
|
||||
|
||||
typename boost::result_of<CPI(Rep,Begin_tag)>::type cartesian_begin()const{
|
||||
decltype(auto) cartesian_begin()const{
|
||||
return CPI()(rep(),Begin_tag());
|
||||
}
|
||||
|
||||
typename boost::result_of<CPI(Rep,End_tag)>::type cartesian_end()const{
|
||||
decltype(auto) cartesian_end()const{
|
||||
return CPI()(rep(),End_tag());
|
||||
}
|
||||
|
||||
|
|
@ -164,159 +131,68 @@ public:
|
|||
return PDBase()(rep());
|
||||
}
|
||||
|
||||
/*
|
||||
Direction_d direction() const
|
||||
{
|
||||
return R().construct_direction_d_object()(*this);
|
||||
friend auto operator==(Point_d const&p, Point_d const&q) {
|
||||
typedef typename Get_functor<Kbase, Equal_points_tag>::type EPBase;
|
||||
return EPBase()(p.rep(), q.rep());
|
||||
}
|
||||
|
||||
Vector_d transform(const Aff_transformation_d &t) const
|
||||
friend auto operator!=(Point_d const&p, Point_d const&q) { return !(p==q); }
|
||||
|
||||
friend std::ostream& operator <<(std::ostream& os, const Point_d& p)
|
||||
{
|
||||
return t.transform(*this);
|
||||
auto b = p.cartesian_begin();
|
||||
auto e = p.cartesian_end();
|
||||
if(is_ascii(os))
|
||||
{
|
||||
os << p.dimension();
|
||||
for(; b != e; ++b){
|
||||
os << " " << *b;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
write(os, p.dimension());
|
||||
for(; b != e; ++b){
|
||||
write(os, *b);
|
||||
}
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
Vector_d operator/(const RT& c) const
|
||||
// TODO: test if the stream is binary or text?
|
||||
friend std::istream& operator>>(std::istream &is, Point_d & p)
|
||||
{
|
||||
return R().construct_divided_vector_d_object()(*this,c);
|
||||
}
|
||||
int dim;
|
||||
if( is_ascii(is) )
|
||||
is >> dim;
|
||||
else
|
||||
{
|
||||
read(is, dim);
|
||||
}
|
||||
|
||||
Vector_d operator/(const typename First_if_different<FT_,RT>::Type & c) const
|
||||
{
|
||||
return R().construct_divided_vector_d_object()(*this,c);
|
||||
}
|
||||
if(!is) return is;
|
||||
std::vector<FT_> coords(dim);
|
||||
if(is_ascii(is))
|
||||
{
|
||||
for(int i=0;i<dim;++i)
|
||||
is >> iformat(coords[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int i=0;i<dim;++i)
|
||||
read(is, coords[i]);
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_x_3, Vector_3>::type
|
||||
x() const
|
||||
{
|
||||
return R().compute_x_3_object()(*this);
|
||||
// FIXME: with Epeck_d, currently, this stores pointers to coords which will soon be dead.
|
||||
if(is)
|
||||
p = Point_d(coords.begin(), coords.end());
|
||||
return is;
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_y_3, Vector_3>::type
|
||||
y() const
|
||||
{
|
||||
return R().compute_y_3_object()(*this);
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_z_3, Vector_3>::type
|
||||
z() const
|
||||
{
|
||||
return R().compute_z_3_object()(*this);
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_hx_3, Vector_3>::type
|
||||
hx() const
|
||||
{
|
||||
return R().compute_hx_3_object()(*this);
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_hy_3, Vector_3>::type
|
||||
hy() const
|
||||
{
|
||||
return R().compute_hy_3_object()(*this);
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_hz_3, Vector_3>::type
|
||||
hz() const
|
||||
{
|
||||
return R().compute_hz_3_object()(*this);
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_hw_3, Vector_3>::type
|
||||
hw() const
|
||||
{
|
||||
return R().compute_hw_3_object()(*this);
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_x_3, Vector_3>::type
|
||||
cartesian(int i) const
|
||||
{
|
||||
CGAL_kernel_precondition( (i == 0) || (i == 1) || (i == 2) );
|
||||
if (i==0) return x();
|
||||
if (i==1) return y();
|
||||
return z();
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_hw_3, Vector_3>::type
|
||||
homogeneous(int i) const
|
||||
{
|
||||
CGAL_kernel_precondition( (i >= 0) || (i <= 3) );
|
||||
if (i==0) return hx();
|
||||
if (i==1) return hy();
|
||||
if (i==2) return hz();
|
||||
return hw();
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_squared_length_3, Vector_3>::type
|
||||
squared_length() const
|
||||
{
|
||||
return R().compute_squared_length_3_object()(*this);
|
||||
}
|
||||
*/
|
||||
};
|
||||
#if 0
|
||||
template <class R_> Point_d<R_>::Point_d(Point_d &)=default;
|
||||
#endif
|
||||
|
||||
template <class R_>
|
||||
std::ostream& operator <<(std::ostream& os, const Point_d<R_>& p)
|
||||
{
|
||||
typedef typename R_::Kernel_base Kbase;
|
||||
typedef typename Get_functor<Kbase, Construct_ttag<Point_cartesian_const_iterator_tag> >::type CPI;
|
||||
// Should just be "auto"...
|
||||
typename CGAL::decay<typename boost::result_of<
|
||||
CPI(typename Point_d<R_>::Rep,Begin_tag)
|
||||
>::type>::type
|
||||
b = p.cartesian_begin(),
|
||||
e = p.cartesian_end();
|
||||
if(is_ascii(os))
|
||||
{
|
||||
os << p.dimension();
|
||||
for(; b != e; ++b){
|
||||
os << " " << *b;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
write(os, p.dimension());
|
||||
for(; b != e; ++b){
|
||||
write(os, *b);
|
||||
}
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
// TODO: test if the stream is binary or text?
|
||||
template<typename K>
|
||||
std::istream &
|
||||
operator>>(std::istream &is, Point_d<K> & p)
|
||||
{
|
||||
typedef typename Get_type<K, Point_tag>::type P;
|
||||
typedef typename Get_type<K, FT_tag>::type FT;
|
||||
int dim;
|
||||
if( is_ascii(is) )
|
||||
is >> dim;
|
||||
else
|
||||
{
|
||||
read(is, dim);
|
||||
}
|
||||
|
||||
if(!is) return is;
|
||||
std::vector<FT> coords(dim);
|
||||
if(is_ascii(is))
|
||||
{
|
||||
for(int i=0;i<dim;++i)
|
||||
is >> iformat(coords[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int i=0;i<dim;++i)
|
||||
read(is, coords[i]);
|
||||
}
|
||||
|
||||
if(is)
|
||||
p = P(coords.begin(), coords.end());
|
||||
return is;
|
||||
}
|
||||
|
||||
//template <class R_>
|
||||
//Vector_d<R_> operator+(const Vector_d<R_>& v,const Vector_d<R_>& w) const
|
||||
|
|
|
|||
|
|
@ -29,10 +29,6 @@
|
|||
#include <boost/type_traits.hpp>
|
||||
#include <CGAL/Kernel/Return_base_tag.h>
|
||||
#include <CGAL/Dimension.h>
|
||||
#ifndef CGAL_CXX11
|
||||
#include <boost/preprocessor/repetition.hpp>
|
||||
#endif
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
// no need for a fancy interface here, people can use the Point_d wrapper on
|
||||
// top.
|
||||
|
|
@ -67,7 +63,6 @@ public:
|
|||
return CGAL::get_pointee_or_identity(data);
|
||||
}
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
template<class...U,class=typename std::enable_if<!std::is_same<std::tuple<typename std::decay<U>::type...>,std::tuple<Ref_count_obj> >::value>::type> explicit Ref_count_obj(U&&...u)
|
||||
: data(Eval_functor(),CBase(),std::forward<U>(u)...){}
|
||||
|
||||
|
|
@ -88,32 +83,6 @@ public:
|
|||
// Ref_count_obj(Origin&& v)
|
||||
// : data(Eval_functor(),CBase(),std::move(v)) {}
|
||||
|
||||
#else
|
||||
|
||||
Ref_count_obj() : data(Eval_functor(),CBase()) {}
|
||||
|
||||
Ref_count_obj(Rep const& v) : data(v) {} // try not to use it
|
||||
|
||||
#define CGAL_CODE(Z,N,_) template<BOOST_PP_ENUM_PARAMS(N,class T)> \
|
||||
explicit Ref_count_obj(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \
|
||||
: data(Eval_functor(),CBase(),BOOST_PP_ENUM_PARAMS(N,t)) {} \
|
||||
\
|
||||
template<class F,BOOST_PP_ENUM_PARAMS(N,class T)> \
|
||||
Ref_count_obj(Eval_functor,F const& f,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \
|
||||
: data(Eval_functor(),f,BOOST_PP_ENUM_PARAMS(N,t)) {}
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_)
|
||||
#undef CGAL_CODE
|
||||
template<class F>
|
||||
Ref_count_obj(Eval_functor,F const& f)
|
||||
: data(Eval_functor(),f) {}
|
||||
|
||||
// // this one should be implicit
|
||||
// Ref_count_obj(Origin const& o)
|
||||
// : data(Eval_functor(),CBase(),o) {}
|
||||
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
} //namespace CGAL
|
||||
|
|
|
|||
|
|
@ -28,10 +28,6 @@
|
|||
#include <boost/type_traits.hpp>
|
||||
#include <CGAL/Kernel/Return_base_tag.h>
|
||||
#include <CGAL/Dimension.h>
|
||||
#ifndef CGAL_CXX11
|
||||
#include <boost/preprocessor/repetition.hpp>
|
||||
#endif
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
namespace CGAL {
|
||||
namespace Wrap {
|
||||
|
|
@ -70,7 +66,6 @@ public:
|
|||
|
||||
typedef R_ R;
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
template<class...U,class=typename std::enable_if<!std::is_same<std::tuple<typename std::decay<U>::type...>,std::tuple<Segment_d> >::value>::type> explicit Segment_d(U&&...u)
|
||||
: Rep(CSBase()(std::forward<U>(u)...)){}
|
||||
|
||||
|
|
@ -92,30 +87,6 @@ public:
|
|||
Segment_d(Rep& v) : Rep(static_cast<Rep const&>(v)) {}
|
||||
Segment_d(Rep&& v) : Rep(std::move(v)) {}
|
||||
|
||||
#else
|
||||
|
||||
Segment_d() : Rep(CSBase()()) {}
|
||||
|
||||
Segment_d(Rep const& v) : Rep(v) {} // try not to use it
|
||||
|
||||
#define CGAL_CODE(Z,N,_) template<BOOST_PP_ENUM_PARAMS(N,class T)> \
|
||||
explicit Segment_d(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \
|
||||
: Rep(CSBase()( \
|
||||
BOOST_PP_ENUM_PARAMS(N,t))) {} \
|
||||
\
|
||||
template<class F,BOOST_PP_ENUM_PARAMS(N,class T)> \
|
||||
Segment_d(Eval_functor,F const& f,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \
|
||||
: Rep(f(BOOST_PP_ENUM_PARAMS(N,t))) {}
|
||||
/*
|
||||
template<BOOST_PP_ENUM_PARAMS(N,class T)> \
|
||||
Point_d(Eval_functor,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \
|
||||
: Rep(Eval_functor(), BOOST_PP_ENUM_PARAMS(N,t)) {}
|
||||
*/
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_)
|
||||
#undef CGAL_CODE
|
||||
|
||||
#endif
|
||||
|
||||
//TODO: if CSEBase returns a reference to a base point, cast it to a
|
||||
//reference to a wrapper point. Ugly but should be safe.
|
||||
|
|
|
|||
|
|
@ -26,10 +26,6 @@
|
|||
#include <boost/type_traits.hpp>
|
||||
#include <CGAL/Kernel/Return_base_tag.h>
|
||||
#include <CGAL/Dimension.h>
|
||||
#ifndef CGAL_CXX11
|
||||
#include <boost/preprocessor/repetition.hpp>
|
||||
#endif
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
namespace CGAL {
|
||||
namespace Wrap {
|
||||
|
|
@ -67,7 +63,6 @@ public:
|
|||
|
||||
typedef R_ R;
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
template<class...U,class=typename std::enable_if<!std::is_same<std::tuple<typename std::decay<U>::type...>,std::tuple<Sphere_d> >::value>::type> explicit Sphere_d(U&&...u)
|
||||
: Rep(CSBase()(std::forward<U>(u)...)){}
|
||||
|
||||
|
|
@ -89,30 +84,6 @@ public:
|
|||
Sphere_d(Rep& v) : Rep(static_cast<Rep const&>(v)) {}
|
||||
Sphere_d(Rep&& v) : Rep(std::move(v)) {}
|
||||
|
||||
#else
|
||||
|
||||
Sphere_d() : Rep(CSBase()()) {}
|
||||
|
||||
Sphere_d(Rep const& v) : Rep(v) {} // try not to use it
|
||||
|
||||
#define CGAL_CODE(Z,N,_) template<BOOST_PP_ENUM_PARAMS(N,class T)> \
|
||||
explicit Sphere_d(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \
|
||||
: Rep(CSBase()( \
|
||||
BOOST_PP_ENUM_PARAMS(N,t))) {} \
|
||||
\
|
||||
template<class F,BOOST_PP_ENUM_PARAMS(N,class T)> \
|
||||
Sphere_d(Eval_functor,F const& f,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \
|
||||
: Rep(f(BOOST_PP_ENUM_PARAMS(N,t))) {}
|
||||
/*
|
||||
template<BOOST_PP_ENUM_PARAMS(N,class T)> \
|
||||
Point_d(Eval_functor,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \
|
||||
: Rep(Eval_functor(), BOOST_PP_ENUM_PARAMS(N,t)) {}
|
||||
*/
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_)
|
||||
#undef CGAL_CODE
|
||||
|
||||
#endif
|
||||
|
||||
//TODO: if COSBase returns a reference to a base point, cast it to a
|
||||
//reference to a wrapper point. Ugly but should be safe.
|
||||
|
|
|
|||
|
|
@ -31,9 +31,6 @@
|
|||
#include <boost/type_traits.hpp>
|
||||
#include <CGAL/Kernel/Return_base_tag.h>
|
||||
#include <CGAL/Dimension.h>
|
||||
#ifndef CGAL_CXX11
|
||||
#include <boost/preprocessor/repetition.hpp>
|
||||
#endif
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
@ -75,7 +72,6 @@ public:
|
|||
|
||||
typedef R_ R;
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC == 1900)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4309)
|
||||
|
|
@ -113,48 +109,20 @@ public:
|
|||
Vector_d(Null_vector&& v)
|
||||
: Rep(CVBase()(std::move(v))) {}
|
||||
|
||||
#else
|
||||
|
||||
Vector_d() : Rep(CVBase()()) {}
|
||||
|
||||
Vector_d(Rep const& v) : Rep(v) {} // try not to use it
|
||||
|
||||
#define CGAL_CODE(Z,N,_) template<BOOST_PP_ENUM_PARAMS(N,class T)> \
|
||||
explicit Vector_d(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \
|
||||
: Rep(CVBase()( \
|
||||
BOOST_PP_ENUM_PARAMS(N,t))) {} \
|
||||
\
|
||||
template<class F,BOOST_PP_ENUM_PARAMS(N,class T)> \
|
||||
Vector_d(Eval_functor,F const& f,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \
|
||||
: Rep(f(BOOST_PP_ENUM_PARAMS(N,t))) {}
|
||||
/*
|
||||
template<BOOST_PP_ENUM_PARAMS(N,class T)> \
|
||||
Vector_d(Eval_functor,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \
|
||||
: Rep(Eval_functor(), BOOST_PP_ENUM_PARAMS(N,t)) {}
|
||||
*/
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_)
|
||||
#undef CGAL_CODE
|
||||
|
||||
// this one should be implicit
|
||||
Vector_d(Null_vector const& v)
|
||||
: Rep(CVBase()(v)) {}
|
||||
|
||||
#endif
|
||||
|
||||
typename boost::result_of<CCBase(Rep,int)>::type cartesian(int i)const{
|
||||
decltype(auto) cartesian(int i)const{
|
||||
return CCBase()(rep(),i);
|
||||
}
|
||||
|
||||
typename boost::result_of<CCBase(Rep,int)>::type operator[](int i)const{
|
||||
decltype(auto) operator[](int i)const{
|
||||
return CCBase()(rep(),i);
|
||||
}
|
||||
|
||||
typename boost::result_of<CVI(Rep,Begin_tag)>::type cartesian_begin()const{
|
||||
decltype(auto) cartesian_begin()const{
|
||||
return CVI()(rep(),Begin_tag());
|
||||
}
|
||||
|
||||
typename boost::result_of<CVI(Rep,End_tag)>::type cartesian_end()const{
|
||||
decltype(auto) cartesian_end()const{
|
||||
return CVI()(rep(),End_tag());
|
||||
}
|
||||
|
||||
|
|
@ -163,180 +131,80 @@ public:
|
|||
return typename Get_functor<R, Opposite_vector_tag>::type()(*this);
|
||||
}
|
||||
|
||||
/*
|
||||
Direction_d direction() const
|
||||
{
|
||||
return R().construct_direction_d_object()(*this);
|
||||
}
|
||||
|
||||
Vector_d transform(const Aff_transformation_d &t) const
|
||||
{
|
||||
return t.transform(*this);
|
||||
}
|
||||
|
||||
Vector_d operator/(const RT& c) const
|
||||
{
|
||||
return R().construct_divided_vector_d_object()(*this,c);
|
||||
}
|
||||
|
||||
Vector_d operator/(const typename First_if_different<FT_,RT>::Type & c) const
|
||||
{
|
||||
return R().construct_divided_vector_d_object()(*this,c);
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_x_3, Vector_3>::type
|
||||
x() const
|
||||
{
|
||||
return R().compute_x_3_object()(*this);
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_y_3, Vector_3>::type
|
||||
y() const
|
||||
{
|
||||
return R().compute_y_3_object()(*this);
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_z_3, Vector_3>::type
|
||||
z() const
|
||||
{
|
||||
return R().compute_z_3_object()(*this);
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_hx_3, Vector_3>::type
|
||||
hx() const
|
||||
{
|
||||
return R().compute_hx_3_object()(*this);
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_hy_3, Vector_3>::type
|
||||
hy() const
|
||||
{
|
||||
return R().compute_hy_3_object()(*this);
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_hz_3, Vector_3>::type
|
||||
hz() const
|
||||
{
|
||||
return R().compute_hz_3_object()(*this);
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_hw_3, Vector_3>::type
|
||||
hw() const
|
||||
{
|
||||
return R().compute_hw_3_object()(*this);
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_x_3, Vector_3>::type
|
||||
cartesian(int i) const
|
||||
{
|
||||
CGAL_kernel_precondition( (i == 0) || (i == 1) || (i == 2) );
|
||||
if (i==0) return x();
|
||||
if (i==1) return y();
|
||||
return z();
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_hw_3, Vector_3>::type
|
||||
homogeneous(int i) const
|
||||
{
|
||||
CGAL_kernel_precondition( (i >= 0) || (i <= 3) );
|
||||
if (i==0) return hx();
|
||||
if (i==1) return hy();
|
||||
if (i==2) return hz();
|
||||
return hw();
|
||||
}
|
||||
|
||||
int dimension() const // bad idea?
|
||||
{
|
||||
return rep.dimension();
|
||||
}
|
||||
*/
|
||||
int dimension() const {
|
||||
typedef typename Get_functor<Kbase, Vector_dimension_tag>::type VDBase;
|
||||
return VDBase()(rep());
|
||||
}
|
||||
|
||||
typename boost::result_of<SLBase(Rep)>::type squared_length()const{
|
||||
decltype(auto) squared_length()const{
|
||||
return SLBase()(rep());
|
||||
}
|
||||
|
||||
friend std::ostream& operator <<(std::ostream& os, const Vector_d& v)
|
||||
{
|
||||
auto b = v.cartesian_begin();
|
||||
auto e = v.cartesian_end();
|
||||
if(is_ascii(os))
|
||||
{
|
||||
os << v.dimension();
|
||||
for(; b != e; ++b){
|
||||
os << " " << *b;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
write(os, v.dimension());
|
||||
for(; b != e; ++b){
|
||||
write(os, *b);
|
||||
}
|
||||
}
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
friend std::istream & operator>>(std::istream &is, Vector_d & v)
|
||||
{
|
||||
int dim;
|
||||
if( is_ascii(is) )
|
||||
is >> dim;
|
||||
else
|
||||
{
|
||||
read(is, dim);
|
||||
}
|
||||
if(!is) return is;
|
||||
|
||||
std::vector<FT_> coords(dim);
|
||||
if(is_ascii(is))
|
||||
{
|
||||
for(int i=0;i<dim;++i)
|
||||
is >> iformat(coords[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int i=0;i<dim;++i)
|
||||
read(is, coords[i]);
|
||||
}
|
||||
|
||||
if(is)
|
||||
v = Vector_d(coords.begin(), coords.end());
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
friend Vector_d operator+(const Vector_d& v,const Vector_d& w)
|
||||
{
|
||||
return typename Get_functor<R, Sum_of_vectors_tag>::type()(v,w);
|
||||
}
|
||||
|
||||
friend Vector_d operator-(const Vector_d& v,const Vector_d& w)
|
||||
{
|
||||
return typename Get_functor<R, Difference_of_vectors_tag>::type()(v,w);
|
||||
}
|
||||
};
|
||||
#if 0
|
||||
template <class R_> Vector_d<R_>::Vector_d(Vector_d &)=default;
|
||||
#endif
|
||||
|
||||
template <class R_>
|
||||
std::ostream& operator <<(std::ostream& os, const Vector_d<R_>& v)
|
||||
{
|
||||
typedef typename R_::Kernel_base Kbase;
|
||||
typedef typename Get_functor<Kbase, Construct_ttag<Vector_cartesian_const_iterator_tag> >::type CVI;
|
||||
// Should just be "auto"...
|
||||
typename CGAL::decay<typename boost::result_of<
|
||||
CVI(typename Vector_d<R_>::Rep,Begin_tag)
|
||||
>::type>::type
|
||||
b = v.cartesian_begin(),
|
||||
e = v.cartesian_end();
|
||||
if(is_ascii(os))
|
||||
{
|
||||
os << v.dimension();
|
||||
for(; b != e; ++b){
|
||||
os << " " << *b;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
write(os, v.dimension());
|
||||
for(; b != e; ++b){
|
||||
write(os, *b);
|
||||
}
|
||||
}
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
template<typename K>
|
||||
std::istream &
|
||||
operator>>(std::istream &is, Vector_d<K> & v)
|
||||
{
|
||||
typedef typename Get_type<K, Vector_tag>::type V;
|
||||
typedef typename Get_type<K, FT_tag>::type FT;
|
||||
int dim;
|
||||
if( is_ascii(is) )
|
||||
is >> dim;
|
||||
else
|
||||
{
|
||||
read(is, dim);
|
||||
}
|
||||
if(!is) return is;
|
||||
|
||||
std::vector<FT> coords(dim);
|
||||
if(is_ascii(is))
|
||||
{
|
||||
for(int i=0;i<dim;++i)
|
||||
is >> iformat(coords[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int i=0;i<dim;++i)
|
||||
read(is, coords[i]);
|
||||
}
|
||||
|
||||
if(is)
|
||||
v = V(coords.begin(), coords.end());
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
template <class R_>
|
||||
Vector_d<R_> operator+(const Vector_d<R_>& v,const Vector_d<R_>& w)
|
||||
{
|
||||
return typename Get_functor<R_, Sum_of_vectors_tag>::type()(v,w);
|
||||
}
|
||||
|
||||
template <class R_>
|
||||
Vector_d<R_> operator-(const Vector_d<R_>& v,const Vector_d<R_>& w)
|
||||
{
|
||||
return typename Get_functor<R_, Difference_of_vectors_tag>::type()(v,w);
|
||||
}
|
||||
|
||||
} //namespace Wrap
|
||||
} //namespace CGAL
|
||||
|
|
|
|||
|
|
@ -29,10 +29,6 @@
|
|||
#include <boost/type_traits.hpp>
|
||||
#include <CGAL/Kernel/Return_base_tag.h>
|
||||
#include <CGAL/Dimension.h>
|
||||
#ifndef CGAL_CXX11
|
||||
#include <boost/preprocessor/repetition.hpp>
|
||||
#endif
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
namespace CGAL {
|
||||
namespace Wrap {
|
||||
|
|
@ -70,7 +66,6 @@ public:
|
|||
|
||||
typedef R_ R;
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
template<class...U,class=typename std::enable_if<!std::is_same<std::tuple<typename std::decay<U>::type...>,std::tuple<Weighted_point_d> >::value>::type> explicit Weighted_point_d(U&&...u)
|
||||
: Rep(CWPBase()(std::forward<U>(u)...)){}
|
||||
|
||||
|
|
@ -92,30 +87,6 @@ public:
|
|||
Weighted_point_d(Rep& v) : Rep(static_cast<Rep const&>(v)) {}
|
||||
Weighted_point_d(Rep&& v) : Rep(std::move(v)) {}
|
||||
|
||||
#else
|
||||
|
||||
Weighted_point_d() : Rep(CWPBase()()) {}
|
||||
|
||||
Weighted_point_d(Rep const& v) : Rep(v) {} // try not to use it
|
||||
|
||||
#define CGAL_CODE(Z,N,_) template<BOOST_PP_ENUM_PARAMS(N,class T)> \
|
||||
explicit Weighted_point_d(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \
|
||||
: Rep(CWPBase()( \
|
||||
BOOST_PP_ENUM_PARAMS(N,t))) {} \
|
||||
\
|
||||
template<class F,BOOST_PP_ENUM_PARAMS(N,class T)> \
|
||||
Weighted_point_d(Eval_functor,F const& f,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \
|
||||
: Rep(f(BOOST_PP_ENUM_PARAMS(N,t))) {}
|
||||
/*
|
||||
template<BOOST_PP_ENUM_PARAMS(N,class T)> \
|
||||
Point_d(Eval_functor,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \
|
||||
: Rep(Eval_functor(), BOOST_PP_ENUM_PARAMS(N,t)) {}
|
||||
*/
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_)
|
||||
#undef CGAL_CODE
|
||||
|
||||
#endif
|
||||
|
||||
//TODO: use references?
|
||||
Point_ point()const{
|
||||
|
|
|
|||
|
|
@ -35,9 +35,7 @@
|
|||
#include <CGAL/NewKernel_d/functor_properties.h>
|
||||
#include <CGAL/predicates/sign_of_determinant.h>
|
||||
#include <functional>
|
||||
#ifdef CGAL_CXX11
|
||||
#include <initializer_list>
|
||||
#endif
|
||||
|
||||
namespace CGAL {
|
||||
namespace CartesianDKernelFunctors {
|
||||
|
|
@ -70,10 +68,9 @@ template<class R_,class D_=typename R_::Default_ambient_dimension,bool=internal:
|
|||
// should we cache the coordinates of p0 in case they are computed?
|
||||
}
|
||||
}
|
||||
return R::LA::sign_of_determinant(CGAL_MOVE(m));
|
||||
return R::LA::sign_of_determinant(std::move(m));
|
||||
}
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
// Since the dimension is at least 2, there are at least 3 points and no ambiguity with iterators.
|
||||
// template <class...U,class=typename std::enable_if<std::is_same<Dimension_tag<sizeof...(U)-1>,typename R::Default_ambient_dimension>::value>::type>
|
||||
template <class...U,class=typename std::enable_if<(sizeof...(U)>=3)>::type>
|
||||
|
|
@ -85,28 +82,8 @@ template<class R_,class D_=typename R_::Default_ambient_dimension,bool=internal:
|
|||
result_type operator()(std::initializer_list<P> l) const {
|
||||
return operator()(l.begin(),l.end());
|
||||
}
|
||||
#else
|
||||
//should we make it template to avoid instantiation for wrong dim?
|
||||
//or iterate outside the class?
|
||||
#define CGAL_VAR(Z,J,I) m(I,J)=c(p##I,J)-c(x,J);
|
||||
#define CGAL_VAR2(Z,I,N) BOOST_PP_REPEAT(N,CGAL_VAR,I)
|
||||
#define CGAL_CODE(Z,N,_) \
|
||||
result_type operator()(Point const&x, BOOST_PP_ENUM_PARAMS(N,Point const&p)) const { \
|
||||
typename Get_functor<R, Compute_point_cartesian_coordinate_tag>::type c(this->kernel()); \
|
||||
Matrix m(N,N); \
|
||||
BOOST_PP_REPEAT(N,CGAL_VAR2,N) \
|
||||
return R::LA::sign_of_determinant(CGAL_MOVE(m)); \
|
||||
}
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(7, 10, CGAL_CODE, _ )
|
||||
// No need to do it for <=6, since that uses a different code path
|
||||
#undef CGAL_CODE
|
||||
#undef CGAL_VAR2
|
||||
#undef CGAL_VAR
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
template<class R_,int d> struct Orientation_of_points<R_,Dimension_tag<d>,true> : private Store_kernel<R_> {
|
||||
CGAL_FUNCTOR_INIT_STORE(Orientation_of_points)
|
||||
typedef R_ R;
|
||||
|
|
@ -114,7 +91,7 @@ template<class R_,int d> struct Orientation_of_points<R_,Dimension_tag<d>,true>
|
|||
typedef typename Get_type<R, Point_tag>::type Point;
|
||||
typedef typename Get_type<R, Orientation_tag>::type result_type;
|
||||
template<class>struct Help;
|
||||
template<int...I>struct Help<Indices<I...> > {
|
||||
template<std::size_t...I>struct Help<std::index_sequence<I...> > {
|
||||
template<class C,class P,class T> result_type operator()(C const&c,P const&x,T&&t)const{
|
||||
return sign_of_determinant<RT>(c(std::get<I/d>(t),I%d)-c(x,I%d)...);
|
||||
}
|
||||
|
|
@ -122,7 +99,7 @@ template<class R_,int d> struct Orientation_of_points<R_,Dimension_tag<d>,true>
|
|||
template<class P0,class...P> result_type operator()(P0 const&x,P&&...p)const{
|
||||
static_assert(d==sizeof...(P),"Wrong number of arguments");
|
||||
typename Get_functor<R, Compute_point_cartesian_coordinate_tag>::type c(this->kernel());
|
||||
return Help<typename N_increasing_indices<d*d>::type>()(c,x,std::forward_as_tuple(std::forward<P>(p)...));
|
||||
return Help<std::make_index_sequence<d*d>>()(c,x,std::forward_as_tuple(std::forward<P>(p)...));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -139,40 +116,6 @@ template<class R_,int d> struct Orientation_of_points<R_,Dimension_tag<d>,true>
|
|||
return help2(Dimension_tag<d+1>(),f,e);
|
||||
}
|
||||
};
|
||||
#else
|
||||
#define CGAL_VAR(Z,J,I) c(p##I,J)-x##J
|
||||
#define CGAL_VAR2(Z,I,N) BOOST_PP_ENUM(N,CGAL_VAR,I)
|
||||
#define CGAL_VAR3(Z,N,_) Point const&p##N=*++f;
|
||||
#define CGAL_VAR4(Z,N,_) RT const&x##N=c(x,N);
|
||||
#define CGAL_CODE(Z,N,_) \
|
||||
template<class R_> struct Orientation_of_points<R_,Dimension_tag<N>,true> : private Store_kernel<R_> { \
|
||||
CGAL_FUNCTOR_INIT_STORE(Orientation_of_points) \
|
||||
typedef R_ R; \
|
||||
typedef typename Get_type<R, RT_tag>::type RT; \
|
||||
typedef typename Get_type<R, Point_tag>::type Point; \
|
||||
typedef typename Get_type<R, Orientation_tag>::type result_type; \
|
||||
result_type operator()(Point const&x, BOOST_PP_ENUM_PARAMS(N,Point const&p)) const { \
|
||||
typename Get_functor<R, Compute_point_cartesian_coordinate_tag>::type c(this->kernel()); \
|
||||
BOOST_PP_REPEAT(N,CGAL_VAR4,) \
|
||||
return sign_of_determinant<RT>(BOOST_PP_ENUM(N,CGAL_VAR2,N)); \
|
||||
} \
|
||||
template<class Iter> \
|
||||
result_type operator()(Iter f, Iter CGAL_assertion_code(e))const{ \
|
||||
Point const&x=*f; \
|
||||
BOOST_PP_REPEAT(N,CGAL_VAR3,) \
|
||||
CGAL_assertion(++f==e); \
|
||||
return operator()(x,BOOST_PP_ENUM_PARAMS(N,p)); \
|
||||
} \
|
||||
};
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(2, 7, CGAL_CODE, _ )
|
||||
#undef CGAL_CODE
|
||||
#undef CGAL_VAR4
|
||||
#undef CGAL_VAR3
|
||||
#undef CGAL_VAR2
|
||||
#undef CGAL_VAR
|
||||
|
||||
#endif
|
||||
|
||||
template<class R_> struct Orientation_of_points<R_,Dimension_tag<1>,true> : private Store_kernel<R_> {
|
||||
CGAL_FUNCTOR_INIT_STORE(Orientation_of_points)
|
||||
|
|
@ -208,8 +151,7 @@ template<class R_> struct Orientation_of_vectors : private Store_kernel<R_> {
|
|||
template<class Iter>
|
||||
result_type operator()(Iter f, Iter e)const{
|
||||
typename Get_functor<R, Compute_vector_cartesian_coordinate_tag>::type c(this->kernel());
|
||||
typename Get_functor<R, Point_dimension_tag>::type vd(this->kernel());
|
||||
// FIXME: Uh? Using it on a vector ?!
|
||||
typename Get_functor<R, Vector_dimension_tag>::type vd(this->kernel());
|
||||
Vector const& v0=*f;
|
||||
int d=vd(v0);
|
||||
Matrix m(d,d);
|
||||
|
|
@ -222,10 +164,9 @@ template<class R_> struct Orientation_of_vectors : private Store_kernel<R_> {
|
|||
m(i,j)=c(v,j);
|
||||
}
|
||||
}
|
||||
return R::LA::sign_of_determinant(CGAL_MOVE(m));
|
||||
return R::LA::sign_of_determinant(std::move(m));
|
||||
}
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
template <class...U,class=typename std::enable_if<(sizeof...(U)>=3)>::type>
|
||||
result_type operator()(U&&...u) const {
|
||||
return operator()({std::forward<U>(u)...});
|
||||
|
|
@ -235,13 +176,10 @@ template<class R_> struct Orientation_of_vectors : private Store_kernel<R_> {
|
|||
result_type operator()(std::initializer_list<V> l) const {
|
||||
return operator()(l.begin(),l.end());
|
||||
}
|
||||
#else
|
||||
//TODO
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
CGAL_KD_DEFAULT_FUNCTOR(Orientation_of_vectors_tag,(CartesianDKernelFunctors::Orientation_of_vectors<K>),(Vector_tag),(Point_dimension_tag,Compute_vector_cartesian_coordinate_tag));
|
||||
CGAL_KD_DEFAULT_FUNCTOR(Orientation_of_vectors_tag,(CartesianDKernelFunctors::Orientation_of_vectors<K>),(Vector_tag),(Vector_dimension_tag,Compute_vector_cartesian_coordinate_tag));
|
||||
|
||||
namespace CartesianDKernelFunctors {
|
||||
template<class R_> struct Linear_rank : private Store_kernel<R_> {
|
||||
|
|
@ -255,11 +193,10 @@ template<class R_> struct Linear_rank : private Store_kernel<R_> {
|
|||
template<class Iter>
|
||||
result_type operator()(Iter f, Iter e)const{
|
||||
typename Get_functor<R, Compute_vector_cartesian_coordinate_tag>::type c(this->kernel());
|
||||
typename Get_functor<R, Point_dimension_tag>::type vd(this->kernel());
|
||||
typename Get_functor<R, Vector_dimension_tag>::type vd(this->kernel());
|
||||
std::ptrdiff_t n=std::distance(f,e);
|
||||
if (n==0) return 0;
|
||||
Vector const& v0 = *f;
|
||||
// FIXME: Uh? Using it on a vector ?!
|
||||
int d=vd(v0);
|
||||
Matrix m(d,n);
|
||||
for(int j=0;j<d;++j){
|
||||
|
|
@ -271,12 +208,12 @@ template<class R_> struct Linear_rank : private Store_kernel<R_> {
|
|||
m(j,i)=c(v,j);
|
||||
}
|
||||
}
|
||||
return R::LA::rank(CGAL_MOVE(m));
|
||||
return R::LA::rank(std::move(m));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
CGAL_KD_DEFAULT_FUNCTOR(Linear_rank_tag,(CartesianDKernelFunctors::Linear_rank<K>),(Vector_tag),(Point_dimension_tag,Compute_vector_cartesian_coordinate_tag));
|
||||
CGAL_KD_DEFAULT_FUNCTOR(Linear_rank_tag,(CartesianDKernelFunctors::Linear_rank<K>),(Vector_tag),(Vector_dimension_tag,Compute_vector_cartesian_coordinate_tag));
|
||||
|
||||
namespace CartesianDKernelFunctors {
|
||||
template<class R_> struct Linearly_independent : private Store_kernel<R_> {
|
||||
|
|
@ -286,9 +223,8 @@ template<class R_> struct Linearly_independent : private Store_kernel<R_> {
|
|||
|
||||
template<class Iter>
|
||||
result_type operator()(Iter f, Iter e)const{
|
||||
typename Get_functor<R, Point_dimension_tag>::type vd(this->kernel());
|
||||
typename Get_functor<R, Vector_dimension_tag>::type vd(this->kernel());
|
||||
std::ptrdiff_t n=std::distance(f,e);
|
||||
// FIXME: Uh? Using it on a vector ?!
|
||||
int d=vd(*f);
|
||||
if (n>d) return false;
|
||||
typename Get_functor<R, Linear_rank_tag>::type lr(this->kernel());
|
||||
|
|
@ -297,7 +233,7 @@ template<class R_> struct Linearly_independent : private Store_kernel<R_> {
|
|||
};
|
||||
}
|
||||
|
||||
CGAL_KD_DEFAULT_FUNCTOR(Linearly_independent_tag,(CartesianDKernelFunctors::Linearly_independent<K>),(Vector_tag),(Point_dimension_tag,Linear_rank_tag));
|
||||
CGAL_KD_DEFAULT_FUNCTOR(Linearly_independent_tag,(CartesianDKernelFunctors::Linearly_independent<K>),(Vector_tag),(Vector_dimension_tag,Linear_rank_tag));
|
||||
|
||||
namespace CartesianDKernelFunctors {
|
||||
template<class R_> struct Contained_in_linear_hull : private Store_kernel<R_> {
|
||||
|
|
@ -311,10 +247,9 @@ template<class R_> struct Contained_in_linear_hull : private Store_kernel<R_> {
|
|||
template<class Iter,class V>
|
||||
result_type operator()(Iter f, Iter e,V const&w)const{
|
||||
typename Get_functor<R, Compute_vector_cartesian_coordinate_tag>::type c(this->kernel());
|
||||
typename Get_functor<R, Point_dimension_tag>::type vd(this->kernel());
|
||||
typename Get_functor<R, Vector_dimension_tag>::type vd(this->kernel());
|
||||
std::ptrdiff_t n=std::distance(f,e);
|
||||
if (n==0) return false;
|
||||
// FIXME: Uh? Using it on a vector ?!
|
||||
int d=vd(w);
|
||||
Matrix m(d,n+1);
|
||||
for(int i=0; f!=e; ++f,++i){
|
||||
|
|
@ -329,14 +264,14 @@ template<class R_> struct Contained_in_linear_hull : private Store_kernel<R_> {
|
|||
int r1 = R::LA::rank(m);
|
||||
// FIXME: Don't use eigen directly, go through an interface in LA...
|
||||
m.conservativeResize(Eigen::NoChange, n);
|
||||
int r2 = R::LA::rank(CGAL_MOVE(m));
|
||||
int r2 = R::LA::rank(std::move(m));
|
||||
return r1 == r2;
|
||||
// TODO: This is very very far from optimal...
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
CGAL_KD_DEFAULT_FUNCTOR(Contained_in_linear_hull_tag,(CartesianDKernelFunctors::Contained_in_linear_hull<K>),(Vector_tag),(Point_dimension_tag,Compute_vector_cartesian_coordinate_tag));
|
||||
CGAL_KD_DEFAULT_FUNCTOR(Contained_in_linear_hull_tag,(CartesianDKernelFunctors::Contained_in_linear_hull<K>),(Vector_tag),(Vector_dimension_tag,Compute_vector_cartesian_coordinate_tag));
|
||||
|
||||
namespace CartesianDKernelFunctors {
|
||||
template<class R_> struct Affine_rank : private Store_kernel<R_> {
|
||||
|
|
@ -363,7 +298,7 @@ template<class R_> struct Affine_rank : private Store_kernel<R_> {
|
|||
// TODO: cache p0[j] in case it is computed?
|
||||
}
|
||||
}
|
||||
return R::LA::rank(CGAL_MOVE(m));
|
||||
return R::LA::rank(std::move(m));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -428,8 +363,8 @@ template<class R_> struct Contained_in_simplex : private Store_kernel<R_> {
|
|||
}
|
||||
// If the simplex has full dimension, there must be a solution, only the signs need to be checked.
|
||||
if (n == d+1)
|
||||
LA::solve(a,CGAL_MOVE(m),CGAL_MOVE(b));
|
||||
else if (!LA::solve_and_check(a,CGAL_MOVE(m),CGAL_MOVE(b)))
|
||||
LA::solve(a,std::move(m),std::move(b));
|
||||
else if (!LA::solve_and_check(a,std::move(m),std::move(b)))
|
||||
return false;
|
||||
for(int i=0;i<n;++i){
|
||||
if (a[i]<0) return false;
|
||||
|
|
@ -462,14 +397,13 @@ template<class R_> struct Linear_base : private Store_kernel<R_> {
|
|||
typedef typename R::LA::Dynamic_matrix Matrix;
|
||||
|
||||
template<class Iter, class Oter>
|
||||
result_type operator()(Iter f, Iter e, Oter&o)const{
|
||||
result_type operator()(Iter f, Iter e, Oter o)const{
|
||||
typename Get_functor<R, Compute_vector_cartesian_coordinate_tag>::type c(this->kernel());
|
||||
typename Get_functor<R, Point_dimension_tag>::type vd(this->kernel());
|
||||
typename Get_functor<R, Vector_dimension_tag>::type vd(this->kernel());
|
||||
typename Get_functor<R, Construct_ttag<Vector_tag> >::type cv(this->kernel());
|
||||
std::ptrdiff_t n=std::distance(f,e);
|
||||
if (n==0) return;
|
||||
Vector const& v0 = *f;
|
||||
// FIXME: Uh? Using it on a vector ?!
|
||||
int d=vd(v0);
|
||||
Matrix m(d,n);
|
||||
for(int j=0;j<d;++j){
|
||||
|
|
@ -481,15 +415,11 @@ template<class R_> struct Linear_base : private Store_kernel<R_> {
|
|||
m(i,j)=c(v,j);
|
||||
}
|
||||
}
|
||||
Matrix b = R::LA::basis(CGAL_MOVE(m));
|
||||
Matrix b = R::LA::basis(std::move(m));
|
||||
for(int i=0; i < R::LA::columns(b); ++i){
|
||||
//*o++ = Vector(b.col(i));
|
||||
typedef
|
||||
#ifdef CGAL_CXX11
|
||||
decltype(std::declval<const Matrix>()(0,0))
|
||||
#else
|
||||
FT
|
||||
#endif
|
||||
Ref;
|
||||
typedef Iterator_from_indices<Matrix, FT, Ref,
|
||||
internal::Matrix_col_access<Ref> > IFI;
|
||||
|
|
@ -499,7 +429,7 @@ template<class R_> struct Linear_base : private Store_kernel<R_> {
|
|||
};
|
||||
}
|
||||
|
||||
CGAL_KD_DEFAULT_FUNCTOR(Linear_base_tag,(CartesianDKernelFunctors::Linear_base<K>),(Vector_tag),(Point_dimension_tag,Compute_vector_cartesian_coordinate_tag));
|
||||
CGAL_KD_DEFAULT_FUNCTOR(Linear_base_tag,(CartesianDKernelFunctors::Linear_base<K>),(Vector_tag),(Vector_dimension_tag,Compute_vector_cartesian_coordinate_tag));
|
||||
|
||||
#if 0
|
||||
namespace CartesianDKernelFunctors {
|
||||
|
|
@ -569,7 +499,7 @@ template<class R_> struct Power_side_of_power_sphere_raw : private Store_kernel<
|
|||
typedef typename LA::Square_matrix Matrix;
|
||||
|
||||
template<class IterP, class IterW, class Pt, class Wt>
|
||||
result_type operator()(IterP f, IterP const& e, IterW fw, Pt const& p0, Wt const& w0) const {
|
||||
result_type operator()(IterP f, IterP const& e, IterW fw, IterW const&/*ew*/, Pt const& p0, Wt const& w0) const {
|
||||
typedef typename Get_functor<R, Squared_distance_to_origin_tag>::type Sqdo;
|
||||
typename Get_functor<R, Compute_point_cartesian_coordinate_tag>::type c(this->kernel());
|
||||
typename Get_functor<R, Point_dimension_tag>::type pd(this->kernel());
|
||||
|
|
@ -599,9 +529,9 @@ template<class R_> struct Power_side_of_power_sphere_raw : private Store_kernel<
|
|||
}
|
||||
}
|
||||
if(d%2)
|
||||
return -LA::sign_of_determinant(CGAL_MOVE(m));
|
||||
return -LA::sign_of_determinant(std::move(m));
|
||||
else
|
||||
return LA::sign_of_determinant(CGAL_MOVE(m));
|
||||
return LA::sign_of_determinant(std::move(m));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -621,11 +551,13 @@ template<class R_> struct Side_of_oriented_sphere : private Store_kernel<R_> {
|
|||
typedef typename R::LA::template Rebind_dimension<D1,D2>::Other LA;
|
||||
typedef typename LA::Square_matrix Matrix;
|
||||
|
||||
/* Undocumented, removed
|
||||
template<class Iter>
|
||||
result_type operator()(Iter f, Iter const& e)const{
|
||||
Point const& p0=*f++; // *--e ?
|
||||
return this->operator()(f,e,p0);
|
||||
}
|
||||
*/
|
||||
|
||||
template<class Iter>
|
||||
result_type operator()(Iter f, Iter const& e, Point const& p0) const {
|
||||
|
|
@ -657,12 +589,11 @@ template<class R_> struct Side_of_oriented_sphere : private Store_kernel<R_> {
|
|||
}
|
||||
}
|
||||
if(d%2)
|
||||
return -LA::sign_of_determinant(CGAL_MOVE(m));
|
||||
return -LA::sign_of_determinant(std::move(m));
|
||||
else
|
||||
return LA::sign_of_determinant(CGAL_MOVE(m));
|
||||
return LA::sign_of_determinant(std::move(m));
|
||||
}
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
template <class...U,class=typename std::enable_if<(sizeof...(U)>=4)>::type>
|
||||
result_type operator()(U&&...u) const {
|
||||
return operator()({std::forward<U>(u)...});
|
||||
|
|
@ -672,9 +603,6 @@ template<class R_> struct Side_of_oriented_sphere : private Store_kernel<R_> {
|
|||
result_type operator()(std::initializer_list<P> l) const {
|
||||
return operator()(l.begin(),l.end());
|
||||
}
|
||||
#else
|
||||
//TODO
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -718,7 +646,7 @@ template <class R_> struct Construct_circumcenter : Store_kernel<R_> {
|
|||
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));
|
||||
LA::solve(res, std::move(m), std::move(b));
|
||||
//std::cout << "Sol: " << res << std::endl;
|
||||
return cp(d,LA::vector_begin(res),LA::vector_end(res));
|
||||
}
|
||||
|
|
@ -762,7 +690,7 @@ template <class R_> struct Construct_circumcenter : Store_kernel<R_> {
|
|||
for(j=0;j<k;++j) m(0,j)=1;
|
||||
b(0)=1;
|
||||
|
||||
LAd::solve(l,CGAL_MOVE(m),CGAL_MOVE(b));
|
||||
LAd::solve(l,std::move(m),std::move(b));
|
||||
|
||||
typename LA::Vector center=typename LA::Construct_vector::Dimension()(d);
|
||||
for(i=0;i<d;++i) center(i)=0;
|
||||
|
|
@ -821,7 +749,6 @@ template<class R_> struct Side_of_bounded_sphere : private Store_kernel<R_> {
|
|||
return enum_cast<Bounded_side> (sos (f, e, p0) * op (f, e));
|
||||
}
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
template <class...U,class=typename std::enable_if<(sizeof...(U)>=4)>::type>
|
||||
result_type operator()(U&&...u) const {
|
||||
return operator()({std::forward<U>(u)...});
|
||||
|
|
@ -831,9 +758,6 @@ template<class R_> struct Side_of_bounded_sphere : private Store_kernel<R_> {
|
|||
result_type operator()(std::initializer_list<P> l) const {
|
||||
return operator()(l.begin(),l.end());
|
||||
}
|
||||
#else
|
||||
//TODO
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -1218,15 +1142,9 @@ template<class R_> struct Compare_lexicographically : private Store_kernel<R_> {
|
|||
CI c(this->kernel());
|
||||
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
auto a_begin=c(a,Begin_tag());
|
||||
auto b_begin=c(b,Begin_tag());
|
||||
auto a_end=c(a,End_tag());
|
||||
#else
|
||||
typename CI::result_type a_begin=c(a,Begin_tag());
|
||||
typename CI::result_type b_begin=c(b,Begin_tag());
|
||||
typename CI::result_type a_end=c(a,End_tag());
|
||||
#endif
|
||||
result_type res;
|
||||
// can't we do slightly better for Uncertain<*> ?
|
||||
// after res=...; if(is_uncertain(res))return indeterminate<result_type>();
|
||||
|
|
@ -1290,15 +1208,9 @@ template<class R_> struct Equal_points : private Store_kernel<R_> {
|
|||
CI c(this->kernel());
|
||||
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
auto a_begin=c(a,Begin_tag());
|
||||
auto b_begin=c(b,Begin_tag());
|
||||
auto a_end=c(a,End_tag());
|
||||
#else
|
||||
typename CI::result_type a_begin=c(a,Begin_tag());
|
||||
typename CI::result_type b_begin=c(b,Begin_tag());
|
||||
typename CI::result_type a_end=c(a,End_tag());
|
||||
#endif
|
||||
|
||||
result_type res = true;
|
||||
// Is using CGAL::possibly for Uncertain really an optimization?
|
||||
|
|
|
|||
|
|
@ -22,10 +22,8 @@
|
|||
#define CGAL_FUNCTOR_TAGS_H
|
||||
#include <CGAL/tags.h> // for Null_tag
|
||||
#include <CGAL/NewKernel_d/utils.h>
|
||||
#ifdef CGAL_CXX11
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#endif
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <boost/mpl/has_xxx.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
|
|
@ -42,10 +40,8 @@ namespace CGAL {
|
|||
: K::template Type<T> {};
|
||||
template <class K, class F, class O=void, class=void> struct Get_functor
|
||||
: K::template Functor<F, O> {};
|
||||
#ifdef CGAL_CXX11
|
||||
template <class K, class T> using Type = typename Get_type<K, T>::type;
|
||||
template <class K, class T> using Functor = typename Get_functor<K, T>::type;
|
||||
#endif
|
||||
|
||||
class Null_type {~Null_type();}; // no such object should be created
|
||||
|
||||
|
|
@ -203,7 +199,11 @@ namespace CGAL {
|
|||
typedef Null_tag value_tag;
|
||||
};
|
||||
|
||||
template<class>struct map_result_tag{typedef Null_type type;};
|
||||
template<class T>struct map_result_tag<Construct_ttag<T> >{typedef T type;};
|
||||
|
||||
#define CGAL_DECL_COMPUTE(X) struct X##_tag {}; \
|
||||
template<>struct map_result_tag<X##_tag>{typedef FT_tag type;}; \
|
||||
template<class A,class B,class C>struct Get_functor_category<A,X##_tag,B,C>{typedef Compute_tag type;}
|
||||
CGAL_DECL_COMPUTE(Compute_point_cartesian_coordinate);
|
||||
CGAL_DECL_COMPUTE(Compute_vector_cartesian_coordinate);
|
||||
|
|
@ -241,9 +241,6 @@ namespace CGAL {
|
|||
CGAL_DECL_ITER_OBJ(Point_cartesian_const_iterator, FT, Compute_point_cartesian_coordinate, Point);
|
||||
#undef CGAL_DECL_ITER_OBJ
|
||||
|
||||
template<class>struct map_result_tag{typedef Null_type type;};
|
||||
template<class T>struct map_result_tag<Construct_ttag<T> >{typedef T type;};
|
||||
|
||||
template<class A,class T,class B,class C>struct Get_functor_category<A,Construct_ttag<T>,B,C> :
|
||||
boost::mpl::if_c<iterator_tag_traits<T>::is_iterator,
|
||||
Construct_iterator_tag,
|
||||
|
|
|
|||
|
|
@ -29,19 +29,8 @@
|
|||
// https://lists.boost.org/boost-users/2014/11/83291.php
|
||||
#endif
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#define CGAL_FORWARDABLE(T) T&&
|
||||
#define CGAL_FORWARD(T,t) std::forward<T>(t)
|
||||
#define CGAL_MOVE(t) std::move(t)
|
||||
#define CGAL_CONSTEXPR constexpr
|
||||
#else
|
||||
#define CGAL_FORWARDABLE(T) T const&
|
||||
#define CGAL_FORWARD(T,t) t
|
||||
#define CGAL_MOVE(t) t
|
||||
#define CGAL_CONSTEXPR
|
||||
#endif
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/preprocessor/repetition.hpp>
|
||||
#include <CGAL/Rational_traits.h>
|
||||
|
|
@ -50,12 +39,6 @@
|
|||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
#define CGAL_BOOSTD std::
|
||||
#else
|
||||
#define CGAL_BOOSTD boost::
|
||||
#endif
|
||||
|
||||
namespace CGAL {
|
||||
namespace internal {
|
||||
BOOST_MPL_HAS_XXX_TRAIT_DEF(type)
|
||||
|
|
@ -81,17 +64,10 @@ struct Has_type_different_from <T, No, true>
|
|||
|
||||
// like std::forward, except for basic types where it does a cast, to
|
||||
// avoid issues with narrowing conversions
|
||||
#ifdef CGAL_CXX11
|
||||
template<class T,class U,class V> inline
|
||||
typename std::conditional<std::is_arithmetic<T>::value&&std::is_arithmetic<typename std::remove_reference<U>::type>::value,T,U&&>::type
|
||||
forward_safe(V&& u) { return std::forward<U>(u); }
|
||||
#else
|
||||
template<class T,class U> inline U const& forward_safe(U const& u) {
|
||||
return u;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
template<class...> struct Constructible_from_each;
|
||||
template<class To,class From1,class...From> struct Constructible_from_each<To,From1,From...>{
|
||||
enum { value=std::is_convertible<From1,To>::value&&Constructible_from_each<To,From...>::value };
|
||||
|
|
@ -99,27 +75,14 @@ struct Has_type_different_from <T, No, true>
|
|||
template<class To> struct Constructible_from_each<To>{
|
||||
enum { value=true };
|
||||
};
|
||||
#else
|
||||
// currently only used in C++0X code
|
||||
#endif
|
||||
|
||||
template<class T> struct Scale {
|
||||
#ifndef CGAL_CXX11
|
||||
template<class> struct result;
|
||||
template<class FT> struct result<Scale(FT)> {
|
||||
typedef FT type;
|
||||
};
|
||||
#endif
|
||||
T const& scale;
|
||||
Scale(T const& t):scale(t){}
|
||||
template<class FT>
|
||||
#ifdef CGAL_CXX11
|
||||
auto operator()(FT&& x)const->decltype(scale*std::forward<FT>(x))
|
||||
#else
|
||||
FT operator()(FT const& x)const
|
||||
#endif
|
||||
decltype(auto) operator()(FT&& x)const
|
||||
{
|
||||
return scale*CGAL_FORWARD(FT,x);
|
||||
return (scale*std::forward<FT>(x));
|
||||
}
|
||||
};
|
||||
template<class NT,class T> struct Divide {
|
||||
|
|
@ -135,16 +98,12 @@ struct Has_type_different_from <T, No, true>
|
|||
T const& scale;
|
||||
Divide(T const& t):scale(t){}
|
||||
template<class FT>
|
||||
#ifdef CGAL_CXX11
|
||||
//FIXME: gcc complains for Gmpq
|
||||
//auto operator()(FT&& x)const->decltype(Rational_traits<NT>().make_rational(std::forward<FT>(x),scale))
|
||||
//decltype(auto) operator()(FT&& x)const
|
||||
NT operator()(FT&& x)const
|
||||
#else
|
||||
NT operator()(FT const& x)const
|
||||
#endif
|
||||
{
|
||||
return Rational_traits<NT>().
|
||||
make_rational(CGAL_FORWARD(FT,x),scale);
|
||||
make_rational(std::forward<FT>(x),scale);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -158,39 +117,25 @@ struct Has_type_different_from <T, No, true>
|
|||
template < class Ret >
|
||||
struct multiplies {
|
||||
template<class A,class B>
|
||||
#ifdef CGAL_CXX11
|
||||
auto operator()(A&&a,B&&b)const->decltype(std::forward<A>(a)*std::forward<B>(b))
|
||||
#else
|
||||
Ret operator()(A const& a, B const& b)const
|
||||
#endif
|
||||
decltype(auto) operator()(A&&a,B&&b)const
|
||||
{
|
||||
return CGAL_FORWARD(A,a)*CGAL_FORWARD(B,b);
|
||||
return std::forward<A>(a)*std::forward<B>(b);
|
||||
}
|
||||
};
|
||||
template < class Ret >
|
||||
struct division {
|
||||
template<class A,class B>
|
||||
#ifdef CGAL_CXX11
|
||||
auto operator()(A&&a,B&&b)const->decltype(std::forward<A>(a)/std::forward<B>(b))
|
||||
#else
|
||||
Ret operator()(A const& a, B const& b)const
|
||||
#endif
|
||||
decltype(auto) operator()(A&&a,B&&b)const
|
||||
{
|
||||
return CGAL_FORWARD(A,a)/CGAL_FORWARD(B,b);
|
||||
return std::forward<A>(a)/std::forward<B>(b);
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
using std::decay;
|
||||
#else
|
||||
template<class T> struct decay : boost::remove_cv<typename boost::decay<T>::type> {};
|
||||
#endif
|
||||
|
||||
template<class T,class U> struct Type_copy_ref { typedef U type; };
|
||||
template<class T,class U> struct Type_copy_ref<T&,U> { typedef U& type; };
|
||||
#ifdef CGAL_CXX11
|
||||
template<class T,class U> struct Type_copy_ref<T&&,U> { typedef U&& type; };
|
||||
#endif
|
||||
template<class T,class U> struct Type_copy_cv { typedef U type; };
|
||||
template<class T,class U> struct Type_copy_cv<T const,U> { typedef U const type; };
|
||||
template<class T,class U> struct Type_copy_cv<T volatile,U> { typedef U volatile type; };
|
||||
|
|
@ -204,67 +149,29 @@ struct Has_type_different_from <T, No, true>
|
|||
template<class It> struct result<Dereference_functor(It)> {
|
||||
typedef typename std::iterator_traits<It>::reference type;
|
||||
};
|
||||
template<class It> typename result<Dereference_functor(It)>::type
|
||||
template<class It> decltype(auto)
|
||||
operator()(It const&i)const{
|
||||
return *i;
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
template<int...> struct Indices{};
|
||||
template<class> struct Next_increasing_indices;
|
||||
template<int...I> struct Next_increasing_indices<Indices<I...> > {
|
||||
typedef Indices<I...,sizeof...(I)> type;
|
||||
};
|
||||
template<int N> struct N_increasing_indices {
|
||||
typedef typename Next_increasing_indices<typename N_increasing_indices<N-1>::type>::type type;
|
||||
};
|
||||
template<> struct N_increasing_indices<0> { typedef Indices<> type; };
|
||||
namespace internal {
|
||||
template<class F,class...U,int...I> inline typename std::result_of<F&&(U...)>::type
|
||||
do_call_on_tuple_elements(F&&f, std::tuple<U...>&&t, Indices<I...>&&) {
|
||||
template<class F,class...U,std::size_t...I> inline decltype(auto)
|
||||
do_call_on_tuple_elements(F&&f, std::tuple<U...>&&t, std::index_sequence<I...>&&) {
|
||||
return f(std::get<I>(std::move(t))...);
|
||||
}
|
||||
} // internal
|
||||
template<class/*result type, ignored*/,class F,class...U>
|
||||
inline typename std::result_of<F&&(U...)>::type
|
||||
template<class F,class...U>
|
||||
inline decltype(auto)
|
||||
call_on_tuple_elements(F&&f, std::tuple<U...>&&t) {
|
||||
return internal::do_call_on_tuple_elements(std::forward<F>(f),std::move(t),
|
||||
typename N_increasing_indices<sizeof...(U)>::type());
|
||||
std::make_index_sequence<sizeof...(U)>());
|
||||
}
|
||||
#else
|
||||
#define CGAL_VAR(Z,N,_) std::get<N>(t)
|
||||
#define CGAL_CODE(Z,N,_) template<class Res, class F BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_PARAMS(N,class U)> \
|
||||
inline Res call_on_tuple_elements(F const&f, \
|
||||
std::tuple<BOOST_PP_ENUM_PARAMS(N,U)> const&t) { \
|
||||
return f(BOOST_PP_ENUM(N,CGAL_VAR,)); \
|
||||
}
|
||||
template<class Res, class F>
|
||||
inline Res call_on_tuple_elements(F const&f, std::tuple<>) {
|
||||
return f();
|
||||
}
|
||||
BOOST_PP_REPEAT_FROM_TO(1, 8, CGAL_CODE, _ )
|
||||
#undef CGAL_CODE
|
||||
#undef CGAL_VAR
|
||||
#endif
|
||||
|
||||
template<class A> struct Factory {
|
||||
typedef A result_type;
|
||||
#ifdef CGAL_CXX11
|
||||
template<class...U> result_type operator()(U&&...u)const{
|
||||
return A(std::forward<U>(u)...);
|
||||
}
|
||||
#else
|
||||
result_type operator()()const{
|
||||
return A();
|
||||
}
|
||||
#define CGAL_CODE(Z,N,_) template<BOOST_PP_ENUM_PARAMS(N,class U)> \
|
||||
result_type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,U,const&u))const{ \
|
||||
return A(BOOST_PP_ENUM_PARAMS(N,u)); \
|
||||
}
|
||||
BOOST_PP_REPEAT_FROM_TO(1, 8, CGAL_CODE, _ )
|
||||
#undef CGAL_CODE
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,15 +24,7 @@
|
|||
#include <CGAL/config.h>
|
||||
#include <utility>
|
||||
|
||||
#ifndef CGAL_CXX11
|
||||
#include <boost/preprocessor/repetition.hpp>
|
||||
#include <boost/utility/result_of.hpp>
|
||||
#endif
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
|
||||
namespace internal {
|
||||
|
||||
template<int,class...> struct Apply_to_last_then_rest_;
|
||||
|
|
@ -55,10 +47,8 @@ struct Apply_to_last_then_rest_<0,F,T,U...> {
|
|||
return std::forward<F>(f)(std::forward<T>(t), std::forward<U>(u)...);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
|
||||
|
||||
struct Apply_to_last_then_rest {
|
||||
template<class F,class T,class...U> inline
|
||||
typename internal::Apply_to_last_then_rest_<sizeof...(U),F,T,U...>::result_type
|
||||
|
|
@ -70,20 +60,6 @@ struct Apply_to_last_then_rest {
|
|||
}
|
||||
};
|
||||
|
||||
#else // CGAL_CXX11
|
||||
|
||||
struct Apply_to_last_then_rest {
|
||||
#define CGAL_CODE(Z,N,_) template<class F,class T,BOOST_PP_ENUM_PARAMS(N,class T)> \
|
||||
typename boost::result_of<F(T,BOOST_PP_ENUM_PARAMS(N,T))>::type \
|
||||
operator()(F const&f, BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t), T const&t) const { \
|
||||
return f(t,BOOST_PP_ENUM_PARAMS(N,t)); \
|
||||
}
|
||||
BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_)
|
||||
#undef CGAL_CODE
|
||||
};
|
||||
|
||||
#endif // CGAL_CXX11
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_ARGUMENT_SWAPS_H
|
||||
|
|
|
|||
|
|
@ -33,11 +33,7 @@ struct Default_coordinate_access {
|
|||
|
||||
//TODO: default type for Value_: typename same_cv<Container_,typename remove_cv<Container_>::type::value_type>::type
|
||||
template <class Container_, class Value_, class Ref_=
|
||||
#ifdef CGAL_CXX11
|
||||
decltype(std::declval<Container_>()[0])
|
||||
#else
|
||||
Value_&
|
||||
#endif
|
||||
, class Coord_access = Default_coordinate_access<Ref_>
|
||||
>
|
||||
class Iterator_from_indices
|
||||
|
|
@ -50,7 +46,7 @@ class Iterator_from_indices
|
|||
typedef std::ptrdiff_t index_t;
|
||||
Container_* cont;
|
||||
index_t index;
|
||||
Coord_access ca;
|
||||
CGAL_NO_UNIQUE_ADDRESS Coord_access ca;
|
||||
void increment(){ ++index; }
|
||||
void decrement(){ --index; }
|
||||
void advance(std::ptrdiff_t n){ index+=n; }
|
||||
|
|
@ -66,6 +62,7 @@ class Iterator_from_indices
|
|||
return ca(*cont,index);
|
||||
}
|
||||
public:
|
||||
Iterator_from_indices(){}
|
||||
Iterator_from_indices(Container_& cont_,std::size_t n)
|
||||
: cont(&cont_), index(n) {}
|
||||
template<class T>
|
||||
|
|
|
|||
|
|
@ -21,17 +21,12 @@
|
|||
#ifndef CGAL_TYPESET_H
|
||||
#define CGAL_TYPESET_H
|
||||
#include <CGAL/config.h>
|
||||
#ifdef CGAL_CXX11
|
||||
#include <type_traits>
|
||||
#else
|
||||
#include <boost/type_traits.hpp>
|
||||
#endif
|
||||
|
||||
// Sometimes using tuple just to list types is overkill (takes forever to
|
||||
// instantiate).
|
||||
|
||||
namespace CGAL {
|
||||
#ifdef CGAL_CXX11
|
||||
template<class...> struct typeset;
|
||||
template<class H,class...U> struct typeset<H,U...> {
|
||||
typedef H head;
|
||||
|
|
@ -55,33 +50,6 @@ namespace CGAL {
|
|||
template<class X> using contains = std::false_type;
|
||||
template<class X> using add = typeset<X>;
|
||||
};
|
||||
#else
|
||||
template<class,class> struct typeset;
|
||||
template<class H=void, class T=typename
|
||||
boost::mpl::if_<boost::is_same<H,void>, void, typeset<void, void> >::type >
|
||||
struct typeset {
|
||||
typedef typeset type;
|
||||
typedef H head;
|
||||
typedef T tail;
|
||||
template<class X> struct contains :
|
||||
boost::mpl::if_<boost::is_same<H,X>,boost::true_type,typename tail::template contains<X> >::type
|
||||
{};
|
||||
template<class X,class=void> struct add;
|
||||
//boost::mpl::if_<boost::is_same<H,X>,typeset,typeset<X,typeset> >::type
|
||||
};
|
||||
template<> struct typeset<> {
|
||||
typedef typeset type;
|
||||
template<class X> struct contains : boost::false_type {};
|
||||
template<class X> struct add : CGAL::typeset<X> {};
|
||||
};
|
||||
|
||||
template<class H,class T>
|
||||
template<class X,class>
|
||||
struct typeset<H,T>::add : typeset<H,typename T::template add<X>::type> {};
|
||||
template<class H,class T>
|
||||
template<class V>
|
||||
struct typeset<H,T>::add<H,V> : typeset<H,T> {};
|
||||
#endif
|
||||
|
||||
template<class T1, class T2> struct typeset_union_ :
|
||||
typeset_union_<typename T1::template add<typename T2::head>::type, typename T2::tail>
|
||||
|
|
@ -93,26 +61,15 @@ namespace CGAL {
|
|||
typedef typename T1::head H;
|
||||
typedef typename typeset_intersection_<typename T1::tail,T2>::type U;
|
||||
typedef typename
|
||||
#ifdef CGAL_CXX11
|
||||
std::conditional<T2::template contains<H>::value,
|
||||
#else
|
||||
boost::mpl::if_<typename T2::template contains<H>,
|
||||
#endif
|
||||
typename U::template add<H>::type, U>::type type;
|
||||
};
|
||||
template<class T>
|
||||
struct typeset_intersection_<typeset<>,T> : typeset<> {};
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
template<class T1, class T2>
|
||||
using typeset_union = typename typeset_union_<T1,T2>::type;
|
||||
template<class T1, class T2>
|
||||
using typeset_intersection = typename typeset_intersection_<T1,T2>::type;
|
||||
#else
|
||||
template<class T1, class T2>
|
||||
struct typeset_union : typeset_union_<T1,T2>::type {};
|
||||
template<class T1, class T2>
|
||||
struct typeset_intersection : typeset_intersection_<T1,T2>::type {};
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ int main()
|
|||
|
||||
//#define BOOST_RESULT_OF_USE_DECLTYPE 1
|
||||
#include <CGAL/Epick_d.h>
|
||||
#include <CGAL/Epeck_d.h>
|
||||
#include <typeinfo>
|
||||
|
||||
#include <CGAL/NewKernel_d/Cartesian_base.h>
|
||||
|
|
@ -121,7 +122,6 @@ void test2(){
|
|||
typedef typename K1::Oriented_side_d OS;
|
||||
typedef typename K1::Orthogonal_vector_d OV;
|
||||
typedef typename K1::Point_dimension_d PD;
|
||||
typedef typename K1::Point_of_sphere_d PS;
|
||||
typedef typename K1::Point_to_vector_d PV;
|
||||
typedef typename K1::Vector_to_point_d VP;
|
||||
typedef typename K1::Barycentric_coordinates_d BC;
|
||||
|
|
@ -190,7 +190,6 @@ void test2(){
|
|||
OS os Kinit(oriented_side_d_object);
|
||||
OV ov Kinit(orthogonal_vector_d_object);
|
||||
PD pd Kinit(point_dimension_d_object);
|
||||
PS ps Kinit(point_of_sphere_d_object);
|
||||
PV pv Kinit(point_to_vector_d_object);
|
||||
VP vp Kinit(vector_to_point_d_object);
|
||||
BC bc Kinit(barycentric_coordinates_d_object);
|
||||
|
|
@ -356,6 +355,8 @@ void test2(){
|
|||
#endif
|
||||
P z0=cp( 0+2,5-3);
|
||||
P z1=cp(-5+2,0-3);
|
||||
assert(abs(sd(z0,z1)-50)<.0001);
|
||||
assert(ed(z0,z0) && !ed(z0,z1));
|
||||
P z2=cp( 3+2,4-3);
|
||||
P tabz[]={z0,z1,z2};
|
||||
Sp sp = csp(tabz+0,tabz+3);
|
||||
|
|
@ -366,18 +367,6 @@ void test2(){
|
|||
assert(abs(cent1[0]-2)<.0001);
|
||||
assert(abs(cent1[1]+3)<.0001);
|
||||
assert(abs(sp.squared_radius()-25)<.0001);
|
||||
#if 1
|
||||
// Fails for an exact kernel
|
||||
P psp0=ps(sp,0);
|
||||
P psp1=ps(sp,1);
|
||||
P psp2=ps(sp,2);
|
||||
assert(!ed(psp0,psp1));
|
||||
assert(!ed(psp0,psp2));
|
||||
assert(!ed(psp2,psp1));
|
||||
assert(abs(sd(cent0,psp0)-25)<.0001);
|
||||
assert(abs(sd(cent0,psp1)-25)<.0001);
|
||||
assert(abs(sd(cent0,psp2)-25)<.0001);
|
||||
#endif
|
||||
P x2py1 = tp(x2,y1);
|
||||
assert(x2py1[1]==-2);
|
||||
WP tw[]={cwp(cp(5,0),1.5),cwp(cp(2,std::sqrt(3)),1),cwp(cp(2,-std::sqrt(3)),1)};
|
||||
|
|
@ -413,6 +402,47 @@ void test2(){
|
|||
D un10; CGAL_USE(un10);
|
||||
}
|
||||
|
||||
// Fails for an exact kernel, so I split it here
|
||||
template<class Ker>
|
||||
void test2i(){
|
||||
typedef Ker K1;
|
||||
typedef typename K1::Point_d P;
|
||||
typedef typename K1::Sphere_d Sp;
|
||||
typedef typename K1::Point_of_sphere_d PS;
|
||||
typedef typename K1::Construct_point_d CP;
|
||||
typedef typename K1::Construct_sphere_d CSp;
|
||||
typedef typename K1::Equal_d E;
|
||||
typedef typename K1::Squared_distance_d SD;
|
||||
typedef typename K1::Center_of_sphere_d COS;
|
||||
Ker k
|
||||
#if 0
|
||||
(2)
|
||||
#endif
|
||||
;
|
||||
CP cp Kinit(construct_point_d_object);
|
||||
PS ps Kinit(point_of_sphere_d_object);
|
||||
CSp csp Kinit(construct_sphere_d_object);
|
||||
E ed Kinit(equal_d_object);
|
||||
SD sd Kinit(squared_distance_d_object);
|
||||
COS cos Kinit(center_of_sphere_d_object);
|
||||
P z0=cp( 0+2,5-3);
|
||||
P z1=cp(-5+2,0-3);
|
||||
P z2=cp( 3+2,4-3);
|
||||
P tabz[]={z0,z1,z2};
|
||||
Sp sp = csp(tabz+0,tabz+3);
|
||||
P cent0=cos(sp);
|
||||
P psp0=ps(sp,0);
|
||||
P psp1=ps(sp,1);
|
||||
P psp2=ps(sp,2);
|
||||
assert(!ed(psp0,psp1));
|
||||
assert(!ed(psp0,psp2));
|
||||
assert(!ed(psp2,psp1));
|
||||
using std::abs;
|
||||
assert(abs(sd(cent0,psp0)-25)<.0001);
|
||||
assert(abs(sd(cent0,psp1)-25)<.0001);
|
||||
assert(abs(sd(cent0,psp2)-25)<.0001);
|
||||
}
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4512)
|
||||
|
|
@ -531,7 +561,7 @@ void test3(){
|
|||
assert(abs(sd(e,a)-32)<.0001);
|
||||
P tab[]={a,b,c,d,e};
|
||||
std::cout << po (&tab[0],tab+4) << ' ';
|
||||
std::cout << sos(&tab[0],tab+5) << ' ';
|
||||
std::cout << sos(&tab[1],tab+5,tab[0]) << ' ';
|
||||
std::cout << sbs(tab+1,tab+5,tab[0]) << std::endl;
|
||||
FO fo=cfo(&tab[0],tab+3);
|
||||
std::cout << fo;
|
||||
|
|
@ -564,13 +594,13 @@ void test3(){
|
|||
std::cout << ifsos(fo3,yy+0,yy+3,yy[3]) << ' ';
|
||||
std::cout << ifsos(fo3,yy+1,yy+4,yy[0]) << '\n';
|
||||
P buf[]={cp(100,900,0),y[0],y[1],y[2],y[3]};
|
||||
std::cout << sos(buf+0,buf+5) << ' ';
|
||||
std::cout << sos(buf+1,buf+5,buf[0]) << ' ';
|
||||
buf[1]=y[1];buf[2]=y[2];buf[3]=y[3];buf[4]=y[0];
|
||||
std::cout << sos(buf+0,buf+5) << ' ';
|
||||
std::cout << sos(buf+1,buf+5,buf[0]) << ' ';
|
||||
buf[1]=yy[0];buf[2]=yy[1];buf[3]=yy[2];buf[4]=yy[3];
|
||||
std::cout << sos(buf+0,buf+5) << ' ';
|
||||
std::cout << sos(buf+1,buf+5,buf[0]) << ' ';
|
||||
buf[1]=yy[1];buf[2]=yy[2];buf[3]=yy[3];buf[4]=yy[0];
|
||||
std::cout << sos(buf+0,buf+5) << '\n';
|
||||
std::cout << sos(buf+1,buf+5,buf[0]) << '\n';
|
||||
assert(cah(y+0,y+3,y[3]));
|
||||
assert(!cah(y+0,y+3,buf[0]));
|
||||
assert(cl(a,a)==CGAL::EQUAL);
|
||||
|
|
@ -687,9 +717,14 @@ CGAL_static_assertion((boost::is_same<CGAL::Dimension_tag<3>,CGAL::Ambient_dimen
|
|||
int main(){
|
||||
//Broken with Linear_base_d (output iterator)
|
||||
//test2<CGAL::Kernel_d_interface<KK> >();
|
||||
test2<Ker2>();
|
||||
test2<Ker2>(); test2i<Ker2>();
|
||||
test3<Ker3>();
|
||||
test3<Kerd>();
|
||||
#if !defined _MSC_VER || _MSC_VER >= 1910
|
||||
test2<CGAL::Epeck_d<CGAL::Dimension_tag<2>>>();
|
||||
test3<CGAL::Epeck_d<CGAL::Dimension_tag<3>>>();
|
||||
test3<CGAL::Epeck_d<CGAL::Dynamic_dimension_tag>>();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -163,6 +163,11 @@ struct Lazy_exact_Ex_Cst : public Lazy_exact_nt_rep<ET>
|
|||
{
|
||||
this->et = new ET(e);
|
||||
}
|
||||
Lazy_exact_Ex_Cst (ET&& e)
|
||||
: Lazy_exact_nt_rep<ET>(CGAL_NTS to_interval(e))
|
||||
{
|
||||
this->et = new ET(std::move(e));
|
||||
}
|
||||
|
||||
void update_exact() const { CGAL_error(); }
|
||||
};
|
||||
|
|
@ -342,14 +347,14 @@ struct Lazy_exact_Max : public Lazy_exact_binary<ET>
|
|||
// The real number type, handle class
|
||||
template <typename ET_>
|
||||
class Lazy_exact_nt
|
||||
: public Lazy<Interval_nt<false>, ET_, Lazy_exact_nt<ET_>, To_interval<ET_> >
|
||||
: public Lazy<Interval_nt<false>, ET_, To_interval<ET_> >
|
||||
, boost::ordered_euclidian_ring_operators2< Lazy_exact_nt<ET_>, int >
|
||||
, boost::ordered_euclidian_ring_operators2< Lazy_exact_nt<ET_>, double >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef Lazy_exact_nt<ET_> Self;
|
||||
typedef Lazy<Interval_nt<false>, ET_, Self, To_interval<ET_> > Base;
|
||||
typedef Lazy<Interval_nt<false>, ET_, To_interval<ET_> > Base;
|
||||
typedef typename Base::Self_rep Self_rep;
|
||||
|
||||
typedef typename Base::ET ET; // undocumented
|
||||
|
|
@ -374,6 +379,8 @@ public :
|
|||
|
||||
Lazy_exact_nt (const ET & e)
|
||||
: Base(new Lazy_exact_Ex_Cst<ET>(e)){}
|
||||
Lazy_exact_nt (ET&& e)
|
||||
: Base(new Lazy_exact_Ex_Cst<ET>(std::move(e))){}
|
||||
|
||||
template <class ET1>
|
||||
Lazy_exact_nt (const Lazy_exact_nt<ET1> &x,
|
||||
|
|
|
|||
|
|
@ -62,12 +62,7 @@ class transforming_iterator_helper
|
|||
typedef std::iterator_traits<Iter> Iter_traits;
|
||||
typedef typename Iter_traits::reference Iter_ref;
|
||||
typedef typename Default::Get<Ref,
|
||||
#ifdef CGAL_CXX11
|
||||
decltype(std::declval<F>()(std::declval<Iter_ref>()))
|
||||
#else
|
||||
typename boost::result_of<F(typename Iter_traits::value_type)>::type
|
||||
// should be reference instead of value_type
|
||||
#endif
|
||||
>::type reference_;
|
||||
|
||||
typedef typename Default::Get<Val,typename boost::remove_cv<typename boost::remove_reference<reference_>::type>::type>::type value_type;
|
||||
|
|
@ -53,12 +53,7 @@ class transforming_pair_iterator_helper
|
|||
::type iterator_category;
|
||||
|
||||
typedef typename Default::Get<Ref,
|
||||
#ifdef CGAL_CXX11
|
||||
decltype(std::declval<F>()(std::declval<typename std::iterator_traits<It1>::reference>(),std::declval<typename std::iterator_traits<It2>::reference>()))
|
||||
#else
|
||||
typename boost::result_of<F(typename std::iterator_traits<It1>::value_type,typename std::iterator_traits<It2>::value_type)>::type
|
||||
// should be reference instead of value_type
|
||||
#endif
|
||||
>::type reference;
|
||||
|
||||
typedef typename Default::Get<Val,typename boost::remove_cv<typename boost::remove_reference<reference>::type>::type>::type value_type;
|
||||
|
|
@ -30,7 +30,7 @@ do
|
|||
fi
|
||||
done
|
||||
|
||||
cmake -DCGAL_HEADER_ONLY=FALSE -DCGAL_ENABLE_CHECK_HEADERS=TRUE -DDOXYGEN_EXECUTABLE="$DOX_PATH" -DCGAL_COPY_DEPENDENCIES=TRUE -DCMAKE_CXX_FLAGS="-std=c++14" ..
|
||||
cmake -DCGAL_HEADER_ONLY=FALSE -DCGAL_ENABLE_CHECK_HEADERS=TRUE -DDOXYGEN_EXECUTABLE="$DOX_PATH" -DCGAL_COPY_DEPENDENCIES=TRUE -DCMAKE_CXX_FLAGS="-std=c++1y" ..
|
||||
if [ -n "$DO_CHECK_HEADERS" ]; then
|
||||
make -j$(nproc --all) -k check_headers
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ range search queries in a model of `SpatialTree`.
|
|||
\cgalHasModel `CGAL::Cartesian_d<FT>`
|
||||
\cgalHasModel `CGAL::Homogeneous_d<RT>`
|
||||
\cgalHasModel `CGAL::Epick_d<DimensionTag>`
|
||||
\cgalHasModel `CGAL::Epeck_d<DimensionTag>`
|
||||
\cgalHasModel `CGAL::Search_traits_2<Kernel>`
|
||||
\cgalHasModel `CGAL::Search_traits_3<Kernel>`
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ parameter of the search classes.
|
|||
\cgalHasModel `CGAL::Cartesian_d<FT>`
|
||||
\cgalHasModel `CGAL::Homogeneous_d<RT>`
|
||||
\cgalHasModel `CGAL::Epick_d<DimensionTag>`
|
||||
\cgalHasModel `CGAL::Epeck_d<DimensionTag>`
|
||||
\cgalHasModel `CGAL::Search_traits_2<Kernel>`
|
||||
\cgalHasModel `CGAL::Search_traits_3<Kernel>`
|
||||
\cgalHasModel `CGAL::Search_traits_d<Kernel,Dim>`
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ include_directories(BEFORE "../include")
|
|||
#add_definitions("-pg")
|
||||
#SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
|
||||
# add_definitions("-g")
|
||||
add_definitions("-std=c++11")
|
||||
add_definitions("-std=c++1y")
|
||||
|
||||
# Polyhedron
|
||||
add_executable(polyhedron_performance performance_2.h polyhedron_performance.h polyhedron_performance.cpp)
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ a Delaunay triangulation. It corresponds to the first template parameter of the
|
|||
\cgalRefines `TriangulationTraits`
|
||||
|
||||
\cgalHasModel `CGAL::Epick_d<Dim>`
|
||||
\cgalHasModel `CGAL::Epeck_d<Dim>`
|
||||
|
||||
\sa `TriangulationTraits`
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ a regular triangulation. It corresponds to the first template parameter of the c
|
|||
\cgalRefines `TriangulationTraits`
|
||||
|
||||
\cgalHasModel `CGAL::Epick_d<Dim>`
|
||||
\cgalHasModel `CGAL::Epeck_d<Dim>`
|
||||
|
||||
\sa `TriangulationTraits`
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ then optimized using spatial sorting.
|
|||
This is not required if the points are inserted one by one.
|
||||
|
||||
\cgalHasModel `CGAL::Epick_d<Dim>`
|
||||
\cgalHasModel `CGAL::Epeck_d<Dim>`
|
||||
|
||||
\sa `DelaunayTriangulationTraits`
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue