I have it set up so I place my mouse in the center of where I want the spiral to be, then I press enter to start the program, then define the radius initially and how much it grows each time it goes around.
I use \$\sin(\theta)\$ = opposite / hypotenuse and \$\cos(\theta)\$ = adjacent / hypotenuse to find how much my coordinates change based on the degree and the radius of my circle that itself is gradually increasing to create a spiral. There is also some printing at the end that I had just to help with debugging. As simple as I think something is going to be there are always problems.
int is because NumPy data can't be operated on.
from numpy import sin, cos, pi import pyautogui as cc import time # (x-h)^2 + (y-k)^2 = r^2 # knowling radius and degree, r*sin(deg*pi/180) = rise || cos = run input('Enter to Begin\n-->') radius = int(input('What do you want your beginning radius to be?\n-->')) rate = int(input('How much do you want it to increase by each cycle?\n-->')) h, k = cc.position() degree = 0 x = h+radius*(int(cos(degree*pi/180)*10**5)/10**5) y = k+radius*(int(sin(degree*pi/180)*10**5)/10**5) cc.moveTo(x, y) cc.mouseDown() while True: degree += 1 radius += rate / 360 x = h+radius*(int(cos(degree*pi/180)*10**5)/10**5) y = k+radius*(int(sin(degree*pi/180)*10**5)/10**5) cc.moveTo(x, y) print('Cords: '+str(x)+'||'+str(y)) print('radius: '+str(radius)) print('degree: '+str(degree)) print()
All feedback is appreciated, but I'm really wondering how I could make this faster in Python.