Skip to content

Instantly share code, notes, and snippets.

@MBARIMike
Created December 13, 2021 21:42
Show Gist options
  • Save MBARIMike/6f3d7a22963796a028ac9885900d820c to your computer and use it in GitHub Desktop.
Save MBARIMike/6f3d7a22963796a028ac9885900d820c to your computer and use it in GitHub Desktop.
$ git diff src/stoqs/geometry.cpp
diff --git a/stoqs/contrib/gltf-generator/src/stoqs/geometry.cpp b/stoqs/contrib/gltf-generator/src/stoqs/geometry.cpp
index 4495916..46f385a 100644
--- a/stoqs/contrib/gltf-generator/src/stoqs/geometry.cpp
+++ b/stoqs/contrib/gltf-generator/src/stoqs/geometry.cpp
@@ -1,7 +1,8 @@
#include <stoqs/geometry.h>
// standard library
-#include <math.h>
+#include <cmath>
+#include <iostream>
#define EARTH_RADIUS_M 6371000.0
@@ -29,6 +30,15 @@ namespace stoqs
Vertex Geometry::get_earth_centered_vertex(double longitude, double latitude, double altitude, uint32_t id)
{
+ // Test with:
+ // longitude, latitude, altitude: -122.503094 37.058946 -1020
+ // x, y, z: -2737902.2652 -4297133.60787 3822000.89563
+ //longitude = -122.503094;
+ //latitude = 37.058946;
+ //altitude = -1020;
+
+ std::cerr << std::fixed;
+ std::cerr << "longitude, latitude, altitude: " << longitude << ' ' << latitude << ' ' << altitude << '\n';
double phi = to_radians(latitude);
double theta = to_radians(longitude);
@@ -43,6 +53,9 @@ namespace stoqs
float y = rho * cos_phi * sin_theta;
float z = rho * sin_phi;
+ std::cerr << "x, y, z: " << x << ' ' << y << ' ' << z << '\n';
+ exit(0);
+
// gltf assumes y is up
return Vertex(x, z, y, id);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment