AGI STK Util 11 Send comments on this topic.
ConvertPositionArray Method (IAgConversionUtility)
See Also  Example
PositionType
PositionArray
ConvertTo





Description

Converts the specified position values from a given position type to another position type.

Syntax

[Visual Basic .NET]
Public Function ConvertPositionArray( _
   ByVal PositionType As AgEPositionType, _
   ByRef PositionArray As System.Array, _
   ByVal ConvertTo As AgEPositionType _
) As System.Array

[C#]
public System.Array ConvertPositionArray(
AgEPositionType PositionType,
ref System.Array PositionArray,
AgEPositionType ConvertTo
);

[Managed C++]
public: System::Array ConvertPositionArray(
AgEPositionType PositionType,
System::Array ^^ PositionArray,
AgEPositionType ConvertTo
);

[Java]
public Object[] convertPositionArray(
AgEPositionType PositionType,
Object[] PositionArray,
AgEPositionType ConvertTo
);

[Unmanaged C++]
public: HRESULT ConvertPositionArray(
AgEPositionType PositionType,
SAFEARRAY ** PositionArray,
AgEPositionType ConvertTo,
SAFEARRAY ** Array
);

Parameters

PositionType
Member Value Description
eCartesian 0 Cartesian: position specified in terms of the X, Y and Z components of the object's position vector, where the Z-axis points to the North pole, and the X-axis crosses 0 degrees latitude/0 degrees longitude.
eCylindrical 1 Cylindrical: position specified in terms of radius (polar), longitude (measured in degrees from -360.0 degrees to +360.0 degrees), and the Z component of the object's position vector.
eGeocentric 2 Geocentric: position specified in terms of latitude (spherical latitude of the sub-point on the surface of the Earth), longitude and altitude.
eGeodetic 3 Geodetic: position specified in terms of latitude (angle between the normal to the reference ellipsoid and the equatorial plane), longitude and altitude.
eSpherical 4 Spherical: position specified in terms of latitude (spherical latitude of the sub-point on the surface of the Earth), longitude and radius (distance of the object from the center of the Earth).
ePlanetocentric 5 Planetocentric: position specified in terms of latitude (spherical latitude of the sub-point on the surface of the Earth), longitude and altitude.
ePlanetodetic 6 Planetodetic: position specified in terms of latitude (angle between the normal to the reference ellipsoid and the equatorial plane), longitude and altitude.
PositionArray
ConvertTo
Member Value Description
eCartesian 0 Cartesian: position specified in terms of the X, Y and Z components of the object's position vector, where the Z-axis points to the North pole, and the X-axis crosses 0 degrees latitude/0 degrees longitude.
eCylindrical 1 Cylindrical: position specified in terms of radius (polar), longitude (measured in degrees from -360.0 degrees to +360.0 degrees), and the Z component of the object's position vector.
eGeocentric 2 Geocentric: position specified in terms of latitude (spherical latitude of the sub-point on the surface of the Earth), longitude and altitude.
eGeodetic 3 Geodetic: position specified in terms of latitude (angle between the normal to the reference ellipsoid and the equatorial plane), longitude and altitude.
eSpherical 4 Spherical: position specified in terms of latitude (spherical latitude of the sub-point on the surface of the Earth), longitude and radius (distance of the object from the center of the Earth).
ePlanetocentric 5 Planetocentric: position specified in terms of latitude (spherical latitude of the sub-point on the surface of the Earth), longitude and altitude.
ePlanetodetic 6 Planetodetic: position specified in terms of latitude (angle between the normal to the reference ellipsoid and the equatorial plane), longitude and altitude.

Example

Convert a position to another representation
[C#] Copy Code
IAgConversionUtility converter = root.ConversionUtility; 
 
// ConvertPositionArray expects a two dimensional array of positions 
Array cartesianPositions = new object[,] 
    { 
        { 1216.47, -4736.124081.39 }, 
        { 1000, -20002000 } 
    }; 
 
// Convert cartesian dates to cylindrical 
// ConvertPositionArray returns a two dimensional array of cartesian dates 
Array cylindricalPositions = converter.ConvertPositionArray(AgEPositionType.eCartesian, ref cartesianPositions, AgEPositionType.eCylindrical); 
 
// Print results 
for (int i = 0; i < cylindricalPositions.GetLength(0); i++) 

    Console.WriteLine("X: {0}, Y: {1}, Z: {2}"
        cylindricalPositions.GetValue(i, 0), 
        cylindricalPositions.GetValue(i, 1), 
        cylindricalPositions.GetValue(i, 2)); 

 

Convert a position to another representation
[Visual Basic .NET] Copy Code
Dim converter As IAgConversionUtility = root.ConversionUtility

' ConvertPositionArray expects a two dimensional array of positions
#If Not CSToJava Then
#Else
#End If
Dim cartesianPositions As Array = New Object(,) {{1216.47, -4736.12, 4081.39}, {1000, -2000, 2000}}

' Convert cartesian dates to cylindrical
' ConvertPositionArray returns a two dimensional array of cartesian dates
#If Not CSToJava Then
Dim cylindricalPositions As Array = converter.ConvertPositionArray(AgEPositionType.eCartesian, cartesianPositions, AgEPositionType.eCylindrical)
#Else
#End If

' Print results
Dim i As Integer = 0
While i < cylindricalPositions.GetLength(0)
    Console.WriteLine("X: {0}, Y: {1}, Z: {2}", cylindricalPositions.GetValue(i, 0), cylindricalPositions.GetValue(i, 1), cylindricalPositions.GetValue(i, 2))
    System.Math.Max(System.Threading.Interlocked.Increment(i),i - 1)
End While

See Also

© 2016 Analytical Graphics, Inc. All Rights Reserved.

STK Programming Interface 11.0.1