Получить ECEF XYZ с учетом начальных координат, диапазона, азимута и угла места - PullRequest
3 голосов
/ 01 сентября 2010

У меня проблема с поиском чего-либо при преобразовании RAE в XYZ.

Если я нахожусь на сфероиде WGS84, скажем, в положении -742507, -5462738, 3196706, и я обнаруживаю объект в диапазоне 30 км, азимуте 310 и углу места 18 градусов, как я могу преобразовать это в ECEF XYZ координаты

Спасибо.

Ответы [ 3 ]

5 голосов
/ 15 сентября 2010

Похоже, что нет прямого процесса, чтобы сделать это.Лучший метод, который я нашел, - это преобразовать координаты RAE в координаты SEZ, а затем из координат SEZ в координаты ECR.Вот код C #, который я изменил для C ++:

void main() {
    // NOTE: distances are in meters, while angles are in degrees
    double siteECR[] = { -763997.48, -5458565.87, 3196706.0 };
    double objRAE[]  = { 30000.0, 310.0, 18.0 };
    double objECR[]  = { 0.0, 0.0, 0.0 };

    // Should return ~[-764142.7629, -5458517.683, 3217218.18] in objECR
    RAEtoECR(siteECR, objRAE, objECR);
}

/************************************************************************************************************************/
/*  Converts a Range, Azimuth, Elevation location to a Latitude, Longitude, Altitude location         */
/*  siteLLA - array holding the Latitude, Longitude, and Altitude of the site location in degrees and meters      */
/*  rae     - array holding the Range, Azimuth, and Elevation, in degrees, of the object viewed from the site location  */
/*  objECR  - destination array to hold the ECR X, Y, Z location in meters             */
/************************************************************************************************************************/
void RAEtoECR(double siteECR[], double rae[], double objECR[]) {
    double tempSEZ[] = { 0.0, 0.0, 0.0 };
    double siteLLA[] = { 0.0, 0.0, 0.0 };

    ECRtoLLA(siteECR, siteLLA);
    RAEtoSEZ(siteLLA, objRAE, tempSEZ);
    SEZtoECR(siteLLA, tempSEZ, objECR);
}

/************************************************************************************************************************/
/*  Converts a Range, Azimuth, Elevation location to a South, East, Zenith location          */
/*  siteLLA - array holding the Latitude, Longitude, and Altitude of the site location in degrees and meters   */
/*  rae     - array holding the Range, Azimuth, and Elevation, in degrees, of the object viewed from the site location  */
/*  sez     - destination array to hold the South, East, and Zenith coordinates of the object being viewed in meters */
/************************************************************************************************************************/
void RAEtoSEZ(double siteLLA[], double rae[], double sez[]) {
    double range, azimuth, elevation;
    range   = rae[0];
    azimuth   = rae[1];
    elevation = rae[2];

    // Compute needed math
    double slat = sin(Deg2Rad(siteLLA[0]));
    double slon = sin(Deg2Rad(siteLLA[1]));
    double clat = cos(Deg2Rad(siteLLA[0]));
    double clon = cos(Deg2Rad(siteLLA[1]));

    // Convert to radians
    azimuth   = DEG2RAD(azimuth);
    elevation = DEG2RAD(elevation);

    // Convert
    sez[0] = -range * cos(elevation) * cos(azimuth);
    sez[1] =  range * cos(elevation) * sin(azimuth);
    sez[2] =  range * sin(elevation);
}

/************************************************************************************************************************/
/*  Converts a South, East, Zenith location to an ECR X, Y, Z location              */
/*  siteLLA - array holding the Latitude, Longitude, and Altitude of the site location in degrees and meters      */
/*  sez     - array holding the South, East, and Zenith coordinates of the object being viewed in meters       */
/*  ecr     - destination array to hold the ECR X, Y, Z location in meters             */
/************************************************************************************************************************/
void SEZtoECR(double siteLLA[], double sez[], double ecr[]) {
    // Convert siteLLA to XYZ
    double[] siteXYZ = { 0.0, 0.0, 0.0 };
    LLAtoECR(siteLLA, siteXYZ);

    double south, east, zenith;
    south  = sez[0];
    east   = sez[1];
    zenith = sez[2];

    // Compute needed math
    double slat = sin(Deg2Rad(siteLLA[0]));
    double slon = sin(Deg2Rad(siteLLA[1]));
    double clat = cos(Deg2Rad(siteLLA[0]));
    double clon = cos(Deg2Rad(siteLLA[1]));

    // Convert
    ecr[0] = ( slat * clon * south) + (-slon * east) + (clat * clon * zenith) + siteXYZ[0];
    ecr[1] = ( slat * slon * south) + ( clon * east) + (clat * slon * zenith) + siteXYZ[1];
    ecr[2] = (-clat *        south) + ( slat * zenith) + siteXYZ[2];
}
0 голосов
/ 06 июля 2017

