Calculate movement along circle arc

125 Views Asked by At

I want to simulate the turn of an aircraft, and therefore need to calculate its position on a circle arc within a cartesian coordinate system. I need to calculate its position every 5s.

What I currently have:

  1. turn radius, which equals roughly 5nm
  2. angle which is covered for the 5s interval (7.5°), by assuming 1.5° turn per second
  3. starting position

Following several explanations I found via googling, and since I am a programmer and not a mathematician, my naive approach is to just calculate the new position using the original position and the angle, as described here: https://gamedev.stackexchange.com/questions/9607/moving-an-object-in-a-circular-path/9610

So the new position would be:

xNew = xOld + cos(angle) * radius
yNew = yOld + sin(angle) * radius

Which is e.g.:

xNew = 2242.44 + cos(0.1309) * 5
yNew = 785.102 + sin(0.1309) * 5

which equals:

xNew = 2.247,43
yNew = 785,113

Now while it does move the position, it moves in a straight line, and not on the circle arc. E.g. for several succeeding positions I get the following result:

Turn by  7.5  old course:  359  new course  351.5  new pos  QPointF(2237.39,784.437)
Turn by  7.5  old course:  351.5  new course  344  new pos  QPointF(2242.44,785.102)
Turn by  7.5  old course:  344  new course  336.5  new pos  QPointF(2247.49,785.766)
Turn by  7.5  old course:  336.5  new course  329  new pos  QPointF(2252.54,786.431)
Turn by  7.5  old course:  329  new course  321.5  new pos  QPointF(2257.59,787.096)

Which looks like this (circle radius is not 5nm, added just for displaying purpose):

enter image description here

What I want is that the position moves along the circle arc towards point G. How can I achieve this? What is wrong in my calculations, or what am I missing?