2017-09-13 13:53:40 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import sys
|
|
|
|
import math
|
|
|
|
|
|
|
|
def main(argv):
|
|
|
|
|
|
|
|
minRadius = 3
|
2017-09-13 16:56:34 +00:00
|
|
|
maxRadius = 20
|
2017-09-13 13:53:40 +00:00
|
|
|
|
2017-09-13 16:56:34 +00:00
|
|
|
print ("circleTable:\t\t;-Y for each X, in bytes")
|
2017-09-13 13:53:40 +00:00
|
|
|
|
|
|
|
for radius in range(0,maxRadius+1):
|
|
|
|
if radius < minRadius:
|
|
|
|
print ("\t.addr 0")
|
|
|
|
else:
|
|
|
|
print ("\t.addr circleTable%d" % radius)
|
|
|
|
|
|
|
|
print()
|
|
|
|
|
|
|
|
for radius in range(minRadius,maxRadius+1):
|
|
|
|
|
|
|
|
print ("circleTable%d:" % radius)
|
|
|
|
print ("\t.word ",end="")
|
2017-09-17 23:17:27 +00:00
|
|
|
byteR = radius*2
|
2017-09-13 13:53:40 +00:00
|
|
|
|
|
|
|
skipMinus1 = 0
|
|
|
|
for p in range(0,radius):
|
2017-09-17 23:17:27 +00:00
|
|
|
x = (radius-p)*2
|
|
|
|
y = (int)(math.sqrt(byteR*byteR - x*x))
|
2017-09-13 13:53:40 +00:00
|
|
|
if p==radius-1: # A fudge to make circles close better
|
2017-09-17 23:17:27 +00:00
|
|
|
y = byteR
|
|
|
|
y*=-1 # Because X=bytes and we need -Y
|
2017-09-13 13:53:40 +00:00
|
|
|
print (y, end=",")
|
|
|
|
|
|
|
|
skipMinus1 = 0
|
|
|
|
for p in range(0,radius):
|
2017-09-17 23:17:27 +00:00
|
|
|
x = (p+1)*2
|
|
|
|
y = (int)(math.sqrt(byteR*byteR - x*x))
|
2017-09-13 13:53:40 +00:00
|
|
|
if p==0: # A fudge to make circles close better
|
2017-09-17 23:17:27 +00:00
|
|
|
y = byteR
|
2017-09-13 13:53:40 +00:00
|
|
|
|
2017-09-17 23:17:27 +00:00
|
|
|
y*=-1 # Because X=bytes and we need -Y
|
2017-09-13 13:53:40 +00:00
|
|
|
if p==radius-1:
|
|
|
|
print(y)
|
|
|
|
else:
|
|
|
|
print (y, end=",")
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main(sys.argv[1:])
|