Ответ дровосека превосходен. Вот это в javascript на всякий случай:

main();

function main() {
    // NOTE: distances are in meters, while angles are in degrees

    var siteECR = {
        X: -763997.48,
        Y: -5458565.87,
        Z: 3196706.0
    };

    var siteLLA = {
        Latitude: 30.28011211999193,
        Longitude: -97.96753350982041,
        Altitude: -1033.8619585652073
    };

    var objRAE = {
        Range: 30000.0,
        Azimuth: 310.0,
        Elevation: 18.0
    }

    var objECR = { X: 0, Y: 0, Z: 0 }

    // Should return ~[-764142.7629, -5458517.683, 3217218.18] in objECR
    RAEtoECR(siteECR, siteLLA, objRAE, objECR);

    console.log(objECR);
}

/************************************************************************************************************************/
/*  Converts a Range, Azimuth, Elevation location to a Latitude, Longitude, Altitude location         */
/*  siteLLA - array holding the Latitude, Longitude, and Altitude of the site location in degrees and meters      */
/*  rae     - array holding the Range, Azimuth, and Elevation, in degrees, of the object viewed from the site location  */
/*  objECR  - destination array to hold the ECR X, Y, Z location in meters             */
/************************************************************************************************************************/
function RAEtoECR(siteECR, siteLLA, rae, objECR) {
    var tempSEZ = { South: 0, East: 0, Zenith: 0 };

    //ECRtoLLA(siteECR, siteLLA);
    RAEtoSEZ(siteLLA, rae, tempSEZ);
    SEZtoECR(siteECR, siteLLA, tempSEZ, objECR);
}

function toRadians(angle) {
    return angle * (Math.PI / 180);
}

/************************************************************************************************************************/
/*  Converts a Range, Azimuth, Elevation location to a South, East, Zenith location          */
/*  siteLLA - array holding the Latitude, Longitude, and Altitude of the site location in degrees and meters   */
/*  rae     - array holding the Range, Azimuth, and Elevation, in degrees, of the object viewed from the site location  */
/*  sez     - destination array to hold the South, East, and Zenith coordinates of the object being viewed in meters */
/************************************************************************************************************************/
function RAEtoSEZ(siteLLA, rae, sez) {
    var range = rae.Range;
    var azimuth = rae.Azimuth;
    var elevation = rae.Elevation;

    // Compute needed math
    var slat = Math.sin(toRadians(siteLLA.Latitude));
    var slon = Math.sin(toRadians(siteLLA.Longitude));
    var clat = Math.cos(toRadians(siteLLA.Latitude));
    var clon = Math.cos(toRadians(siteLLA.Longitude));

    // Convert to radians
    azimuth   = toRadians(azimuth);
    elevation = toRadians(elevation);

    // Convert
    sez.South = -range * Math.cos(elevation) * Math.cos(azimuth);
    sez.East =  range * Math.cos(elevation) * Math.sin(azimuth);
    sez.Zenith =  range * Math.sin(elevation);
}

/************************************************************************************************************************/
/*  Converts a South, East, Zenith location to an ECR X, Y, Z location              */
/*  siteLLA - array holding the Latitude, Longitude, and Altitude of the site location in degrees and meters      */
/*  sez     - array holding the South, East, and Zenith coordinates of the object being viewed in meters       */
/*  ecr     - destination array to hold the ECR X, Y, Z location in meters             */
/************************************************************************************************************************/
function SEZtoECR(siteXYZ, siteLLA, sez, ecr) {

    var south  = sez.South;
    var east   = sez.East;
    var zenith = sez.Zenith;

    // Compute needed math
    var slat = Math.sin(toRadians(siteLLA.Latitude));
    var slon = Math.sin(toRadians(siteLLA.Longitude));
    var clat = Math.cos(toRadians(siteLLA.Latitude));
    var clon = Math.cos(toRadians(siteLLA.Longitude));

    // Convert
    ecr.X = ( slat * clon * south) + (-slon * east) + (clat * clon * zenith) + siteXYZ.X;
    ecr.Y = ( slat * slon * south) + ( clon * east) + (clat * slon * zenith) + siteXYZ.Y;
    ecr.Z = (-clat *        south) + ( slat * zenith) + siteXYZ.Z;
}
0 голосов
/ 24 ноября 2013

Вы можете использовать функции matlab sph2cart.m

или

http://computitos.files.wordpress.com/2008/03/cartesian_spherical_transformation.pdf

Убедитесь, что ваша 0 градусов в вашем проекте такая же, как математическая 0 градусов.

  • ВМФ использует 0 градусов в качестве севера.
...