Polar Flower


This sketch generates random points in a polar coordinate system to produce a flower-like pattern, operating much like a three-dimensional Spirograph.

It starts by generating random increments for the rr, θ\theta, and ϕ\phi coordinates. A random range, [rmin,rmax][r_{min}, r_{max}], is generated for the rr coordinate, while θ\theta and ϕ\phi operate within the fixed range [0,2π][0, 2\pi].

The first point always starts at (rmin,0,0)(r_{min}, 0, 0). The increments are then applied to each coordinate to generate the next point. The rr coordinate oscillates between rminr_{min} and rmaxr_{max}, while the θ\theta and ϕ\phi coordinates wrap around when they reach the limits of their range.

The resulting points are converted to R3\mathbb{R}^3 space and rendered to the screen.

You can use the mouse to rotate around the axes and the mouse wheel to zoom. The following key controls are also available: