This Endless Frame

| Home | Data | Color | 3D | Rivers | Notes | Chirps |

Sunflower Sampling and Distance Transforms

Sunflower sampling or Fibonacci packing is a method of using the golden angle to generate a 2D point sampling.

A while ago, I wrote a C++11-ish version compiled with -std=c++17.

Currently, I'm mostly writing python.

I asked Gemini to port the C++ to python and got the following for sunflower sampling :

Not bad.

The original code also used OpenCV to apply a distance transform.

The result of a distance transformed sunflower sampling is this groovy image :

Attribution

Multi-lingual sunflower sampled distance transform image.
August 2026
Image: NMoroney

Then I had Gemni port the original code to C++17.

Finally I had Gemini port the code to C++23.

Which gets to std::views in the below code.

Also not bad.

But I can tell it's going to take me some time for me to warm up to std::views.

AI commentary is bimodal, but for multi-lingual coding it's promising.

fleuron

Finally a hard coding convention for me.

Choose the name that's easier to spell.

So it's sunflower_sample and not fibonacci_pack because sunflower is easier for me to spell.


2026-08-26
NMoroney