The OrbitTools Libraries Track Library
C++ Source Code Example #2 |
|
// // This program illustrates how to use the OrbitTools Track Library to // create a set of LAT/LON points that represent a satellite ground // track. // // Copyright © 2014 Michael F. Henry // 2014-07-04 // #include "stdafx.h" // These header file provide access to the main functionality // of the OrbitTools software libraries. #include "coreLib.h" #include "orbitLib.h" #include "trackLib.h" using namespace Zeptomoby::OrbitTools::Track::Tracks; int main(int argc, char* argv[]) { // Create the TLE object and a satellite object string line0 = "GPS BIIF-2 (PRN 01)"; string line1 = "1 37753U 11036A 12043.26600496 .00000050 00000-0 00000+0 0 1793"; string line2 = "2 37753 55.0122 178.4391 0003903 34.9135 325.0832 2.00565114 4219"; cTle tle(line0, line1, line2); cSatellite sat(tle, cWgs84::Instance()); // The times t1 and t2 are the start/stop times of the ground track cJulian t1(2012, 02, 14, 1, 30); // UTC: 2012-02-14 01:30 cJulian t2 = t1; t2.AddSec(sat.Orbit().Period()); // There are several overloads of the GroundTrack() method, to allow: // - Specifying times with cJulian objects; // - Specifying times with minutes-past-epoch values; // - Obtaining LAT/LON points that are equally-spaced in distance; // - Obtaining LAT/LON points that are equally-spaced in time. // In this example a list of ground track points are created for the // time window t1..t2 with a distance spacing of 100 kilometers. vector<cGeoTime> points = GroundTrack(sat, t1, t2, 100.0); printf("Total number of ground track points: %d\n", points.size()); for (const cGeoTime& pt : points) { double lat = pt.LatitudeDeg(); // negative values = south double lon = pt.LongitudeDeg(); // negative values = west printf("%.3f, %.3f\n", lat, lon); } return 0; // Program output: // // Total number of ground track points: 309 // -29.767, 215.922 // -30.633, 216.230 // -31.489, 216.553 // -32.341, 216.892 // -33.188, 217.250 // ( output truncated... ) // -26.768, 34.984 // -27.639, 35.239 // -28.507, 35.507 // -29.372, 35.790 // -29.776, 35.928 // } |
|
|