mirror of https://github.com/CGAL/cgal
Merge pull request #1354 from afabri/BGL_fix_input-GF
All examples now read from a file
This commit is contained in:
commit
9257b803a2
|
|
@ -0,0 +1,5 @@
|
|||
0 0
|
||||
1 0
|
||||
0.2 0.2
|
||||
0 1
|
||||
0 2
|
||||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include <CGAL/boost/graph/dijkstra_shortest_paths.h>
|
||||
#include <boost/graph/filtered_graph.hpp>
|
||||
#include <fstream>
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||
typedef K::Point_2 Point;
|
||||
|
|
@ -44,17 +45,18 @@ typedef boost::associative_property_map<VertexIndexMap> VertexIdPropertyMap;
|
|||
VertexIdPropertyMap vertex_index_pmap(vertex_id_map);
|
||||
|
||||
int
|
||||
main(int,char*[])
|
||||
main(int argc,char* argv[])
|
||||
{
|
||||
const char* filename = (argc > 1) ? argv[1] : "data/points.xy";
|
||||
std::ifstream input(filename);
|
||||
Triangulation t;
|
||||
Filter is_finite(t);
|
||||
Finite_triangulation ft(t, is_finite, is_finite);
|
||||
|
||||
t.insert(Point(0,0));
|
||||
t.insert(Point(1,0));
|
||||
t.insert(Point(0.2,0.2));
|
||||
t.insert(Point(0,1));
|
||||
t.insert(Point(0,2));
|
||||
Point p ;
|
||||
while(input >> p){
|
||||
t.insert(p);
|
||||
}
|
||||
|
||||
vertex_iterator vit, ve;
|
||||
// Associate indices to the vertices
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include <CGAL/boost/graph/dijkstra_shortest_paths.h>
|
||||
#include <boost/graph/filtered_graph.hpp>
|
||||
#include <fstream>
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||
typedef K::Point_2 Point;
|
||||
|
|
@ -42,17 +43,18 @@ typedef boost::graph_traits<Finite_triangulation>::vertex_iterator vertex_iterat
|
|||
|
||||
|
||||
int
|
||||
main(int,char*[])
|
||||
main(int argc,char* argv[])
|
||||
{
|
||||
const char* filename = (argc > 1) ? argv[1] : "data/points.xy";
|
||||
std::ifstream input(filename);
|
||||
Triangulation t;
|
||||
Filter is_finite(t);
|
||||
Finite_triangulation ft(t, is_finite, is_finite);
|
||||
|
||||
t.insert(Point(0,0));
|
||||
t.insert(Point(1,0));
|
||||
t.insert(Point(0.2,0.2));
|
||||
t.insert(Point(0,1));
|
||||
t.insert(Point(0,2));
|
||||
Point p ;
|
||||
while(input >> p){
|
||||
t.insert(p);
|
||||
}
|
||||
|
||||
vertex_iterator vit, ve;
|
||||
// associate indices to the vertices
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include <boost/graph/kruskal_min_spanning_tree.hpp>
|
||||
#include <boost/graph/filtered_graph.hpp>
|
||||
#include <fstream>
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||
typedef K::Point_2 Point;
|
||||
|
|
@ -48,14 +49,16 @@ typedef boost::associative_property_map<VertexIndexMap> VertexIdPropertyMap;
|
|||
VertexIdPropertyMap vertex_index_pmap(vertex_id_map);
|
||||
|
||||
int
|
||||
main(int,char*[])
|
||||
main(int argc,char* argv[])
|
||||
{
|
||||
const char* filename = (argc > 1) ? argv[1] : "data/points.xy";
|
||||
std::ifstream input(filename);
|
||||
Triangulation t;
|
||||
Filter is_finite(t);
|
||||
Finite_triangulation ft(t, is_finite, is_finite);
|
||||
|
||||
Point p ;
|
||||
while(std::cin >> p){
|
||||
while(input >> p){
|
||||
t.insert(p);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue