I am trying to create a spherical interpolation with 3 points. I'm currently using Quadratic Bezier Interpolation but have been told I should use Rational Quadratic Bezier Curve in order to get a perfectly circular curve. I have tried implementing this based on the formula I found here (3 control points A,B and C, 3 weights W1, W2, W3 and a time t):
CurvePoint = (A*W1*(1-t)^2 + B*W2*2t(1-t) + C*W3*t^2) / (W1*(1-t)^2 + W2*2t(1-t) + W3*t^2).
How do I determine the correct weight values for this to work as a circle? Is that even possible without moving the middle point? Thank you.
Here is the code I am using (with all weights set to 1.0) and the curve it produces:
def ArcPoints(node): points = node.GetAllPoints() # The three points of the point object a, b, c = points[:3] samples = 6 arcPoints = list() for i in range(samples): t = float(i)/(samples - 1) w1 = 1 w2 = 1 w3 = 1 p2 = (a * w1 * (1-t) ** 2 + b * w2 * 2*t * (1-t) + c * w3 * t ** 2 ) / (w1 * (1-t) ** 2 + w2 * 2*t * (1-t) + w3 * t**2) arcPoints.append(p) return arcPoints