feoh [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=35003 Drawing a simple spiral <p>Hi all!</p> <p>Based on my embryonic understanding of polar coordinates, you can draw a spiral by incrementing R and THETA in lock step.</p> <p>So I put together this little blob of code:</p> <div> <div style="max-width:800px; overflow:auto; margin-bottom:12px"> <table style="width:100%" cellspacing=0 cellpadding=0> <tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> <td background=/gfx/code_bg0.png> <div style="font-family : courier; color: #000000; display:absolute; padding-left:10px; padding-top:4px; padding-bottom:4px; "> <pre>-- draw a spiral -- in polar coordinates, you -- do this by incrementing r -- and theta at the same time. for r = 1,99 do theta = r / 100 x = r * cos(theta) y = r * sin(theta) pset(x,y) end</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p>And that <em>almost</em> yields a spiral! At least it yields a curve. Yay curves!</p> <img style="" border=0 src="https://www.lexaloffle.com/bbs/files/35003/spiralish_000.png" alt="" /> <p>Is it possible that I'm drawing my spiral, I just need to somehow scale it down so that the dots are contiguous and maybe the angle of turn is sharper?</p> <p>Any clues are appreciated. I'm just trying to gain an understanding of the basics and build from there.</p> <p>Thanks!</p> https://www.lexaloffle.com/bbs/?tid=34152 https://www.lexaloffle.com/bbs/?tid=34152 Tue, 07 May 2019 14:01:04 UTC