I would like to draw an arc from a specific point to a goal point, during the process of drawing a larger path. I would like to do it using bezier curves, which aren't adequate for modeling circular arcs, but these equations found here seem to potentially estimate the arc pretty well (I can't tell if these equations correctly implement the circular arc using cubic Bezier curves (yet), but it seems like a good start). Here is the equations from that link.
start coordinate = {
x: R,
y: 0
}
control point 1 = {
x: R,
y: R * 4/3 * tan( phi / 4)
}
control point 2 = {
x: R * ( cos(phi) + 4/3 * tan( phi/4 ) * sin(phi) ),
y: R * ( sin(phi) - 4/3 * tan( phi/4 ) * cos(phi) ),
}
end coordinate = {
x: R * cos(phi),
y: R * sin(phi)
}
So let's say I start with a drawing of a path composed of some stuff, in this case just a few connected line segments (doesn't matter what they are):
Then what we want to do next, from the current point we left off at, is draw an arc. This is what that arc might look like:
You can see that there is a center where we can draw a radius, and a goal point where the arc ends (so it doesn't complete a whole circle).
My question is, how to determine the angle phi
(in the equation above). That way I can use the equation. I am not sure what my current orientation is, if it is all relative to a global coordinate space or what. This is for traditional graphics. So need to figure that part out. Let's say it is a global coordinate space and not relative to the direction I moved along the path. Then this would be the angle:
I don't know, I'm already confused. So somehow I need to figure out some angle, which I'm not sure what to do. From there I think I could figure out the rest. Any help would be appreciated.
After the radius is found, then these equations above would take my simple circular arc, and turn it into a cubic Bezier equation so hopefully it could be drawn in an environment that only supports that and not arcs.