Just experimenting with some code for creating circles with "triangle math".
As always, I start with big and ugly code just to understand the pieces before making the code pretty.
As always, I start with big and ugly code just to understand the pieces before making the code pretty.
Code: (Select All)
' C is the right angle
' c is opposite side
' c squared = a squared + b squared
size = 100
aspect_ratio = 1
screen _newimage(size, size, 12)
root_x = size / 2 : root_y = size / 2
c = size / 2 - 25
for a = C to 0 step - 0.01
b = ( c ^ 2 - a ^ 2 ) ^ (0.5)
pset (root_x + a, root_y - (b/aspect_ratio)), 14
next a
for a = 0 to c step 0.01
b = ( c ^ 2 - a ^ 2 ) ^ (0.5)
pset (root_x - a, root_y - (b/aspect_ratio)), 13
next a
for a = -c to 0 step 0.01
b = ( c ^ 2 - a ^ 2 ) ^ (0.5)
pset (root_x + a, root_y + (b/aspect_ratio)), 12
next a
for a = 0 to c step 0.01
b = ( c ^ 2 - a ^ 2 ) ^ (0.5)
pset (root_x + a, root_y + (b/aspect_ratio)), 11
next a