CGAL 5.5 - 2D Triangulations on the Sphere
Triangulation_on_sphere_2/triang_on_sphere_range.cpp
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_on_sphere_2.h>
#include <CGAL/Projection_on_sphere_traits_3.h>
#include <iostream>
#include <fstream>
typedef DToS2::Point_3 Point;
int main(int argc, char** argv)
{
std::cout.precision(17);
const std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("points_3/radar.xyz");
std::vector<Point> points;
double x, y, z;
std::ifstream in(filename);
if(!in)
{
std::cerr << "Invalid input file: " << filename << std::endl;
return EXIT_FAILURE;
}
while(in >> x >> y >> z)
points.emplace_back(x, y, z);
std::cout << points.size() << " points in input" << std::endl;
Traits traits(Point(0, 0, 0), 100);
DToS2 dtos(points.begin(), points.end(), traits);
std::cout << dtos.number_of_vertices() << " vertices" << std::endl;
std::cout << dtos.number_of_faces() << " solid faces" << std::endl;
CGAL::IO::write_OFF("result.off", dtos, CGAL::parameters::stream_precision(17));
return EXIT_SUCCESS;
}