Sign in to follow this  
Followers 0
Guest Px(N)

Plotting an Archimedean spiral

5 posts in this topic

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 Posted Image in microsoft paint, much like I've done with the other less complex graphs.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Archimedes Spiral

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):

#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 by jefhal

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites

#3 ·  Posted (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...Posted Image

Edit: Updated the code to your new version and now the graph is just crazy.. the spiral isn't even going the correct direction. ;)Posted Image

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 by Px(N)

Share this post


Link to post
Share on other sites

#4 ·  Posted (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:

Posted Image

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 by jefhal

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 by jefhal

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0