# Sierpinski triangle

I’m an architecture student and I’m quite new to grasshopper. I was wondering if there is a way to create what you see below.

I was able to create sierpinski trinagle in C# component (with a help of ParametricCamp on YouTube), where I can change interations with a slider. However I would like to create addresses for each triangle based on a path from the centroid of the biggest traingle. There is an example of what I mean.

I would highly appreciate any answer.
Thanks

Daniel

yep, download weaverbird. there are sierpinski carpet or subdivision as well as many other very useful functions.

hope that helps

Ben

Thanks! I downloaded it and I’m not sure if it can help me create the addresses tho. I can create sierpinski triangle in wb very easily compared to C#, but I get to the same problem as before. I still don’t have an idea how to create the addresses.
I thought I could make a path using construct path with 3 different branches, where the path would go from the base centroid connecting centroids of the “children” (triangles smaller then the previous iteration) and the direction would be set by 3 vectors (top, left, right or 0, 1, 2). But this method is quite complicated and I couldn’t even make this to work.

Try with this idea , you need loop to repeat the process

Sierpinski triangle.gh (11.6 KB)

Interesting way of creating the iterations “outwards”. But this is not the problem I’m trying to solve anymore. There is a photo of what I’m trying to do. I apologise, maybe I’m not explaining it right.

Use `Mesh` , `Triangulate`, `Delete Faces` (the one in the center) and repeat the process with loop

Oh, I think I understand. Thank you!
And do you think there’s a way to assign a letter or a number referencing the direction of the path to each triangle?
I know there’s a way to assign numbers to points with “point list”, so I would have to assign it to corresponding centroid I guess, but that doesn’t seem right to me.

this should do the trick, although it’s not very visible on the pic.

if you want a specific order like on your previous post, you’d probably need to filter by height (in my case y) and their respective left or right side. here’s an example of only filtering by y axis.

1 Like

If i understand you can use Graft and Text tag

Sierpinski triangle.gh (16.5 KB)

2 Likes

Ooohh, thank you so much! I’ll try it, it looks very promissing!

Check this python code, and try to make it better

Sierpinski triangle python.gh (6.3 KB)

2 Likes

Ok, thank you, I’ll have a look. I haven’t worked in python yet, but I’ll try my best