Skip to content

Commit 94d4555

Browse files
committed
Merge pull request #7678 from efifogel/gsoc2023-aos_sphere_demo-denizdiktas
Gsoc2023, stand-alone interactive program that demonstrates 2D arrangements embedded on the sphere
2 parents d9a8aa2 + ec18666 commit 94d4555

File tree

76 files changed

+368872
-507
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+368872
-507
lines changed

Arrangement_on_surface_2/demo/Arrangement_on_surface_2_earth/Aos.cpp

Lines changed: 1384 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
// Copyright(c) 2023, 2024 Tel-Aviv University (Israel).
2+
// All rights reserved.
3+
//
4+
// This file is part of CGAL (www.cgal.org).
5+
//
6+
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
7+
//
8+
// Author(s): Engin Deniz Diktas <[email protected]>
9+
10+
#ifndef AOS_H
11+
#define AOS_H
12+
13+
#include <map>
14+
#include <memory>
15+
#include <vector>
16+
#include <qvector3d.h>
17+
18+
#include "Kml_reader.h"
19+
20+
class Aos {
21+
public:
22+
using Approx_arc = std::vector<QVector3D>;
23+
using Approx_arcs = std::vector<Approx_arc>;
24+
//using Arr_handle = void*;
25+
using Arr_handle = std::shared_ptr<void>;
26+
27+
static Approx_arc get_approx_identification_curve(double error);
28+
29+
// this constructs some sample arcs manually (used to check the visual output)
30+
static Approx_arcs get_approx_arcs(double error);
31+
32+
// this is used to construct approximate arcs from KML-Placemark data
33+
static Approx_arcs get_approx_arcs(const Kml::Placemark& placemark,
34+
double error);
35+
36+
static void get_curves();
37+
38+
static void check(const Kml::Placemarks& placemarks);
39+
40+
// Extended check: here we use the extended version of the DCEL to understand
41+
// what is going on with the additional vertices and faces.
42+
// INPUT: GIS data
43+
// OUTPUT: vertices created during arrangement construction
44+
static std::vector<QVector3D> ext_check(const Kml::Placemarks& placemarks);
45+
46+
// Same as above function but works by identifying the duplicate nodes
47+
static std::vector<QVector3D> ext_check_id_based(Kml::Placemarks& placemarks);
48+
49+
// This function is used to find the newly-created faces during arrangement
50+
// construction. It uses the extended DCEL structure (see: above 2 functions).
51+
// NOTE: The need for this function arises due to the following observation:
52+
// when constructing the arrangement from our data-set I observed a newly
53+
// created face which is not defined explicitly in the data-set. My intiution
54+
// tells me that this is the Caspian sea, because it is the only land-locked
55+
// polygon whose boundaries are not defined in the data-set and its boundaries
56+
// are defined indirecly by its surrounding countries.
57+
static Approx_arcs find_new_faces(Kml::Placemarks& placemarks);
58+
59+
// save the arrangement created with EPEC
60+
static void save_arr(Kml::Placemarks& placemarks,
61+
const std::string& file_name);
62+
63+
// loads the arrangement created by the save_arr function
64+
// NOTE: This one loads the arrangement as "Country_arr" type
65+
static Arr_handle load_arr(const std::string& file_name);
66+
67+
static Arr_handle construct(Kml::Placemarks& placemarks);
68+
//static std::vector<QVector3D> get_triangles(Arr_handle arrh);
69+
70+
//using Country_triangles_map = std::map<std::string, std::vector<QVector3D>>;
71+
//static Country_triangles_map get_triangles_by_country(Arr_handle arrh);
72+
73+
using Country_color_map = std::map<std::string, std::size_t>;
74+
static Country_color_map get_color_mapping(Arr_handle arrh);
75+
76+
static std::string locate_country(Arr_handle arrh, const QVector3D& point);
77+
78+
// this will get the approximate arcs of face-edges from the arrangement
79+
// NOTE: this is similar to "get_approx_arcs(KML::Placemarks&, double)" above!
80+
static Approx_arcs get_approx_arcs_from_faces_edges(Arr_handle arrh,
81+
double error);
82+
};
83+
84+
#endif
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Copyright(c) 2023, 2024 Tel-Aviv University (Israel).
2+
// All rights reserved.
3+
//
4+
// This file is part of CGAL (www.cgal.org).
5+
//
6+
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
7+
//
8+
// Author(s): Engin Deniz Diktas <[email protected]>
9+
10+
#ifndef AOS_DEFS_H
11+
#define AOS_DEFS_H
12+
13+
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
14+
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
15+
#include <CGAL/Arrangement_on_surface_2.h>
16+
#include <CGAL/Arr_extended_dcel.h>
17+
#include <CGAL/Arr_geodesic_arc_on_sphere_traits_2.h>
18+
#include <CGAL/Arr_spherical_topology_traits_2.h>
19+
#include <CGAL/Vector_3.h>
20+
21+
//#define USE_EPIC
22+
23+
#ifdef USE_EPIC
24+
using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel;
25+
#else
26+
using Kernel = CGAL::Exact_predicates_exact_constructions_kernel;
27+
#endif
28+
29+
using Geom_traits = CGAL::Arr_geodesic_arc_on_sphere_traits_2<Kernel>;
30+
using Point = Geom_traits::Point_2;
31+
using Curve = Geom_traits::Curve_2;
32+
using Topol_traits = CGAL::Arr_spherical_topology_traits_2<Geom_traits>;
33+
using Arrangement = CGAL::Arrangement_on_surface_2<Geom_traits, Topol_traits>;
34+
35+
// the following is from "arr_inexact_construction_segments.h":
36+
using Segment = Geom_traits::X_monotone_curve_2;
37+
using Vertex_handle = Arrangement::Vertex_handle;
38+
39+
// COUNTRIES AOS for grouping the faces by the country name
40+
using Countries_dcel = CGAL::Arr_face_extended_dcel<Geom_traits, std::string>;
41+
using Countries_topol_traits =
42+
CGAL::Arr_spherical_topology_traits_2<Geom_traits, Countries_dcel>;
43+
using Countries_arr =
44+
CGAL::Arrangement_on_surface_2<Geom_traits, Countries_topol_traits>;
45+
46+
47+
#endif

0 commit comments

Comments
 (0)