Mandelbrot set: Difference between revisions
m
Used partial antialiasing for boundary detection and made some truncations.
m (Finally, basic iteration count and edge detection were added) |
m (Used partial antialiasing for boundary detection and made some truncations.) |
||
Line 7,981:
'''Smoothing, Normalization and Distance Estimation'''
This is a translation of the corresponding Python section: see there for more explanations. The ''e^(-|z|)-smoothing'', ''normalized iteration count'' and ''exterior distance estimation'' algorithms are used. Partial antialiasing is used for boundary detection.
<syntaxhighlight lang="julia">using Plots
gr(aspect_ratio=:equal, axis=true, ticks=true, legend=false, dpi=200)
Line 8,005:
heatmap(S .^ 0.1, c=:balance)
savefig("Mandelbrot_set_1.png")
N = abs.(Z) .>= r # normalized iteration count
Line 8,013 ⟶ 8,010:
heatmap(T .^ 0.1, c=:balance)
savefig("
N = abs.(Z) .> 2 # exterior distance estimation
Line 8,019 ⟶ 8,016:
heatmap(D .^ 0.1, c=:balance)
savefig("
N = D .> 0 # boundary detection with partial antialiasing
D[N] = 0.005 .- min.(D[N], 0.005)
heatmap(
savefig("
'''Normal Map Effect and Stripe Average Coloring'''
Line 10,956:
'''Smoothing, Normalization and Distance Estimation'''
The Mandelbrot set is printed with smooth colors. The ''e^(-|z|)-smoothing'', ''normalized iteration count'' and ''exterior distance estimation'' algorithms are used with NumPy and complex matrices (see Javier Barrallo & Damien M. Jones: [http://www.mi.sanu.ac.rs/vismath/javier/index.html ''Coloring Algorithms for Dynamical Systems in the Complex Plane''] and
<syntaxhighlight lang="python">import numpy as np
import matplotlib.pyplot as plt
Line 10,979:
plt.imshow(S ** 0.1, cmap=plt.cm.twilight_shifted, origin="lower")
plt.savefig("Mandelbrot_set_1.png", dpi=200)
N = abs(Z) >= r # normalized iteration count
Line 10,987 ⟶ 10,984:
plt.imshow(T ** 0.1, cmap=plt.cm.twilight_shifted, origin="lower")
plt.savefig("
N = abs(Z) > 2 # exterior distance estimation
Line 10,993 ⟶ 10,990:
plt.imshow(D ** 0.1, cmap=plt.cm.twilight_shifted, origin="lower")
plt.savefig("
N = D > 0 # boundary detection with partial antialiasing
D[N] = 0.005 - np.minimum(D[N], 0.005)
plt.imshow(
plt.savefig("
'''Normal Map Effect and Stripe Average Coloring'''
|