17 lines of numpy + matplotlib, no 3D engine: a parametric surface over
u ∈ [0, 1] × v ∈ [0, 2π], drawn with a single plot_surface call.
with a = 1, b = 0.5, k = 0.3, u ∈ [0, 1], v ∈ [0, 2π].
r(u) alone is a body of revolution: it narrows to a point at u = 1 and swells
towards the base. The k term is what breaks the symmetry — it pushes x and z
sideways by an amount that depends on both u and v, so the cross-section stops
being a circle. Nudge the parameters and the leaf turns into a petal.
Mesh: 20 × 32 samples, 640 quads. Coloured with matplotlib's viridis.
pip install numpy matplotlib
python "python/surface/花瓣.py"The script opens matplotlib's own 3D window; the picture above was rendered separately with a fixed view and a dark background — see docs/provenance.md for exactly what was changed.
