Working on identifying the vertex problems

This commit is contained in:
denizdiktas 2023-07-10 15:52:04 +03:00
parent ea0604eddc
commit 258b40a7d7
4 changed files with 24 additions and 8 deletions

View File

@ -334,6 +334,9 @@ 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;
@ -341,8 +344,8 @@ std::vector<QVector3D> Aos::ext_check(const Kml::Placemarks& placemarks)
{
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;
}
@ -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";

View File

@ -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
{
@ -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")
{

View File

@ -16,12 +16,21 @@ public:
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;

View File

@ -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);
}