我有一些距离部分
int[] parts = [1823, 344, 2345, 1022, 2387, ...]; //in meters
我可以计算数组中每个部分的结束/起始位置坐标。为此,我使用随机承载
int bearingRnd = new Random().nextInt(360);
和这个公式
double dkm = parts[j]/1000.0;
double dist = dkm/6371.0;
double bearing = Math.toRadians(bearingRnd);
double firstLatitude = Math.toRadians(currentLat);
double firstLongitude = Math.toRadians(currentLng);
double secondLatitude = Math.asin(Math.sin(firstLatitude) * Math.cos(dist) + Math.cos(firstLatitude) * Math.sin(dist) * Math.cos(bearing));
double a = Math.atan2(Math.sin(bearing) * Math.sin(dist) * Math.cos(firstLatitude), Math.cos(dist) - Math.sin(firstLatitude) * Math.sin(secondLatitude));
double secondLongitude = firstLongitude + a;
secondLongitude = (secondLongitude + 3 * Math.PI) % (2 * Math.PI) - Math.PI;
double newLat = Math.toDegrees(secondLatitude);
double newLng = Math.toDegrees(secondLongitude);
但是如果我知道整个路径的最后位置的坐标怎么办?如何控制轴承的价值来计算位置,以便我有例如在我当前位置开始和结束的圆圈?