View Question
 Question
 Subject: 2D Bezier Curves Category: Reference, Education and News > Homework Help Asked by: garbonzo-ga List Price: \$5.00 Posted: 14 Oct 2006 09:07 PDT Expires: 13 Nov 2006 08:07 PST Question ID: 773418
 ```Hello, I am getting stuck on the following exercise. A curve p1 is Bezier form has coefficients: -- -- -- -- -- -- | -2 | | -1 | | x0 | | 1 | , | 0 | , | y0 | -- -- -- -- -- -- and another curve p2 has coefficients -- -- -- -- -- -- | -2 | | -1 | | x0 | | 1 | , | 0 | , | y0 | -- -- -- -- -- -- For what values x0, y0 do the two curves meet with equal first derivative? For what values x2, y2 do the two curves meet with equal second derivative? If you could, please explain your thought processes while solving this, and also, explain what the problem is asking in different words. Thanks!``` Request for Question Clarification by maniac-ga on 14 Oct 2006 09:39 PDT ```Hello Garbonzo, It appears the coefficients for x0, y0 were repeated and x2, y2 were omitted. Can you clarify the question (otherwise the curves p1, p2 would be equal at all points)? You may also want to explain the use of the coefficients in your question - there are more than one way to represent a bezier curve (another example is the use of 4 control points), we would like to make sure you get the correct answer. --Maniac``` Clarification of Question by garbonzo-ga on 14 Oct 2006 09:56 PDT ```oh poo, i copied and pasted, and failed to edit. here are the coefficients in the 2nd curve -- -- -- -- -- -- | x0 | | 1 | | x2 | | y0 | , | 0 | , | y2 | -- -- -- -- -- -- sorry. This is the question as it is posed on a sample midterm, for preperation for the midterm I have this coming Tuesday. Thanks again.``` Request for Question Clarification by maniac-ga on 14 Oct 2006 13:21 PDT ```Hello Garbonzo, Hmm. An interesting question. Apparently the coefficients you provided are the three data points of a pair of quadratic bezier curves as described at http://en.wikipedia.org/wiki/Bézier_curve I created a simple worksheet to play with the formulas and noted there appears to be an infinite number of solutions to both equations. As a side note, I've found this is a helpful first step in solving these kinds of problems (allowing you to confirm results visually as well as formally). When Y0 is one (1), the first curve is horizontal. The second curve starts horizontal and then moves towards the X2/Y2 coordinates. This satisfies the first condition (equal first derivative). In a similar manner, if Y2 is one (1), both the first and second curves are horizontal. This satisfies the second condition (equal second derivative). Of course, this is not a formal proof - there are certainly other researchers here (e.g., mathtalk) who could work through it in a much more formal manner. It would probably be something like the following: At the wikipedia site, the equation is represented like: B(t) = (1-t)^2*P0+2*t*(1-t)*P1+t^2*P2 where P0, P1, and P2 represent two element vectors with the [X,Y] values. Note that at t=0, this simplifies to B(t) = P0, and at t=1 this simplifies to B(t) = P2. Reorder the terms in powers of t like: B(t) = t^2*(P0-P1+P2) + t*(2*P0+2P1) + (P0) The first derivative of B(t) in terms of t is: B'(t) = 2*t*(P0-P1+P2) + (2*P0+2P1) and second derivative is: B''(t) = 2*(P0 - P1 + P2) You would then compute the formulas for T=1 (curve p1) and T=0 (curve p2) equate, and solve to compare the slopes / accelerations at that point. If you are satisfied with the above as the answer, please let me know and I'll repost as an answer. If you really need a formal solution, another researcher (or commenter) may post one. --Maniac``` Clarification of Question by garbonzo-ga on 16 Oct 2006 12:54 PDT ```Hello maniac, (that sounds weird...) That answer is suitable. Please feel free to repost that as your answer, and I will happily "fork up the dough". Thanks a bunch. garbonzo```
 ```Hello Garbonzo, Thanks for the kind words. Let me recap and expand (and correct!) a little bit on the answer. First - the values you provided are the X / Y coordinates for the control points of a Quadratic Bezier Curve as described at http://en.wikipedia.org/wiki/Bezier_curve [apparently GA doesn't reformat the URL with the é properly] As illustrated at the same page (scroll down), a Quadratic Bezier Curve has slope limiting as follows: at t=0, slope of P0 -> P1 at t=1, slope of P1 -> P2 Hmm. It appears my spreadsheet is in error - let me fix it. [...] OK. With the corrected worksheet, there is still an infinite number of solutions where the first condition appears to be true. The corrected solution is where Y0 = 0 and X0 is in the range (-1, 1). This is a condition where p1 (P0, P1, P2) has P1 -> P2 has slope zero. p2 (P0, P1, P2) has P0 -> P1 has slope zero. Correcting my previous message, making the second derivative equal, the simplest solution is where X0 = 0, Y0 = 0 and X2 = 2, Y2 = 1 In this case, the resulting curves p1 and p2 are symmetric around the origin, and thus the second derivative has to be equal on both sides of Y=0. Note in this case that both (X0, Y0) and (X2, Y2) must be specified for the condition to be true. Reviewing the formal analysis I described before, I found at least one more mistake. The corrected versions are: B(t) = t^2*(P0-2*P1+P2) + t*(-2*P0+2*P1) + (P0) The first derivative of B(t) in terms of t is: B'(t) = 2*t*(P0-2*P1+P2) + (-2*P0+2*P1) and second derivative is: B''(t) = 2*(P0 - 2*P1 + P2) I suggest you confirm this with your own analysis. It looks odd to me that the order of the three points P0, P1, P2 or P2, P1, P0 doesn't change the acceleration - so I may have made an additional mistake [I'll think about it some more & post a clarification if I find it] However, based on the above and doing a little testing with the worksheet, it appears that the condition of: Y0 = 0 and X0 is in the range (-1, 1) is still OK when X2=2, Y2=-1. Taking a look at equating B''(t) for the two splines, the point (X0, Y0) falls out during simplification and the other points are symmetric - so the acceleration is still "constant" and equal for both splines. If any part of the answer is unclear or if you need additional information on some part of the answer, please make a clarification request. I will be glad to help further. Good luck with your upcoming test. --Maniac```
 garbonzo-ga rated this answer: `That helped. Thanks.`