Sierpinski Carpet - Construction

Construction

The construction of the Sierpinski carpet begins with a square. The square is cut into 9 congruent subsquares in a 3-by-3 grid, and the central subsquare is removed. The same procedure is then applied recursively to the remaining 8 subsquares, ad infinitum. The Hausdorff dimension of the carpet is log 8/log 3 ≈ 1.8928.

The area of the carpet is zero (in standard Lebesgue measure).

The Sierpinski carpet can also be created by iterating every pixel in a square and using the following algorithm to decide if the pixel is filled. The following implementation is valid C, C++, and Java.

/** * Decides if a point at a specific location is filled or not. This works by iteration first checking if * the pixel is unfilled in successively larger squares or cannot be in the center of any larger square. * @param x is the x coordinate of the point being checked with zero being the first pixel * @param y is the y coordinate of the point being checked with zero being the first pixel * @return 1 if it is to be filled or 0 if it is open */ int isSierpinskiCarpetPixelFilled(int x, int y) { while(x>0 || y>0) // when either of these reaches zero the pixel is determined to be on the edge // at that square level and must be filled { if(x%3==1 && y%3==1) //checks if the pixel is in the center for the current square level return 0; x /= 3; //x and y are decremented to check the next larger square level y /= 3; } return 1; // if all possible square levels are checked and the pixel is not determined // to be open it must be filled }

Read more about this topic:  Sierpinski Carpet

Famous quotes containing the word construction:

    There is, I think, no point in the philosophy of progressive education which is sounder than its emphasis upon the importance of the participation of the learner in the formation of the purposes which direct his activities in the learning process, just as there is no defect in traditional education greater than its failure to secure the active cooperation of the pupil in construction of the purposes involved in his studying.
    John Dewey (1859–1952)

    Striving toward a goal puts a more pleasing construction on our advance toward death.
    Mason Cooley (b. 1927)

    No real “vital” character in fiction is altogether a conscious construction of the author. On the contrary, it may be a sort of parasitic growth upon the author’s personality, developing by internal necessity as much as by external addition.
    —T.S. (Thomas Stearns)