From 71d1666b391376d2b4b66efa30c200276f6c2d61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 31 May 2016 09:48:36 +0200 Subject: [PATCH] replace tabs with 4 spaces --- .../doc/Cone_spanners_2/Cone_spanners_2.txt | 4 +- .../examples/Cone_spanners_2/data/n20.cin | 40 +- .../include/CGAL/Compute_cone_boundaries_2.h | 72 ++-- .../Cone_spanners_2/Less_by_direction_2.h | 2 +- .../CGAL/Cone_spanners_2/Plane_Scan_Tree.h | 28 +- .../CGAL/Cone_spanners_2/_Plane_Scan_Tree.h | 8 +- .../include/CGAL/Construct_theta_graph_2.h | 52 +-- .../include/CGAL/Construct_yao_graph_2.h | 28 +- .../include/CGAL/gnuplot_output_2.h | 350 +++++++++--------- .../test/Cone_spanners_2/cones_inexact.cpp | 14 +- .../test/Cone_spanners_2/data/n20.cin | 40 +- 11 files changed, 319 insertions(+), 319 deletions(-) diff --git a/Cone_spanners_2/doc/Cone_spanners_2/Cone_spanners_2.txt b/Cone_spanners_2/doc/Cone_spanners_2/Cone_spanners_2.txt index 931805c9b14..37a1f7b28ff 100644 --- a/Cone_spanners_2/doc/Cone_spanners_2/Cone_spanners_2.txt +++ b/Cone_spanners_2/doc/Cone_spanners_2/Cone_spanners_2.txt @@ -192,7 +192,7 @@ in the `boost::adjacency_list` object. This template function has the following \code{.cpp} template - void gnuplot_output_2(const Graph_& g, const std::string& prefix); + void gnuplot_output_2(const Graph_& g, const std::string& prefix); \endcode The template parameter `Graph_` specifies the type of the graph to be plotted. For this function to work, @@ -284,7 +284,7 @@ The following two files will be generated for \gnuplot: - `t4n20.v`: This file contains the \f$(x, y)\f$-coordinates of the 20 vertices. - `t4n20.plt`: This is the script to be loaded by \gnuplot. It will read `t4n20.v` to plot the vertices. It will also plot all the edges, - which are included in this script itself. + which are included in this script itself. \cgalFigureRef{f-t4} shows the Theta graph plotted when the above `t4n20.plt` is loaded by \gnuplot. diff --git a/Cone_spanners_2/examples/Cone_spanners_2/data/n20.cin b/Cone_spanners_2/examples/Cone_spanners_2/data/n20.cin index 04b84e4938d..ea2cb1f299c 100644 --- a/Cone_spanners_2/examples/Cone_spanners_2/data/n20.cin +++ b/Cone_spanners_2/examples/Cone_spanners_2/data/n20.cin @@ -1,20 +1,20 @@ -97.6188 489.679 -673.018 672.436 -67.6374 539.91 -40.0488 138.312 -110.286 659.128 -399.326 677.844 -585.28 614.301 -880.102 831.773 -752.166 840.363 -437.925 993.181 -120.746 215.884 -32.6144 584.674 -845.06 328.004 -656.569 774.867 -843.833 334.36 -368.169 941.452 -824.039 41.1866 -613.888 891.676 -581.096 653.936 -29.9877 691.382 +97.6188 489.679 +673.018 672.436 +67.6374 539.91 +40.0488 138.312 +110.286 659.128 +399.326 677.844 +585.28 614.301 +880.102 831.773 +752.166 840.363 +437.925 993.181 +120.746 215.884 +32.6144 584.674 +845.06 328.004 +656.569 774.867 +843.833 334.36 +368.169 941.452 +824.039 41.1866 +613.888 891.676 +581.096 653.936 +29.9877 691.382 diff --git a/Cone_spanners_2/include/CGAL/Compute_cone_boundaries_2.h b/Cone_spanners_2/include/CGAL/Compute_cone_boundaries_2.h index 3231b34426e..c14c70b16f0 100644 --- a/Cone_spanners_2/include/CGAL/Compute_cone_boundaries_2.h +++ b/Cone_spanners_2/include/CGAL/Compute_cone_boundaries_2.h @@ -65,7 +65,7 @@ template class Compute_cone_boundaries_2 { public: - /*! the geometric traits class. */ + /*! the geometric traits class. */ typedef Traits_ Traits; /*! the direction type. */ @@ -73,27 +73,27 @@ public: private: - typedef typename Traits::Aff_transformation_2 Transformation; + typedef typename Traits::Aff_transformation_2 Transformation; public: - /* No member variables in this class, so a custom constructor is not needed. */ - // Compute_cone_boundaries_2() {}; + /* No member variables in this class, so a custom constructor is not needed. */ + // Compute_cone_boundaries_2() {}; - /*! \brief The operator(). + /*! \brief The operator(). + * + * \details The direction of the first ray can be specified by the parameter `initial_direction`, + * which allows the first ray to start at any direction. + * This operator first places the `initial_direction` at the + * position pointed by `result`. Then, it calculates the remaining directions (cone boundaries) + * and output them to `result` in the counterclockwise order. + * Finally, the past-the-end iterator for the resulting directions is returned. * - * \details The direction of the first ray can be specified by the parameter `initial_direction`, - * which allows the first ray to start at any direction. - * This operator first places the `initial_direction` at the - * position pointed by `result`. Then, it calculates the remaining directions (cone boundaries) - * and output them to `result` in the counterclockwise order. - * Finally, the past-the-end iterator for the resulting directions is returned. - * * \tparam DirectionOutputIterator an `OutputIterator` with value type `Direction_2`. - * \param cone_number The number of cones - * \param initial_direction The direction of the first ray - * \param result The output iterator - */ - template + * \param cone_number The number of cones + * \param initial_direction The direction of the first ray + * \param result The output iterator + */ + template DirectionOutputIterator operator()(const unsigned int cone_number, const Direction_2& initial_direction, DirectionOutputIterator result) { @@ -106,7 +106,7 @@ public: const double cone_angle = 2*CGAL_PI/cone_number; double sin_value, cos_value; - Direction_2 ray; + Direction_2 ray; for (unsigned int i = 1; i < cone_number; i++) { sin_value = std::sin(i*cone_angle); cos_value = std::cos(i*cone_angle); @@ -114,7 +114,7 @@ public: *result++ = ray; } - return result; + return result; } // end of operator }; @@ -128,7 +128,7 @@ template <> class Compute_cone_boundaries_2 { public: - /* Indicate the type of the cgal kernel. */ + /* Indicate the type of the cgal kernel. */ typedef Exact_predicates_exact_constructions_kernel_with_root_of Kernel_type; private: @@ -137,10 +137,10 @@ private: typedef Kernel_type::Aff_transformation_2 Transformation; public: - /* No member variables in this class, so a Constructor is not needed. */ - // Compute_cone_boundaries_2() {}; + /* No member variables in this class, so a Constructor is not needed. */ + // Compute_cone_boundaries_2() {}; - /* The operator(). + /* The operator(). The direction of the first ray can be specified by the parameter initial_direction, which allows the first ray to start at any direction. @@ -150,7 +150,7 @@ public: \param initial_direction The direction of the first ray \param result The output iterator */ - template + template DirectionOutputIterator operator()(const unsigned int cone_number, const Direction_2& initial_direction, DirectionOutputIterator result) { @@ -164,7 +164,7 @@ public: // Since CGAL::root_of() gives the k-th smallest root, // here -x is actually used instead of x. - // But we want the second largest one with no need to count. + // But we want the second largest one with no need to count. Polynomial x(CGAL::shift(Polynomial(-1), 1)); Polynomial double_x(2*x); Polynomial a(1), b(x); @@ -176,21 +176,21 @@ public: a = b - 1; unsigned int m, i; - bool is_even; + bool is_even; if (cone_number % 2 == 0) { - is_even = true; + is_even = true; m = cone_number/2; // for even number of cones - } + } else { m= cone_number/2 + 1; // for odd number of cones - is_even = false; - } + is_even = false; + } FT cos_value, sin_value; - // for storing the intermediate result + // for storing the intermediate result Direction_2 ray; - // For saving the first half number of rays when cone_number is even - std::vector ray_store; + // For saving the first half number of rays when cone_number is even + std::vector ray_store; // add the first half number of rays in counter clockwise order for (i = 1; i <= m; i++) { @@ -198,14 +198,14 @@ public: sin_value = sqrt(FT(1) - cos_value*cos_value); ray = Transformation(cos_value, -sin_value, sin_value, cos_value)(initial_direction); *result++ = ray; - if (is_even) + if (is_even) ray_store.push_back(ray); } // add the remaining half number of rays in ccw order if (is_even) { for (i = 0; i < m; i++) { - *result++ = -ray_store[i]; + *result++ = -ray_store[i]; } } else { for (i = 0; i < m-1; i++) { @@ -216,7 +216,7 @@ public: } } - return result; + return result; }; // end of operator() }; // end of functor specialization: Compute_cone_..._2 diff --git a/Cone_spanners_2/include/CGAL/Cone_spanners_2/Less_by_direction_2.h b/Cone_spanners_2/include/CGAL/Cone_spanners_2/Less_by_direction_2.h index ab55c512852..d6b8ee02602 100644 --- a/Cone_spanners_2/include/CGAL/Cone_spanners_2/Less_by_direction_2.h +++ b/Cone_spanners_2/include/CGAL/Cone_spanners_2/Less_by_direction_2.h @@ -82,7 +82,7 @@ public: } /* otherwise, outcome == CGAL::EQUAL, ties will be broken by a second order - * according to the ccw90(base_line) direction. + * according to the ccw90(base_line) direction. */ // define a rotation of counter clockwise 90 Transformation ccw90(0, -1, 1, 0); diff --git a/Cone_spanners_2/include/CGAL/Cone_spanners_2/Plane_Scan_Tree.h b/Cone_spanners_2/include/CGAL/Cone_spanners_2/Plane_Scan_Tree.h index 640dae48341..0ad2db1e204 100644 --- a/Cone_spanners_2/include/CGAL/Cone_spanners_2/Plane_Scan_Tree.h +++ b/Cone_spanners_2/include/CGAL/Cone_spanners_2/Plane_Scan_Tree.h @@ -61,10 +61,10 @@ namespace ThetaDetail { * University Press, 2007, p. 71 */ template , - typename VComp=std::less - > + typename T, + typename Comp=std::less, + typename VComp=std::less + > class Plane_Scan_Tree { private: typedef _Node _node_type; @@ -97,14 +97,14 @@ class Plane_Scan_Tree { : less (comp), vless (vcomp), root (NULL), m_min (NULL), m_max (NULL), _size (0) {} - /* Constructor */ + /* Constructor */ template Plane_Scan_Tree (InputIterator first, InputIterator last, const key_compare& comp = key_compare(), const value_compare& vcomp = value_compare()) : less (comp), vless (vcomp), root (NULL), m_min (NULL), m_max (NULL), _size (0) - { + { // TODO - Inplement a more efficient algorithm that builds the tree bottom up for (;first != last; ++first) add (first->first, first->second); @@ -160,13 +160,13 @@ class Plane_Scan_Tree { _size++; } - /* find a key */ + /* find a key */ iterator find(const key_type& k) { _leaf_type* l = root->leafNode(k); return iterator (l, k); } - /* find a constant key */ + /* find a constant key */ const_iterator find(const key_type& k) const { _leaf_type* l = root->leafNode(k); return const_iterator (l, k); @@ -242,22 +242,22 @@ class Plane_Scan_Tree { protected: private: - /* key_compare funtor */ + /* key_compare funtor */ const key_compare less; - /* value_compare funtor */ + /* value_compare funtor */ const value_compare vless; - /* pointer to root */ + /* pointer to root */ _node_type* root; - /* pointer to m_min */ + /* pointer to m_min */ _leaf_type* m_min; - /* pointer to m_max */ + /* pointer to m_max */ _leaf_type* m_max; - /* size of the tree */ + /* size of the tree */ size_t _size; }; diff --git a/Cone_spanners_2/include/CGAL/Cone_spanners_2/_Plane_Scan_Tree.h b/Cone_spanners_2/include/CGAL/Cone_spanners_2/_Plane_Scan_Tree.h index 46e130faa25..48d39c79a3b 100644 --- a/Cone_spanners_2/include/CGAL/Cone_spanners_2/_Plane_Scan_Tree.h +++ b/Cone_spanners_2/include/CGAL/Cone_spanners_2/_Plane_Scan_Tree.h @@ -159,8 +159,8 @@ class _Leaf : public _Node { } virtual bool isLeaf() const { - return true; - } + return true; + } virtual _leaf_type* leafNode(const key_type&) { return this; @@ -293,8 +293,8 @@ class _Internal : public _Node { } virtual bool isLeaf() const { - return false; - } + return false; + } virtual _leaf_type* leafNode(const key_type& k) { int i = 0; diff --git a/Cone_spanners_2/include/CGAL/Construct_theta_graph_2.h b/Cone_spanners_2/include/CGAL/Construct_theta_graph_2.h index 5e8f4f73965..f9ec75e0f94 100644 --- a/Cone_spanners_2/include/CGAL/Construct_theta_graph_2.h +++ b/Cone_spanners_2/include/CGAL/Construct_theta_graph_2.h @@ -54,10 +54,10 @@ class Construct_theta_graph_2 { public: - /*! the geometric traits class. */ + /*! the geometric traits class. */ typedef Traits_ Traits; - /*! the specific type of `boost::adjacency_list`. */ + /*! the specific type of `boost::adjacency_list`. */ typedef Graph_ Graph; /*! the point type */ @@ -91,7 +91,7 @@ public: */ Construct_theta_graph_2 (unsigned int k, Direction_2 initial_direction = Direction_2(1,0) - ): cone_number(k), rays(std::vector(k)) + ): cone_number(k), rays(std::vector(k)) { if (k<2) { @@ -100,21 +100,21 @@ public: } /* Initialize a functor, specialization will happen here depending on the kernel type to - compute the cone boundaries either exactly or inexactly */ + compute the cone boundaries either exactly or inexactly */ Compute_cone_boundaries_2 compute_cones; // compute the rays using the functor compute_cones(k, initial_direction, rays.begin()); } /* \brief Copy constructor. As commented by Michael Hemmer, copy constructor is not needed for - a functor. + a functor. \param x another Construct_theta_graph_2 object to copy from. Construct_theta_graph_2 (const Construct_theta_graph_2& x) : cone_number(x.cone_number), rays(x.rays) {} */ /*! - \brief Function operator to construct a Theta graph. + \brief Function operator to construct a Theta graph. \details For the details of this algorithm, please refer to the User Manual. @@ -128,7 +128,7 @@ public: const PointInputIterator& end, Graph_& g) { - // add vertices into the graph + // add vertices into the graph for (PointInputIterator curr = start; curr != end; ++curr) { g[boost::add_vertex(g)] = *curr; } @@ -136,7 +136,7 @@ public: unsigned int i; // ray index of the cw ray unsigned int j; // index of the ccw ray - // add edges into the graph for every cone + // add edges into the graph for every cone for (i = 0; i < cone_number; i++) { j = (i+1) % cone_number; add_edges_in_cone(rays[i], rays[j], g); @@ -156,14 +156,14 @@ public: \tparam DirectionOutputIterator an `OutputIterator` with value type `Direction_2`. \return `result` */ - template - DirectionOutputIterator directions(DirectionOutputIterator result) { - typename std::vector::iterator it; - for (it=rays.begin(); it!=rays.end(); it++) { - *result++ = *it; - } - return result; - } + template + DirectionOutputIterator directions(DirectionOutputIterator result) { + typename std::vector::iterator it; + for (it=rays.begin(); it!=rays.end(); it++) { + *result++ = *it; + } + return result; + } protected: @@ -171,7 +171,7 @@ protected: \param cwBound The direction of the clockwise boundary of the cone. \param ccwBound The direction of the counter-clockwise boundary. - \param g The Theta graph to be built. + \param g The Theta graph to be built. */ void add_edges_in_cone(const Direction_2& cwBound, const Direction_2& ccwBound, Graph_& g) { if (ccwBound == cwBound) { @@ -204,7 +204,7 @@ protected: typedef CGAL::ThetaDetail::Plane_Scan_Tree PSTree; + Less_by_direction > PSTree; PSTree pst(orderD2, orderMid); #ifndef NDEBUG #ifdef REALLY_VERBOSE_TREE_STATE_AFTER_EVERY_TREE_UPDATE__SAFE_TO_REMOVE_FOR_PRODUCTION @@ -219,15 +219,15 @@ protected: pst.add(*it, *it); const typename Graph_::vertex_descriptor *const ri = pst.minAbove(*it); if ( ri != NULL ) { - typename Graph_::edge_descriptor existing_e; - bool existing; - // check whether the edge already exists - boost::tie(existing_e, existing)=boost::edge(*it, *ri, g); - if (!existing) + typename Graph_::edge_descriptor existing_e; + bool existing; + // check whether the edge already exists + boost::tie(existing_e, existing)=boost::edge(*it, *ri, g); + if (!existing) boost::add_edge(*it, *ri, g); - //else - // std::cout << "Edge " << *it << ", " << *ri << " already exists!" << std::endl; - } + //else + // std::cout << "Edge " << *it << ", " << *ri << " already exists!" << std::endl; + } #ifndef NDEBUG #ifdef REALLY_VERBOSE_TREE_STATE_AFTER_EVERY_TREE_UPDATE__SAFE_TO_REMOVE_FOR_PRODUCTION diff --git a/Cone_spanners_2/include/CGAL/Construct_yao_graph_2.h b/Cone_spanners_2/include/CGAL/Construct_yao_graph_2.h index be1bd9e2a23..f75350d7518 100644 --- a/Cone_spanners_2/include/CGAL/Construct_yao_graph_2.h +++ b/Cone_spanners_2/include/CGAL/Construct_yao_graph_2.h @@ -52,9 +52,9 @@ template class Construct_yao_graph_2 { public: - /*! the geometric traits class. */ + /*! the geometric traits class. */ typedef Traits_ Traits; - /*! the specific type of `boost::adjacency_list`. */ + /*! the specific type of `boost::adjacency_list`. */ typedef Graph_ Graph; /*! the point type */ @@ -78,7 +78,7 @@ private: public: /*! - \brief Constructor. + \brief Constructor. \param k Number of cones to divide space into \param initial_direction A direction denoting one of the rays dividing the @@ -87,7 +87,7 @@ public: */ Construct_yao_graph_2 (unsigned int k, Direction_2 initial_direction = Direction_2(1,0) - ): cone_number(k), rays(std::vector(k)) + ): cone_number(k), rays(std::vector(k)) { if (k<2) { @@ -148,7 +148,7 @@ public: } /*! \brief outputs the set of directions to the iterator `result`. - + \tparam DirectionOutputIterator an `OutputIterator` with value type `Direction_2`. \return `result` */ @@ -202,17 +202,17 @@ protected: typename Point_set::iterator it2 = pst.find(*it); // Find minimum in pst from last ended node - O(n) typename Point_set::iterator min = std::min_element(++it2, pst.end(), comp); - // add an edge + // add an edge if (min != pst.end()) { typename Graph_::edge_descriptor existing_e; - bool existing; - // check whether the edge already exists - boost::tie(existing_e, existing)=boost::edge(*it, *min, g); - if (!existing) + bool existing; + // check whether the edge already exists + boost::tie(existing_e, existing)=boost::edge(*it, *min, g); + if (!existing) boost::add_edge(*it, *min, g); //else - // std::cout << "Edge " << *it << ", " << *min << " already exists!" << std::endl; - } + // std::cout << "Edge " << *it << ", " << *min << " already exists!" << std::endl; + } } // end of for @@ -226,10 +226,10 @@ protected: const Point_2& p; const Graph_& g; - // constructor + // constructor Less_euclidean_distance(const Point_2&p, const Graph_& g) : p(p), g(g) {} - // operator + // operator bool operator() (const typename Point_set::iterator::value_type& i, const typename Point_set::iterator::value_type& j) { const Point_2& p1 = g[i]; const Point_2& p2 = g[j]; diff --git a/Cone_spanners_2/include/CGAL/gnuplot_output_2.h b/Cone_spanners_2/include/CGAL/gnuplot_output_2.h index 3a6a2ad34d5..3883dbb832a 100644 --- a/Cone_spanners_2/include/CGAL/gnuplot_output_2.h +++ b/Cone_spanners_2/include/CGAL/gnuplot_output_2.h @@ -39,207 +39,207 @@ namespace CGAL { - /* ------ Declarations go first, then implementations follow. ------ */ - - /*! - * \ingroup PkgConeBasedSpanners - * \brief Output a set of files used by Gnuplot to plot `g`. - * - * The files that are generated for Gnuplot are: - * (1) prefix.v (vertex list) - * (2) prefix.plt (Gnuplot script), This script will read - * prefix.v as input to plot the vertex list. The edge list is also - * included in this script. - * - * Notes: - * (1) If these files already exists, this function will overwrite these - * files. - * (2) Parallel and self-edges cannot be plotted. - * - * \tparam Graph The type of the graph to be plotted. For this function to work, - * the graph type must be `boost::adjacency_list` with `CGAL::Point_2` - * as the `VertexProperties`. - * - * \param g A `boost::adjacency_list` graph with `CGAL::Point_2` as the VertexProperties to be plotted - * \param prefix The prefix of the output files names - */ - template - void gnuplot_output_2 (const Graph& g, const std::string& prefix); + /* ------ Declarations go first, then implementations follow. ------ */ + + /*! + * \ingroup PkgConeBasedSpanners + * \brief Output a set of files used by Gnuplot to plot `g`. + * + * The files that are generated for Gnuplot are: + * (1) prefix.v (vertex list) + * (2) prefix.plt (Gnuplot script), This script will read + * prefix.v as input to plot the vertex list. The edge list is also + * included in this script. + * + * Notes: + * (1) If these files already exists, this function will overwrite these + * files. + * (2) Parallel and self-edges cannot be plotted. + * + * \tparam Graph The type of the graph to be plotted. For this function to work, + * the graph type must be `boost::adjacency_list` with `CGAL::Point_2` + * as the `VertexProperties`. + * + * \param g A `boost::adjacency_list` graph with `CGAL::Point_2` as the VertexProperties to be plotted + * \param prefix The prefix of the output files names + */ + template + void gnuplot_output_2 (const Graph& g, const std::string& prefix); - /* - * \brief Compiles a multi-lined %string to draw the edges in \p g by Gnuplot. - * Compiles an edge list in the following format: - * - * set arrow from (start x, start y) to (end x, end y) - * ... - * - * NOTE: For undirected graphs, use "set style arrow nohead"; for directed graphs, - * use "set style arrow head" - * - * \param g A boost::adjacency_list graph with CGAL::Point_2 as the VertexProperties to be plotted - * \return The edge list string. - */ - template - std::string gnuplot_edge_list (const Graph& g); + /* + * \brief Compiles a multi-lined %string to draw the edges in \p g by Gnuplot. + * Compiles an edge list in the following format: + * + * set arrow from (start x, start y) to (end x, end y) + * ... + * + * NOTE: For undirected graphs, use "set style arrow nohead"; for directed graphs, + * use "set style arrow head" + * + * \param g A boost::adjacency_list graph with CGAL::Point_2 as the VertexProperties to be plotted + * \return The edge list string. + */ + template + std::string gnuplot_edge_list (const Graph& g); - /* - * \brief Compiles a multi-lined %string representing the vertices in \p g. - * - * Compiles a vertex list in the following format: - * x y - * x y - * ... - * - * \param g A boost::adjacency_list graph with CGAL::Point_2 as the VertexProperties to be plotted - * \return The vertex list string. - */ - template - std::string gnuplot_vertex_list (const Graph& g); + /* + * \brief Compiles a multi-lined %string representing the vertices in \p g. + * + * Compiles a vertex list in the following format: + * x y + * x y + * ... + * + * \param g A boost::adjacency_list graph with CGAL::Point_2 as the VertexProperties to be plotted + * \return The vertex list string. + */ + template + std::string gnuplot_vertex_list (const Graph& g); - /* This struct is defined to use partial specialization to generate arrow styles differently for - * directed and undirected graphs. - * Note: Need to use structs because C++ before 11 doesn't allow partial specialisation - * for functions - */ - template - struct Gnuplot_edges_2; + /* This struct is defined to use partial specialization to generate arrow styles differently for + * directed and undirected graphs. + * Note: Need to use structs because C++ before 11 doesn't allow partial specialisation + * for functions + */ + template + struct Gnuplot_edges_2; - /* ------- IMPLEMENTATIONS ------- */ + /* ------- IMPLEMENTATIONS ------- */ - template - std::string gnuplot_edge_list (const Graph& g) - { - std::stringstream ss; - ss.precision(3); - ss << std::fixed; // Use fixed floating-point notation + template + std::string gnuplot_edge_list (const Graph& g) + { + std::stringstream ss; + ss.precision(3); + ss << std::fixed; // Use fixed floating-point notation - typename Graph::edge_iterator eit, ee; - for (boost::tie(eit, ee) = boost::edges(g); eit != ee; ++eit) { - typename Graph::vertex_descriptor src = boost::source(*eit, g); - typename Graph::vertex_descriptor end = boost::target(*eit, g); - ss << "set arrow from "; - ss << to_double(g[src].x()) << "," << to_double(g[src].y()); - ss << " to "; - ss << to_double(g[end].x()) << "," << to_double(g[end].y()); - ss << " as 1" << std::endl; - } - return ss.str(); - } + typename Graph::edge_iterator eit, ee; + for (boost::tie(eit, ee) = boost::edges(g); eit != ee; ++eit) { + typename Graph::vertex_descriptor src = boost::source(*eit, g); + typename Graph::vertex_descriptor end = boost::target(*eit, g); + ss << "set arrow from "; + ss << to_double(g[src].x()) << "," << to_double(g[src].y()); + ss << " to "; + ss << to_double(g[end].x()) << "," << to_double(g[end].y()); + ss << " as 1" << std::endl; + } + return ss.str(); + } - // Common regardless of whether g is directed. - template - std::string gnuplot_vertex_list(const Graph& g) { - std::stringstream ss; - ss.precision(3); - ss << std::fixed; + // Common regardless of whether g is directed. + template + std::string gnuplot_vertex_list(const Graph& g) { + std::stringstream ss; + ss.precision(3); + ss << std::fixed; - typename Graph::vertex_iterator vit, ve; - for (boost::tie(vit, ve) = boost::vertices(g); vit != ve; ++vit) { - ss << to_double(g[*vit].x()) << " " << to_double(g[*vit].y()) << std::endl; - } - return ss.str(); - } + typename Graph::vertex_iterator vit, ve; + for (boost::tie(vit, ve) = boost::vertices(g); vit != ve; ++vit) { + ss << to_double(g[*vit].x()) << " " << to_double(g[*vit].y()) << std::endl; + } + return ss.str(); + } - template - void gnuplot_output_2 (const Graph& g, const std::string& prefix) - { - // Generate the vertex list to the .v file - std::ofstream fs((prefix + ".v").c_str(), - std::ofstream::out | std::ofstream::trunc); - fs << gnuplot_vertex_list(g); - fs.close(); - std::cout << prefix << ".v" << " is generated. " << std::endl; + template + void gnuplot_output_2 (const Graph& g, const std::string& prefix) + { + // Generate the vertex list to the .v file + std::ofstream fs((prefix + ".v").c_str(), + std::ofstream::out | std::ofstream::trunc); + fs << gnuplot_vertex_list(g); + fs.close(); + std::cout << prefix << ".v" << " is generated. " << std::endl; - // Generate the Gnuplot Script to the .plt file - fs.open((prefix + ".plt").c_str(), - std::ofstream::out | std::ofstream::trunc); - fs << "set term "; - // Choose one: - fs << "wxt "; - // fs << "postscript eps "; + // Generate the Gnuplot Script to the .plt file + fs.open((prefix + ".plt").c_str(), + std::ofstream::out | std::ofstream::trunc); + fs << "set term "; + // Choose one: + fs << "wxt "; + // fs << "postscript eps "; - fs << "font \", 9\" enhanced" << std::endl; + fs << "font \", 9\" enhanced" << std::endl; - // Uncomment if eps: - // fs << "set output \"" << prefix << ".eps\"" << std::endl; + // Uncomment if eps: + // fs << "set output \"" << prefix << ".eps\"" << std::endl; - fs << "set title" << std::endl; - fs << "set xlabel # when no options, clear the xlabel" << std::endl; - fs << "set ylabel" << std::endl; - fs << "unset key" << std::endl; - fs << "set size square" << std::endl; - fs << "unset xtics" << std::endl; - fs << "unset ytics" << std::endl; - fs << "unset border" << std::endl; + fs << "set title" << std::endl; + fs << "set xlabel # when no options, clear the xlabel" << std::endl; + fs << "set ylabel" << std::endl; + fs << "unset key" << std::endl; + fs << "set size square" << std::endl; + fs << "unset xtics" << std::endl; + fs << "unset ytics" << std::endl; + fs << "unset border" << std::endl; - /* - ss << "set xtics" << std::endl; - ss << "set ytics" << std::endl; - ss << "set border" << std::endl; - ss << "set grid xtics ytics" << std::endl; - */ + /* + ss << "set xtics" << std::endl; + ss << "set ytics" << std::endl; + ss << "set border" << std::endl; + ss << "set grid xtics ytics" << std::endl; + */ - fs << std::endl; - // Specific part that depends on whether g is directed - fs << Gnuplot_edges_2::gnuplot_edge_script(g); - fs << std::endl; + fs << std::endl; + // Specific part that depends on whether g is directed + fs << Gnuplot_edges_2::gnuplot_edge_script(g); + fs << std::endl; - // plot the vertices - fs << "plot \"" << prefix << ".v\" with points pt 7 ps 0.8 lt rgb \"blue\"" << std::endl; + // plot the vertices + fs << "plot \"" << prefix << ".v\" with points pt 7 ps 0.8 lt rgb \"blue\"" << std::endl; - // Uncomment if wxt and also want eps output: - // fs << "set term postscript eps " << std::endl; - // fs << "set output \"" << prefix << ".eps\"" << std::endl; - // fs << "replot" << std::endl; + // Uncomment if wxt and also want eps output: + // fs << "set term postscript eps " << std::endl; + // fs << "set output \"" << prefix << ".eps\"" << std::endl; + // fs << "replot" << std::endl; - fs.close(); - std::cout << prefix << ".plt" << " is generated. " << std::endl; - } + fs.close(); + std::cout << prefix << ".plt" << " is generated. " << std::endl; + } - // directed graphs - /* Writing edge list to the gnuplot script for directed graphs */ - template - struct Gnuplot_edges_2 { + // directed graphs + /* Writing edge list to the gnuplot script for directed graphs */ + template + struct Gnuplot_edges_2 { - // Uses "set style arrow 1 head" to draw directed edges - // Edges are written directly into the script file. - static std::string gnuplot_edge_script(const Graph& g) - { - std::stringstream ss; - - ss << "set style arrow 1 head filled lc rgb \"black\"" << std::endl; - ss << std::endl; - ss << "# edges" << std::endl; - ss << gnuplot_edge_list(g); - ss << "# end of edges" << std::endl; + // Uses "set style arrow 1 head" to draw directed edges + // Edges are written directly into the script file. + static std::string gnuplot_edge_script(const Graph& g) + { + std::stringstream ss; + + ss << "set style arrow 1 head filled lc rgb \"black\"" << std::endl; + ss << std::endl; + ss << "# edges" << std::endl; + ss << gnuplot_edge_list(g); + ss << "# end of edges" << std::endl; - return ss.str(); - } - }; + return ss.str(); + } + }; - // Bidirectional graph, the same as the directed graph. - /* Writing edge list to the gnuplot script for bidirectional graphs */ - template - struct Gnuplot_edges_2 : public Gnuplot_edges_2 {}; + // Bidirectional graph, the same as the directed graph. + /* Writing edge list to the gnuplot script for bidirectional graphs */ + template + struct Gnuplot_edges_2 : public Gnuplot_edges_2 {}; - // Undirected graphs - /* Writing edge list to the gnuplot script for undirected graphs */ - template - struct Gnuplot_edges_2 { + // Undirected graphs + /* Writing edge list to the gnuplot script for undirected graphs */ + template + struct Gnuplot_edges_2 { - static std::string gnuplot_edge_script(const Graph& g) - { - std::stringstream ss; - ss << "set style arrow 1 nohead lc rgb \"black\"" << std::endl; - ss << std::endl; - ss << "# edges" << std::endl; - ss << gnuplot_edge_list(g); - ss << "# end of edges" << std::endl; + static std::string gnuplot_edge_script(const Graph& g) + { + std::stringstream ss; + ss << "set style arrow 1 nohead lc rgb \"black\"" << std::endl; + ss << std::endl; + ss << "# edges" << std::endl; + ss << gnuplot_edge_list(g); + ss << "# end of edges" << std::endl; - return ss.str(); - } + return ss.str(); + } - }; + }; } // namespace CGAL diff --git a/Cone_spanners_2/test/Cone_spanners_2/cones_inexact.cpp b/Cone_spanners_2/test/Cone_spanners_2/cones_inexact.cpp index c8479a9dfd6..54f0ee4180f 100644 --- a/Cone_spanners_2/test/Cone_spanners_2/cones_inexact.cpp +++ b/Cone_spanners_2/test/Cone_spanners_2/cones_inexact.cpp @@ -40,15 +40,15 @@ int main(int argc, char ** argv) { } // construct the functor - CGAL::Compute_cone_boundaries_2 cones; - // create the vector rays to store the results - std::vector rays(k); - // compute the cone boundaries and store them in rays - cones(k, initial_direction, rays.begin()); + CGAL::Compute_cone_boundaries_2 cones; + // create the vector rays to store the results + std::vector rays(k); + // compute the cone boundaries and store them in rays + cones(k, initial_direction, rays.begin()); - // display the computed rays, starting from the initial direction, ccw order + // display the computed rays, starting from the initial direction, ccw order for (unsigned int i=0; i