I have a circle centred at 0 with radius 80. How using python do I calculate the coordinates for 8 equidistant points around the circumference of the circle?
相关问题
- Flush single app django 1.9
- d3.js moving average with previous and next data v
- How to get a fixed number of evenly spaced points
- Check if a number is a perfect power of another nu
- How to stop a dbus gobject loop
相关文章
- Is there a size limit for HTTP response headers on
- ceil conterpart for Math.floorDiv in Java?
- why 48 bit seed in util Random class?
- Does there exist empty class in python?
- ImportError: No module named twisted.persisted.sty
- Get a header with Python and convert in JSON (requ
- python unit testing methods inside of classes
- Need help generating discrete random numbers from
click this pic for more clarity
in the above picture.
coordinates 1,2,3,4,5,6,7,8 are equidistant points on a circumference of circle Radius R and its centre is at X (0,0)
take the triangle XLZ , its aright angled at L ,
Let LZ = H , LY = A
since XLZ is right angled , XZ square = XL square + LZ square
since these 8 points makes an octagon theta = 360 deg / 8 = 45 deg
tan 45 deg = h / XL = h / R-A => 1 = h/ R-A => h = R-A —————2
Z coordinates are (R-A, h) = > (h,h)
from the equations 1 and 2
R square = h square + h square => 2 h square = R square => h = R/ sqrt 2
so the coordinates at point 2 (Z) = (R/sqrt2, R/sqrt2)
remaining can be derived easily as they are just oppside
So all coordinates are
1 (0,R) 2 (R/sqrt2,R/sqrt2) 3 (R,0) 4 (-R/sqrt2, R/sqrt2) 5 (-R,0) 6 (-R/sqrt2,-R/sqrt2) 7 (0,-R) 8 (R/sqrt2, -R/sqrt2)
you can simplify this some if you know you are always going to have only 8 points with something like:
with x being the x/y of the point 45 degrees and 80 units away from the origin