6 ms·
> still have no idea what the final 3 lines of irregularcircle do, or why the \pgfmathsetmacro\len{} is repeated twice. Divide the circle in angles of 10 degre
by pvaldes 5y ago
> still have no idea what the final 3 lines of irregularcircle do, or why the \pgfmathsetmacro\len{} is repeated twice.
Divide the circle in angles of 10 degrees. Each one will be a node for drawing the line. Then go to 10,20,30,40 degrees etc until reaching 350 degrees and assign a length for the radius in each node
This length will be is the desired radius of the circle plus a small amount of irregularity that is randomly assigned but starting at a value provided as second argument. Finally we need to close the circle with -- cycle. The polygon is defined as a -- b -- cycle, or in this case:
starting_node -- {iteration} -- closing_node. Iteration is a list of values for the radius each ten degrees.
If I'm not wrong, we need to use the macro two times because the first time we use a starting value with angle = 0 and then we iterate over the whole circle. We need to assure that we start and end exactly at the same radius value (the radius provided as first argument) so the polygon line will close correctly. Therefore the first and last node can't have any irregularity.