mirror of https://github.com/CGAL/cgal
parent
dcb38f3151
commit
a052572103
|
|
@ -1635,70 +1635,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
// This is the magic functor for functors that write their result as Objects into an output iterator
|
||||
|
||||
template <typename LK, typename AC, typename EC>
|
||||
struct Lazy_intersect_with_iterators
|
||||
{
|
||||
static const bool Protection = true;
|
||||
typedef typename LK::Approximate_kernel AK;
|
||||
typedef typename LK::Exact_kernel EK;
|
||||
typedef typename LK::E2A E2A;
|
||||
typedef void result_type;
|
||||
typedef Lazy<Object, Object, E2A> Lazy_object;
|
||||
typedef Lazy<std::vector<Object>, std::vector<Object>, E2A> Lazy_vector;
|
||||
|
||||
CGAL_NO_UNIQUE_ADDRESS AC ac;
|
||||
CGAL_NO_UNIQUE_ADDRESS EC ec;
|
||||
|
||||
public:
|
||||
|
||||
// In the example we intersect two Lazy<Segment>s
|
||||
// and write into a back_inserter(list<Object([Lazy<Point>,Lazy<Segment>]) >)
|
||||
template <typename L1, typename L2, typename OutputIterator>
|
||||
OutputIterator
|
||||
operator()(const L1& l1, const L2& l2, OutputIterator it) const
|
||||
{
|
||||
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
|
||||
{
|
||||
Protect_FPU_rounding<Protection> P;
|
||||
try {
|
||||
Lazy_vector lv(new Lazy_rep_with_vector_2<AC, EC, E2A, L1, L2>(ac, ec, l1, l2));
|
||||
// lv.approx() is a std::vector<Object([AK::Point_2,AK::Segment_2])>
|
||||
// that is, when we get here we have constructed all approximate results
|
||||
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_n<typename AK::X, typename EK::X, Ith<typename AK::X>, \
|
||||
Ith<typename EK::X>, E2A, false, Lazy_vector> \
|
||||
(Ith<typename AK::X>(i), Ith<typename EK::X>(i), lv))); \
|
||||
continue; \
|
||||
}
|
||||
|
||||
#include <CGAL/Kernel/interface_macros.h>
|
||||
|
||||
std::cerr << "we need more casts" << std::endl;
|
||||
}
|
||||
return it;
|
||||
} catch (Uncertain_conversion_exception&) {}
|
||||
}
|
||||
CGAL_BRANCH_PROFILER_BRANCH(tmp);
|
||||
// TODO: Instead of using a vector, write an iterator adapter
|
||||
Protect_FPU_rounding<!Protection> P2(CGAL_FE_TONEAREST);
|
||||
CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST);
|
||||
std::vector<Object> exact_objects;
|
||||
ec(CGAL::exact(l1), CGAL::exact(l2), std::back_inserter(exact_objects));
|
||||
for (std::vector<Object>::const_iterator oit = exact_objects.begin();
|
||||
oit != exact_objects.end();
|
||||
++oit){
|
||||
*it++ = make_lazy<LK>(*oit);
|
||||
}
|
||||
return it;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <typename T>
|
||||
struct Object_cast
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue