From 6a68396aa2387df0c237196fa0bdb35652119492 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9rik=20Paradis?= Date: Thu, 1 Dec 2016 15:57:34 -0500 Subject: [PATCH] Adding the choice of even or odd cones for half-theta/yao-graphs in cone spanners ipelet --- .../demo/CGAL_ipelets/cone_spanners.cpp | 28 +++++++++++++------ .../lua/libCGAL_cone_spanners.lua | 6 ++-- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/CGAL_ipelets/demo/CGAL_ipelets/cone_spanners.cpp b/CGAL_ipelets/demo/CGAL_ipelets/cone_spanners.cpp index 7deb278264e..7c3cbcc3215 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/cone_spanners.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/cone_spanners.cpp @@ -28,13 +28,15 @@ typedef boost::adjacency_list Graph; -const std::string labels[] = { "Theta-k-graph", "Yao-k-graph", "Half-theta-k-graph", "Half-Yao-k-graph", "k cones", "Help" }; +const std::string labels[] = { "Theta-k-graph", "Yao-k-graph", "Half-theta-k-graph with even cones", "Half-Yao-k-graph with even cones", "Half-theta-k-graph with odd cones", "Half-Yao-k-graph with odd cones", "k cones", "Help" }; const std::string hmsg[] = { - "Compute a theta-graph with k cones.", - "Compute a Yao-graph with k cones.", - "Compute an half-theta-graph with k cones.", - "Compute an half-Yao-graph with k cones.", - "Draw k cones around the points.", + "Draws a theta-graph with k cones.", + "Draws a Yao-graph with k cones.", + "Draws an half-theta-graph with the even of k cones.", + "Draws an half-Yao-graph with the even of k cones.", + "Draws an half-theta-graph with the odd of k cones.", + "Draws an half-Yao-graph with the odd of k cones.", + "Draws k cones around the points.", }; class Cone_spanners_ipelet @@ -56,6 +58,8 @@ void Cone_spanners_ipelet::protected_run(int fn) case 2: case 3: case 4: + case 5: + case 6: { std::vector points_read; read_active_objects( @@ -84,18 +88,23 @@ void Cone_spanners_ipelet::protected_run(int fn) } break; } - case 5: + case 7: show_help(); return; } - if(fn >= 0 && fn <= 3) { - bool half = (fn == 2 || fn == 3); + if(fn >= 0 && fn <= 5) { + CGAL::Half half = CGAL::ALL_CONES; + if(fn == 2 || fn == 3) + half = CGAL::EVEN_CONES; + else if(fn == 4 || fn == 5) + half = CGAL::ODD_CONES; Graph g; switch (fn){ case 0: case 2: + case 4: { CGAL::Construct_theta_graph_2 theta(number_of_cones, Direction_2(1,0), half); theta(lst.begin(), lst.end(), g); @@ -103,6 +112,7 @@ void Cone_spanners_ipelet::protected_run(int fn) } case 1: case 3: + case 5: { CGAL::Construct_yao_graph_2 yao(number_of_cones, Direction_2(1,0), half); yao(lst.begin(), lst.end(), g); diff --git a/CGAL_ipelets/demo/CGAL_ipelets/lua/libCGAL_cone_spanners.lua b/CGAL_ipelets/demo/CGAL_ipelets/lua/libCGAL_cone_spanners.lua index 3eccb6d5e1e..8ca3a90fe01 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/lua/libCGAL_cone_spanners.lua +++ b/CGAL_ipelets/demo/CGAL_ipelets/lua/libCGAL_cone_spanners.lua @@ -19,8 +19,10 @@ end methods = { { label="Theta-k-graph" }, { label="Yao-k-graph" }, - { label="Half-theta-k-graph" }, - { label="Half-Yao-k-graph" }, + { label="Half-theta-k-graph with even cones" }, + { label="Half-Yao-k-graph with even cones" }, + { label="Half-theta-k-graph with odd cones" }, + { label="Half-Yao-k-grap with odd cones" }, { label="k cones" }, { label="Help" }, }