# L-system avoid self-intersection

## Recommended Posts

Hey guys,

I am currently experimenting in 2D with L-system. I am wondering if there is a way to prevent branches to intersect / cross ? Like I would rather has my branch to stop than crossing another one / itself like in the picture

##### Share on other sites

L-systems aren't self-aware like that... they handle all their substitution iterations internally, so you have no way of crafting rules based on the previous iteration's geometry. You're better off either using a particle system / solver SOP instead, or handle overlaps after the L-system is done via detangle or some other solver that could clip or displace overlapping polylines.

##### Share on other sites

Hum ok I see that is what I was thinking just wanted to be sure thank you! And is there a way to check the current orientation of the turtle ? Like say       X:(\$(x,y,z)=(x,y,z))=F      or even simpler       X:(\$(x)=x)=F      I know this is not good at all just wanna illustrate my words

##### Share on other sites

Hmm, I don't think there's any direct way to check the orientation. Maybe acos/asin? There aren't a ton of supported expressions in L-system rules.

##### Share on other sites

I had a similar problem and find that fusing with the power of 2 grid solves the problem, in my case.

Here you have some interesting examples. I'm just curious about what you do in 2d ? @sneaky

1-file to notice

 P L Rule 1 L = S Rule 2 S = F”+[f-Y]F;G
Rule 3 Y = –[|F-F–FY]- Rule 4 G = FGF[+F]+Y Angle -3832 Generations

30

##### Share on other sites

• 3 weeks later...

Hey @Librarian thank you for your answer I am a bite late by now ahah been quite busy!
I wanted to create a plane surface, kind of a motherboard if u want!

I have to say I don't really understand ur notice and how it could help me ? If you have time to explain your point I would be interested for sure.
Few very interesting examples on this website but they all seem to intersect if I am not wrong!

To explain my self a little further I searched an example for you. Even if I know the guys from Panoply (tremendous work by the way in here) didn't used L-system it is the kind of structure I would like to achieve.

##### Share on other sites

@sneaky
that solution it's already posted .. a million ways to do this in solver... have fun ...
just find file "13 fun" ( endless possibility) solver... first file

##### Share on other sites

Oh ok ahah didn't search with the good key words thank a lot!

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×