Search Blogs Blogs

How To Transform Between Earth Centered Fixed and Earth Centered Inertial reference frames using Vector Geometry Tool API

By: pnalyvayko
Using the VGT API you can easily transform between different reference frames. The following screenshot taken using STK 9.2.1 shows the Earth Centered Inertial (red) and Earth Centered Fixed (green) coordinate frames. Let me demonstrate how, using the VGT API, you can transform the position of a point given in ECF frame to a position in the ECI reference frame. Add the following references to your project (unless you've done so already): Check the References folder to ensure your project references contain the following assemblies: Modify your code by adding the following statements: using AGI.STKX; using AGI.STKObjects; using AGI.STKVgt; using AGI.STKUtil; Do not forget to initialize the STK Engine: AgSTKXApplication app = new AgSTKXApplication(); To access the VGT API functionality, you will need to create a new instance of the STK Object Model root object: AgStkObjectRoot root = new AgStkObjectRoot(); // Set the unit preferences root.UnitPreferences.SetCurrentUnit("DateFormat", "UTCG"); root.UnitPreferences.SetCurrentUnit("DistanceUnit", "m"); Using the instance of the Object Model root object let's get the root object of the VGT API: AgCrdnRoot crdnRoot = (AgCrdnRoot)root.VgtRoot; Create a Cartesian point using the STK Object Model Conversion utility: // Create and initialize a cartesian vector IAgCartesian3Vector point = root.ConversionUtility.NewCartesian3Vector(); // Set the point coordinates to the location of the AGI Headquarters: Latitude = 40.04 deg, Longitude = -75.595 deg point.Set(1.21647e+006, -4.73612e+006, 4.08139e+006); At last, transform the position of the point from ECF to ECI reference frame: IAgCrdnSystem ECI = crdnRoot.WellKnownSystems.Earth.Inertial; IAgCrdnSystem ECF = crdnRoot.WellKnownSystems.Earth.Fixed; IAgCrdnSystemTransformResult result = ECF.TransformFrom("8 Oct 2010 12:00:00", ECI, point); Print the point's position in both ECI and ECF reference frames: string format = "ECF {{{0},{1},{2}}} => ECI {{{3},{4},{5}}}"; Trace.WriteLine(string.Format(format, point.X, point.Y, point.Z, result.Vector.X, result.Vector.Y, result.Vector.Z)); Using the VGT API the same steps can be used to transform between any standard or user-defined reference frames available in STK. See Technical Notes for Central Bodies, Vector Geometry API: Part I, Vector Geometry API: Part II and STK Vector Geometry Library Reference for more information.
Posted: 10/8/2010 7:18:30 PM