Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have equation

bezier cubic curve

As much I know, I have four points lets say A(x1,y1), B(x2,y2), C(x3,y3), D(x4, y4). How these 'P' are related to these set of points. And what might a Cubic Bézier curves be for the this (A, B, C, D) given set of points.

[UPDATE]

Having problem uploading image, but image somewhat looks like this

http://stackoverflow.com/questions/5142556/algorithm-to-add-color-in-bezier-curves

Regards,

share|improve this question
    
The $P_0$, $P_1$, $P_2$, $P_3$ are the points A, B, C, D. If you let $t=0$ you get $B(0)=P_0$; if you let $t=1$ you get $B(1)=P_3$ so the curve starts at the initial point and finishes at the last. –  Henry Mar 11 '11 at 8:02
    
@Henry i am looking to get equation in two variables $x$ and $y$ (cubic equation). and where does this variable $t$ come in play. –  Santosh Linkha Mar 11 '11 at 8:07
1  
You really do not want to do that. You can try solving $x = (1-t)^3 x_1 + 3(1-t)^2 t x_2 + 3(1-t) t^2 x_3 + t^3 x_4$ for $t$ in terms of $x$ as a cubic equation and then substitute that value of $t$ into $y = (1-t)^3 y_1 + 3(1-t)^2 t y_2 + 3(1-t) t^2 y_3 + t^3 y_4$ but you will get into such a mess that it will not have helped. The relationship between $x$ and $y$ is not in general cubic, just the relations between each of them and $t$. –  Henry Mar 11 '11 at 8:18
    
@Henry thanks, i think in understand. Certainly, those two equations were helpful. –  Santosh Linkha Mar 11 '11 at 8:21

1 Answer 1

up vote 1 down vote accepted

That depends on what relationship you want your points $A$ to $D$ to have to the spline. It may be that you want them to have exactly the relationship to the splines that the points $P_0$ to $P_3$ have, which is explained here. Strangely, the equation in your question looks as if you copied it from there, but in that case you'd have to explain what part of the explanation there of what $P_0$ to $P_3$ mean you don't understand, and what you want your points $A$ to $D$ to mean instead.

share|improve this answer
    
shouldn't the equation be like $y=Px^3+Qx^2+ ...$ so that i could plot graph. But what i have i set of points $P0-P3$ . How P's come in equation. Is it complex equation? –  Santosh Linkha Mar 11 '11 at 8:10
    
@experimentX: Your equation gives $y$ in terms of $x$. The equation in the question give $x$ and $y$ in terms of a parameter $t$. That is, $B(t)$ is a vector $(x(t),y(t))$ that traces a Bézier curve as you vary $t$ from $0$ to $1$. In particular, $B(0)=P_0$ and $B(1)=P_3$. This can't easily be put into the form $y(x)$ that you're interested in, because that would require solving the cubic $x(t)$ for $t$ and substituting into $y(t)$; the result would be pretty ugly and unhelpful. And no, it's not a complex equation, just an equation involving two-dimensional vectors. –  joriki Mar 11 '11 at 8:27
    
thanks it was helpful ... just someone had posted and script for printing this function, i was just wondering how could i improve it. see the result in the updated section. –  Santosh Linkha Mar 11 '11 at 8:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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