algorithmic modeling for Rhino
Hi,
I am to trying to develop a python script for 2-D l-system which grows from multiple points and in different directions in grasshopper and have managed to grow the branches based on certain angles and desired length.
For the next step i want to avoid collision between two branches of one tree and also between different trees and stop the growth if one branch collides with the other. i am having some trouble in doing so. It will be helpful if someone could assist me with this..
Attaching the rhino and grasshopper script for reference
Tags:
Hi Viral
I've looked at the script and I think you could handle the collision in a similar manner as the one which was asked by Pim and for which I suggested a solution in this discussion about paths, which is somehow similar.
On the other hand, if you want to avoid intersections between lines, then it's even more complicated, as the only simple solution is to check intersections with all previously-added curves. This becomes a large operation as the number of curves increases. In order to do that, you could use
result = rs.CurveCurveIntersection(lineA, lineB)
Then you can just use
if result:
#there was an intersection
to see if the lines actually created some intersection events.
However, you will have to choose how to define which recursive structure 'wins' when several collide into a specific point, or when one collides into another.
Does it help?
Thanks,
Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com
Hi Giulio,
Thanks for the reply. i understand what you mean.
Is there a way in which i can define which recursion has a preference while checking for collision.
The problem that i have write now is that if 1 line collides with the other than the whole recursion stops.And for iterations after a certain number the lines keep on changing.
Attaching the script for reference
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by