git @ Cat's Eye Technologies Dipple / master python / n-gon.py
master

Tree @master (Download .tar.gz)

n-gon.py @masterraw · history · blame

1
2
3
4
5
6
7
8
9
# Generate the co-ordinates of a regular n-gon inscribed in a unit circle

# SPDX-FileCopyrightText: Chris Pressey, the original author of this work, has dedicated it to the public domain.
# For more information, please refer to <https://unlicense.org/>
# SPDX-License-Identifier: Unlicense

from math import pi, cos, sin
n = 8
print [(cos(2 * k * pi / n), sin(2 * k * pi / n)) for k in xrange(n)]