E++ExpSmoothting { ; by Edgar Malinovsky 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 zmin=1e20 float zmax=-1 float cabsz=0.0 float lnz=0.0 int cnt=0 complex eproduct = (0,0) float oldcabsz = 0.0 float data = 0 loop: IF (cnt<= iter) ;calculates first iterations cabsz= cabs(#z+@posneg) IF (@expdim == TRUE) lnz=exp(-cabsz) ;finding min and max z. IF (lnz < zmin) zmin = lnz ENDIF IF (lnz > zmax) zmax = lnz ENDIF ENDIF ; some inside normalisation cabsz =cnt/iter + cabsz cnt=cnt+1 ;now negative, smoothing and convergent/divergent. IF (@calculation == 0) data = -cabsz - @darkness ELSEIF (@calculation == 1) data = oldcabsz - cabsz - @darkness ENDIF ;exponentiation IF (@exponentype == "Eulers Number") eproduct = e^(data) ELSEIF (@exponentype == "Negative E") eproduct = minuse^(data) ELSEIF (@exponentype == "Imaginary E") eproduct = (imagine)^(data) ELSEIF (@exponentype == "Free exponent") eproduct = @base^(data) ENDIF ;summ of all iterations sum= eproduct + sum oldcabsz = cabsz ENDIF final: ;only real positive numbers are of use result=abs(real(sum)) IF (@expdim == TRUE) result=result/(1+zmax-zmin) 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) 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=0 hint="Specify the iteration cycle at which colouring is applied." endparam param expdim caption = "Fractal dimension smoothing" default = FALSE hint = "Divides colour value by fractal dimension. Sometimes generates smoother result." 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. Makes less colour density." endparam param calculation caption = "Type" enum = "Mandelbrot type" "Newton type" default = 0 endparam param exponentype caption = "Used Exponent" enum = "Eulers Number" "Negative E" "Imaginary E" "Free exponent" default = 0 endparam param pallete caption = "Use Gradient" default=true hint= "Don't use gradient and built in transfer functions, hence shows as it is. Resulting number 0 is black colour and 1 is white." endparam param base caption = "Exponent Base" default = (-2,2) hint="Base for inverse exponent. Negative and imaginary values works differently than real." visible = (@exponentype == "free exponent") endparam param postfn caption = "Post Function" enum = "1- None" "2- Half Cosine" "3- Cosine" "4- Haversine" "5- Sine" "6- DoubleEdged" "7- Hyperbolic Tangent" default = 0 endparam }