Created
June 2, 2009 20:20
-
-
Save khafatech/122550 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
radius = 105 | |
width = (radius * 2) - 1 | |
points = [] | |
for x in xrange(-radius, radius+1): | |
for y in xrange(-radius, radius+1): | |
if math.sqrt(x**2 + y**2) < radius: | |
points.append((x,y)) | |
print len(points) | |
polar_points = {} | |
for p in points: | |
# FIXME - fix angles and duplicates | |
if p[0] == 0: | |
# slope = 9000 | |
theta = math.radians(90) | |
else: | |
# slope = float(p[1])/p[0] | |
theta = math.atan(float(p[1])/p[0]) | |
if theta in polar_points: | |
polar_points[theta].append(p) | |
else: | |
polar_points[theta] = [p] | |
print len(polar_points) | |
# sorted polar points | |
spp = sorted(polar_points.items()) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment