28 Aug
2024
28 Aug
'24
10:55 a.m.
Hi, Consider following code: vardef polygon_with_side(expr n, s) = save a, b, r; numeric a, b, r; a * n = 360; a + 2b = 180; r = s * sind(b) / sind(a); for i = 0 upto n-1: (0, r) rotated (a * i) -- endfor cycle enddef; beginfig(1); path p; p = polygon_with_side(21, 20); draw p; endfig; bye; It draws a polygon with 21 sides with radius 20. I understand all of it except the for loop. What is (0, r) rotated (a *i) doing? -- Respect, Shiv Shankar Dayal