Plotting a circle

Monkey Forums/Monkey Programming/Plotting a circle

Kaltern(Posted 2014) [#1]
Hi, sorry, really easy problem I imagine - trying to plot points on a circle. Found some C++ code, and thought I'd converted it ok, but I simply can't get it to work.

Local x:Int
Local y:Int
Local length:Int = 50
Local angle:float = 0.0
Local angle_stepsize:float = 0.1

SetColor 255, 255, 255
While (angle < 2 * PI)
    
    x = length * Cos(angle)
    y = length * Sin(angle)

    DrawPoint(x + 100, y + 100)
    angle = angle + angle_stepsize
	
Wend


Any help? :)


Trez(Posted 2014) [#2]
try this:

x = length * Cosr(angle)
y = length * Sinr(angle)



Kaltern(Posted 2014) [#3]
Ugh damnit radians not degrees... I didn't even consider there was a different command. Math is not my top subject in the world :P

You sir have earned a virtual beer - enjoy :P