# Drawing spirals on virtual whiteboards

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.

Converting to 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-->')
rate = int(input('How much do you want it to increase by each cycle?\n-->'))
h, k = cc.position()
degree = 0
cc.moveTo(x, y)
cc.mouseDown()
while True:
degree += 1
cc.moveTo(x, y)
print('Cords: '+str(x)+'||'+str(y))
print('degree: '+str(degree))
print()


All feedback is appreciated, but I'm really wondering how I could make this faster in Python.

The standard way to do this would be to use a tkinter canvas or pygame, but rolling with your method, you only have one huge efficiency problem, you are wasting subpixel precision on your calculations, I added a simple PRECISION constant so that you can decide at will how many degrees you advance per step, you only used 1 degree per step that is really to little, I suggest $10$, it looks good and goes fast.

I also added a constant for 10**5 so that you can avoid computing it every cycle (not a big deal) but mainly so that you could explain with a name what that number does.

I also replaced the while loop with a for loop so that the program does not run indefinitely (I was quite trolled by the program taking my mouse cursor for infinite time, it was not easy to shut it down).

Also please put care in your comments, about spelling formatting etc.. and the standard format is a docstring on top of the file.

Removing the printing can also speed up your program a bit.

"""
This program takes control of the mouse to draw an ellipse.

(x-h)^2 + (y-k)^2 = r^2
rise = r*sin(deg*pi/180)
run  = r*cos(deg*pi/180)
"""

from numpy import sin, cos, pi
import pyautogui as cc
import time

BIG_NUM = 10**5
PRECISION = 10 # higher is less precision
ITERATIONS = 300

input('Enter to Begin\n-->')
rate = int(input('How much do you want it to increase by each cycle?\n-->'))
h, k = cc.position()
degree = 0
cc.moveTo(x, y)
cc.mouseDown()

for i in range(ITERATIONS):
degree += PRECISION
degree %= 360
radius += (PRECISION * rate) / 360