在给定起始坐标,范围,方位角和高程的情况下获取ECEF XYZ [英] Get ECEF XYZ given starting coordinates, range, azimuth, and elevation

查看:107
本文介绍了在给定起始坐标,范围,方位角和高程的情况下获取ECEF XYZ的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在将RAE转换为XYZ时找不到任何东西。

I'm having a problem locating anything on converting RAE to XYZ.

如果我在WGS84椭球上,则位置为-742507,-5462738、3196706并且我检测到30km,310方位角和18度仰角范围内的物体,如何将其转换为ECEF XYZ坐标?

If I am on a WGS84 spheroid, at say position -742507, -5462738, 3196706 and I detect an object at a range of 30km, azimuth of 310, and elevation angle of 18 degrees how can I convert that to ECEF XYZ coordinates?

谢谢。

推荐答案

似乎没有直接的过程可以做到这一点。我发现的最佳方法是将RAE坐标转换为SEZ坐标,然后将SEZ坐标转换为ECR坐标。这是一些我修改为C ++的C#代码以实现此目的:

It appears that there is no straight forward process to do this. The best method I found is to convert from RAE coordinates to SEZ coordinates, then from SEZ coordinates to ECR coordinates. Here is some C# code I modified to C++ to achieve this:

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];
}

这篇关于在给定起始坐标,范围,方位角和高程的情况下获取ECEF XYZ的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