# Introduction to fractals 50 examples

This is p5.js version of 《Introduction to fractals 50 examples》. I choose to use plain html to avoid maintain generate tools. all link is p5js graphics.

1.1 Simple forward generation of LS fractals in meta format1.2 Simple forward generation of LS fractals in meta format

The previous section describes how to create LS fractals in a simple forward format by creating a star with a pentagram.

What do we mean by "forward format" ? In the experience of drawing board LS fractals, it means that the generators A-B are compressed (iterated) in the order of the arrows as shown in the figure The line is compressed (iterated) forward onto each segment of the generating element, where it goes from B'' to B''' and then back again to B''. If the iterations from B'' to B'' are retained, the resulting fractal is a Durer pentagon (see Example 15), while removing the B'' to B''' gives a pentagon.

2.1 DurerThere are many fractals with left and right format generators in the L-fractal, such as the Dragon curve, the Hilbert curve, and the linear Sierpinski triangle. The iterative method of LS fractals with left- and right-format generators is described below with the help of the exercise of successive single-curve Sierpinski triangles. I. Make the initial element AB and the left generating element A-B. The line segment AB, with A as the centre, rotates B by 60° counterclockwise to obtain B' (this point can also be taken arbitrarily), respectively, with A, B as the centre, 0.5 as the ratio of scaling B' to obtain B'', B''', hide B'', obtain the initial element line segment AB and the left generating element by four points AB''B'''B as shown on the left (without the line segment). Note that, using the drawing board for the L-fractal, the effect of the symmetric right-generating element can be obtained by reversing the compression of the left-generating element, so it can be omitted. II. Iterate over the generating elements. Delete the line AB''B''B, show the initial element AB, create a new parameter n, and compress the initial element AB to B''A, B''B''', BB''', i.e. AB→B''A, B→B''B''', AB→BB''' for the final iteration; hide the initial element and the points, increase the number of iterations n, and obtain a continuous single curve LS- Sierpinski triangles are shown in the right Figure.

2 Continuous single curve LS-Sierpinski triangle

# TODO

The mapping of plant structure by the L-system is the most interesting part of the LS fractal. The first two forms of compression are from a starting point to an end point, whereas in order to simulate a plant form, there must be a starting point and multiple end points. So the L-system, as a computer symbolic command system, must have a command symbol that, after drawing a branch, allows the computer to retreat to the main stem and then to another branch to continue the drawing. The drawing board uses the "human brain + computer" method, so this process is a breeze. The following is an introduction to this format with the production of a four-branched fractal tree LS Fractal The production method of LS fractals.I. Deterministic LS fractal tree

1. Make the initial element AB and the generating element A-B. Make the initial element vertical line segment AB, make two points A1 and A4 on AB, rotate B by angle 36° to B1 and A4 by angle 126° to B4 respectively, rotate A1 by angle -171° to B2 and rotate A1 by angle 144° to B3 respectively, connect A1B1, BB2, BB3, A4B4, to generate element A-B as shown on the left.

2. Delete the four branches of the generating element, show the initial element AB, create a new parameter n=5, make the final iteration of AB→A1B1, AB→BB2, AB→BB3, AB→A4B4 with depth n, adjust the position of the two points A1A4 and hide the points to score the tree as shown on the right. 3

This example not only introduces Koch curves and Koch snowflakes, but also other drawing boards for LS
snowflakes. The Koch Curve

I. Making Koch curves

1. Make the initial element AB and generate the element A-B: make the line AB, take A as the centre, scale
the point B by 1/3, 2/3 to get the point B', B''; then take B' as the centre, rotate the point B'' by 60°
counterclockwise to get the point B''', connect the line A B' B'' B'' B'' B, to get the generated element
A-B (left figure).

2. Delete the four small line segments in the generating element A-B to show the initial element AB, create
a new parameter n=1, and make the final iteration of AB→AB', AB→B'B''', AB→B'''B'', AB→B''B'', AB→B''B with
depth n, hide the generating element and points B', B''', B'', and increase the parameter n to obtain the
Koch curve (right).

Koch snowflake production

1. Select the Koch curve, and select points A, B and n in turn, create a new tool "Tool #1", call up the Set
n to auto-match in the tool script.

2. Make a square triangle CDE (three vertices clockwise), if you use "Tool #1" to match CD, DE, EC in turn.
The Koch snowflake is shown on the left,

if you use "Tool #1" to match DC, CE and ED in order, the Koch inverse snowflake is shown on the right. The image on the right.

4.2 Koch inverse snowflake
The Koch snowflakes are too monotonous and empty inside. The snowflakes look much better when compressed
into hexagons.

