#include <CGAL/box_intersection_d.h>
#include <vector>
#include <algorithm>
#include <iterator>
#include <cassert>
int p[9*4] = { 0,0,1,1, 1,0,2,1, 2,0,3,1,
0,1,1,2, 1,1,2,2, 2,1,3,2,
0,2,1,3, 1,2,2,3, 2,2,3,3};
Box boxes[9] = { Box( p, p+ 2), Box( p+ 4, p+ 6), Box( p+ 8, p+10),
Box( p+12, p+14), Box( p+16, p+18), Box( p+20, p+22),
Box( p+24, p+26), Box( p+28, p+30), Box( p+32, p+34)};
Box query[2] = { Box( p+16, p+18), Box( p+32, p+34)};
template <class OutputIterator>
struct Report {
void operator()( const Box& a, const Box&) { *it++ = a.id(); }
};
template <class Iter>
Report<Iter> report( Iter it) { return Report<Iter>(it); }
int main() {
std::vector<std::size_t> result;
report( std::back_inserter( result)));
std::sort( result.begin(), result.end());
std::size_t check1[13] = {0,1,2,3,4,4,5,5,6,7,7,8,8};
assert(result.size() == 13 && std::equal(check1,check1+13,result.begin()));
std::copy( result.begin(), result.end(),
std::ostream_iterator<std::size_t>( std::cout, " "));
std::cout << std::endl;
result.clear();
report( std::back_inserter( result)),
std::ptrdiff_t(1),
std::sort( result.begin(), result.end());
std::size_t check2[2] = {4,8};
assert(result.size() == 2 && std::equal(check2, check2+2, result.begin()));
std::copy( result.begin(), result.end(),
std::ostream_iterator<std::size_t>( std::cout, " "));
std::cout << std::endl;
return 0;
}
Box_d is a generic iso-oriented bounding box in dimension .
Definition: Box_d.h:55
void box_intersection_d(RandomAccessIterator1 begin1, RandomAccessIterator1 end1, RandomAccessIterator2 begin2, RandomAccessIterator2 end2, Callback callback, std::ptrdiff_t cutoff=10, CGAL::Box_intersection_d::Topology topology=CGAL::Box_intersection_d::CLOSED, CGAL::Box_intersection_d::Setting setting=CGAL::Box_intersection_d::BIPARTITE)
Invocation of box intersection with default box traits Box_intersection_d::Box_traits_d<Box_handle>,...
@ HALF_OPEN
Definition: Box_traits_d.h:57