I've found many answers to similar questions here, but I'm still stuck.
I want to move an object from point sx,sy to point dx,dy through an arc that bulges by distance b from the line straight between those two points.
The equations for a circle are:
cx,cy = center of circle
x = r * cos(t) + cx
y = r * sin(t) + cy
d = distance between the two points
r = (4*b*b + d*d) / (8*b)
I think the center of the circle is:
cx = sx - r * cos(startingT)
cy = sy - r * sin(startingT)
The total angle that must be traveled between the two points is:
travelAng = atan2(dy-sy,dx-sx)
However, I don't know what the starting angle (startingT) is which I'd use in the equations for the circle.
EDIT:
I've tried a few points and the following seems to work:
r =(4*b^2 + d^2) / (8*b)
cx = r * cos((2*atan(b) + 90)*PI/180) + sx
cy = r * sin((2*atan(b) + 90)*PI/180) + sy
startingT = acos((sx - cx)/r)
To get the opposite bulge along the same lines:
cx = r * cos((2*atan(b) + 180)*PI/180) + sx
cy = r * sin((2*atan(b) + 180)*PI/180) + sy
startingT = acos((sx - cx)/r) + PI
Theses results can then be plugged into the equations for the circle.
x = r * cos(t) + cx
y = r * sin(t) + cy
To plot 11 points along the arc I'd plot with t=startingT and then add travelAng/10 for each new point.
I'm not sure if these equations can be simplified somehow, but so far they seem to work.
EDIT: Ok, this just simply doesn't work. I got it to work for a circle around 0,0 with r=1, but changing parameters always breaks things. If I set the bulge b=0.001 to try and create a nearly straight line, the results end up ridiculously wrong. I have no idea what else to try.
EDIT: Ok, I'm just going to forget about this approach. I see lots of questions about this sort of thing but no answers that actually work given these inputs. However, I now realize that I could just apply apply an acceleration perpendicular to the path of travel and then reverse the acceleration half way through. The result would be a curve. I'll just experiment until I find an acceleration which looks decent. (I feel stupid for not thinking of this earlier.)
On the page I've been lookinga t on the subject http://www.afralisp.net/archive/lisp/Bulges1.htm they actually have that c (for chord) is the distance between the 2 points and $s = (c/2)*b$ (s for sagitta) with $r = ((c/2)^2+s^2)/2s$
On the webpage I've listed above it explains very well why the travel angle is 4arctan(b) where b is the bulge
Right: I think i've finally cracked it, using the almost complete explanation on the page linked to above. Here's how it goes:
We know starting point S and finishing point D and bulge (b).
We can find the angle turned through $(\theta)$ using $\theta = 4arctan(b)$
By Pythagoras, the chord (the line directly joining S and D) is given by
$c = \sqrt{(Sx-Dx)^2+(Sy-Dy)^2}$
The sagitta is computed using $s = \frac{bc}{2}$
The radius $r = \frac{((\frac{c}{2})^2 + s^2)}{2s}$
With angles in degrees, we find the centre of the circle using $Cx = rcos(\frac{\theta}{2} + 90) + Sx$ and $Cy = rsin(\frac{\theta}{2} + 90) + Sy$ OR
If the arc is clockwise, rather than anticlockwise (I think I've got clockwise and anitclockwise the right way round here) $Cx = rcos(\frac{3\theta}{2} - 90) + Sx$ and $Cy = rsin(\frac{3\theta}{2} - 90) + Sy$ OR
(see webpage quoted for an explanation of why). Points 1 requires a but of reading to understand. Point 2 is simple. 3's quites straight forward. I don't know why 4 works at the moment, but I've taken the author of the webpage's word for it. I haven't got my head around why 5 works either. I'm not even 100% sure I've implemented it correctly. I'd check on the webpage to make sure you agree with my reasoning. The author actually gives 2 methods (I've used the first) but neither is explained comprehensively.