Mandelbrot set: Difference between revisions
→Distance Estimation, Normal Maps, Mercator Maps and Perturbation Theory: Improved readability
(→Distance Estimation, Normal Maps, Mercator Maps and Deep Zoom: Improved readability and speed) |
(→Distance Estimation, Normal Maps, Mercator Maps and Perturbation Theory: Improved readability) |
||
Line 6,567:
===Distance Estimation, Normal Maps, Mercator Maps and Perturbation Theory ===
This is a translation of the corresponding Python section. The Mandelbrot set is represented by distance estimation and normal maps using complex matrices (cf. Arnaud Chéritat:
<syntaxhighlight lang="julia">using Plots
gr(aspect_ratio=:equal, axis=true, ticks=true, legend=false, dpi=200)
Line 6,574:
n, r = 200, 500 # number of iterations and escape radius (r > 2)
height, angle = 1.5, 45 # height factor
v = exp(angle / 180 * pi * im) # unit 2D vector in this direction
Line 6,583:
C = (2.0 + 1.0im) .* (A' .+ B .* im) .- 0.5
Z, dZ, ddZ
D, T = zeros(size(C)), zeros(size(C))
Line 6,599:
N = abs.(Z) .> 2 # normal map (potential function)
U
T[N] = max.(((real.(U
heatmap(T .^ 1.0, c=:grays)
Line 6,606:
N = abs.(Z) .> 2 # normal map (distance estimation)
ZN, dZN, ddZN = Z[N], dZ[N], ddZ[N]
T[N] = max.(((real.(U) .* real.(v) .+ imag.(U) .* imag.(v)) ./ abs.(U) .+ height) ./ (1 .+ height), 0)
heatmap(T .^ 1.0, c=:grays)
|