Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
Solved

# Bezier Curves with variable  No. of points?

Posted on 2000-04-27
Medium Priority
409 Views
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
Question by:karouri
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 6
• 5

LVL 3

Expert Comment

ID: 2754824
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

LVL 3

Author Comment

ID: 2763253
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

LVL 3

Accepted Solution

sburck earned 200 total points
ID: 2763315
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

LVL 3

Expert Comment

ID: 2904331
Still there?
0

LVL 3

Author Comment

ID: 2911902
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

LVL 3

Expert Comment

ID: 2926981
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

LVL 3

Author Comment

ID: 2927965
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

LVL 3

Expert Comment

ID: 2928028
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

LVL 3

Author Comment

ID: 2933919
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

LVL 3

Expert Comment

ID: 2938096
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

LVL 3

Author Comment

ID: 2942631
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have toâ€¦