gpt4 book ai didi

math - 在给定起始坐标、范围、方位角和仰角的情况下获取 ECEF XYZ

转载 作者:行者123 更新时间:2023-12-01 06:45:39 25 4
gpt4 key购买 nike

我在查找有关将 RAE 转换为 XYZ 的任何内容时遇到问题。

如果我在 WGS84 椭球体上,比如位置 -742507、-5462738、3196706,我检测到一个距离为 30 公里、方位角为 310 度、仰角为 18 度的物体,我如何将其转换为 ECEF XYZ坐标?

谢谢。

最佳答案

似乎没有直接的过程可以做到这一点。我发现的最佳方法是从 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];
}

关于math - 在给定起始坐标、范围、方位角和仰角的情况下获取 ECEF XYZ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3612749/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com