Files
qt6-migration-pipeline/external/GeographicLib/share/doc/GeographicLib-dev/example-Cartesian3.cpp
T
torstenandCopilot 342ffd3e5c Update submodule to latest BUILD_RTI fixes
- HandlerMinelayerData: BUILD_RTI Guards für RTI-Abhängigkeiten
- svcTabCommon: Export-Header-Fix via Fallback-Target
- TrainingAreaBase: Stub-Header für BUILD_RTI=OFF
- ddsfts: Include-Pfad und Dependency-Fixes
- BUILD_RTI=OFF Compilation vollständig unterstützt

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Entire-Checkpoint: 01M0JNZA586SACX1PRZ2DJAE5S
2026-08-21 19:30:20 +02:00

37 lines
998 B
C++

// Example of using the Triaxial::Cartesian3 class.
#include <iostream>
#include <iomanip>
#include <exception>
#include <random>
#include <GeographicLib/Triaxial/Cartesian3.hpp>
using namespace std;
using namespace GeographicLib;
int main() {
try {
using Triaxial::Cartesian3;
Cartesian3 cart(3, 2, 1);
unsigned long long
s1 = std::random_device()(),
s2 = std::random_device()();
std::seed_seq seq{s1, s2};
std::mt19937 g(seq);
cout << "10 random points on the ellipsoid with semiaxes [3, 2, 1]\n"
<< "X Y Z beta omega\n" << fixed << setprecision(3);
Cartesian3::vec3 r;
Angle bet, omg;
for (int i = 0; i < 10; ++i) {
cart.cart2rand(g, r);
cart.cart2toany(r, Cartesian3::ELLIPSOIDAL, bet, omg);
cout << r[0] << " " << r[1] << " " << r[2] << " "
<< double(bet) << " " << double(omg) << "\n";
}
}
catch (const exception& e) {
cerr << "Caught exception: " << e.what() << "\n";
return 1;
}
}