#include <iostream>
#include <fstream>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/AABB_face_graph_triangle_primitive.h>
#include <CGAL/KDOP_tree/KDOP_tree.h>
#include <CGAL/KDOP_tree/KDOP_traits.h>
const unsigned int NUM_DIRECTIONS = 14;
typedef K::Point_3 Point;
typedef CGAL::Surface_mesh<Point> Mesh;
int main(int argc, char* argv[])
{
if (argc != 2) {
std::cerr << "Need mesh file!" << std::endl;
return 0;
}
const char* filename = argv[1];
std::ifstream input(filename);
Mesh mesh;
input >> mesh;
const char* pointsFile = argv[2];
std::ifstream pointsf(pointsFile);
Point point(1./3., 2./3., 1./6.);
Tree_kdop tree_kdop( faces(mesh).first, faces(mesh).second, mesh );
tree_kdop.build();
Point closest_point = tree_kdop.closest_point(point);
std::cout << closest_point << std::endl;
return 0;
}