Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-06-2005, 01:17 PM   #1
Senior Member
Registered: Aug 2003
Location: New Delhi, India
Distribution: Fedora 7
Posts: 1,305

Rep: Reputation: 45
Trouble with Bezier Curves


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

BEZ (t) = P1(1-t)^3 + 3*P2 * t(1-t)^2 + 3 * P3 * t^2(1-t) + P4 * t^3

(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.

Old 07-08-2005, 03:08 PM   #2
Senior Member
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
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.
Old 07-09-2005, 04:21 AM   #3
Senior Member
Registered: Aug 2003
Location: New Delhi, India
Distribution: Fedora 7
Posts: 1,305

Original Poster
Rep: Reputation: 45
thanks a lot kev82. Your detailed reply was a big help, and don't worry about it being a mathematical suggestion - that's what I was looking for.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't draw curves in Photoshop 7 Cinematography Linux - Software 2 08-24-2005 10:27 AM
regionally undoing curves/levels changes in gimp layer? (i.e. using black brush) webazoid Linux - Software 1 04-16-2005 01:14 PM
how to draw curves usink glade pranith Programming 0 10-25-2004 01:51 PM
trouble ahead, trouble behind....trouble with mplayer Goonie Linux - Software 3 07-02-2003 03:29 AM
Kernel Trouble (Not actually trouble though) chem1 Linux - General 4 10-01-2002 02:10 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:38 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration