blindwig Posted May 10, 2006 Share Posted May 10, 2006 (edited) I've been working on graphics routines for my 360-degree Snake program, and I've been experimenting with bezier curves. It's kind of a pain to have to generate all those control points, so I wrote a routine to do it automatically. I thought someone else might like it, so I'll share it.This routine would be useful to anyone who is doing line-graphics and wants them smoother, or for example if you are drawing a graph and want it to look more round and not so sharp.The _PointDrawBezier() function is designed to draw open shapes, but with some modifications I can write another function better suited for closed shapes.Anyway, have a look. The example is really easy to understand - it will ask you for a curve strength (just take the default of 0.5 for now) and then click on the screen to set the points. Once you have at least 4 point (3 points set, the mouse counts as a 4th), it can calculate the curve.If you're curious to know where the control points are, then uncomment the 4 lines that have "$GUI_GR_DOT" in them.Enjoy!EDITAdded a new version that also does closed figures.Last version had 17 downloads.MWR_beziers_20060511.zip Edited May 12, 2006 by blindwig Zedna 1 My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions Link to comment Share on other sites More sharing options...
CyberSlug Posted May 10, 2006 Share Posted May 10, 2006 That is really cool Thanks for sharing! Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
RazerM Posted May 10, 2006 Share Posted May 10, 2006 well done blindwig! Very nice... My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
blindwig Posted May 12, 2006 Author Share Posted May 12, 2006 OK I wrote a function that does closed figures. The function is _PointDrawBezierClosed() If the display is confusing, go to GraphRedraw() and comment out the routines you don't want to see. My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now