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")
 
heatmap(T .^ 0.1, c=:balance)
savefig("Mandelbrot_set_2.png")
 
N = abs.(Z) .>= r # normalized iteration count
Line 8,013 ⟶ 8,010:
 
heatmap(T .^ 0.1, c=:balance)
savefig("Mandelbrot_set_3Mandelbrot_set_2.png")
 
N = abs.(Z) .> 2 # exterior distance estimation
Line 8,019 ⟶ 8,016:
 
heatmap(D .^ 0.1, c=:balance)
savefig("Mandelbrot_set_4Mandelbrot_set_3.png")
 
N = D .> 0 # boundary detection with partial antialiasing
D[N] = 0.005 .- min.(D[N], 0.005)
 
heatmap((0 .< D) .& (D^ 1.< 0.005), c=:binary)
savefig("Mandelbrot_set_5Mandelbrot_set_4.png")</syntaxhighlight>
 
'''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 MikaelArnaud Hvidtfeldt ChristensenChéritat: [httphttps://blogwww.hvidtfeldtsmath.netuniv-toulouse.fr/~cheritat/wiki-draw/index.php/2011/09/distance-estimated-3d-fractals-v-the-mandelbulb-different-de-approximationsMandelbrot_set#Boundary_detection_methods_via_distance_estimators ''DistanceBoundary Estimateddetection 3Dmethods Fractalsvia (V): The Mandelbulb & Different DEdistance Approximationsestimators'']).
<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)
 
plt.imshow(T ** 0.1, cmap=plt.cm.twilight_shifted, origin="lower")
plt.savefig("Mandelbrot_set_2.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("Mandelbrot_set_3Mandelbrot_set_2.png", dpi=200)
 
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("Mandelbrot_set_4Mandelbrot_set_3.png", dpi=200)
 
N = D > 0 # boundary detection with partial antialiasing
D[N] = 0.005 - np.minimum(D[N], 0.005)
 
plt.imshow((0 < D) & (D <** 1.0.005), cmap=plt.cm.binary, origin="lower")
plt.savefig("Mandelbrot_set_5Mandelbrot_set_4.png", dpi=200)</syntaxhighlight>
 
'''Normal Map Effect and Stripe Average Coloring'''
305

edits