Solved

Bezier Curves with variable  No. of points?

Posted on 2000-04-27
11
366 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
 
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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now