Formula to draw a regular polygon inscribed or circumscribed to a circle

preview_player
Показать описание
r: radius of the circle
(x, y): center of the circle
N: number of sides of the polygon
k: index of the vertex
rp: radius of the polygon

rp = r (for inscribed polygon)
rp = r/cos(pi/N) (for circumscribed polygon)

V(k) = (rp * cos(2 * pi * k / N) + x, rp * sin(2 * pi * k / N) + y), for all k in [0, N)
Рекомендации по теме