I have an arc described by three points: arc center, starting point, ending point.
In order to calculate intermediate points of the arc, I would normally use the parametrized equation.
x(t) = x(center) + radius * cos(a0 + a*t)
y(t) = y(center) + radius * sin(a0 + a*t)
being a = a1 - a0; a1 = ending angle; a0 = starting angle.
t goes from 0 (starting point) to 1 (ending point).
The problem is that my points are not described in a cartesian system (x,y), but using WSG84 (latitude and longitude).
How can I calculate intermediate points like this?
My first attempt was going from LLA to ECEF like explained here (using 0 as altitude).
Then I parametrized the arc in 3D space like explained here.
I had to calculate the three vectors and parametrized equation becomes (the same of the link but in C++ and just for an arc instead of the whole circumference:
tPoint.x = ecefCenter.x + radius * (v1.x * cos(angleStart + (angleEnd - angleStart)*t) + v2.x * sin(angleStart+ (angleEnd - angleStart)*t));
tPoint.y = ecefCenter.y + radius * (v1.y * cos(angleStart+ (angleEnd - angleStart)*t) + v2.y * sin(angleStart+ (angleEnd - angleStart)*t));
tPoint.z = ecefCenter.z + radius * (v1.z * cos(angleStart+ (angleEnd - angleStart)*t) + v2.z * sin(angleStart+ (angleEnd - angleStart)*t));
I calculate arc points with it and then come back ECEF to LL.
Results are not bad but there is some approximation in any of the steps, it is not exact.
The three original points:
9:03:34.012863: Daniel testing, turn center latitude:
9:03:34.012926: 42.4292
9:03:34.012984: Daniel testing, turn center longitude:
9:03:34.013016: -6.91824
9:03:34.013062: Daniel testing, start latitude of turn:
9:03:34.013092: 42.4422
9:03:34.013127: Daniel testing, start longitude of turn:
9:03:34.013150: -6.89639
9:03:34.013192: Daniel testing, end latitude of turn:
9:03:34.013218: 42.45
9:03:34.013247: Daniel testing, end longitude of turn:
9:03:34.013267: -6.91908
Starting and ending point, as obtained from parametrization:
9:03:34.014212: 42.4422
9:03:34.014236: -6.89639
9:03:34.016545: 42.4499
9:03:34.016570: -6.91662
Here you can see the problem graphically.