Example: Regular triangle with a side length of 12 centered at the origin
Step: Compute the circumradius. In an equilateral triangle,
Step: Plot vertex A. A sits on the positive y-axis at distance .
A=(0, 4*sqrt(3))
Step: Plot vertex B and C. They extend symmetrically to the left and right by half the side length: . The distance from the center to the flat bottom side is the apothem, which for an equilateral triangle is exactly half of the circumradius: . Since it is below the x-axis, it is negative.
B = (6, -2\sqrt{3})
C = (-6, -2\sqrt{3})
Step: Draw the polygon
triangle = Polygon(A, B, C)
Example: Regular hexagon with a side length of 12 centered at the origin
Step: In a regular hexagon, the circumradius equals the side length, so the diameter is two times the circumradius, so vertices on the horizontal axis (A and D) sit exactly at D(-12, 0) and A(12, 0)
A = (12, 0)
D = (-12, 0)
Step: Plot remaining vertices B, C, E and F. The remaining vertices are shifted horizontally by half the radius () and vertically by the apothem height
\(B = (6, 6\sqrt{3})\) (Top Right)\(C = (-6, 6\sqrt{3})\) (Top Left)\(E = (-6, -6\sqrt{3})\) (Bottom Left)\(F = (6, -6\sqrt{3})\) (Bottom Right)
B = (6, 6*sqrt(3))
C = (-6, 6*sqrt(3))
E = (-6, -6*sqrt(3))
F = (6, -6*sqrt(3))
Step: Draw the polygon.
hexagon = Polygon(A, B, C, D, E, F)
Example: Regular dodecagon with a side length of 12 centered at the origin
Step: Compute the circumradius.
You can use any of the following expressions:
R = 6*sqrt(6) + 6*sqrt(2)
Step: Draw vertices at the x-axis and y-axis.
- Vertex A ($\theta = 0^\circ$): Lands on the positive $x$-axis $\rightarrow (R, 0)$
- Vertex D ($\theta = 90^\circ$): Lands on the positive $y$-axis $\rightarrow (0, R)$
- Vertex G ($\theta = 180^\circ$): Lands on the negative $x$-axis $\rightarrow (-R, 0)$
- Vertex J ($\theta = 270^\circ$): Lands on the negative $y$-axis $\rightarrow (0, -R)$
A = (R, 0)
D = (0, R)
G = (-R, 0)
J = (0, -R)
Step: Draw remaining vertices
B = (R*cos(30º), R*sin(30º))
C = (R*cos(60º), R*sin(60º))
E = (R*cos(120º), R*sin(120º))
F = (R*cos(150º), R*sin(150º))
H = (R*cos(210º), R*sin(210º))
I = (R*cos(240º), R*sin(240º))
K = (R*cos(300º), R*sin(300º))
L = (R*cos(330º), R*sin(330º))
Step: Draw polygon.
dodecagon = Polygon(A, B, C, D, E, F, G, H, I, J, K, L)