1. as generated elements A-B: take two points A, B, A as the centre, B as the vertex of the positive hexagon
BCDEFG, to generate elements A-B; and then A as the centre of this hexagon will be compressed by 2/3 of the
vertices, to get six points B', C', D', E', F', G' (as the left figure).

2. New parameter n=1, make AB→B'B, AB→C'C, AB→D'D, AB→E'E, AB→F'F, AB→G'G with depth n. Final iteration,
hide the generated elements and points, increase parameter n, get LS snowflake (as shown on the right)

II. Continuous single curve snowflake graph

1. Make the initial element AB and the generating element A-B: make the line AB and rotate B
counterclockwise by 60° with A as the centre to get point B', the rest of the points are the three equal
points of the side of the triangle, to obtain the eight-point shape ACDEFGHB, that is, the generation of
elements A-B
as shown below on the left.

2. Show the initial element AB, create a new parameter n=1, make the final iteration of AB→CA, AB→CD, AB→DE,
AB→EF, AB→GF, AB→HG, AB→HB with depth n, hide the initial element and the points, increase the parameter n,
and obtain a continuous single curve snowflake (the following figure on the right)

Example 5. Two-dimensional IFS fractal deterministic algorithm
The theory and practice of iterated function systems (IFS) occupy a very important place in fractal
geometry. Two-dimensional IFS fractals are actually points on the complex plane, which are in a set of A
fractal is actually a fractal created by iterating over the image of a point on the complex plane under a
set of compressed affine transformations.
The following is an example of the IFS-Sierpinski triangle, and an introduction to its principles and
production.
As shown in the diagram above left, the Sierpinski triangle is determined by the following three affine
transformations.

W1: (x,y)→(0.5x,0.5y).
(one transformation effect: △ABC → △ADF)

W2:(x,y)→(0.5x+0.5,0.5y) .
(One transformation effect: △ABC→△DBE)

W3:(x,y)→(0.5x,0.5y+0.5).
(One transformation effect: △ABC→△FEC)

We call the system {W 1,W2,W3} a system of iterative functions, and use this set of affine transformations
to iterate over a given set of points The Sierpinski triangle is formed by iterating this set of affine
transformations over a given set of points. Specific methods are as follows.

I. Formula method.

1. Construct three affine transformations
Any point z, measure its horizontal and vertical coordinates x and y, calculate 0.5x, 0.5y, 0.5x+0.5,
0.5y+0.5, and make Points A(0.5x,0.5y), B(0.5x+0.5,0.5y), C(0.5x,0.5y+0.5).

2. Iterate into ISF fractal Create a new parameter n and make the final iterations z→A, z→B, z→C with depth
n. Increase the value of n to obtain The ISF-Sierpinski triangle 1 is shown in the figure above right.

Example 6. 2D IFS fractal deterministic algorithm (I)
Let us now practice the drawing board implementation of the LS dragon curve and the IFS dragon curve. As in
Fig.

I. Principle of dragon curve generation.
The dragon curve is determined by the following two affine transformations (as shown in the top left).
W1:(x,y)→(0.5x-0.5y,0.5x+0.5y), (i.e. the left generating element ACB is compressed to 2^0.5 of the original
then rotate 45° counterclockwise to obtain the line AEC).
W2:(x,y)→(-0.5x-0.5y+1,0.5x-0.5y), (i.e. compress the left generating element ACB to 2^0.5.
Then rotate 135° counterclockwise and move 1 unit to the right to obtain the line BFC).
II. The method of creating the LS Long curve.
1. Generate the element A-B: A and B are independent points, and ∠ACB = 90° as shown on the left.
2. Make AB→AC, AB→BC, iterations of depth n, shown as the final iteration, to obtain the LS dragon curve
As shown in the diagram above right.
IFS dragon curve production method (formula method).
1. make a point z, measure its coordinates, make a point w1 (0.5x-0.5y, 0.5x+0.5y), w2 (-0.5x-0.5y+1,
.5x-0.5y).
2. make z→w1,z→w2 , the depth of n iterations are shown as the final iteration, to obtain the IFS dragon
curve
4. The production method of IFS dragon curve (tool method).
B, B, C to obtain STransf2.
2. Make z→STransf1,z→STransf2, complete iterations of depth n, change n=12, and get IFS Long curve 2. Line
2.

Example 7. 2-D IFS fractal deterministic algorithm (II)

The fractal shown above is called a flower-basket cluster and is determined by 5 affine
transformations.

W1:(x,y)→ (0.5x-0.134y, 0.134x+0.5y).

W2:(x,y)→ (0.5x+0.134y+0.5, -0.134x+0.5y+0.134).

W3:(x,y)→ (-0.1667x-0y+0.583, 0x-0.1667y+0.134).

