# Can a rational Bézier curve take exactly the same shape as a part of the sine function?

I'm wondering whether a rational Bézier curve could take exactly the same shape as a part of the sine function. The best way to check this seems like this:

• Find a part of the sine function such that there is no symmetry anymore in this part, e.g. from $\sin(0)$ to $\sin({\pi \over 2})$.
• In that case, the control points for a quadratic Bézier curve follow from the sine function. Because a Bézier curve is tangent to the control polygon at the first and last points, this results in the points $(0,0)$, $(1,1)$ and $({\pi \over 2}, 1)$. The second point $(1,1)$ is the intersection of the two tangent lines.

When plotting the above:

Which is pretty close, but I'm looking for an exact representation (if possible). Therefore, the next step is to look to a rational Bézier curve:

In this case I used the weights [1, 1.4, 1]. It is now a very close approximation for this part of the sine function, but it is not exact.

What would be a systematic way to do this? And if it fails for a quadratic rational Bézier curve, could it work for a cubic, quartic, quintic, ... curve?

I don't think it would be meaningful to look into Uniform Rational B-Splines (or Non-Uniform ones, NURBS) since they are just piecewise rational Bézier curves, right?

-
It might help to link to a definition of a rational Bézier curve. Here's one on Wikipedia. –  Ilmari Karonen Mar 4 '12 at 20:46

In a Bézier curve, $x$ and $y$ are polynomials in the parameter $t$. Note that you can't just have "a part of the sine function": if $y(t) = \sin(x(t))$ for $t$ in some interval, since both sides of that equation are analytic functions on the complex plane the equation would be true for all complex numbers $t$. Since $y(t)$ is a polynomial, for any given value of $y$ (unless $y$ is constant) there are only finitely many $t$ and thus finitely many $x$. But this is not the case for the sine function: $\sin(n \pi) = 0$ for all integers $n$. So the sine curve can't be given exactly by a Bézier curve of any degree.

-
@Robert: Thanks, but I'm talking about a part of the sine curve. Unless I'm overlooking something, your answer seems a little beside the point. –  Ailurus Mar 4 '12 at 19:02
@WimC: But we're talking about rational functions. I'm a little confused, since for example part a circle can be exactly represented by a rational Bézier curve. –  Ailurus Mar 4 '12 at 19:08
@Ailurus, I removed my first comment since the answer was updated. A circle does satisfy a polynomial relation, e.g. $x^2+y^2=1$ and so my argument didn't apply to that. –  WimC Mar 4 '12 at 19:11
@Robert: Could you please elaborate on the "both sides are analytic" part? I know that $sin(x)$ is analytic, and hence infinitely differentiable ($C^\infty$). But why does this mean that a part of the sine curve cannot be represented as a rational Bézier curve? –  Ailurus Mar 4 '12 at 19:35
If $x(t)$ and $y(t)$ are polynomials, $y(t) - \sin(x(t))$ is an analytic function on the whole complex plane. It is a theorem of complex analysis that if $f(z)$ is analytic on (open, connected) domain $D$ in the complex plane and $f(z) = 0$ on a line segment in $D$, then $f(z) = 0$ on all of $D$. –  Robert Israel Mar 4 '12 at 20:26

Since a Bezier curve has only finitely many nonzero derivatives and a sine has infinitely many, they can not coincide on any interval in their domains containing more than one point.

-
The function $y=\sqrt{x}$ can be fitted exactly with a quadratic bezier curve, so this is not a valid argument. –  WimC Mar 4 '12 at 19:03

The word 'exact' is a bit confusing here.

You cannot 'exactly' represent anything in a computer other than finite numbers. For example, Sin is a transcendental function. y=sin(45 degrees) has the answer of suqare-root of 2. You can never 'exactly' represent sqrt(2) in a computer, because it is an infinite series. You can store a symbol representing root 2, but as soon as you want to plot it on a graph, you have to convert it to an integer for the pixel screen, and it won't be 'exact' anymore.

y=sin(x) only has a few places where y and x are both 'exactly' finite rationals, by Niven's Theorem. x=0 degrees, x=30 degrees, x=90 degrees, x=150 degrees, x=180 degrees, and on and on. For a unit circle, sin(x) is then 0, 1/2, 1, 1/2, 0, and on and on.

Bezier curve is as you say, rational. It has infinitely many rational points. However, the only rational points where it will exactly match the sin curve are at those few points of Niven's theorem. Not exactly a nice approximation.

What you may be looking for is a really close approximation. . . .

There are quite a few sites on the web if you type bezier approximate sine.

Off the top of my head, untested, would be to try De Casteljau's algorithm (drawing beziers using points on simple lines)... and use tangent-lines to the sine-curve as a way to figure out some good starting control points.

This page: http://pomax.github.io/bezierinfo/ has huge details, including on 'de Casteljau's algorithm' and even a section at the end on 'Curve Moulding' that seems like it might apply!

-