ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am concerned with solving the following Bezier question mathematically. So it isn't a programming question, but only a programmer can help me I guess!
Ques 1.
4 control points P1 (70,0), P2 (50,0), P3 (120,60), P4 (120,30) are specified for a Bezier curve. Obtain the co-ordinates of the mid point of the curve (t=0.5).
It is desired to draw another bezier curve which joins the above curve smoothly. Suggest co-ordinates of 4 control points for this purpose.
I use the following bezier equation for solving a cubic bezier curve
(a) am I using the correct equation for solving the problem?
(b) How do I find the co-ordinates of the next control points?
Ques 2.
4 points P1(a,b); P2(20,50); P3(40,40); P4(72,c) are available for drawing a cubic bezier curve. Compute the values of a,b and c such that the curve starts from the point (21,43) and terminates with a slope of -8/7.
(a) I am sure that a,b are 21,43 but how do I determine C with the help of the slope?
I have misplaced my notes on bezier curves. Any help/URL would be of great help in preparing for my CG exam.
My knowledge of Bezier curves is limited so I'm going on general maths here. Hence you should only take this as a guess, not as a perfect solution.
1a) From my understanding, two of a Bezier curve's control points are the origin and the end-point. Your equation evaluated at t=0 gives P1 and evaluated at t=1 gives P4, looks good so far. The other two control points give the derivative at the start and end points. Differentiating and substituting gives d/dt(x,y)=(3P2 - 3P1) for t=0, and d/dt(x,y)=(3P4 - 3P3) for t=1. Because dy/dx=(dy/dt)/(dx/dt) it is clear that P2 and P3 give the correct derivative. Thus I would conclude that this equation represents a Bezier curve.
1b) For a curve to join onto this one smoothly it must meet this curve, and have the same derivative at the meeting point. The clear choice for this P1=(120, 30) and P2=(120,0) you could of course take P2=(120,k) with k<30. If k were greater than 30 then the derivative is infinity instead of -infinity. The other two control points are completely arbitrary, I chose P3=(190,0) and P4=(170,0) but anything will do.
2a) Yep, your choices for a and b are correct. To find the value of c either state or derive(differentiate your eqn and let t=1) that d/dt(x,y)|1=(3P4 - 3P3). Substitute P3 and P4 and use dy/dx=(dy/dt)/(dx/dt) to find that (c-40)/32=-8/7 hence c=24/7.
I'm afraid I don't have any notes on Bezier curves because I've never done them, Google is bound to have something though.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.