STK UtilSend comments on this topic.
ConvertPositionArray Method (IAgConversionUtility)
See Also
PositionType
PositionArray
ConvertTo
Windows





Windows & Linux

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, _
    ByVal PositionArray As System.Array, _
    ByVal ConvertTo As AgEPositionType _
) As System.Array
[C#]
public System.Array ConvertPositionArray(
    AgEPositionType PositionType,
    System.Array PositionArray,
    AgEPositionType ConvertTo
);
[Managed C++]
public: System::Array ConvertPositionArray(
    AgEPositionType PositionType,
    System::Array ^ PositionArray,
    AgEPositionType ConvertTo
);
[Unmanaged C++]
public: HRESULT ConvertPositionArray(
    AgEPositionType PositionType,
    SAFEARRAY * * PositionArray,
    AgEPositionType ConvertTo,
    SAFEARRAY * * ppOutVal
);
[Java]
public AgSafeArray convertPositionArray(
    AgEPositionType PositionType,
    AgSafeArray PositionArray,
    AgEPositionType ConvertTo
);
[Python - STK API ]
def ConvertPositionArray(self, PositionType:"AgEPositionType", PositionArray:list, ConvertTo:"AgEPositionType") -> list:

Parameters

PositionType
PositionArray
ConvertTo

See Also

Example

Convert a position to another representation
[C#]
IAgConversionUtility converter = root.ConversionUtility;

// ConvertPositionArray expects a two dimensional array of positions
Array cartesianPositions = 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
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]
Dim converter As IAgConversionUtility = root.ConversionUtility

' ConvertPositionArray expects a two dimensional array of positions
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
Dim cylindricalPositions As Array = converter.ConvertPositionArray(AgEPositionType.eCartesian, cartesianPositions, AgEPositionType.eCylindrical)

' 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
© 2024 Analytical Graphics, Inc. All Rights Reserved.