Guest Px(N) Posted October 4, 2005 Posted October 4, 2005 I've plotted simple spirals in AutoIt before however I don't know how to go about plotting an Archimedes Spiral. Example code or pointers are welcome. I've done a bit of googleing and have yet to find any useful sites in terms of plotting one of these.In the end I want to be able to create a picture like this in microsoft paint, much like I've done with the other less complex graphs.
jefhal Posted October 4, 2005 Posted October 4, 2005 (edited) Archimedes SpiralTry this. I don't know how to make the red lines, but the mouse shows the general shape. Please check my math (35+ years ago):#include <math.au3> HotKeySet("{ESC}", "Terminate") $power = 1.5 dim $radians for $theta = 1 to 3600 $radians = _Radian($theta) $x = 500 + $radians^$power*(Cos($radians)) $y = 400 + $radians^$power*(Sin($radians)) MouseMove($x, $y, 2) Next Func Terminate() Exit 0 EndFunc Edited October 4, 2005 by jefhal ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Guest Px(N) Posted October 4, 2005 Posted October 4, 2005 (edited) Try this. I don't know how to make the red lines, but the mouse shows the general shape. Please check my math (35+ years ago):It looked okay except this is the graph it produced...Edit: Updated the code to your new version and now the graph is just crazy.. the spiral isn't even going the correct direction. Maybe I modified it incorrectly?#include <math.au3> HotKeySet("{ESC}", "Terminate") Sleep(2000) $power = .012; use any value you want (within reason?) for $theta = 1 to 3600 Local $x, $y $xy = MouseGetPos() $x = $xy[0] $y = $xy[1] $radians = _Radian($theta) $x1 = $x + $radians^$power*(Cos($radians)) $y1 = $y + $radians^$power*(Sin($radians)) MouseClick("left", $x1, $y1) ;MouseMove($x, $y, 2) Next Func Terminate() Exit 0 EndFunc Edited October 4, 2005 by Px(N)
jefhal Posted October 4, 2005 Posted October 4, 2005 (edited) This is fun! If I run the script and call up Paint Shop Pro while the image hose is turned on I can get things like Archimedes Spiders:Latest code:#include <math.au3> HotKeySet("{ESC}", "Terminate") winactivate("Jasc Paint Shop Pro") $power = 1.5 dim $radians for $theta = 10 to 3600 step 10 $radians = _Radian($theta) $x = 500 + $radians^$power*(Cos($radians)) $y = 400 + $radians^$power*(Sin($radians)) ; MouseMove($x, $y, 2) MouseClick("left", $x, $y) Next Func Terminate() Exit 0 EndFunc Edited October 4, 2005 by jefhal ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
jefhal Posted October 4, 2005 Posted October 4, 2005 (edited) This is the latest version. Open mspaint and then run the script below:#include <math.au3> HotKeySet("{ESC}", "Terminate") winactivate("Jasc Paint Shop Pro") $power = 1 $n = .01 dim $radians for $theta = 10 to 3600 step 10 $radians = _Radian($theta) $x = 500 + $radians^$power*(Cos($radians))*$radians^-$n $y = 400 + $radians^$power*(Sin($radians))*$radians^-$n ; MouseMove($x, $y, 2) MouseClick("left", $x, $y) Next Func Terminate() Exit 0 EndFunc Edited October 4, 2005 by jefhal ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
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