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 01631769b3c..d38d00131d5 100644
--- a/Cone_spanners_2/include/CGAL/Construct_theta_graph_2.h
+++ b/Cone_spanners_2/include/CGAL/Construct_theta_graph_2.h
@@ -44,11 +44,11 @@ namespace CGAL {
\brief A template functor for constructing Theta graphs with a given set of 2D points and
a given initial direction for the cone boundaries.
- \tparam Traits_ Must be either `CGAL::Exact_predicates_exact_constructions_kernel_with_root_of`
+ \tparam Traits_ Must be either `CGAL::Exact_predicates_exact_constructions_kernel_with_root_of`
or `CGAL::Exact_predicates_inexact_constructions_kernel`.
\tparam Graph_ The graph type to store the constructed cone based spanner.
- It must be `boost::adjacency_list`
+ It must be `boost::adjacency_list`
with `Traits_::Point_2` as `VertexProperties`.
*/
template
@@ -78,6 +78,9 @@ private:
/* Store the number of cones. */
unsigned int cone_number;
+ /* Store wheter this is an half-theta graph */
+ bool half;
+
/* Store the directions of the rays dividing the plane. The initial direction will be
* stored in rays[0].
*/
@@ -90,10 +93,13 @@ public:
\param initial_direction A direction denoting one of the rays dividing the
cones. This allows arbitary rotations of the rays that divide
the plane. (default: positive x-axis)
+ \param half_theta Indicates whether all the cones are used or just half of
+ them (default: all cones).
*/
Construct_theta_graph_2 (unsigned int k,
- Direction_2 initial_direction = Direction_2(1,0)
- ): cone_number(k), rays(std::vector(k))
+ Direction_2 initial_direction = Direction_2(1,0),
+ bool half_theta = false
+ ): cone_number(k), rays(std::vector(k)), half(half_theta)
{
if (k<2) {
@@ -131,7 +137,8 @@ public:
unsigned int j; // index of the ccw ray
// add edges into the graph for every cone
- for (i = 0; i < cone_number; i++) {
+ int increment = half ? 2 : 1;
+ for (i = 0; i < cone_number; i += increment) {
j = (i+1) % cone_number;
add_edges_in_cone(rays[i], rays[j], g);
}
@@ -201,10 +208,10 @@ protected:
Less_by_direction > PSTree;
PSTree pst(orderD2, orderMid);
- // Step 3: visit S in orderD1
+ // Step 3: visit S in orderD1
// insert '*it' into T
// find ri = T.minAbove(*it)
- // add an edge
+ // add an edge
for (typename std::vector::const_iterator
it = S.begin(); it != S.end(); ++it) {
pst.add(*it, *it);
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 b3e0af398bf..62e82d3f170 100644
--- a/Cone_spanners_2/include/CGAL/Construct_yao_graph_2.h
+++ b/Cone_spanners_2/include/CGAL/Construct_yao_graph_2.h
@@ -42,11 +42,11 @@ namespace CGAL {
\brief A template functor for constructing Yao graphs with a given set of 2D points and
a given initial direction for the cone boundaries.
- \tparam Traits_ Must be either `CGAL::Exact_predicates_exact_constructions_kernel_with_root_of`
+ \tparam Traits_ Must be either `CGAL::Exact_predicates_exact_constructions_kernel_with_root_of`
or `CGAL::Exact_predicates_inexact_constructions_kernel`.
\tparam Graph_ The graph type to store the constructed cone based spanner.
- It must be `boost::adjacency_list`
+ It must be `boost::adjacency_list`
with `Traits_::Point_2` as `VertexProperties`
*/
template
@@ -73,6 +73,9 @@ private:
/* Store the number of cones. */
unsigned int cone_number;
+ /* Store wheter this is an half-theta graph */
+ bool half;
+
/* Store the directions of the rays dividing the plane. The initial direction will be
stored in rays[0]. */
std::vector rays;
@@ -85,10 +88,13 @@ public:
\param initial_direction A direction denoting one of the rays dividing the
cones. This allows arbitary rotations of the rays that divide
the plane. (default: positive x-axis)
+ \param half_yao Indicates whether all the cones are used or just half of
+ them (default: all cones).
*/
Construct_yao_graph_2 (unsigned int k,
- Direction_2 initial_direction = Direction_2(1,0)
- ): cone_number(k), rays(std::vector(k))
+ Direction_2 initial_direction = Direction_2(1,0),
+ bool half_yao = false
+ ): cone_number(k), rays(std::vector(k)), half(half_yao)
{
if (k<2) {
@@ -127,7 +133,8 @@ public:
unsigned int j; // index of the ccw ray
// add edges into the graph for every cone
- for (i = 0; i < cone_number; i++) {
+ int increment = half ? 2 : 1;
+ for (i = 0; i < cone_number; i += increment) {
j = (i+1) % cone_number;
add_edges_in_cone(rays[i], rays[j], g);
}