How to calculate control points in cubic beizer curve
While going through a cubi开发者_如何学Pythonc beizer curve program
I found it uses end points as(10,10,0) and (0,1,0) and other control points as(5,10,2) and (-10,-5,-2).I am not able to understand how did they get this other control points please help me with any formula or method to fins them Edit:- if you want to put a Bézier curve smoothly through N points with N>2, how do you get the intermediate control points.As belisarius said in his comment, the control points are actually input parameters for a Bézier curve. The wikipedia article has some nice animations that visualize the process of drawing the curve and how the control points are used for it.
As a summary, a cubic Bézier curve consists of 4 points. Let's name them Start
, End
, Control1
and Control2
. The curve starts at Start
, following the line from Start
to Control1
. But to reach the end point End
, it has to deviate from that path and approaches the line from Control2
to End
until it reaches the End
point.
So you can "calculate" the control points you'll need for a specific curve f.e. by drawing the desired curve on a piece of paper. The control points have to lie somewhere on the curve tangents at the start and end point to create a Bézier curve similar to your sketch.
Here is a illustration I've done with Paint (which is actually good for playing with this because it has a tool to create cubic Bézier curves). On the left side I've drawn a rough freehand sketch of the curve (black), then added my estimate of the tangents (gray). Finally I chose two points on the lines to be the control points (green). On the right side you see the same, but the curve has been created using Paint's Bézier tool drawing a line from the start to the end point and then clicking the two control points.
Playing around with this should give you a better feeling about how the control points build your curve. For example, if you choose control points farther away from the start/end point of your curve, it will run "tighter" along the gray "control lines".
I found that, I hope that helps ..
http://www.codeproject.com/Articles/31859/Draw-a-Smooth-Curve-through-a-Set-of-2D-Points-wit
精彩评论