Basically I wish to draw a curve between 3 points in openGL as the below image indicates. I’ve found a couple of segments of code which would be useful for drawing a bezier curve using 4 points but for 3 points I’ve had really no success.

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
From the definition of a Bezier curve you have the following formula (for each x, y component):
In your case you know the mid point
(p2x,p2y). You can also assume thatc1xandc2xhave the same value; and thatc1yandc2yalso have the same valueSo we have the following equations at t=0.5
which are solved for
c1x=c2xandc1y=c2ywithto give the final Bezier equation to use in terms of points
(p1x,p1y),(p2x,p2y)and(p3x,p3y):Summary
Try the four control points
( p1x, p1y )( -(p1x-8*p2x+p3x)/6, -(p1y-8*p2y+p3y)/6 )( -(p1x-8*p2x+p3x)/6, -(p1y-8*p2y+p3y)/6 )( p3x, p3y )Here is an example I made with
p1=(0,0),p2=(2,2)andp3=(4,-1). I calculated the following control points( 0, 0 )( 2, 17/6 )( 2, 17/6 )( 4, -1)with the results shown below: