How to control a circular interpolation using a reference point?

12 Views Asked by At
r0 = 1 # radius of circle
w0 = ? # angle of interpolation

x0 = 0 # x-coordinate from center of circle
y0 = 0 # y-coordinate from center of circle

x1 = 3 # x-coordinate from reference point
y1 = 5 # y-coordinate from reference point

a0 = x0 + r0 * cos(t) # parametric equation for x
b0 = y0 + r0 * sin(t) # parametric equation for y

p0 = (x0, y0) # center of circle
p1 = (x1, y1) # reference point
q0 = (a0, b0) # circular interpolation

The angle of interpolation w0 varies from 0 to 2pi, effectively tracing out all points around the circumference of the circle with radius r0 and with the help of parametric equations a0 and b0. However, what would be an equation to obtain the angle of interpolation w0 in such a way that the resulting angle is always within the range of 0 to 2pi depending on the quadrant in which the reference point p1 is located?

I tried using arctan2(x,y) but the output range of this function is from -pi to pi not from 0 to 2pi.