Skip to content

Commit

Permalink
Working on identifying the vertex problems
Browse files Browse the repository at this point in the history
  • Loading branch information
denizdiktas committed Jul 10, 2023
1 parent ea0604e commit 258b40a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
12 changes: 9 additions & 3 deletions Arrangement_on_surface_2/demo/earth/Aos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,15 +334,18 @@ std::vector<QVector3D> Aos::ext_check(const Kml::Placemarks& placemarks)
auto& d = vit->data();
if (vit->data().v == false)
{
std::cout << "-------------------------------------\n";
std::cout << vit->point() << std::endl;

if (2 == vit->degree())
;//continue;

if (1 == vit->degree())
{
auto p = vit->point();
auto p2 = p.location();
std::cout << "deg-1 vertex = " << p << std::endl;
std::cout << "deg-1 vertex: " << std::boolalpha << vit->incident_halfedges()->target()->data().v << std::endl;
std::cout << " deg-1 vertex = " << p << std::endl;
std::cout << " deg-1 vertex: " << std::boolalpha << vit->incident_halfedges()->target()->data().v << std::endl;
}


Expand All @@ -362,9 +365,12 @@ std::vector<QVector3D> Aos::ext_check(const Kml::Placemarks& placemarks)
do {

} while (++curr != first);


std::cout << "\n";
}
}
Kml::Node n{ 180.0, -84.71338 };
std::cout << "Node itself = " << n.get_coords_3d() << std::endl;
std::cout << "*** num created vertices = " << num_created_vertices << std::endl;

std::cout << "-------------------------------\n";
Expand Down
7 changes: 4 additions & 3 deletions Arrangement_on_surface_2/demo/earth/Kml_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ bool Kml::Node::operator == (const Node& r) const
}
Kml::Vec3d Kml::Node::get_coords_3d(const double r) const
{
const auto phi = qDegreesToRadians(lat);
const auto theta = qDegreesToRadians(lon);
const long double phi = qDegreesToRadians(lat);
const long double theta = qDegreesToRadians(lon);
const auto z = r * std::sin(phi);
const auto rxy = r * std::cos(phi);
const auto x = rxy * std::cos(theta);
const auto y = rxy * std::sin(theta);

return Vec3d{ x, y, z };
return Vec3d{ (double)x, (double)y, (double)z };
}
QVector3D Kml::Node::get_coords_3f(const double r) const
{
Expand Down Expand Up @@ -120,6 +120,7 @@ Kml::Placemarks Kml::read(const std::string& file_name)
else if (name == "LinearRing")
{
// LinearRing is moved to the correct locations via other tags above
assert(*lring.nodes.begin() == *(--lring.nodes.end()));
}
else if (name == "coordinates")
{
Expand Down
9 changes: 9 additions & 0 deletions Arrangement_on_surface_2/demo/earth/Kml_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,21 @@ class Kml
struct Vec3d
{
double x, y, z;

friend std::ostream& operator << (std::ostream& os, const Vec3d& v)
{
os << v.x << ", " << v.y << ", " << v.z;
return os;
}
};

struct Node
{
double lon, lat;

Node() : lon(-1111), lat(-1111) {};
Node(double longitude, double latitude) : lon(longitude), lat(latitude) {};

bool operator == (const Node& r) const;
Vec3d get_coords_3d(const double r = 1.0) const;
QVector3D get_coords_3f(const double r=1.0) const;
Expand Down
4 changes: 2 additions & 2 deletions Arrangement_on_surface_2/demo/earth/Main_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ void Main_widget::initializeGL()
else
{
// check the arrangement constructed from the GIS data-set
//auto created_vertices = Aos::ext_check(m_countries);
auto created_vertices = Aos::ext_check_id_based(m_countries);
auto created_vertices = Aos::ext_check(m_countries);
//auto created_vertices = Aos::ext_check_id_based(m_countries);
m_vertices = std::make_unique<Vertices>(created_vertices);
}

Expand Down

0 comments on commit 258b40a

Please sign in to comment.