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:

enter image description here

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:

enter image description here

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?


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.

  • $\begingroup$ @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. $\endgroup$ – Ailurus Mar 4 '12 at 19:02
  • $\begingroup$ @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. $\endgroup$ – Ailurus Mar 4 '12 at 19:08
  • $\begingroup$ @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. $\endgroup$ – WimC Mar 4 '12 at 19:11
  • $\begingroup$ @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? $\endgroup$ – Ailurus Mar 4 '12 at 19:35
  • 2
    $\begingroup$ 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$. $\endgroup$ – Robert Israel Mar 4 '12 at 20:26

The answer to the question posted is that given a high enough order of rational bezier you can approximate $\sin(x)$ to within a given error, but I think the question that the author meant to ask was more along the lines of "how can a parametric quadratic bezier exactly describe a conic section but I can't get one to give me an exact $\sin$ approximation?"

The keyword here is "parametric". You can easily generate a parametric rational quadratic curve which exactly passes through all the points on a quarter of a circle: $$ arc(t) = \left \{(1-t^2)/(1+t^2),\, 2\,t\,/(1+t^2)\right \},\, t \in \left [0, 1 \right ] $$ The problem is that the variable t does not have to transcribe the arc at a constant angular rate for it to still make an exact arc, so the following is unfortunately true: $$ arc(t) \neq \left \{ \cos(t\: \pi/2),\, \sin(t\: \pi/2) \right \},\, t \in \left [0, 1 \right ] $$ As an example $arc(1/2) = \left \{ 0.6,\, 0.8 \right \}$ and indeed $\sqrt{1-0.6^2}=0.8$ so the point is on the unit circle, but clearly $\left \{ 0.6,\, 0.8 \right \} \neq \left \{ 1/\sqrt{2},\, 1/\sqrt{2} \right \}$


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.

  • $\begingroup$ The function $y=\sqrt{x}$ can be fitted exactly with a quadratic bezier curve, so this is not a valid argument. $\endgroup$ – 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!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.