codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:



Home » Visual Basic » Article

Maths Behind The Bezier Curve in Visual Basic

Article by: Thaha Hussain (10/12/2002)
Bookmark us now! Add to Favourites
Email a friend!Tell a friend
Sponsored by: FindMyHosting - Web Hosting Search
Summary: Explains how we can draw a Bezier Curve! The maths behind a Cubic Bezier.Very simple. No API's used. Key words : paint brush, draw, curve, graphics, picture, technique, smooth curve
Viewed: 25585 times Rating (57 votes): 
 4.1 out of 5
 Rate this Article  Read Comments  Post Comments

Maths Behind The Bezier Curve in Visual Basic



Explains how we can draw a Bezier Curve! The maths behind a Cubic Bezier.Very simple. No API's used.





Select All Code







CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
Rate this article:     Poor Excellent
View highlighted Comments
User Comments on 'Maths Behind The Bezier Curve in Visual Basic'
Posted by :  Archive Import (mohammad) at 04:40 on Tuesday, November 05, 2002
hi.
the Xpoint function is not valid!!!!
if you could explain me how can i use or create it.
thanks.
Posted by :  Archive Import (Smidge204) at 18:02 on Thursday, December 26, 2002
According to the code snippet, XPoint() is an Integer array of 3 elements. Looks like somebody didn't copy all the code or didn't put it into their project properly :)

Works just fine for me. Great stuff!
=Smidge=
Posted by :  Archive Import (Peter Goodier) at 00:10 on Friday, December 27, 2002
How do you construct a BEZIER curve (spline), from more than 4 points
eg. 50 "X , Y" co-ordinance points.

Kind Regards
Peter Goodier
Posted by :  Archive Import (Thaha Hussain (Author)) at 03:56 on Tuesday, February 18, 2003
Pls copy and paste the code to your general declaration section. It will work.

Bezier curve is made always with 4 control points.

Pls see another wonderful snippet.

http://www.planetsourcecode.com/vb/scripts/ShowCodeAsText.asp?txtCodeId=1871&lngWId=1

Best,
Thaha Hussain
Posted by :  Archive Import (Paul) at 10:42 on Thursday, February 27, 2003
Thaha - excellent piece of code. Very impressive.
Posted by :  Archive Import (Shu Yih) at 22:27 on Wednesday, March 19, 2003
how could i trace the action of user clicking on the curve?your code trace the action click on the control point only. Thanks
Posted by :  Archive Import (Raja Kumar) at 00:34 on Tuesday, April 15, 2003
I saw your curve program for my ref. but i need somthing like a ecg reading.
I have time and thickness values from that i want to write a continues drawing line a ecg scan reading graph.
can you help me.

with advance thanks
Raja Kumar D.S
Posted by :  Archive Import (Andrés Vilegas R) at 14:17 on Wednesday, April 23, 2003
The code is excellent!!. Except don´t function for values that don't fit in the range of a Interger. I Changed the line: Dim XPoint(3) As Integer, YPoint(3) As Integer to this: Dim XPoint(3) As Long, YPoint(3) As Long, and the code runs very well.

Posted by :  Archive Import (Thaha Hussain) at 10:55 on Wednesday, June 04, 2003
Dear Readers,

Thanx.

If you have queries, please contact me thro' my mail id.

Regs,
Thaha Hussain
thaha_ko(a)yahoo.com
Posted by :  Archive Import (mohamed) at 13:57 on Sunday, June 08, 2003
i think it's better to deal with bezire curve by more better graphics representation
to enhance ur program
thnx and good luck
Posted by :  Archive Import (sudha) at 03:32 on Monday, June 30, 2003
the taask is just ok! this movement is every one knows.
You will find try to move the line without selecting end or starting point user can move mid point of the line.
You will find the solution means that is powerful
ok!
Posted by :  Archive Import (enix) at 20:04 on Tuesday, July 01, 2003
yes, this was exacly the kind of theory and implementation i was looking for! thank you Thaha, codetoad and google :)
Posted by :  Archive Import (Robert Canty) at 11:01 on Monday, July 07, 2003
Very very good indeed!
Posted by :  Archive Import (Thaha Hussain(Author)) at 10:56 on Wednesday, July 16, 2003
As Enix said, my aim was to teach the simple maths behind Bezier Curve. Enhancements.. upto you!

