#include <CGAL/Simple_cartesian.h>
#include <CGAL/box_intersection_d.h>
#include <vector>
#include <fstream>
std::vector<Point_3> points;
std::vector<Point_3*> boxes;
const float eps = 0.1f;
struct Traits {
typedef float NT;
typedef Point_3* Box_parameter;
typedef std::ptrdiff_t ID;
static int dimension() { return 3; }
static float coord( Box_parameter b, int d) {
return (d == 0) ? b->x() : ((d == 1) ? b->y() : b->z());
}
static float min_coord( Box_parameter b, int d) { return coord(b,d)-eps;}
static float max_coord( Box_parameter b, int d) { return coord(b,d)+eps;}
static std::ptrdiff_t id(Box_parameter b) { return (std::ptrdiff_t)(b); }
};
void report( const Point_3* a, const Point_3* b) {
if ( dist < 2*eps) {
std::cout << "Point " << (a - &(points.front())) << " and Point "
<< (b - &(points.front())) << " have distance " << dist
<< "." << std::endl;
}
}
int main(int argc, char*argv[]) {
std::ifstream in((argc>1)?argv[1]:CGAL::data_file_path("points_3/points.xyz"));
Point_3 p;
while(in >> p){
points.push_back(p);
}
for(std::size_t i = 0; i< points.size();++i) {
boxes.push_back( &points[i]);
}
report, Traits());
return 0;
}
void box_self_intersection_d(RandomAccessIterator begin, RandomAccessIterator end, Callback callback, std::ptrdiff_t cutoff=10, CGAL::Box_intersection_d::Topology topology=CGAL::Box_intersection_d::CLOSED)
Invocation of box intersection with default box traits Box_intersection_d::Box_traits_d<Box_handle>,...
Kernel::FT squared_distance(Type1< Kernel > obj1, Type2< Kernel > obj2)