E++ExpSmoothting { ; by Edgar Malinovsky ; based on bunch of different ideas from REB, LDM and LKM to Fractal Explorer and my own. ; 17.07.2012 global: int iter=@iternum IF (iter >= #maxiter) iter=#maxiter - 1 ENDIF complex imagine = #e*(0,1) float minuse = - #e init: complex sum = (0, 0) float result=0.0 float zmax=-1 float cabsz=0.0 float lnz=0.0 int cnt=0 float oldcabsz = 0.0 float data = 0 loop: IF (cnt<= iter) ;calculates first iterations ; pre function and trap center. IF (@prefn == 0) cabsz= cabs( #z +@posneg) ELSEIF (@prefn == 1) cabsz= cabs( real(#z)- imag(#z) +@posneg) ELSEIF (@prefn == 2) cabsz= cabs( real(#z)* imag(#z) +@posneg) ELSEIF (@prefn == 3) cabsz= cabs( real(#z)% (imag(#z) +1E-20) +@posneg) ELSEIF (@prefn == 4) cabsz= |#z +@posneg| ENDIF ;finding max z. IF (@expdim == TRUE) lnz=exp(-cabsz) IF (lnz > zmax) zmax = lnz ENDIF ENDIF ; some normalisation for insides => small value. IF (@calculation == 2) cabsz =cnt/iter*0.25 + cabsz ELSE cabsz =cnt/iter + cabsz ENDIF cnt=cnt+1 ;now smoothing and convergent/divergent or both. IF (@calculation == 0) data = -cabsz - @darkness ELSEIF (@calculation == 1) data = oldcabsz - cabsz - @darkness ELSEIF (@calculation == 2) data= -abs( recip(oldcabsz -cabsz)- cabsz) - @darkness ENDIF ;summ of exponents IF (@exponentype == "Eulers Number") sum = exp(data) + sum ELSEIF (@exponentype == "Negative E") sum = minuse^(data) + sum ELSEIF (@exponentype == "Imaginary E") sum = (imagine)^(data) + sum ELSEIF (@exponentype == "Free exponent") sum = @base^(data) + sum ENDIF oldcabsz = cabsz ENDIF final: ;only real positive numbers are of use result=abs(real(sum)) IF (@expdim == TRUE) result=result/(1+ zmax) ENDIF IF (@postfn==0) ;nothing ELSEIF (@postfn==1) result=cos(#pi*result)+result*0.5 ELSEIF (@postfn==2) result=cos(result) ELSEIF (@postfn==3) result=sqr(sin(#pi*result)) ELSEIF (@postfn==4) result=sin(result) ELSEIF (@postfn==5) result=result*0.5 + 0.5/result ELSEIF (@postfn==6) result=tanh(result) ELSEIF (@postfn==7) result= abs( result -round(result) ) ENDIF IF (@pallete==false) #color = rgb(result, result, result) ELSE #color = gradient(result) ENDIF default: title = "E++ExpSmoothting" param posneg caption = "Add to pixel value" default = (0, 0) hint = "The same as trap center. Adding number diverses negative Z areas and marks -n with dots. Say 2 marks all pixels where z=-2 with dots (technicaly zeroes)." endparam param iternum caption="Use first N iterations" default=7770000 min=1 hint="Specify the iteration cycle at which colouring is applied. Using just few first iterations would make fractal much smoother." endparam param expdim caption = "Fractal dimension smoothing" default = FALSE hint = "Divides colour value by max inverse exponent. Sometimes generates smoother result, with a kalisets can generate sharper patterns." endparam heading caption = "Info" text = "Trying to make more advanced version of exponent smoothing;)" endheading param darkness caption = "Darkness" default = 0.0 hint="Adds value to inverse exponent. Positive value decreases detail density, negative increases." endparam param calculation caption = "Formula type" enum = "Mandelbrot type" "Newton type" "Magnet type" default = 0 hint = "Uses different formulas originaly intended for different fractal types based on bailout options: convergent, divergent and both (magnet). Should work with both." endparam param exponentype caption = "Exponent Base" enum = "Eulers Number" "Negative E" "Imaginary E" "Free exponent" default = 0 hint = "Exponent base used to calculate colours. Normal exponent function is single curve thus generating smooth gradient. Negative and imaginary exponents are wave functions thus generating waved colour gradient. Non default exponents could cease to work in deep zooms." endparam param base caption = "Exponent Base" default = (-2,2) hint="Base for inverse exponent. Negative and imaginary values works differently than real. The larger number the least would be colour density." visible = (@exponentype == "free exponent") endparam param pallete caption = "Use Gradient" default=true hint= "Without gradient shows greyscale image as is calculated. Value 0 is black colour and >= 1 is white." endparam param prefn caption = "Pre Function" enum = "1 None" "2 X-Y" "3 X*Y" "4 remainder of X/Y" "5 X*X+Y*Y" default = 0 hint= "Pre function applied before colour calculations. Strongly changes colour pattern." endparam param postfn caption = "Transfer Function" enum = "1- None" "2- Half Cosine" "3- Cosine" "4- Haversine" "5- Sine" "6- DoubleEdged" "7- Hyperbolic Tangent" "8- Solarisation" default = 0 hint= "The same as built in colour transfer, but with additional functions." endparam }