@Test
public void test() {
// 雷达信息
double radarLon = 120.283664;
double radarLat = 29.892702;
double northAngle = 26.5;
// 目标信息
float x = -13.7f * 0.1f;
float y = 234.7f * 0.1f;
float v = -1.3f;
calculateTarget(radarLon, radarLat, northAngle, x, y, v);
}
public RadarTarget calculateTarget(double radarLon, double radarLat, double northAngle,
double x, double y, double v) {
// 1. 计算距离
double distance = Math.sqrt(x * x + y * y);
// 2. 计算方位角(弧度)
double theta = Math.atan2(y, x);
double bearing = Math.toRadians(26.5) + theta;
// 3. 计算运动方向(相对于正北顺时针的角度)
double direction = Math.toDegrees(bearing);
if (direction < 0) {
direction += 360;
}
// 4. 计算目标经纬度
double northAngleRad = Math.toRadians(northAngle);
double deltaX = x * Math.cos(northAngleRad) - y * Math.sin(northAngleRad);
double deltaY = x * Math.sin(northAngleRad) + y * Math.cos(northAngleRad);
System.out.println(deltaY);
// 转换为经纬度 - 1度纬度对应的米数
double deltaLon = deltaX / (111320 * Math.cos(Math.toRadians(radarLat)));
double deltaLat = deltaY / 111320;
double targetLon = radarLon + deltaLon;
double targetLat = radarLat + deltaLat;
return new RadarTarget(distance, targetLon, targetLat, direction, v);
}