lokster Posted June 18, 2007 Share Posted June 18, 2007 This example shows how to draw The Sierpinski triangle with autoit:sierpinski.au3:expandcollapse popup#cs According to wikipedia, sierpinski triangle is a fractal named after Waclaw Sierpinski who described it in 1915. Originally constructed as a curve, this is one of the basic examples of self-similar sets, i.e. it is a mathematically generated pattern that can be reproducible at any magnification or reduction. #ce #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Sierpinski triangle example (by lokster)", 400, 400) GUISetOnEvent($GUI_EVENT_CLOSE, "Bye") GUISetState(@SW_SHOW) Global $user32 = DllOpen("user32.dll") Global $gdi32 = DllOpen("gdi32.dll") Global $hdc = GetDC($Form1) For $x = 0 To 400 For $y = 0 To 400 If BitAND($x,$y) Then pix($hdc,$x,$y,0xFFFFFF) Else pix($hdc,$x,$y,0x000000) EndIf Next Next While 1 Sleep(100) WEnd Func Bye() DllCall ($user32,"int","ReleaseDC","int",$hdc,"hwnd",$Form1) DllClose($user32) DllClose($gdi32) Exit EndFunc Func pix($dc,$x,$y,$color) DllCall ($gdi32, "long", "SetPixel", "long", $dc, "long", $x, "long", $y, "long", $color) EndFunc Func GetDC($handle) $dc = DllCall ($user32, "int", "GetDC", "hwnd", $handle) Return $dc[0] EndFunc Link to comment Share on other sites More sharing options...
LuckyMurari Posted June 18, 2007 Share Posted June 18, 2007 Very nice one lokster Link to comment Share on other sites More sharing options...
Sn0opy Posted June 18, 2007 Share Posted June 18, 2007 Remembers me to John Conway's Game of Life ^^ Nice idea! Link to comment Share on other sites More sharing options...
RazerM Posted June 18, 2007 Share Posted June 18, 2007 Nice, i can't believe it's so simple! 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...
lordofthestrings Posted June 19, 2007 Share Posted June 19, 2007 that is (again) some freaky looking code from you Lokster.. Link to comment Share on other sites More sharing options...
lokster Posted June 19, 2007 Author Share Posted June 19, 2007 To be honest, I have found this example in wikipedia, but it was written in Java...I am long time interested in fractals, regardless of my math skills Now I am working on a complete script for generating and drawing L-Systems http://en.wikipedia.org/wiki/L-systemsIt is 50% in FreeBasic (the iterative calculations) and 50% in autoit - the GUIHere are some screenshots (I will post the complete script soon): Link to comment Share on other sites More sharing options...
lordofthestrings Posted June 21, 2007 Share Posted June 21, 2007 I first saw fractals when a MOD file player called CHAOS (before MP3 before Windows 3.0) would display neverending fractals on the beat of the MOD Files.. that's a long time ago... at least 20 years? 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