At present, the fractals that the author has come into contact with mainly include the following types:
1. Similar to Clifford's fractals. The characteristics of this fractal are: the initial coordinates of the fractal are (0,0). After a large number of iterations through the initial coordinates, a series of points are obtained, and the fractal curve is drawn based on the obtained points. This type of fractal has limited parameters and can be easily implemented.
2. Fractal like IFS fern. This fractal has more parameters than the previous one. It is worth noting that there is a P value in the parameter list of the IFS fern fractal. This value represents the probability that each set of different parameters should appear. If this value is useless It is impossible to get the desired graphics.
3. Fractal like Mandelbrot. This fractal involves the knowledge of complex numbers and time escape algorithms. Essentially, it is a set of a series of points on the complex plane. The time escape algorithm is used to determine whether the point is within the set, and a series of points are obtained, and graphics are drawn based on these points.
4. Fractal like L-System Sticks. This type of fractal needs to define the parent string and the rules of evolution, and draw graphics through the points reached by different parent strings and evolution rules. It is not difficult to understand the evolution rules and parent strings. The main reason is that the transformation between coordinates is difficult to calculate.
The following is a piece of code about Mandelbrot fractal.
1 2 3 4 5 6 7 8 |
|
1 2 3 4 5 |
|
1 2 3 4 5 6 7 |
|
The above is the detailed content of Example code about Mandelbrot fractal. For more information, please follow other related articles on the PHP Chinese website!