緯度・経度・高さを三次元直交座標系に変換

'IGlobeViewUtilで変換される3次元直交座標系はnormalized geocentric coordinatesといい,回転楕円体と接する地点を1(半径=1)として計算する

Type Coordinates
    Name As String      'Coordinates Name
    X As Double         'Geocentric Coordinates X (m)
    Y As Double         'Geocentric Coordinates Y (m)
    Z As Double         'Geocentric Coordinates Z (m)
    Lon As Double       'Longitude (Decimal Degree)
    Lat As Double       'Latitude (Decimal Degree)
    Height As Double    'Elevation Height (m)
End Type


Public Function GetCoordinates(Coords As Coordinates, Optional ToGeographic As Boolean = True)
    Dim pGlobeViewUtil As IGlobeViewUtil
    Set pGlobeViewUtil = New GlobeCamera
    
    Dim CloneCoords As Coordinates
    LSet CloneCoords = Coords
    
    Debug.Print CloneCoords.Name, "Before               ", CloneCoords.Lon, CloneCoords.Lat, CloneCoords.Height, CloneCoords.X, CloneCoords.Y, CloneCoords.Z

    If ToGeocentric = False Then
        'GeographicToGeocentric
        pGlobeViewUtil.GeographicToGeocentric CloneCoords.Lon, CloneCoords.Lat, CloneCoords.Height, CloneCoords.X, CloneCoords.Y, CloneCoords.Z
        Debug.Print CloneCoords.Name, "GeographicToGeocentric", CloneCoords.Lon, CloneCoords.Lat, CloneCoords.Height, CloneCoords.X, CloneCoords.Y, CloneCoords.Z
    Else
        'GeocentricToGeographic
        pGlobeViewUtil.GeocentricToGeographic CloneCoords.X, CloneCoords.Y, CloneCoords.Z, CloneCoords.Lon, CloneCoords.Lat, CloneCoords.Height
        Debug.Print CloneCoords.Name, "GeocentricToGeographic", CloneCoords.Lon, CloneCoords.Lat, CloneCoords.Height, CloneCoords.X, CloneCoords.Y, CloneCoords.Z
    End If

End Function

Public Function GetCoordinates2(ByRef X As Double, ByRef Y As Double, ByRef Z As Double, Optional ToGeographic As Boolean = True)
    Dim pGlobeViewUtil As IGlobeViewUtil
    Set pGlobeViewUtil = New GlobeCamera
    
    If ToGeographic = False Then
        'GeographicToGeocentric
        pGlobeViewUtil.GeographicToGeocentric X, Y, Z, X, Y, Z
    Else
        'GeocentricToGeographic
        pGlobeViewUtil.GeocentricToGeographic X, Y, Z, X, Y, Z
    End If

End Function