Home >Software Tutorial >Computer Software >How to draw a Sierpinski carpet with geometric sketchpad

How to draw a Sierpinski carpet with geometric sketchpad

PHPz
PHPzforward
2024-04-17 16:22:41823browse

Have you encountered the problem of drawing a Sierpinski carpet with a geometric sketchpad? PHP editor Yuzai brings you a detailed tutorial to help you solve this problem. This tutorial covers the steps of drawing a Sierpinski rug fractal pattern using Geometric Sketchpad, starting with a basic square and ending up with a complex geometric pattern. Read on to learn how to draw this fascinating fractal artwork and explore the mathematics behind it.

Analysis: Take the square and divide it into 9 equal parts to get 9 small squares. Discard the small square in the center and keep the 8 small squares around it. Then divide each small square into 9 equal parts and discard the central square as well. Continue to subdivide and discard according to this rule until infinity. The limit graphic area of ​​the Sierpinski carpet tends to zero, and the number of small squares and the number of line segments on its sides tends to infinity. It is a line set, and the graph has strict self-similarity.

The specific drawing operations are as follows:

1. Open the geometric sketchpad, draw any line segment AB on the plane, and construct a square ABCD with the line segment AB as the side length.

How to draw a Sierpinski carpet with geometric sketchpad

2. Using point A as the scaling center, scale points B and D to 1/3 to get E and F; using D as the scaling center, scale points A and C to 1 /3 to get G and H. In the same way, points I, J, K, and L are obtained. Connect the dots to divide the square into nine equal parts.

How to draw a Sierpinski carpet with geometric sketchpad

3. Click [Data - New Parameter] to create a new parameter n, and change the value to 2. Click on two points A and B in sequence (note: these two points are the two endpoints of the line segment you first drew) and parameter n, hold down the shift key, click [Transform - Depth Iteration] to open the iteration dialog box, and select G , P two points, click [Structure] - [Add New Mapping], select P and O two points, continue to add new mapping, select O, J; F, M; N, K; A, E; E, L;L,B. (Note: Do not click on the M and N points in the middle) Click [Iterate] to complete the iterative production.

How to draw a Sierpinski carpet with geometric sketchpad

4. Fill the middle square MNOP, measure the area of ​​the MNOP, select the measurement result and the filled square, click [Display] - [Color] - [Parameters], Click [OK] in the pop-up dialog box.

How to draw a Sierpinski carpet with geometric sketchpad

5. Finally, select all points and press Ctrl H to hide unnecessary points.

How to draw a Sierpinski carpet with geometric sketchpad

Tips: Change the size of square ABCD, and the color of square MNOP will change as its area changes. Observe the difference in Sierpinski carpet by changing the value of parameter n.

How to draw a Sierpinski carpet with geometric sketchpad

The above is the detailed content of How to draw a Sierpinski carpet with geometric sketchpad. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:zol.com.cn. If there is any infringement, please contact admin@php.cn delete