Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
denizdiktas committed Aug 12, 2023
1 parent 66d0ef8 commit 0c3ab6d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 26 deletions.
45 changes: 23 additions & 22 deletions Arrangement_on_surface_2/demo/earth/Aos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,28 @@
#include <nlohmann/json.hpp>
using json = nlohmann::ordered_json;

// Includes for Arrangements on Sphere (AOS)
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Arrangement_on_surface_2.h>
#include <CGAL/Arr_extended_dcel.h>
#include <CGAL/Arr_geodesic_arc_on_sphere_traits_2.h>
#include <CGAL/Arr_spherical_topology_traits_2.h>
#include <CGAL/Vector_3.h>

#include "arr_print.h"
#include "Tools.h"

// Includes for Constrained Delaunay Triangulation
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/draw_triangulation_2.h>
#include <CGAL/mark_domain_in_triangulation.h>
#include <CGAL/Polygon_2.h>
//#include <CGAL/Projection_traits_3.h>
#include <unordered_map>
#include <boost/property_map/property_map.hpp>


namespace {
//#define USE_EPIC

Expand Down Expand Up @@ -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);
Expand All @@ -1542,29 +1553,19 @@ Aos::Arr_handle Aos::construct(Kml::Placemarks& placemarks)
return arr;
}

#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/draw_triangulation_2.h>
#include <CGAL/mark_domain_in_triangulation.h>
#include <CGAL/Polygon_2.h>
//#include <CGAL/Projection_traits_3.h>

#include <iostream>
#include <unordered_map>
#include <boost/property_map/property_map.hpp>

std::vector<QVector3D> Aos::get_triangles(Arr_handle arrh)
{
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
// typedef CGAL::Projection_traits_3<K_epic> K;
typedef CGAL::Triangulation_vertex_base_2<K> Vb;
typedef CGAL::Constrained_triangulation_face_base_2<K> Fb;
typedef CGAL::Triangulation_data_structure_2<Vb, Fb> TDS;
typedef CGAL::Exact_predicates_tag Itag;
typedef CGAL::Constrained_Delaunay_triangulation_2<K, TDS, Itag> CDT;
typedef CDT::Face_handle Face_handle;
typedef CDT::Point Point;
typedef CGAL::Polygon_2<K> Polygon_2;
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
//using K = CGAL::Projection_traits_3<K_epic>;
using Vb = CGAL::Triangulation_vertex_base_2<K>;
using Fb = CGAL::Constrained_triangulation_face_base_2<K>;
using TDS = CGAL::Triangulation_data_structure_2<Vb, Fb>;
using Itag = CGAL::Exact_predicates_tag;
using CDT = CGAL::Constrained_Delaunay_triangulation_2<K, TDS, Itag>;
using Face_handle = CDT::Face_handle;
using Point = CDT::Point;
using Polygon_2 = CGAL::Polygon_2<K>;

auto& arr = *reinterpret_cast<Arrangement*>(arrh);

Expand Down
8 changes: 4 additions & 4 deletions Arrangement_on_surface_2/demo/earth/Main_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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!!!";
Expand Down

0 comments on commit 0c3ab6d

Please sign in to comment.