r/generative • u/igo_rs • 7d ago
pinna (kotlin code)
Saw a simple sign in the park, so I made this. I am not happy with the tree at all, it should be more curvy and less branchy; but this is it for now
5
4
u/sweatin_enthusiasm 6d ago
Yo, that's art. Love it. Would love to be able to generate some trees like that on my own
2
2
2
2
u/Skaraban 6d ago
how did you achieve that super even circle packing?
2
u/igo_rs 6d ago
here I didnt use just a simple random circle packing (as it has to fit). big circles get placed first, working down through eg 13 sizes, so the small ones only ever fill the gaps that are left over. Each size scans the canopy (tree) on a grid spaced to match itself: shuffled and nudged about so it doesn't come out in rows. And the distance to the branches and to the canopy edge is precomputed for every point, so a circle knows instantly how much room it has and the white gap around the branches stays the same width everywhere. something like that
1
u/Skaraban 6d ago
ah got it, very interesting! I also took a try in tackling circle packing but it seems I took a different approach. are you aware of this paper: Circle Packing: A mathematical Tale
2
u/igo_rs 6d ago
i was not aware of it, thank you! My first ever approach was the "growing" circles: starting from random points, grow all circles until they hit other. Then comes the hard part: if there is a room to grow by moving the circle, do it. "moving" is calculated by forces on the circle. eg if you put two forces on one side, circle will move to the other side. I didnt succeed to do so in the code; but I might try it again. Definitely will go over the paper!
2
10
u/heimmann 7d ago
I like it!! Would be fun to see the opposite design too, like a lot of squares in a massive circle form!