Help: Drawing Sierpinski Carpet in mathematica

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
Posts: 1
Joined: January 25th, 2017, 10:05 pm

Help: Drawing Sierpinski Carpet in mathematica

Post by LeoNsky » January 25th, 2017, 10:21 pm

Dear Planet Chili users, can someone be that kind to help a Polish Student in need? I have to create a function that will draw a sierpinski carpet with vertexes(i dunno if that is clear, my english isnt perfect, what i mean is points around carpet so we can change them and rotate the carpet or expand it) and to a depth given in func. I have a func. done for the Sierpinski triangle, but I dont know how to do it for the carpet can smn pls help? Here's the code for the triangle:

It draws the triangle to a depth that we want and we can manipulate it so it's exactly what i need to have, but i need to have it for the carpet.

Translate[Scale[#, 1/2, {0, 0}], pts/2] &, {Polygon[pts]},
depth]}, PlotRange -> {{0, 1}, {0, 1}},
PlotRangePadding -> .2], {{pts, {{0, 0}, {1, 0}, {1/2, 1}}},
Locator}, {{depth, 4}, Range[7]}]

Post Reply