# Help me understand Rational Bézier curve

Example: Given a rational linear Bézier curve between points $(x=0,y=0)$ and $(x=0,y=1)$, with weights of $1$ and $2$ respectively, for a given value of $t$, how do I find $y$?

I can understand Bézier curves okay, the equations go over my head but I can visualise what's going on as a series of linear interpolations. These visualisations https://en.wikipedia.org/wiki/B%C3%A9zier_curve#Constructing_B.C3.A9zier_curves are what made sense to me.

I'm trying to visualise something similar for rational linear Bézier curves.

Am I correct in understanding that the absolute values of the weights don't matter, only their values relative to each other?

Suppose we have two 2D points $$\mathbf{P}_0 = (x_0,y_0)$$ and $$\mathbf{P}_1 = (x_1,y_1)$$, and two weights $$w_0$$ and $$w_1$$. The linear rational Bézier curve defined by these points has equation $$\mathbf{P}(t) = \frac {(1-t)w_0 \mathbf{P}_0 + t w_1 \mathbf{P}_1 } {(1-t)w_0 + t w_1 }$$ Or, in terms of coordinates $$x(t) = \frac {(1-t)w_0 x_0 + t w_1 x_1 } {(1-t)w_0 + t w_1 } \quad;\quad y(t) = \frac {(1-t)w_0 y_0 + t w_1 y_1 } {(1-t)w_0 + t w_1 }$$ In your example, we have the data $$(x_0,y_0) = (0,0)$$, $$(x_1,y_1) = (0,1)$$, $$w_0=1$$, $$w_1=2$$. Substituting these into the equations above, we get $$x(t) = 0 \quad;\quad y(t) = \frac{ 2t }{1+t }$$ One interesting thing to note: when $$t = \tfrac12$$, we get $$y(t)=\tfrac23$$, which is not the mid-point of the line. So, a linear rational Bézier curve is a straight line, but the line is not traversed with constant speed.
The linear interpolation idea can be applied with rational Bézier curves, too. I'll just treat the case of 2D curves, since this gives us an easy way to visualize. The basic idea is to construct an ordinary (polynomial) Bézier curve in 3D, and then project it onto the plane $$z=1$$. So, in detail, we let \begin{align} X(t) &= (1-t)w_0 x_0 + t w_1 x_1 \\ Y(t) &= (1-t)w_0 y_0 + t w_1 y_1 \\ Z(t) &= (1-t)w_0 + t w_1 \end{align} Clearly this is just an ordinary 3D (polynomial) Bézier curve defined by the two points $$(w_0 x_0, w_0 y_0, w_0)$$ and $$(w_1 x_1, w_1 y_1, w_1)$$. Then we project the 3D point $$\bigl( X(t), Y(t), Z(t) \bigr)$$ along a line through the origin onto the plane $$Z=1$$. This picture illustrates this projection
The point $$\mathbf{C}$$ is the origin, and $$\pi$$ is the plane $$Z=1$$. Again, note that the mid-point of the blue 3D line $$E$$ will not be projected onto the mid-point of the red 2D line $$E'$$. This projection has the equation $$f(X,Y,Z) = (X/Z,Y/Z)$$, so the projected curve has equation $$\mathbf{R}(t) = \left( \frac{X}{Z}, \frac{Y}{Z} \right) = \left( \frac {(1-t)w_0 x_0 + t w_1 x_1 } {(1-t)w_0 + t w_1 } , \frac {(1-t)w_0 y_0 + t w_1 y_1 } {(1-t)w_0 + t w_1 } \right)$$ This is the equation of the linear rational Bézier curve that we saw above.
You are right that only the ratios of the weights matters, not their numerical values. In any of the equations above, you can replace $$w_0$$ and $$w_1$$ by $$kw_0$$ and $$kw_1$$, and the $$k$$ will cancel out, leaving you with the same equation.