Files
qt6-migration-pipeline/external/GeographicLib/share/doc/GeographicLib-dev/example-Intersect.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

34 lines
1.1 KiB
C++

// Example of using the GeographicLib::Intersect class
#include <iostream>
#include <exception>
#include <GeographicLib/Intersect.hpp>
#include <GeographicLib/Constants.hpp>
using namespace std;
using namespace GeographicLib;
int main() {
try {
Geodesic geod(Constants::WGS84_a(), Constants::WGS84_f());
Intersect intersect(geod);
// Define the two geodesics
GeodesicLine lineX(geod, 0, 0, 45, Intersect::LineCaps);
GeodesicLine lineY(geod, 45, 10, 135, Intersect::LineCaps);
// Find displacement to closest intersection
Intersect::Point point = intersect.Closest(lineX, lineY);
// Check position at intersection
double latx, lonx, laty, lony;
lineX.Position(point.first, latx, lonx);
lineY.Position(point.second, laty, lony);
cout << "X intersection displacement + position "
<< point.first << " " << latx << " " << lonx << "\n";
cout << "Y intersection displacement + position "
<< point.second << " " << laty << " " << lony << "\n";
}
catch (const exception& e) {
cerr << "Caught exception: " << e.what() << "\n";
return 1;
}
}