#include <cstdlib>
#include <iostream>
#include <fstream>
#include <iterator>
#include <string>
#include <vector>
#include <CGAL/Exact_predicates_exact_constructions_kernel_with_root_of.h>
#include <CGAL/Construct_theta_graph_2.h>
#include <CGAL/gnuplot_output_2.h>
typedef boost::adjacency_list<boost::listS,
boost::vecS,
boost::undirectedS,
Point_2
> Graph;
int main(int argc, char ** argv)
{
unsigned int k=4;
std::string filename="data/n9.cin";
if (argc > 1 &&
(!strcmp(argv[1],"-h") || !strcmp(argv[1],"--help") || !strcmp(argv[1],"-?")))
{
std::cout << "Usage: " << argv[0] << " <no. of cones> <input filename> [<direction-x> <direction-y>]" << std::endl;
return 1;
}
if (argc > 1)
{
k = atoi(argv[1]);
if (k<2) {
std::cout << "The number of cones should be larger than 1!" << std::endl;
return 1;
}
}
if (argc > 2)
{ filename=std::string(argv[2]); }
std::ifstream inf(filename);
if (!inf) {
std::cout << "Cannot open file " << filename << "!" << std::endl;
return 1;
}
Direction_2 initial_direction;
if (argc == 1 || argc == 3)
initial_direction = Direction_2(1, 0);
else if (argc == 5)
initial_direction = Direction_2(atof(argv[3]), atof(argv[4]));
else {
std::cout << "Usage: " << argv[0] << " <no. of cones> <input filename> [<direction-x> <direction-y>]" << std::endl;
return 1;
}
std::istream_iterator<Point_2> input_begin( inf );
std::istream_iterator<Point_2> input_end;
Graph g;
theta(input_begin, input_end, g);
boost::graph_traits<Graph>::vertices_size_type n = boost::num_vertices(g);
std::string file_prefix = "t" + std::to_string(k) + "n" + std::to_string(n);
return 0;
}
A template functor for constructing Theta graphs with a given set of 2D points and a given initial di...
Definition: Construct_theta_graph_2.h:52
void gnuplot_output_2(const Graph &g, const std::string &prefix)
outputs a set of files used by Gnuplot to plot g.
Definition: gnuplot_output_2.h:139