## Help: Drawing Sierpinski Carpet in mathematica

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

### Help: Drawing Sierpinski Carpet in mathematica

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.

Manipulate[
Graphics[{Nest[
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]}]