x
• Status: Solved
• Priority: Medium
• Security: Public
• Views: 434

Bezier Curves with variable No. of points?

To use Canvas.PolyBezier the number of points must be three times an integer plus 1. Isn't there any way to draw a bezier curve going through a variable number of points or guided by them?
0
karouri
• 6
• 5
1 Solution

Commented:
Each set of 4 (3) points is used to define a section of the Bezier curve.  The first 4 points define the first curve (1 & 4 are endpoints, 2 & 3 are control points).  The next three points define the next section of the curve, where the original point 4 is the starting point, the new point 3 is the new end point, and the new 1 & 2 are the new control points.  The 'variable number of points' is exactly the 'three times an integer' you mentioned above - the points numbered 1,4,7,10... which you pass to PolyBezier are points on the curve, whereas 2,3 define the curve between 1&4, 5&6 define the curve between 4&7, etc...
0

Author Commented:
If the points I need to draw a bezier curve through are points 1,4,7,10,... then I must have two points between each point I already have.What are these points?
0

Commented:
They are control points for the Bezier curve.  A Bezier curve is defined by endpoints and control points.  For a description of exactly what a control point is, there's a nice discussion with some Shockwave descriptions at

http://www.moshplant.com/direct-or/bezier/index.html

0

Commented:
Still there?
0

Author Commented:
Sorry,sburck.
I am still there, and my idea is exactly to draw a smooth curve that passes though a given number of points or is guided by them,like in a airline map.
The number may be anything 3,4,5,6,...
Now you see my problem, I hope there is an answer.
By the way,the site about Bezier is good,thanks.
0

Commented:
I'm still saying that that is exactly what you do with the function PolyBezier.  The endpoints (1,4),(4,7),(7,10)...(k*3+1,k*3+3) are the points you pass through, the other points direct the direction of the curve on the way through those points.
0

Author Commented:
Say I have 8 points, now I use (1,4),(4,7) as end points,and points 2,3,5,6 as intermediary points. What about point 8. Shall I leave it out of the line?
0

Commented:
No, you're confused.  If you want to run your curve though a set of eight different points, you require a total of 22 points.  Each foursome is a set of endpoints, with two control points.  The startpoints and endpoints overlap.  So, in your exampl, your eight points are: 1,4,7,10,13,16,19 & 22.  The remain points: 2,3,5,6,8,9,11,12,14,15,17,18,20,21 are the control points where:

2 & 3 are the control points for the segment between 1 & 4.
5 & 6 are the control points for the segment between 4 & 7.
....
n & n +1 are the control points for the segment between n-1 & n+2

Your curve passes through all 8 of your points, and the control points determine the path the curve will take between the pairs of points (look at the site again, at the live control point placer, to see how to place the control points to get the curve shape you want).
0

Author Commented:
I am beginning to get the point, I think. Though I'm a little confused about the control points. Experimenting a little with Bezier curves may give me a clue as for where to put the control points,so you will get the points. If you have any other advice,I will be thankful.
0

Commented:
Just look again at the website I pointed out - the control points are the two points off of the curve which 'pull' the curve toward them.  For example (try to do a text drawing here.

C1

----
/     \__       __Y
X -/          \___/

C2

The points C1 and C2 determine the way the curve goes up from X, down from C1 to C2, and up to Y.  If the control points were reversed, the curve would leave X going down and sharply to the right from X toward C2, draw to the left and up from C2 to C1, and then down and sharply to the right to Y, something like this:

c2
X \        /--\
\      /     ----- Y   (sort of, doing this in text is difficult).
--\  |
_|
c1

Try it a few times at the website, you'll get a feel for it.
0

Author Commented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Featured Post

• 6
• 5
Tackle projects and never again get stuck behind a technical roadblock.