From 0c3ab6d10a3c4b79699ee6fb0ac9b721e2f4708e Mon Sep 17 00:00:00 2001 From: denizdiktas Date: Sat, 12 Aug 2023 16:18:13 +0300 Subject: [PATCH] code cleanup --- Arrangement_on_surface_2/demo/earth/Aos.cpp | 45 ++++++++++--------- .../demo/earth/Main_widget.cpp | 8 ++-- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/Arrangement_on_surface_2/demo/earth/Aos.cpp b/Arrangement_on_surface_2/demo/earth/Aos.cpp index b5951bae047..8d5fba9576b 100644 --- a/Arrangement_on_surface_2/demo/earth/Aos.cpp +++ b/Arrangement_on_surface_2/demo/earth/Aos.cpp @@ -13,6 +13,7 @@ #include using json = nlohmann::ordered_json; +// Includes for Arrangements on Sphere (AOS) #include #include #include @@ -20,10 +21,20 @@ using json = nlohmann::ordered_json; #include #include #include - #include "arr_print.h" #include "Tools.h" +// Includes for Constrained Delaunay Triangulation +#include +#include +#include +#include +#include +//#include +#include +#include + + namespace { //#define USE_EPIC @@ -1532,7 +1543,7 @@ Aos::Arr_handle Aos::load_arr(const std::string& file_name) Aos::Arr_handle Aos::construct(Kml::Placemarks& placemarks) { - Geom_traits traits; + static Geom_traits traits; auto* arr = new Arrangement(&traits); auto xcvs = get_arcs(placemarks, *arr); @@ -1542,29 +1553,19 @@ Aos::Arr_handle Aos::construct(Kml::Placemarks& placemarks) return arr; } -#include -#include -#include -#include -#include -//#include - -#include -#include -#include std::vector Aos::get_triangles(Arr_handle arrh) { - typedef CGAL::Exact_predicates_inexact_constructions_kernel K; - // typedef CGAL::Projection_traits_3 K; - typedef CGAL::Triangulation_vertex_base_2 Vb; - typedef CGAL::Constrained_triangulation_face_base_2 Fb; - typedef CGAL::Triangulation_data_structure_2 TDS; - typedef CGAL::Exact_predicates_tag Itag; - typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; - typedef CDT::Face_handle Face_handle; - typedef CDT::Point Point; - typedef CGAL::Polygon_2 Polygon_2; + using K = CGAL::Exact_predicates_inexact_constructions_kernel; + //using K = CGAL::Projection_traits_3; + using Vb = CGAL::Triangulation_vertex_base_2; + using Fb = CGAL::Constrained_triangulation_face_base_2; + using TDS = CGAL::Triangulation_data_structure_2; + using Itag = CGAL::Exact_predicates_tag; + using CDT = CGAL::Constrained_Delaunay_triangulation_2; + using Face_handle = CDT::Face_handle; + using Point = CDT::Point; + using Polygon_2 = CGAL::Polygon_2; auto& arr = *reinterpret_cast(arrh); diff --git a/Arrangement_on_surface_2/demo/earth/Main_widget.cpp b/Arrangement_on_surface_2/demo/earth/Main_widget.cpp index 95dc4496c0d..1ddf10e39ff 100644 --- a/Arrangement_on_surface_2/demo/earth/Main_widget.cpp +++ b/Arrangement_on_surface_2/demo/earth/Main_widget.cpp @@ -178,8 +178,8 @@ void Main_widget::initializeGL() //const auto file_name = data_path + "world_countries.kml"; //const auto file_name = data_path + "ne_110m_admin_0_countries.kml"; - //const auto file_name = data_path + "ne_110m_admin_0_countries_africa_1.kml"; - const auto file_name = data_path + "ne_110m_admin_0_countries_equatorial_guinea.kml"; + const auto file_name = data_path + "ne_110m_admin_0_countries_africa.kml"; + //const auto file_name = data_path + "ne_110m_admin_0_countries_equatorial_guinea.kml"; m_countries = Kml::read(file_name); // find the country with the least number of nodes @@ -224,8 +224,8 @@ void Main_widget::initializeGL() // trianglulation { qDebug() << "constructiong arr.."; - //auto arrh = Aos::construct(m_countries); - auto arrh = Aos::load_arr("C:/work/gsoc2023/ne_110m_admin_0_countries.json"); + auto arrh = Aos::construct(m_countries); + //auto arrh = Aos::load_arr("C:/work/gsoc2023/ne_110m_admin_0_countries.json"); if (arrh == nullptr) { qDebug() << "** FAILED TO LOAD THE ARRANGEMENT!!!";