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
  • Learn & ask questions
Solved

Bezier Curves with variable  No. of points?

Posted on 2000-04-27
11
380 Views
Last Modified: 2010-04-04
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
Comment
Question by:karouri
  • 6
  • 5
11 Comments
 
LVL 3

Expert Comment

by:sburck
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

by:karouri
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

by:
sburck earned 50 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 3

Expert Comment

by:sburck
ID: 2904331
Still there?
0
 
LVL 3

Author Comment

by:karouri
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

by:sburck
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

by:karouri
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

by:sburck
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

by:karouri
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

by:sburck
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

by:karouri
ID: 2942631
Comment accepted as answer
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Machine not responding during CopyFile() 3 104
Delphi Dbf export problem to a Visual Foxpro application 6 207
Delphi selector screen 2 84
enhance the following code 3 37
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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question