W4:(x,y)→ (0.083x-0.229y+0.417,0.229x+0.083y+0.134).

W5:(x,y)→ (0.083x+0.229y+0.5,-0.229x+0.083y+0.359).

i.e. A-B → A-C

A-B→C-B

A-B→C'-C''

A-B→C''-D

A-B→D-C''

I. How to make an LS flower basket cluster.

1. Generate the element: as shown below, make a line segment AB, rotate A clockwise by 15° with B as the
centre to get A', make a vertical line of line AB and intersect A'B at C. Scale A to A'' by 1/12 with B as
the centre. A''B translates C to C', translates C to C'' by the vector BA'', and rotates C'' by 75° in the
clockwise direction with C'' as its centre The ray C''C''' intersects the perpendicular of AB at D. The
figure is organised as shown above to form the elements A-B.

2. Make final generations of depth n: AB→AC, AB→C''D, AB→DC', AB→CB, AB→C'C''.
Increase n worth of LS basket clusters.

III. Method of making IFS flower basket clusters (tool method).

1. Change the generated elements A-B to L-R, make a point z, create a new parameter n=3, enter the "Edit"
menu "Parameter Options" and change the unit of angle to "radian" or "direction"; the "Directional
degrees".

2. Call the "Drawing Board Fractal Common Toolkit_[Transform Tool]" of "▲ Similar Transformation (Point -
Point, No Flip) [RL→R'L', Invert No]" tool, and "Show Script View ", change the prerequisite 3 "reverse
match R, otherwise match L" to L, while checking the "automatically match objects in the drawing board", as
shown in the figure.
STransf4, STransf5.
4. make z→STransf1 , z→STransf 2 , z→STransf3 , z→STransf4 , z→STransf5 , depth
The final iterative iterations of depth n are obtained as IFS basket cluster 2.

The method of making IFS flower basket clusters (formula method).
1. Make five points.
w1 (0.5x-0.134y , 0.134x+0.5y),

w2 (0.5x+0.134y+0.5, -0.134x+0.5y+0.134),

w3 (-0.1667x-0y+0.583, 0x-0.1667y+0.134),

w4 (0.083x-0.229y+0.417,0.229x+0.083y+0.134),

w5 (0.083x+0.229y+0.5,-0.229x+0.083y+0.359)

2. Make iterations z→w1, z→w2, z→w3, z→w4, z→w5 of depth n shown as the final iteration.
The IFS basket cluster 1 is obtained.

For some non-linear fractals in integer or fractional iteration format, we can also use inverse iteration to
construct the IFS fractal. The following is an example of a fractal of the form "z→z 7/4+c", and describes
how this
inverse iteration method can be implemented on the drawing board.
The inverse solution z=w 7/4+c gives wm+1=(z-c)4/7ei-2mπ/7, where m=0,1,... ,6, which gives the iterative
system of
functions {Wm:z→wm;m=1,2,... ,7}. The drawing board is implemented as follows.

I. Construct the iterative format.

1. Open the "Complex Fractal Generation Platform [Simple Scanning Framework]", delete the points P, Q, T0,
parameters r, p0, n-1, eT, φ, and change the title to "Inverse Iteration IFS: z7/4+c→z", change k=4/7, n=2,
and edit
θ=2π/7, Edit θ=2π/7 radians.

2. Call "Drawing Board Fractal Common Toolkit_【Operation Tools】", use the "z[1]-z[2]" tool and "z^k" tool to
calculate the horizontal and vertical coordinates of w1 Draw the point w1.
3. Mark the origin as the centre and the angle of rotation as θ. Rotate w1 counterclockwise by 2π/7 to
obtain the
point wm, m=2,3,... ,7.
II. Iterative component shapes
z→w1, z→w2, z→w3, z→w4, z→w5, z→w6, z→w7, complete iterations of depth n.
The IFS fractal is saved by varying n=4 (c=4.5 is recommended).

Example 12. IFS fractal by inverse iteration (inverse iteration) (II) The iteration of the classical Julia set is in the form z → z2 + c. The inverse solution yields two analytic branches w1 = ±(z-c)0.5, which gives the function The inverse iterative system {W1,W2} is practised in the following way to produce the inverse iterative circular IFS-Julia set. I. Constructing the iterative format. 1. Call the "z[1]-z[2]" tool from the "Drawing Board Fractal Common Toolkit_[Operations Tool]" to find z-c (the real and imaginary part). 2. Change the value of k to 0.5 and use the "z^k" tool to find (z-c)^0.5 and plot the corresponding point A. 3. Calculate -(z-c)^0.5 from the data menu and plot the corresponding point B. 4. Use the Transform menu to create a custom transform 1: z→A, transform 2: z→B, hide A and B. 5. Use the circle tool to draw a circle and its interior, mark the centre as C and the point on the circle as D. 6. Use custom transformations 1 and 2 to transform points C', D', C'', D'' of C and D respectively. 7. The metric zC, zC', zC" are used as RGB to colour the inside of the circle in turn, changing the circle to a thin line and white. II. Iterative component shape 1. Let n=5, make CD→C'D', CD→C''D'', a complete iteration of depth n. 2. Drag the centre of the circle C to the origin, increase the value of n (less than 13), drag the point c to change the shape of the fractal, drag the point D to change the state of the circle cover, set the background to "black" , drag point z to adjust the colour of the fractal until you are satisfied with it, resulting in the following figure.

12Spherification of LS fractals In order to obtain a fractal with a particular visual effect, some special transformations are often applied. These special transformations can be applied to the first image of the iteration, or to the final image of the iteration or to the generating element. The following is an example of the fractal pane (right), which introduces the LS fractal spherification method. The fractal pane (above right) consists of the generators A-B compressed to AA', BB', DD' and CC', respectively.

13Second, the spherical of the fractal pane 1. Call the "Spherical Mirror Reflection Transformation [Meridian Geometry] (Point-Point) [Sphere Center A, Outer End of Radius B, Point Z\C] of "Artboard Fractals Common Toolkit_[Transformation Tool]", make the center O near the center point, make the outer endpoint of the radius in the appropriate position, make the point z in the space inside the generator, get the transformation point z', and delete the graticule; 2. Select the point z and point z', enter the "Transformation" menu to create a custom transformation "z→z' transformation", then select each line segment of the generator, and enter the "Transformation" menu point "z→z' transformation" again to obtain the spherical transformation image of the generator, hide the line segments of the generator, and pay attention to retaining the points; 3. Let n=1, compress AB to AA', BB', DD' and CC' respectively, adjust the position and radius of the spherical center O appropriately, and then change n=3 or 4 to obtain the spherical fractal pane:

13.1
Weierstrass function of the spherification process

The Weierstrass function is a class of real-valued functions that are continuous everywhere and not
differentiable everywhere, whose analytic equation is.
The existence of the so-called "pathological" functions was demonstrated by its appearance, which
changed the way mathematicians viewed continuous functions at the time. This brought about a major
crisis in the history of mathematics in terms of the foundations of mathematics, and the final
resolution of this crisis brought about a leap forward in mathematics. The final resolution of this
crisis brought about a leap forward in mathematics.
The Weierstrass function is fractal in nature: any local enlargement has some resemblance to the whole.
Enlargement each bend does not show that the graph converges more and more to a straight line, no matter
how close two points are to each other, the function is not monotonic, so it may be described as the
earliest fractal. The following is a description of how the Weierstrass function image was created. In
order to see every detail of its curvature, we spheroidize the image locally.
I. Constructing the moving points on the image

1. Create the new parameters a=0.35, b=15, k=9, n=0, w=0, calculate n+1, make an independent point A,
measure its horizontal coordinate xA, calculate w+ancos(bnπxA), set the label W, draw the point
B(xA,W).

2. k as the depth, n→n+1, w→W iteration, select the iterative image with the "Transform" menu command
"Endpoint" for the iterative image of the endpoint C, the Weierstrass function on the image of the
point.
Second, the function of the image of the point of spherification

1. make an independent point D, the point D to -0.5π radian angle translation 3 cm to get the point D'.

2. Call the "Drawing Board Fractal Common Toolkit_[Transformation Tool]" of "Spherical Mirror
Transformation [Longitudinal Geometry] (Point-Point) [Spherical Centre A, Outer Radius B, Point z\c]"
Match the points D, D' and C in order to obtain the transformed point z'\c', delete the point N, delete
the latitude and longitude network, hide the points B and C, separate the point S, merge S with the
point D', and hide D and D'.

3. Make a line segment EF on the x-axis and the interior of circle D. Change the colour to light grey
and the two axes to light grey.

4. Select the point A and the transformation point z'\c', customize the A→z'\c' transformation, then
apply the A→z'\c' transformation to the line EF to obtain the result

5. Let the image of the Weierstrass function be a black, very thin line with 3000 samples, with the line
EF endpoints marked across The fractal structure of the Weierstrass function can be observed by dragging
the circle (to simulate a magnifying glass).

16

16

16

16

16

16

16

The creation of an Apollony fractal starts with three initial equal circles tangent to each other, the first step makes a tangent circle inwards between the three, the second step makes three tangent circles between any three of them, ...... and so on, for n iterations. The Apollony fractal is given in the fourth figure below.

16 16.1 16.2If the Apollony fractal is transformed by inversion with the unit circle as the base circle, we will see an even more beautiful fractal - a four-circle limit set.

If the Apollony fractal is transformed by inversion with the unit circle as the base circle, we will see a more beautiful fractal, the four-circle limit set. The following example practices the implementation of the limit set of a circle on the drawing board. I. Apollony fractal point-type inversion method 1. The center of the base circle, the upper point of the base circle, and the initial point are matched with the origin and the unit point, and the initial point is placed in a blank space (remembered as w) to obtain the transformation point ITransf; 2. Select w1, w2, w3, and then enter the "Transform" menu, and use the custom transform to get the corresponding three inverse points; 3. Make z→w1, z→w2, z→w3, the final iteration iteration with depth n=2, save and change n=8 to get the point iteration four-circle limit set.

172. Apollony fractal circle inversion method 1. Follow the second and second steps of Example 16, call "Drawing Board Fractal Common Toolkit_[Transformation Tool]" of "Inverse Transformation (Point-Point) [Base Circle Center, Base Circle Upper Point, Initial Point]" tool, base circle center and base circle upper point match the origin and unit point respectively, and the initial point is placed in the blank (noted as w), to get the transformation point ITransf; 2. 2. Enter the "Transform" menu to create a custom transform: w→ITransf transform, select B1', C1', B2', C2', B3', C3', and then enter the "Transform" menu. "Transform" menu, use custom transform to get the corresponding inverse points B'1', C'1 ', B'2 ', C'2', B'3', C'3', make three circles B'1' C'1 ', B'2' C'2', B'3' C'3'; 3. B2 'C2', BC→B3'C3'. Move the points B and C to the origin and the unit point, respectively, and change n=10 to obtain the limit set of the circle iteration of four circles.

17.1
Example 21.Complex fractal escape time algorithm

Let f be a complex compression transformation, τ be the
natural number, and f forward iterative transformation fτ is defined as: f 0(z)=z,f 1(z)=f [f
0(z)],...,fτ+1(z)=f [fτ(z)],..., Let the positive real number r be the threshold radius, the positive
integer n be the maximum number of iterations, and z be the point in the scan box. When the time τ (number
of iterations) ≤ n-1, if |fτ(z)|≤r, then enter the next iteration, if |fτ(z)|>r, the iteration is
terminated; The iteration is terminated when the number of iterations τ=n. The time defined when terminating
the iteration is denoted as et, the modulo of the escape critical point |f et(z)| Write it as em, and assign
the point z the color of the associated parameters et, em. This computer drawing method is called escape
time arithmetic, and the threshold radius r is also called the escape radius. When f(z)=z2+c, if z is
colored, the fractals (boundary) iteratively formed are called the classical Julia set, and if the
c-colored, the fractals (boundaries) iteratively formed are called the classical Mandelbrot set. The
following introduces the artboard implementation method of the escape time algorithm through the production
of Julia set and Mandelbrot set (Note: This tutorial mainly introduces the method of using tools to make
complex fractals, in order to help readers better understand its mathematical principles, the tool-free
method is introduced in Example 26), and the shading mode adopts the "smooth shading mode".

1. Build an
iterative format (coordinate formula) Open the "Complex Fractal Generation Platform", call the "z^2" tool
from the "Artboard Fractals Common Toolkit_[Format Tools]", find the coordinates of z2 according to the
prompts in the lower left corner of the window, and then use the "z[1]+z[2]" tool to calculate the
coordinates of z2+c. Second, find et, em 1. Call the "p schematic number, p transformation point M, T, x[M],
y[M], y[M], y[M], y[$]" tool of "Drawing board fractals common toolkit_[judgment tool]", and match the
horizontal and vertical coordinates of the point z2 + c in turn to obtain the parameters p, p0+p, point M,
T, coordinates xM, yM;

2. Make xz→xM, yz→yM, p0→p0+p, complete iterations with a depth of n-1, and obtain M
and T iterations like EM and ET;

3. Use the "et(eT), em(eM) [iteration like EM, ET]" tool of "artboard
fractals common toolkit_[judgment tool]", and successively match the iteration like EM and ET to obtain the
parameters et, em and the iteration endpoint eT and eM.

3. Scan line coloring

1. Call the "Smooth
Shading
Parameters RGB [et, em]" tool of "Artboard Fractals Common Toolkit_[Coloring Tools]", and match et, em
successively to obtain parameters s, R, G, B;

2. Use the "RGB Shading" tool to match the pixel Pixel to
get
the coloring point PixelRGB, at which time the system selects the coloring point by default;

3. Without ununchecking the coloring point
selection state, directly enter the "Transformation" menu "Create Custom Color Transformation", get the
"Pixel→Pixel[RGB]" color transformation, and then uncheck the colored point selection state;

4.
Right-click
"Edit parameters" xz, yz for xPixel, yPixel (equivalent to coloring c); or right-click "Edit parameters" xc,
yc for xPixel, yPixel (equivalent to coloring z);

5. Select the scan line, re-enter the "Transform" menu
and
click "Pixel→Pixel [RGB]" to map the custom color transform to the scan line;

6. The system still
selects
the color transformation image of the scan line by default, directly enter the "Display" menu and click
"Track Path Transformation"; Display the unit points of the x-axis, increase the coordinate system unit
length appropriately, and save as "Example 21 [Julia set 1]" or "Example 21 [Mandelbrot set]".

7.
Attached
file parameter settings: "Julia set 1", n=200, r=100, c=-0.749-0.196i:

22 22.1 22.2

TODO

22.3 22.4 22.5Example 24. Isometrics of a complex fractal The fractal of iteration format z→f(z)+c (where f(z) is the complex compression transformation) is called the generalized Julia set for z coloring and the generalized Mandelbrot set for c coloring. From Example 21, we can see that the fractal boundary obtained by the escape time algorithm (circular critical threshold) is a fractal bounded by a circle of The fractal boundary obtained by the escape time algorithm (circular critical threshold) is a set of immobile points wrapped by a ring of equal et bands. The points z' (or c') of the fractal boundary obtained by the escape time algorithm (circular critical threshold) are the set of immobile points wrapped by a ring of iso-et rings. The two points do not always fall in the same et-loop, let s=1 when they fall in the same et-loop, otherwise s=0. is the coloring parameter for z (or c), so that the ring is white, and the two adjacent rings are separated by a thin black line. The method is called the et line method. In the following, we practice the iso-et line method for the generalized J-set with the iteration format z→1-z^2+z^5/(2+4z)+c. line method.

24
// I give up :(

Example 25. Proposed 3D-et of a complex fractal

Let the point (x,y) on the complex plane, the proposed 3D transformation (x,y) → (x',y') is.
x'=(x-xcenter)*cos(θ)-(y-ycenter)*sin(θ)+xcenter.
y'=cos(φ)*[ (x-xcenter)*sin(θ)+ (y-ycenter)*cos(θ)]+ sin(φ)*h+ ycenter.
(where θ is the horizontal line direction angle, φ is the surface inclination angle, (xcenter,ycenter) is
the transformation center, and h is the real function of elevation associated with et, em or dist of the
elevation real function).

梯度距离估计边缘

ref https://mrob.com/pub/muency/distanceestimator.html浮雕, 参考 John C.Russ 数字图像处理

33TODO

Example 35. Newton fractal

To solve the complex equation f(z)=0, Newton's iterative formula zk+1=zk-f(zk)/f '(zk) is commonly used for
approximation of the zero point. When iterating
generation to |zk+1 -zk| is smaller than a given error threshold r (e.g., = 0.000001) for the first time, a
Newton fractal image is generated. In this example, we will introduce the Newton fractal production method
through the Newton iteration of the complex equation z4+z3-1=0.
I. Calculate the iteration format
1. Open the "Complex Fractal Generation Platform".
2. Call the "z^k" of the [operation tool] to calculate the horizontal and vertical coordinates of z4 and z3
respectively. "z^2" calculates the horizontal and vertical coordinates of z2 z^2" calculates the horizontal
and vertical coordinates of z2.
3. Calculate the horizontal and vertical coordinates of f (z)= z4+z3-1 and f '(z)=4z3+3z2 using the "Data"
menu.
4. Calculate the horizontal and vertical coordinates x÷, y÷ of z-f(z)/f'(z) by using the operation tools
"z[1]÷z[2]" and "z[1]-z[2]".
Build the iterative image to find the escape threshold mode em and escape time et
1. Call the judgment tool "N-p exponential number, p transformation point M, T [x[$], y[$]]", match x÷, y÷
to get
point M, T.
2. Make an iteration of depth n-1: xz→xM, yz→yM, p0→p0+p, and change r=0.00001.
3. Use the tool "et(eT), em(eM) [iteration image EM, ET]" to match the iteration images of points M and T
successively.
to get et and em.
Third, scan line coloring
1. Call the coloring tool "N set coloring parameters HSV [et, em, point]", match et, em successively, get H,
S, V,
S, V.
2. Use "HSV coloring" tool to color the pixel Pixel, edit the parameters xz and yz to xPixel and yPixel.
After editing parameters xz and yz as xPixel and yPixel, apply a color shift to the horizontal scan line,
double-click parameter H, and change the first "+" sign to "*" sign.
3. After the test scan, use the "preview viewfinder" to position and zoom in so that the center is located
at the point (-0.43302, 0.47737).
The scanning range was set to (-1.46541, 0.95985)~(0.59938,0), n=100, and the points H, S, and V were
adjusted at the same time until satisfied.
Save it as "Example 35 [N set z^4+z^3-1= 0]" and scan the figure below.

Newton fractal has a beautiful "necklace" structure, which provides abundant material for the creation of fractal art graphics. From the previous experience, we know that the secondary processing of fractal art graphics, that is, the application of different special effects to fractals. The fractal art graphics can be derived from different effects. In this example, the Newton iteration of the complex equation zk+1=0 will be used to introduce the Newton fractal. This example will introduce the special effects treatment of Newton fractal through the Newton iteration of the complex equation zk+1=0. I. Newton fractal for the complex equation zk+1=0 1. Open the "complex fractal generation platform", change the label and value of the parameter "θ" to "k-1". 2. Call the format tool "z^k" to calculate the horizontal and vertical coordinates of zk and z k-1 respectively. 3. Calculate the horizontal and vertical coordinates of f (z)= zk+1 and f '(z)=kzk-1 using the "Data" menu. 4. Use the formatting tools "z[1]÷z[2]" and "z[1]-z[2]" to calculate the horizontal and vertical coordinates of z-f(z)/f'(z) x -, y-. 5. Call the judgment tool "N-p exponential number, p-transformation point M, T [x[$], y[$]]", match x -, y- to get the point M, T. 6. Make iterations of depth n-1: xz→xM, yz→yM, p0→p0+p, and change r=0.00001. 7. Use the tool "et(eT), em(eM) [iteration image EM, ET]" to match the iteration images of points M and T successively. Get et, em. 8. Call the coloring tool "N set coloring parameter HSV [et, em, point]", match et, em successively, get H, S, V; use "N set coloring parameter HSV [et, em, point]", match et, em successively, get H, S, V, S, V; use the "HSV coloring" tool to color the pixel Pixel, edit the parameters xz, yz to xPixel, yPixel. Apply a color shift to the horizontal scan line. 9. Set the scan range to (-2,2)~(2,-2), n=100, k=4, and adjust the points H, S, and V in the test scan until satisfied, V, until satisfied, save as "Example 36 [N set z^4+1= 0]", and scan the following figure.

36II. Format of the algorithm for constructing special effects The algorithm of recoloring w by combining the initial point z of a complex iteration and the image f(w) under a complex transformation of w. The algorithm is used to realize the effect processing of Newton fractal. The common effect processing complex transformations f(w) are. 1. "Chinese knot". xz=xw2+ yw2,yz=2xw*yw 2. "Net structure". xz=sin(2xw+ 2yw),yz= cos(2xw-2yw) 3. Moebius transformation: z = (αw+β)/(γw+δ) 4. Complex transformation. z=w±w -1 It is also possible to use the composite transform of these transforms as special effects to deal with the complex transform. The specific method of constructing the fractal is. 1. Calculate the horizontal and vertical coordinates of f(w) and plot the point f(w). 2. Merge the initial point z of the Newton iteration (i.e., the pixel point Pixel) into the point f(w). 3. Color the point w, and then color, trace, and scan the scan line. The following diagram shows the "net" processing of the Newton fractal with z4+1=0.

36.1Third Order Network

36.2The following figures show the "first-order Chinese knot" processing of the Newton fractal with z4+1=0 and z6+1=0, respectively.

36.416

16

16

16

16

16

16

Example 41. Point trap scanning algorithm for J\M set

The principle of the point trap algorithm for J\M set
is: Let the point column z0=z,z1,z2,... ,zk,... Let the color parameter s 1= q0, when |zk-#|≥q0, the color
parameter sk=sk-1, when |zk-# |sk=|zk-#| when |zk-#| less than q0 (i.e., zk falls into the trap). The final
value of the iteration of sk is associated with the coloring parameter, so that the scanned fractal map is
the point trap J\M set.

Generally, by changing the definition of the distance |z-#|, you can also make the point trap into other complex shapes such as star, flower, etc. For example, change |z-#|= 3 | x 2 | + | y 2 | , z z d=1, delete id, S, calculate s= | 2 ⋅ e #- 1|, apply grayscale coloring to the pixel with s as the parameter, and change the color to Save it as "Example 41.2 [Octagonal point trap J set].gsp" and trace the scan to get the following figure: Octagonal point trap J set.

41.2 Octagonal point trap J set.Open the file "Example 41.1 [Spherical point trap J set].gsp", right click to edit xc, yc as 0.2xPixel, 0.2yPixel, change xz=0, yz=0, n=50; double click to edit |z-#| as abs(1-sqrt( xz^2+ yz^2)), change the denominator 4 in H to 7, change the factor of e# in S to 9, change the exponent in V to 0.05, reapply the color transformation to the scan line, increase the length of the scan frame appropriately, and trace the scan to the left figure below; if you then double-click to edit p, make it increase by a factor (1-ifid), and scan to the right figure below (File: Example 41.3 [Circular point trap M set]. gsp).

41.3 Circular point trap M setOpen the file "Example 41.1 [Spherical point trap J set].gsp", double click to edit |z-#|=5*(xz^2+yz^2)^1.1 * abs(0.5-( xz^2+yz^2)^0.25) Change the denominator 4 in H to 7, change the coefficient of e# in S to 150, change the index in V to 0.3, change xz and yz to 0.15xPixel and 0.15yPixel, change d=0.0042, xc=-0.9, yc=0, n=62, adjust the length of the scan window appropriately, and save it as "Example 41.4 [One ring, one ball gsp", and scan the following figure.

41.4 Circular point trap M setOpen the file "Example 41.1 [Spherical Point Trap J Set].gsp", double click to edit |z-#|= (xz^2+yz^2)^0.95* abs(1-(((xz-0.53)^2+(yz-0.08)^2)^0.15)* abs(1-(( xz+0.53)^2+(yz+0.08)^2)^0.15), add a factor (1-id0) to p, change the denominator 4 to 9 in H, change the coefficient of e# to 3000 in S, change the exponent to 0.5 in V, change xz and yz to 0.125xPixel and 0.125yPixel, change d=0.0003 and xc=-0.8, yc=-0.16, n=134, adjust the length of the scan window appropriately, and save it as "Example 41.5 [Two rings and one ball with different trap points J set] .gsp".

41.5 Two rings and one ball with different trap points J set 1617

44 Fractal Superposition and Embedding

Fractal superposition involves the embedding of fractals within shapes. When the embedded shapes are also fractals, it results in a multi-fractal. I. Using the endpoint eM of an iterative path for fractal superposition The two images below depict the Mandelbrot set overlaid onto the complement of the Sierpinski triangle (left image) and a double fractal along the boundary (right image). The procedure is as follows: 1. Define point z and the equilateral triangle L'R'C with center 0. Construct three inner equilateral triangles centered at points 1, 2, and 3 (as shown below) and calculate the interior values int1, int2, and int3 for point z with respect to these triangles. 2. Apply transformations L'D→L'R', DR'→L'R', FE→L'R' to point z to get transformation points STransf1, STransf2, STransf3, and subsequently, apply an inner iteration transformation to obtain point Z. Hide all points between STransf1 and STransf3. 3. Set new parameters n' = 3 and t = 0, compute T = t + int1 + int2 + int3, draw a horizontal ray, and plot point T0 with a value of t on the ray. 4. After a complete iteration with depth n for z→Z and t→T, create the iterative image endpoint eM and the endpoint eT of point T0. Measure the positional value of eT on the horizontal ray as et'. Calculate s' = sgn(1 - sgn(et' - n' + 1)). 5. Open the file "Example 29.1 [M Set Distance Estimate].gsp," copy the left two columns of parameters and metric values from the scanning box, paste them to the right of the upper image, display the x-axis, and plot points G and H with values -0.3 and -3. 6.1. Utilize the "Similarity Transformation (point-point, no flip)" tool, switch z to eM in script view, create point eM concerning the transformation 0D→GH, merge pixel points into Stransf[]. For point eM concerning the interior value int of triangle DEF, edit k = 0.003 + 0.1 * (et'/7)^2, calculate s = s' * (1 - int) + sdem * int. Use s as a parameter for grayscale coloring of point z and apply color transformation to scanning lines. Set n = 40, r = 8, and trace the scan to obtain the image on the previous page (left image). 6.2. If points eM are transformed respectively by transformations 1F→GH, 2E→GH, 3C→GH to get transformation points Stransf11, Stransf12, Stransf13 and measure their coordinates. Use the "Polygon Interior Value" tool to calculate the interior values int11, int12, int13 for point eM concerning the three equilateral triangles centered at points 1, 2, 3. Calculate x = int11 * xStransf11 + int12 * xStransf12 + int13 * xStransf13, y = int11 * yStransf11 + int12 * yStransf12 + int13 * yStransf13. Edit xc = x + 0.00001, yc = y, delete pixel points, edit k = 0.005 * 2.5^n', calculate s = 1 - sdem * ext, use s as a parameter for grayscale coloring of point z and apply color transformation to scanning lines. Set n = 40, r = 8, n' = 2, and trace the scan to obtain the image on the previous page (right image).

1920

21

22

Thanks for @ The Coding Train to let me know the p5.js.

Thanks for the origin author to write this book.