Content pfp
Content
@
0 reply
0 recast
0 reaction

B1das 🔷️ pfp
B1das 🔷️
@b1das
Anyone here with some experiance in fractals and recursive functions ? Its melting my brain a little 😅
1 reply
0 recast
6 reactions

i-rat.eth  pfp
i-rat.eth
@i-rat.eth
How can I help you, bro?
2 replies
0 recast
1 reaction

B1das 🔷️ pfp
B1das 🔷️
@b1das
Actually, would you recome d using global variables in recursive functions ? Right now it was just 2 functions interwoven(in the picture case about 2200 times on 7 levels deep) but next one might have like 6 functions so it seems like lot of variables to keep track and send around so if its global it might simplify idk
1 reply
0 recast
0 reaction

i-rat.eth  pfp
i-rat.eth
@i-rat.eth
Actually, no, I wouldn't recommend it. Recursion in python is not a good idea in itself, I would recommend avoiding it by resorting to loops if possible. As for variables, it is better to keep them as arguments to functions than as global constants, such code will be much easier to maintain and reuse.
2 replies
0 recast
0 reaction

B1das 🔷️ pfp
B1das 🔷️
@b1das
Im trying to implement this
1 reply
0 recast
0 reaction

i-rat.eth  pfp
i-rat.eth
@i-rat.eth
Ah, ok, now I got what you have to achieve. Let me some time…
3 replies
0 recast
0 reaction

B1das 🔷️ pfp
B1das 🔷️
@b1das
End goal would be to implement it to blender as geometry node and generate trees or sth. But i will need to learn geometry nodes first for that haha
1 reply
0 recast
0 reaction

i-rat.eth  pfp
i-rat.eth
@i-rat.eth
I started to write code, but realized that what I want to write has already written :) Check this out: https://github.com/miaisakovic/l-system-drawings/blob/main/l_system.py Basically, no matter how complex your L-system is, you don't need to complicate the code that builds it, just parameterize it with other rules.
1 reply
0 recast
0 reaction

i-rat.eth  pfp
i-rat.eth
@i-rat.eth
Note, there is no recursion in the implementation.
4 replies
0 recast
0 reaction

B1das 🔷️ pfp
B1das 🔷️
@b1das
You couls peobably do the stacking like done for saving positions and i will look into that but yeah when i looked at it all i thought maybe i should try recursive functions and i never used them so it was kinda also part of an exploration and learning
1 reply
0 recast
0 reaction

i-rat.eth  pfp
i-rat.eth
@i-rat.eth
Check this thing out https://github.com/AidanMM/AMM-3DEngine/blob/master/AMMEngine/MeshGenerator.cpp It's not very readable c++ code, but the idea is clear - everything works the same way in 3d, just a different set of rules.
1 reply
0 recast
1 reaction

B1das 🔷️ pfp
B1das 🔷️
@b1das
I guess i was also trying to avoid 20 if statements 😂 but yeah i think i would be able to do it that way. I thought recursion solution would be more elegant but i have my concerns now 😅 i will play around and let you know if i manage to crack it 😊 ty for help and i will tag you or sth if i find myseld in stuck
1 reply
0 recast
0 reaction

i-rat.eth  pfp
i-rat.eth
@i-rat.eth
In general, a sheet of if's is not a good thing. However, in the python world it is still better than recursion. Instead of ifs, dict with mapping between variants and rules might work here, the code will be a bit cleaner.
1 reply
0 recast
2 reactions

i-rat.eth  pfp
i-rat.eth
@i-rat.eth
https://craftofcoding.wordpress.com/2021/02/08/why-python-is-horrible-for-recursion/ - fyi
1 reply
0 recast
1 reaction

B1das 🔷️ pfp
B1das 🔷️
@b1das
Interesting. I will start by refoing the first turtle code you sent me but avoiding using turtle library for drawing and whatever else
1 reply
0 recast
1 reaction