#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/box_intersection_d.h>
#include <vector>
#include <fstream>
typedef std::vector<Triangle_3> Triangles;
struct Report {
Triangles* triangles;
Report(Triangles& triangles)
: triangles(&triangles)
{}
void operator()(const Box* a, const Box* b) const
{
std::cout << "Box " << (a->handle() - triangles->begin()) << " and "
<< (b->handle() - triangles->begin()) << " intersect";
if ( ! a->handle()->is_degenerate() && ! b->handle()->is_degenerate()
std::cout << ", and the triangles intersect also";
}
std::cout << '.' << std::endl;
}
};
int main(int argc, char*argv[])
{
std::ifstream in((argc>1)?argv[1]:"data/triangles.xyz");
Triangles triangles;
Triangle_3 t;
while(in >> t){
triangles.push_back(t);
}
std::vector<Box> boxes;
for (
Iterator i = triangles.begin(); i != triangles.end(); ++i)
boxes.push_back( Box( i->bbox(), i));
std::vector<Box *> ptr;
for ( std::vector<Box>::iterator i = boxes.begin(); i != boxes.end(); ++i)
ptr.push_back( &*i);
return 0;
}