Bezier curve, X position of reference points outside [Xstart, Xend]

143 Views Asked by At

Not quite sure whether this belongs here or on stackoverflow, but considering it's about the formula itself and not the implementation I'm placing it here.

I'm required to implement bezier curves in 2 ways: using de Casteljau's algorithm and the explicit formula (http://en.wikipedia.org/wiki/B%C3%A9zier_curve#Explicit_definition).

As of right now $x$ (as $t$) runs from $p_0.x$ up to and with $p_n.x$ where $p_0$ is the first point and $pn$ is the last point. I also have $p_1, p_2, .., ..p_{n-1}$, which are the control points.

So I'm wondering whether it is actually possible for the curve to go outside $[p_0.x, p_n.x]$ when one or more control point(s) are placed (far) outside that interval. Another example is when you place $p_n$ at the bottom-left of $p_0$ while the control points are all to the right of both end points.

Is that just a limitation of the explicit formula or am I using $x$ wrong?

I hope this isn't too vague. If it is I shall try to explain better with the use of images. Thank you.

1

There are 1 best solutions below

0
On BEST ANSWER

I've found the answer to my own question and seems I missed an important step. I thought you were supposed to have $x = t * (p_n.x - p_0.x) + p_0.x$ which led to the expected problems. Instead I should have performed the formula given in my original post on both the $x$ and $y$ variables instead of just $x$.