I have a circular series of 250 Cartesian coordinates that are all equidistant from one another (essentially 250 equally spaced points making up a 360 degree circle), and I’d like to create a program (python, preferably) that assigns a label to each point for easier readout. For instance, (0, 500) could be point number 1, while (0, -500) would be point number 125. I’m having trouble coming up with a coherent means of doing this, though. I briefly considered translating to polar coordinates, but that didn’t seem right. I then considered plotting each of the points and manually inputting the translated point for each, but that seems unnecessarily clunky. Any tips on how I can achieve this? Am I going to have to break out my old trigonometry book? Haha
Asked
Active
Viewed 99 times
-1
-
Welcome to Stack Overflow! Could you show us some code? – Hemerson Tacon Mar 09 '19 at 14:19
-
"Equal spacing" and "circle" really does imply a solution based on polar coordinates. Why did you dismiss that approach? – Steve Boyd Mar 09 '19 at 14:20
1 Answers
0
This will print i and the (x, y) coordinate of the points in Python.
import math
n = 250
r = 500
angle = math.pi * 2 / n
for i in range(n):
x = r * math.cos(angle * i)
y = r * math.sin(angle * i)
print(i, x, y)

Peter Collingridge
- 10,849
- 3
- 44
- 61