![](https://secure.gravatar.com/avatar/3d131c6a351a6b0092c19b389bd99cf0.jpg?s=120&d=mm&r=g)
Hi,
I don't know where you found the code, but the answer to "What is (0,
r) rotated (a *i) doing?" is that it takes the point (0,r) and rotates
it a*i degrees.
For your labeling problem, see the last example of section 2.9 of
https://www.pragma-ade.com/general/manuals/metafun-p.pdf
/Mikael
PS Please do not cross post here and on stackexchange (at least not
without telling).
On Wed, Aug 28, 2024 at 11:12 AM Shiv Shankar Dayal
I think it works like (0, r) rotated (a) -- (0, r) rotated (a * 2) -- ... (0, r) rotated (a*20) -- cycle
Is my understanding correct? Also, how can I label these vertices in a for loop?
On Wed, Aug 28, 2024 at 2:25 PM Shiv Shankar Dayal
wrote: 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
-- Respect, Shiv Shankar Dayal ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________