Regards,
Thaha Hussain
Posted by :  Archive Import (sanosi ) at 05:04 on Thursday, July 31, 2003
Iwant you to Call Me in my Email
Posted by :  Archive Import (Senthil) at 08:56 on Monday, August 04, 2003
I saw ur code for bezier curve. I got this concept from other website. But now I try to create a tapered bezier curve.It is done by using drawwidth change for each points. but it is not smoothly. If u know any option for smooth plz send it to me.
Posted by :  Archive Import (Abdul) at 12:41 on Wednesday, September 03, 2003
Is this code or anything similar to it avaiable in C++?
Posted by :  Archive Import (victor ) at 19:56 on Friday, September 05, 2003
Sorry for my bad english. I want to make a question, is it posible to create a graph like wich are done with Excel, inside a form in visual Basic?. How can I do that?
Thanks for your help
Posted by :  JAD at 08:51 on Thursday, March 23, 2006
hello all , my best friend is in deep trouble , coz we couldnt figure out how to code this one , the submission is tomorrow ...
here's the link to the pdf

http://www.geocities.com/jad_4ev3r/Semester_2_Coursework.pdf

it's a Bezier curve , if anyone can do it tonight , we'll be very very thankful ..
Posted by :  JAD at 09:17 on Thursday, March 23, 2006
oh forget to say that it has to be done in C++ , here's the download for the program that has to be done in it
http://www.salfordsoftware.co.uk/software/downloads/compilers.html

thanks again
Posted by :  zagros at 03:50 on Tuesday, November 07, 2006
hi
please help me for drawing bezier curve with four points which all located on bezier curve.(Drawing a Bezier curve through four data point)

regards
zag
Posted by :  mjane at 13:08 on Tuesday, February 12, 2008
I'm trying to make a bezier curve display on a chart in Access...any suggestions on how to change the code to pass the points from a table?


To post comments you need to become a member. If you are already a member, please log in .

 



RELATED ARTICLES
Generate License Keys (such as CD keys on Microsoft software)
by Brian Gillham
This class allows you to generate license keys, such as the CD keys on the case of most Microsoft software
Visual Basic Read and Modify the Registry
by Kenneth Ives
Perform the four basic functions to the Windows registry. Add, change, delete, and query. Allows you to to read registry values, and modify both keys and values.
Communicating with the Database (Using ADO)
by Chaudhary Pradeep K. Roy
Using ADO to get connected with the database.
Generate an Array of Unique Random Numbers
by Brian Gillham
This function will generate an ARRAY of TRULY random numbers.
Beginning Resource Files in Visual Basic
by Kenneth Ives
Have you ever wanted to use graphics, such as icons, bitmaps, cursors, and AVI files? How about sound or even message box text? This can be an enormous amount of overhead. These are all examples of more files to keep track of when you distribute an application, DLL, or OCX. Lets find out how resource files can help....
Visual Basic Compact/Repair Access Database Utility
by Kenneth Ives
This utility will compact and repair the access database you select. It is actually more convenient to use this utility than do the same task with Access, because you don't have to save the database with a different name and then delete the old database when you are done: here, a temporary copy of the database is automatically created and deleted.
Creating a watermark in Excel with VBA
by Kenneth Ives
Adding a watermark to an Excel spreadsheet using VBA.
Generate your own Random Numbers
by Thaha Hussain
This simple program generates random numbers using the basic mathematical methods.
Change Cursor to Hour Glass
by Brian Gillham
A simple script to change the cursor to an hour glass.
Analog Clock
by Thaha Hussain
This program demonstrates Thaha Hussain's Clock Work Formula to paint an Analogue Clock.








Recent Forum Threads
• mkdirs
• Re: Web Development Project
• ** Site Hacked ** javascript inserted...
• Losing background/text color when converting HTML to PDF
• hidden div block when displayed, displays at an offset of 200px only in IE 6..
• help - sketch
• Re: Perl Script - File Handling.
• Open a file from website
• Re: to open 5 terminals from one and also execute different commands on each terminal


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2008