Earlier I discussed my silly dream of generating random splats. That dream had a sequel that the recent break afforded me time to pursue: generating random splats with lobes.
I had a hunch that this task would be easier if I had a utility function for generating a random curve that netted a turn of a certain number of degrees. So, I wrote this function, which turns a random angle in [minAngle, maxAngle], moves a bit, and keeps on doing that until the target curvature is reached:
A left turn is made by skewing the distribution of angles negative. A right turn, by skewing positive. I created a random undulation by alternating between left and right curves:
To turn this undulating pattern into the perimeter of a lobed splat, I shrunk the target angle of the left curves—so they didn’t fully cancel out the right turn. The net effect was that we were carried a little way around the circular pattern:
Each iteration of the repeat loop netted us a turn of 60 degrees. To go around a complete circle, I repeated 6 times. But to make the ends of the path meet, I employed the same trick as I did with the simple splats. I distribute the gap between the endpoints across all intermediate vertices. The end result is the lobed splat that I had in mind:
Now time to print some and hang them on our Christmas tree.