comment { Coloring methods by Andreas Lober based on an Arithmetic-Geometric-Mean property. Last update on August 05, 2000, 21:00 For the latest version of this file go to: http://formulas.ultrafractal.com http://www.aartika.freewire.co.uk/lober/mseries and look for the Download Area under "Various Artists" or just type http://www.aartika.freewire.co.uk/lober/mseries/akl-m.zip or mail to abmlober@t-online.de resp. andreas.lober@sap.com Newest updates: all colourings got new options: * masking in different modes requested by Emily Garlick (Queri) and Angela Wilczynski (Wizzle) - their images are worth every hour spent with work on my formulas - inspired by Mark Townsend's masking with some good ideas from Michèle Dessureault * combinable textures inspired by Mark Townsend's texturing in the fBm Popcorn Trap realized with code containing ideas from Mark Townsend's Gnarl and Popcorn and Samuel Monnier's SFBM and some ideas of my own * cut out feature to determine regions that can be masked and do not have to be calculated * Loop Turnaround Mode for a kind of tiling and a Loop Randomness for scratching the shapes * I tried to give all the formulas the same look and feel so that techniques learned with one formula can be applied to the other ones. } agm { ; ; AGM means "Arithmetic Geometric Mean". ; AM and GM are normally different. ; But if they are iterated on their ; new values, they begin to come ; nearer and nearer... ; ; let AM_n be AM(AM_(n-1),GM_(n-1)) ; Then you have ; lim (AM(AM_n,GM_n) - GM(AM_n,GM_n)) = 0 ; ; All the AGM colourings measure the "n" ; when the above number series are near ; a certain small value called epsilon... ; ; Andreas Lober, July 30, 2000 ; init: bool no_spare = true if (@spareMode > 0) float spareVert = real(@sparePoint) float spareHori = imag(@sparePoint) complex pixpix = #pixel float rePix = 0 float imPix = 0 if (@spareMode <= 18) if (@spareRot%360 != 0) complex rotCentre = @sparePoint if (@spareMode > 12 && @spareMode < 19) rotCentre = (@sparePoint+@sparePoint2)/2 endif pixpix = (pixpix-rotCentre)*exp(-1i*#pi*@spareRot/180) + rotCentre endif rePix = real(pixpix) imPix = imag(pixpix) endif if (@spareMode <= 12) if (@spareMode == 1 || @spareMode == 5 || @spareMode == 6 \ || @spareMode == 9 || @spareMode == 10) ; upper upper+right upper+left ; upper&right upper&left if (imPix >= spareHori) if (@spareMode == 9) if (rePix < spareVert) no_spare = false endif elseif (@spareMode == 10) if (rePix >= spareVert) no_spare = false endif else no_spare = false endif endif elseif (@spareMode == 2 || @spareMode == 7 || @spareMode == 8 \ || @spareMode == 11 || @spareMode == 12) ; lower lower+right lower+left ; lower&right lower&left if (imPix < spareHori) if (@spareMode == 11) if (rePix < spareVert) no_spare = false endif elseif (@spareMode == 12) if (rePix >= spareVert) no_spare = false endif else no_spare = false endif endif endif if (@spareMode == 3 || @spareMode == 5 || @spareMode == 7) ; left upper+left lower+left if (rePix < spareVert) no_spare = false endif elseif (@spareMode == 4 || @spareMode == 6 || @spareMode == 8) ; right upper+right lower+right if (rePix >= spareVert) no_spare = false endif endif elseif (@spareMode <= 18) float rePnt = real(@sparePoint2) float imPnt = imag(@sparePoint2) float upper = imPnt float lower = spareHori float left = spareVert float right = rePnt if (imPnt < spareHori) upper = spareHori lower = imPnt endif if (spareVert > rePnt) left = rePnt right = spareVert endif if (@spareMode == 13) ; inside rect if (rePix > left && rePix < right && imPix > lower && imPix < upper) no_spare = false endif elseif (@spareMode == 14) ; outside rect if (rePix < left || rePix > right || imPix < lower || imPix > upper) no_spare = false endif elseif (@spareMode == 15) ; inside vert if (rePix > left && rePix < right) no_spare = false endif elseif (@spareMode == 16) ; outside vert if (rePix < left || rePix > right) no_spare = false endif elseif (@spareMode == 17) ; inside hori if (imPix > lower && imPix < upper) no_spare = false endif elseif (@spareMode == 18) ; outside hori if (imPix < lower || imPix > upper) no_spare = false endif endif elseif (@spareMode <= 20) float radiusOFCutCircle = cabs(@sparePoint-@sparePoint2) if (@spareMode == 19) ; inside circle if (cabs(#pixel-@sparePoint) < radiusOFCutCircle) no_spare = false endif elseif (@spareMode == 20) ; outside circle if (cabs(#pixel-@sparePoint) > radiusOFCutCircle) no_spare = false endif endif endif ; spareMode > 12 endif ; @spareMode > 0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; float testAngle1 = #pi/@corte1 float testAngle2 = 3*testAngle1 complex rotAngle1 = @corte2*1i*testAngle1 complex rotAngle2 = @corte2*1i*testAngle2 complex zStart = #pixel if (@turnMode) complex zRound = 0 complex zZ = zStart if (@turnScale != 0) complex zRound = round(zStart*@turnScale)/@turnScale complex zZ = zStart-zRound endif float targ = atan2(zZ) ; "Turn around" part taken from Sam if (abs(targ) < testAngle1) zStart = zZ*exp(rotAngle1)+zRound elseif (abs(targ) > testAngle2) zStart = zZ*exp(rotAngle2)+zRound endif endif ; @turnMode complex ar = |real(@fn1(zStart))| complex ge = |imag(@fn2(zStart))| complex arit = 0 complex geom = 0 int iter = 0 bool do_loop = TRUE loop: if (no_spare) if (do_loop) iter = iter +1 ; Calculate new values of arithmetical ; and geometrical mean arit = (ar+ge)/2.0 geom = sqrt(ar*ge) ; give these values back ; for the next loop-run ar = arit ge = geom ; stop the loop if (|@fkt(ar)-@fkt(ge)| < @epsilon/@granulation || \ iter > @maxIter*@granulation) do_loop = FALSE endif endif endif ; no_spare final: if (no_spare) float temp = iter/@granulation float mask = 0 bool no_mask = true zStart = #z if (@masking > 0) if (@maskType == 0) ; Index mask = temp elseif (@maskType == 1) ; Re z mask = real(zStart) elseif (@maskType == 2) ; Im z mask = imag(zStart) elseif (@maskType == 3) ; Angle mask = atan2(zStart)/(2*#pi) if mask < 0 mask = mask + 1 endif mask = mask*360 elseif (@maskType == 4) ; Iteration mask = iter elseif (@maskType == 5) ; Re Mixel mask = real(zStart+#pixel)/2 elseif (@maskType == 6) ; Im Mixel mask = imag(zStart+#pixel)/2 elseif (@maskType == 7) ; Abs Mixel mask = cabs(zStart+#pixel)/2 elseif (@maskType == 8) ; Dist(z,Pixel) mask = cabs(zStart-#pixel) elseif (@maskType == 9) ; |z| mask = cabs(zStart) endif endif if (@masking == 1) ; Lower if (mask < @threshold_l) #solid = true no_mask = false endif elseif (@masking == 2) ; Upper if (mask > @threshold_u) #solid = true no_mask = false endif elseif (@masking == 3) ; Between if (mask > @threshold_l && mask < @threshold_u) #solid = true no_mask = false endif elseif (@masking == 4) ; Outside if (mask < @threshold_l || mask > @threshold_u) #solid = true no_mask = false endif else no_mask = true endif if (no_mask) float to_index = real(@trf(temp)) if (@colour_limit != 0) to_index = to_index%@colour_limit endif if (@f_randomness != 0) to_index = to_index + @f_randomness * real(#random) endif complex _zz = zStart if (@base4txtr == 1) _zz = #pixel elseif (@base4txtr == 2) _zz = (#pixel+_zz)/2 elseif (@base4txtr == 3) _zz = abs(#pixel-_zz) elseif (@base4txtr == 4) _zz = cabs(#pixel-_zz) endif if (@txtr_gnarl != 0) complex zGnarl = _zz zGnarl = zGnarl-trunc(zGnarl*@txtr_gnarl_scale)/@txtr_gnarl_scale if (@txtr_gnarl_size != 0 && @txtr_gnarl_size != 1) zGnarl = zGnarl/@txtr_gnarl_size endif if (@reachThrough) _zz = zGnarl endif float x = real(zGnarl) float y = imag(zGnarl) float xOld = 0 int iter3 = @txtr_gnarl_octaves while (iter3 > 0) iter3 = iter3-1 xOld = x x = x - sin(y + sin(y)) y = y - sin(xOld + sin(xOld)) endwhile float textureGnarl = 0 if (@txtr_gnarl_type == 0) textureGnarl = abs(x) elseif (@txtr_gnarl_type == 1) textureGnarl = abs(x)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_gnarl_type == 2) textureGnarl = abs(x-y) elseif (@txtr_gnarl_type == 3) textureGnarl = abs(x-y)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_gnarl_type == 4) textureGnarl = abs(x+y)/2 elseif (@txtr_gnarl_type == 5) textureGnarl = abs(x*y)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_gnarl_type == 6) textureGnarl = atan2(x+1i*y)/(2*#pi) if (textureGnarl < 0) textureGnarl = textureGnarl + 1 endif elseif (@txtr_gnarl_type == 7) textureGnarl = sqrt(x^2+y^2) endif if (@txtr_Gnarl_limit != 0) textureGnarl = textureGnarl%@txtr_Gnarl_limit endif to_index = to_index + @txtr_gnarl*textureGnarl endif if (@txtr_PopCorn != 0) complex zPopCorn = _zz zPopCorn = zPopCorn-trunc(zPopCorn*@txtr_PopCorn_scale)/@txtr_PopCorn_scale if (@txtr_PopCorn_size != 0 && @txtr_PopCorn_size != 1) zPopCorn = zPopCorn/@txtr_PopCorn_size endif if (@reachThrough) _zz = zPopCorn endif float x = real(zPopCorn) float y = imag(zPopCorn) float xOld = 0 int iter3 = @txtr_PopCorn_octaves while (iter3 > 0) iter3 = iter3-1 xOld = x x = x - sin(y + log(y + cos(y))) y = y - sin(xOld + log(xOld + cos(xOld))) endwhile float texturePopCorn = 0 if (@txtr_PopCorn_type == 0) texturePopCorn = abs(x) elseif (@txtr_PopCorn_type == 1) texturePopCorn = abs(x)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_PopCorn_type == 2) texturePopCorn = abs(x-y) elseif (@txtr_PopCorn_type == 3) texturePopCorn = abs(x-y)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_PopCorn_type == 4) texturePopCorn = abs(x+y)/2 elseif (@txtr_PopCorn_type == 5) texturePopCorn = abs(x*y)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_PopCorn_type == 6) texturePopCorn = atan2(x+1i*y)/(2*#pi) if (texturePopCorn < 0) texturePopCorn = texturePopCorn + 1 endif elseif (@txtr_PopCorn_type == 7) texturePopCorn = sqrt(x^2+y^2) endif if (@txtr_PopCorn_limit != 0) texturePopCorn = texturePopCorn%@txtr_PopCorn_limit endif to_index = to_index + @txtr_PopCorn*texturePopCorn endif if (@txtr_SFBM != 0) float mod = 1 float d1 = 0 float d2 = 0 float d3 = 0 float d4 = 0 float nindex = 0 float textureSFBM = 0 float scale = 0 cr1 = 0 cr2 = 0 cr3 = 0 cr4 = 0 float crp1 = 0 float crp2 = 0 float crp3 = 0 float crp4 = 0 complex tv1 = 0 complex tv2 = 0 complex tv3 = 0 complex tv4 = 0 complex seed = @txtr_SFBM_seed rotAngleFBM = exp(1i*pi/180*@txtr_SFBM_rot) if (@txtr_SFBM_scaledis == 4) ; min textureSFBM = 1e20 elseif (@txtr_SFBM_scaledis == 5) ; max textureSFBM = -1e20 endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; complex zSFBM = _zz zSFBM = zSFBM-trunc(zSFBM*@txtr_SFBM_scale)/@txtr_SFBM_scale if (@txtr_SFBM_size != 0 && @txtr_SFBM_size != 1) zSFBM = zSFBM/@txtr_SFBM_size endif if (@reachThrough) _zz = zSFBM endif int iter3 = 0 complex ttmp = 0 while (iter3 < @txtr_SFBM_octaves) scale = @txtr_SFBM_magn^iter3 zSFBM = zSFBM*rotAngleFBM iter3 = iter3 + 1 if @txtr_SFBM_mod == 1 mod = sqrt(iter3) endif zc = round(scale*_zz)/scale zc1 = zc + (.5,.5)/scale zc2 = zc + (-.5,.5)/scale zc3 = zc + (.5,-.5)/scale zc4 = zc + (-.5,-.5)/scale ttmp = seed/(mod*zc1+124), cr1 = ttmp-floor(ttmp) ttmp = seed/(mod*zc2+124), cr2 = ttmp-floor(ttmp) ttmp = seed/(mod*zc3+124), cr3 = ttmp-floor(ttmp) ttmp = seed/(mod*zc4+124), cr4 = ttmp-floor(ttmp) if (@txtr_SFBM_mode == 0) tv1 = (zSFBM - zc1)*scale tv2 = (zSFBM - zc2)*scale tv3 = (zSFBM - zc3)*scale tv4 = (zSFBM - zc4)*scale crp1 = real(cr1)*real(tv1) + imag(cr1)*imag(tv1) crp2 = real(cr2)*real(tv2) + imag(cr2)*imag(tv2) crp3 = real(cr3)*real(tv3) + imag(cr3)*imag(tv3) crp4 = real(cr4)*real(tv4) + imag(cr4)*imag(tv4) endif ttmp = zSFBM - zc d1 = real(ttmp)*scale + 0.5 d2 = 1 - d1 d3 = imag(ttmp)*scale + 0.5 d4 = 1 - d3 if (@txtr_SFBM_power != 1) d1 = d1^@txtr_SFBM_power d2 = d2^@txtr_SFBM_power d3 = d3^@txtr_SFBM_power d4 = d4^@txtr_SFBM_power endif if @txtr_SFBM_mode == 0 nindex = 10 + crp1*d1*d3 + crp3*d1*d4 + crp2*d2*d3 + crp4*d2*d4 elseif @txtr_SFBM_mode == 1 nindex = cabs(cr1*d1*d3 + cr3*d1*d4 + cr2*d2*d3 + cr4*d2*d4) endif if (@txtr_SFBM_scaledis == 0) textureSFBM = textureSFBM + nindex/scale elseif (@txtr_SFBM_scaledis == 1) textureSFBM = textureSFBM + nindex/sqrt(scale) elseif (@txtr_SFBM_scaledis == 2) textureSFBM = textureSFBM + nindex/(scale^(1/scale)) elseif (@txtr_SFBM_scaledis == 3) textureSFBM = textureSFBM + nindex/iter3 elseif (@txtr_SFBM_scaledis == 4) if (nindex < textureSFBM) textureSFBM = nindex endif elseif (@txtr_SFBM_scaledis == 5) if (nindex > textureSFBM) textureSFBM = nindex endif endif endwhile if (@txtr_SFBM_limit != 0) textureSFBM = textureSFBM%@txtr_SFBM_limit endif to_index = to_index + @txtr_SFBM*textureSFBM endif if (@txtr_primes != 0) complex zPrimes = _zz zPrimes = zPrimes-trunc(zPrimes*@txtr_Primes_scale)/@txtr_Primes_scale if (@txtr_Primes_size != 0 && @txtr_Primes_size != 1) zPrimes = zPrimes/@txtr_Primes_size endif if (@reachThrough) _zz = zPrimes endif float texturePrimes = 0 float trz = 0 float tiz = 0 float t_rz = 0 float t_iz = 0 float tstartSnip = 10^@txtr_primes_where2start float tendOfSnip = 10^(@txtr_primes_where2start+@txtr_primes_lengthOfSnip) if (@txtr_primes_mode == 0) trz = |real(zPrimes)| tiz = |imag(zPrimes)| elseif (@txtr_primes_mode == 1) trz = |real(zPrimes)| tiz = trz elseif (@txtr_primes_mode == 2) tiz = |imag(zPrimes)| trz = tiz elseif (@txtr_primes_mode == 3) trz = |zPrimes| tiz = trz elseif (@txtr_primes_mode == 4) trz = atan2(zPrimes) if (trz < 0) trz = trz + 2*#pi endif tiz = trz elseif (@txtr_primes_mode == 5) trz = real(atan(zPrimes)) if (trz < 0) trz = trz + 2*#pi endif tiz = imag(atan(zPrimes)) if (tiz < 0) tiz = tiz + 2*#pi endif elseif (@txtr_primes_mode == 6) trz = atan2(zPrimes) if (trz < 0) trz = trz + 2*#pi endif tiz = |zPrimes| endif t_rz = (trz - trunc(trz*tstartSnip)/tstartSnip)*tendOfSnip t_iz = (tiz - trunc(tiz*tstartSnip)/tstartSnip)*tendOfSnip if (@txtr_primes_withFinalTrunc) t_rz = trunc(t_rz) t_iz = trunc(t_iz) endif texturePrimes = 10*((t_rz%821) + (t_iz%823))/1644 if (@txtr_Primes_limit != 0) texturePrimes = texturePrimes%@txtr_Primes_limit endif to_index = to_index + @txtr_Primes*texturePrimes endif ; @txtr_primes != 0 if (@txtr_Gauss != 0) complex zGauss = _zz zGauss = zGauss-trunc(zGauss*@txtr_Gauss_scale)/@txtr_Gauss_scale if (@txtr_Gauss_size != 0 && @txtr_Gauss_size != 1) zGauss = zGauss/@txtr_Gauss_size endif if (@reachThrough) _zz = zGauss endif float textureGauss = 0 float t_d = cabs(zGauss) float t_r = real(zGauss) float t_i = imag(zGauss) if (@txtr_Gauss_type == 0) textureGauss = t_d elseif (@txtr_Gauss_type == 1) textureGauss = |t_r| elseif (@txtr_Gauss_type == 2) textureGauss = |t_i| elseif (@txtr_Gauss_type == 3) textureGauss = |t_i-t_r| elseif (@txtr_Gauss_type == 4) textureGauss = |t_i*t_r| elseif (@txtr_Gauss_type == 5) textureGauss = |t_i/t_r| elseif (@txtr_Gauss_type == 6) if (|t_i| < |t_r|) textureGauss = |t_i| else textureGauss = |t_r| endif elseif (@txtr_Gauss_type == 7) if (|t_i| > |t_r|) textureGauss = |t_i| else textureGauss = |t_r| endif elseif (@txtr_Gauss_type == 8) textureGauss = atan2(zGauss)/(2*#pi) if textureGauss < 0 textureGauss = textureGauss + 1 endif elseif (@txtr_Gauss_type == 9) textureGauss = (|t_i|+|t_r|+t_d)/3 elseif (@txtr_Gauss_type == 10) textureGauss = (|t_i|*|t_r|*t_d)^(1/3) endif if (@txtr_Gauss_limit != 0) textureGauss = textureGauss%@txtr_Gauss_limit endif to_index = to_index + @txtr_Gauss*textureGauss endif #index = to_index endif ; no_mask else if (@spareMask) #solid = true endif endif ; no_spare default: title = "AGM #1 (Arithm. Geom. Mean)" param epsilon caption = "epsilon" default = 0.001 min = 0.0 endparam param granulation caption = "Granulation" default = 1.0 min = 0.0001 endparam param maxIter caption = "Maximum Iterations" default = 60 min = 1 endparam param colour_limit caption = "Colour Limitation" default = 0.0 min = 0.0 max = 400.0 endparam param turnMode caption = "L: Turnaround Mode" default = false endparam param turnScale caption = "L: Turn Scale" default = 1.0 min = 0.0 endparam param corte1 caption = "L: Turnaround #1" default = 4.0 endparam param corte2 caption = "L: Turnaround #2" default = 2.0 endparam param l_randomness caption = "L: Randomness" hint = "This adds a randomness in the outlines." default = 0.0 endparam param f_randomness caption = "T: Random Texture" hint = "This adds a random texture the the coloring." default = 0.0 endparam param base4txtr caption = "Texture Base" enum = "Z" "Pixel" "Mixel" "Diff(Z,Pixel)" "Dist(Z,Pixel)" default = 0 endparam param reachThrough caption = "T: Reach Through Scales" default = false hint = "Reaches the Scale and Pattern Size from one \ Texture to the next. Every Texture changes all \ that follow." endparam param txtr_gnarl caption = "T: Gnarl Texture" hint = "This adds a Gnarl texture the the coloring." default = 0.0 endparam param txtr_gnarl_type caption = "T: Gnarl Type" enum = "x" "x/d" "x-y" "(x-y)/d" "(x+y)/2" "x*y/d" "Angle" "d" default = 0 endparam param txtr_gnarl_scale caption = "T: Gnarl Scale" hint = "Scaling Factor for this Gnarl texture." default = 1.0 endparam param txtr_gnarl_size caption = "T: Gnarl Pattern Size" default = 1.0 endparam param txtr_gnarl_limit caption = "T: Gnarl Limitation" default = 0.0 min = 0.0 endparam param txtr_gnarl_octaves caption = "T: Gnarl Octaves" default = 5 min = 1 endparam param txtr_PopCorn caption = "T: PopCorn Texture" hint = "This adds a PopCorn texture the the coloring." default = 0.0 endparam param txtr_PopCorn_type caption = "T: PopCorn Type" enum = "x" "x/d" "x-y" "(x-y)/d" "(x+y)/2" "x*y/d" "Angle" "d" default = 0 endparam param txtr_PopCorn_scale caption = "T: PopCorn Scale" hint = "Scaling Factor for this PopCorn texture." default = 1.0 endparam param txtr_PopCorn_size caption = "T: PopCorn Pattern Size" default = 1.0 endparam param txtr_PopCorn_limit caption = "T: PopCorn Limitation" default = 0.0 min = 0.0 endparam param txtr_PopCorn_octaves caption = "T: PopCorn Octaves" default = 5 min = 1 endparam param txtr_SFBM caption = "T: SFBM Texture" hint = "This adds a SFBM texture to the coloring." default = 0.0 endparam param txtr_SFBM_mode caption = "T: SFBM Noise type" default = 1 enum = "Perlin's" "Raw... (Sam's)" endparam param txtr_SFBM_scale caption = "T: SFBM Scale" hint = "Scaling Factor for this SFBM texture." default = 1.0 endparam param txtr_SFBM_scaledis caption = "T: SFBM Scale Distribution" default = 0 enum = "1/scale" "1/sqrt(scale)" "Fancy" "1/i" endparam param txtr_SFBM_size caption = "T: SFBM Pattern Size" default = 0.1 endparam param txtr_SFBM_magn caption = "T: SFBM Magnification Step" default = 1.2 endparam param txtr_SFBM_limit caption = "T: SFBM Limitation" default = 0.0 min = 0.0 endparam param txtr_SFBM_rot caption = "T: SFBM Rotation Step" default = 28.0 endparam param txtr_SFBM_power caption = "T: SFBM Power" default = 1.0 endparam param txtr_SFBM_mod caption = "Vary Random Numbers?" default = 1 enum = "No" "Use sqrt(i)" endparam param txtr_SFBM_seed caption = "T: SFBM Seed" default = 123094 endparam param txtr_SFBM_octaves caption = "T: SFBM Octaves" default = 5 min = 1 endparam param txtr_Primes caption = "T: Primes Texture" hint = "This adds a Primes texture to the coloring." default = 0.0 endparam param txtr_Primes_scale caption = "T: Primes Scale" hint = "Scaling Factor for this Primes texture." default = 1.0 endparam param txtr_Primes_size caption = "T: Primes Pattern Size" default = 0.5 endparam param txtr_primes_withFinalTrunc caption = "With Final Truncation" default = TRUE endparam param txtr_primes_where2start caption = "T: Start of Snip" default = 1 min = 0 endparam param txtr_primes_lengthOfSnip caption = "T: Length of Snip" default = 1 min = 1 endparam param txtr_primes_Mode caption = "T: Primes Mode" enum = "Real,Imag" "Real" "Imag" "|z|" "Angle" "Angel" "Polar" default = 5 endparam param txtr_primes_limit caption = "T: Primes Limitation" default = 0.0 min = 0.0 endparam param txtr_Gauss caption = "T: Gauss Texture" hint = "This adds a Gauss texture to the coloring." default = 0.0 endparam param txtr_Gauss_type caption = "T: Gauss Type" enum = "d" "x" "y" "x-y" "x*y" "y/x" "min x,y" "max x,y" "Angle" \ "Pyth. am" "Pyth. gm" default = 0 endparam param txtr_Gauss_scale caption = "T: Gauss Scale" hint = "Scaling Factor for this Gauss texture." default = 1.0 endparam param txtr_Gauss_size caption = "T: Gauss Pattern Size" default = 1.0 endparam param txtr_Gauss_limit caption = "T: Gauss Limitation" default = 0.0 min = 0.0 endparam param masking caption = "Masking" enum = "None" "Lower" "Upper" "Between" "Outside" default = 0 endparam param maskType caption = "Mask Type" enum = "Index" "Re z" "Im z" "Angle" "Iteration" \ "Re Mixel" "Im Mixel" "Abs Mixel" \ "Dist(z,Pixel)" "|z|" default = 0 endparam param threshold_l caption = "Lower Mask Threshold" default = 0.5 endparam param threshold_u caption = "Upper Mask Threshold" default = 1.0 endparam param spareMode caption = "Cut Out" enum = "None" "Upper" "Lower" \ "Left" "Right" \ "Upper + Left" "Upper + Right" "Lower + Left" "Lower + Right" \ "Upper & Left" "Upper & Right" "Lower & Left" "Lower & Right" \ "Inside Rectangle" "Outside Rectangle" \ "Between Vertical" "Outside Vertical" \ "Between Horizontal" "Outside Horizontal" \ "Inside Circle" "Outside Circle" default = 0 endparam param sparePoint caption = "Line of Cut, 1. Point" default = (0,0) endparam param sparePoint2 caption = "Add. Point/Line for Cut" default = (1,1) endparam param spareRot caption = "Rotate Cut" default = 0.0 min = -90.0 max = 90.0 endparam param spareMask caption = "Mask Cut" default = true endparam func fkt caption = "Test Function" default = ident() endfunc func trf caption = "Transfer Function" default = ident() endfunc func fn1 caption = "Real Part Init Function" default = ident() endfunc func fn2 caption = "Imag Part Init Function" default = ident() endfunc } ; agm agm2 { ; ; AGM means "Arithmetic Geometric Mean". ; AM and GM are normally different. ; But if they are iterated on their ; new values, they begin to come ; nearer and nearer... ; ; let AM_n be AM(AM_(n-1),GM_(n-1)) ; Then you have ; lim (AM(AM_n,GM_n) - GM(AM_n,GM_n)) = 0 ; ; All the AGM colourings measure the "n" ; when the above number series are near ; a certain small value called epsilon... ; ; Andreas Lober, July 30, 2000 ; init: bool no_spare = true if (@spareMode > 0) float spareVert = real(@sparePoint) float spareHori = imag(@sparePoint) complex pixpix = #pixel float rePix = 0 float imPix = 0 if (@spareMode <= 18) if (@spareRot%360 != 0) complex rotCentre = @sparePoint if (@spareMode > 12 && @spareMode < 19) rotCentre = (@sparePoint+@sparePoint2)/2 endif pixpix = (pixpix-rotCentre)*exp(-1i*#pi*@spareRot/180) + rotCentre endif rePix = real(pixpix) imPix = imag(pixpix) endif if (@spareMode <= 12) if (@spareMode == 1 || @spareMode == 5 || @spareMode == 6 \ || @spareMode == 9 || @spareMode == 10) ; upper upper+right upper+left ; upper&right upper&left if (imPix >= spareHori) if (@spareMode == 9) if (rePix < spareVert) no_spare = false endif elseif (@spareMode == 10) if (rePix >= spareVert) no_spare = false endif else no_spare = false endif endif elseif (@spareMode == 2 || @spareMode == 7 || @spareMode == 8 \ || @spareMode == 11 || @spareMode == 12) ; lower lower+right lower+left ; lower&right lower&left if (imPix < spareHori) if (@spareMode == 11) if (rePix < spareVert) no_spare = false endif elseif (@spareMode == 12) if (rePix >= spareVert) no_spare = false endif else no_spare = false endif endif endif if (@spareMode == 3 || @spareMode == 5 || @spareMode == 7) ; left upper+left lower+left if (rePix < spareVert) no_spare = false endif elseif (@spareMode == 4 || @spareMode == 6 || @spareMode == 8) ; right upper+right lower+right if (rePix >= spareVert) no_spare = false endif endif elseif (@spareMode <= 18) float rePnt = real(@sparePoint2) float imPnt = imag(@sparePoint2) float upper = imPnt float lower = spareHori float left = spareVert float right = rePnt if (imPnt < spareHori) upper = spareHori lower = imPnt endif if (spareVert > rePnt) left = rePnt right = spareVert endif if (@spareMode == 13) ; inside rect if (rePix > left && rePix < right && imPix > lower && imPix < upper) no_spare = false endif elseif (@spareMode == 14) ; outside rect if (rePix < left || rePix > right || imPix < lower || imPix > upper) no_spare = false endif elseif (@spareMode == 15) ; inside vert if (rePix > left && rePix < right) no_spare = false endif elseif (@spareMode == 16) ; outside vert if (rePix < left || rePix > right) no_spare = false endif elseif (@spareMode == 17) ; inside hori if (imPix > lower && imPix < upper) no_spare = false endif elseif (@spareMode == 18) ; outside hori if (imPix < lower || imPix > upper) no_spare = false endif endif elseif (@spareMode <= 20) float radiusOFCutCircle = cabs(@sparePoint-@sparePoint2) if (@spareMode == 19) ; inside circle if (cabs(#pixel-@sparePoint) < radiusOFCutCircle) no_spare = false endif elseif (@spareMode == 20) ; outside circle if (cabs(#pixel-@sparePoint) > radiusOFCutCircle) no_spare = false endif endif endif ; spareMode > 12 endif ; @spareMode > 0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; float _dist = 0 float _rdist = 0 float _idist = 0 float _tdist = 0 float _cdist = 0 float _qdist = 0 float _rd = 0 float _id = 0 float _min_dist = 1e20 float _max_dist = -1 float _min_rdist = 1e20 float _max_rdist = -1 float _min_idist = 1e20 float _max_idist = -1 float _min_tdist = 1e20 float _max_tdist = -1 float _min_cdist = 1e20 float _max_cdist = -1 float _min_qdist = 1e20 float _max_qdist = -1 float temp = -1 ; ; Traps ; bool _do_trap = true float _trap = 0.01 bool _do_rtrap = true float _rtrap = 0.01 bool _do_itrap = true float _itrap = 0.01 bool _do_ttrap = true float _ttrap = 0.01 bool _do_ctrap = true float _ctrap = 0.01 ; ; Sums ; float _sum = 0 float _rsum = 0 float _isum = 0 float _tsum = 0 float _csum = 0 float _qsum = 0 ; ; Weighted Sums ; float _sum_w = 0 float _rsum_w = 0 float _isum_w = 0 float _tsum_w = 0 float _csum_w = 0 float _qsum_w = 0 ; ; Square-Weighted Sums ; float _sum_w2 = 0 float _rsum_w2 = 0 float _isum_w2 = 0 float _tsum_w2 = 0 float _csum_w2 = 0 float _qsum_w2 = 0 complex ar = |real(@fn1(#pixel))| complex ge = |imag(@fn2(#pixel))| complex arit = 0 complex geom = 0 complex _zz = #pixel int iter = 0 bool do_loop = TRUE int l_coord = @coordLoop int koord = @coord complex zStart = 0 float testAngle1 = #pi/@corte1 float testAngle2 = 3*testAngle1 complex rotAngle1 = @corte2*1i*testAngle1 complex rotAngle2 = @corte2*1i*testAngle2 loop: if (no_spare) if (do_loop) iter = iter +1 ; Calculate new values of arithmetical ; and geometrical mean arit = (ar+ge)/2.0 geom = sqrt(ar*ge) ; give these values back ; for the next loop-run ar = arit ge = geom ; stop the loop if (|@fkt(ar)-@fkt(ge)| < @epsilon/@granulation || \ iter > @maxIter*@granulation) do_loop = FALSE endif if (_zz != 0) _zz = _zz^iter + 1/_zz ; endif if (@pure) _zz = _zz + #pixel endif endif if (@init_z == 0) zStart = #z elseif (@init_z == 1) zStart = zStart + #z elseif (@init_z == 2) zStart = zStart + #z/iter elseif (@init_z == 3) zStart = zStart + #z/iter^2 elseif (@init_z == 4) zStart = zStart + #z + #pixel elseif (@init_z == 5) zStart = abs(#pixel - #z) elseif (@init_z == 6) zStart = (#pixel + #z)/2 endif; int loop_i = 0 while (loop_i < l_coord) loop_i = loop_i + 1 if (@coordMode == 1) ; cyclic koord = (koord+1)%19 endif if (koord == 1) zStart = cabs(zStart) + 1i*atan2(zStart) elseif (koord == 2) float rad = cabs(zStart) float phi = atan2(zStart) zStart = rad*(sinh(phi) + 1i*cosh(phi)) elseif (koord == 3) float rad = cabs(zStart) float phi = atan2(zStart) zStart = rad*(asin(phi) + 1i*acos(phi)) elseif (koord == 4) float rad = cabs(zStart) float phi = atan2(zStart) zStart = rad*(asinh(phi) + 1i*acosh(phi)) elseif (koord == 5) zStart = real(sin(zStart)) + 1i*cos(zStart) elseif (koord == 6) zStart = real(sinh(zStart)) + 1i*cosh(zStart) elseif (koord == 7) zStart = real(asin(zStart)) + 1i*acos(zStart) elseif (koord == 8) zStart = real(asinh(zStart)) + 1i*acosh(zStart) elseif (koord == 9) zStart = abs(zStart) + conj(zStart)/(|zStart|+1e-20) elseif (koord >= 10 && koord <= 19) if (zStart != 0) float rad = cabs(zStart) float re = real(zStart)/rad float im = imag(zStart)/rad if (koord == 10) zStart = re*zStart + im*conj(zStart) elseif (koord == 11) zStart = re*zStart + im*flip(zStart) elseif (koord == 12) zStart = re*sin(zStart) + im*cos(zStart) elseif (koord == 13) zStart = re*sin(zStart) + 1i*im*cos(zStart) elseif (koord == 14) zStart = re*asin(zStart) + im*acos(zStart) elseif (koord == 15) zStart = re*asin(zStart) + 1i*im*acos(zStart) elseif (koord == 16) zStart = re*sinh(zStart) + im*cosh(zStart) elseif (koord == 17) zStart = re*sinh(zStart) + 1i*im*cosh(zStart) elseif (koord == 18) zStart = re*asinh(zStart) + im*acosh(zStart) elseif (koord == 19) zStart = re*asinh(zStart) + 1i*im*acosh(zStart) endif endif endif endwhile ; Schleife über die Koordinaten if (@turnMode) complex zRound = 0 complex zZ = zStart if (@turnScale != 0) complex zRound = round(zStart*@turnScale)/@turnScale complex zZ = zStart-zRound endif float targ = atan2(zZ) ; "Turn around" part taken from Sam if (abs(targ) < testAngle1) zStart = zZ*exp(rotAngle1)+zRound elseif (abs(targ) > testAngle2) zStart = zZ*exp(rotAngle2)+zRound endif endif ; @turnMode zStart = @startFct(zStart) if (@l_randomness != 0) zStart = zStart + @l_randomness * #random endif ; ; Calculate distances ; _dist = cabs(_zz - zStart) _rd = real(_zz - zStart) _id = imag(_zz - zStart) _rdist = abs(_rd) _idist = abs(_id) if _rd > _id _tdist = _rdist _cdist = _idist if _id == 0 _qdist = _rdist else _qdist = _rdist / _idist endif else _tdist = _idist _cdist = _rdist if _rd == 0 _qdist = _idist else _qdist = _idist / _rdist endif endif ; ; Calculate Min ; if @_mode == 0 && _dist < _min_dist _min_dist = _dist endif if @_mode == 1 && _rdist < _min_rdist _min_rdist = _rdist endif if @_mode == 2 && _idist < _min_idist _min_idist = _idist endif if @_mode == 3 && _tdist < _min_tdist _min_tdist = _tdist endif if @_mode == 4 && _tdist < _min_cdist _min_cdist = _cdist endif if @_mode == 29 && _qdist < _min_qdist _min_qdist = _qdist endif ; ; Calculate Max ; if @_mode == 5 && _dist > _max_dist _max_dist = _dist endif if @_mode == 6 && _rdist > _max_rdist _max_rdist = _rdist endif if @_mode == 7 && _rdist > _max_rdist _max_idist = _idist endif if @_mode == 8 && _tdist > _max_tdist _max_tdist = _tdist endif if @_mode == 9 && _cdist > _max_cdist _max_cdist = _cdist endif if @_mode == 30 && _qdist > _max_qdist _max_qdist = _qdist endif ; ; Calculate the traps ; if @_mode == 19 && _do_trap && _dist > @_trap_min && _dist < @_trap_max _do_trap = false _trap =_dist endif if @_mode == 20 && _do_rtrap && _rdist > @_trap_min && _rdist < @_trap_max _do_rtrap = false _rtrap =_rdist endif if @_mode == 21 && _do_itrap && _idist > @_trap_min && _idist < @_trap_max _do_itrap = false _itrap =_idist endif if @_mode == 22 && _do_ttrap && _tdist > @_trap_min && _tdist < @_trap_max _do_ttrap = false _ttrap =_tdist endif if @_mode == 23 && _do_ctrap && _cdist > @_trap_min && _cdist < @_trap_max _do_ctrap = false _ctrap =_cdist endif ; ; Calculate the sums ; if @_mode == 24 _sum = _sum + _dist endif if @_mode == 25 _rsum = _rsum + _rdist endif if @_mode == 26 _isum = _isum + _idist endif if @_mode == 27 _tsum = _tsum + _tdist endif if @_mode == 28 _csum = _csum + _cdist endif if @_mode == 31 _qsum = _qsum + _qdist endif ; ; Calculate the weighted sums ; if @_mode == 33 _sum_w = _sum_w + _dist/iter endif if @_mode == 34 _rsum_w = _rsum_w + _rdist/iter endif if @_mode == 35 _isum_w = _isum_w + _idist/iter endif if @_mode == 36 _tsum_w = _tsum_w + _tdist/iter endif if @_mode == 37 _csum_w = _csum_w + _cdist/iter endif if @_mode == 38 _qsum_w = _qsum_w + _qdist/iter endif ; ; Calculate the square-weighted sums ; if @_mode == 39 _sum_w2 = _sum_w2 + _dist/iter^2 endif if @_mode == 40 _rsum_w2 = _rsum_w2 + _rdist/iter^2 endif if @_mode == 41 _isum_w2 = _isum_w2 + _idist/iter^2 endif if @_mode == 42 _tsum_w2 = _tsum_w2 + _tdist/iter^2 endif if @_mode == 43 _csum_w2 = _csum_w2 + _cdist/iter^2 endif if @_mode == 44 _qsum_w2 = _qsum_w2 + _qdist/iter^2 endif endif ; no_spare final: if (no_spare) if @_mode == 0 temp = _min_dist ; "Min Dist" elseif @_mode == 1 temp = _min_rdist ; "Min Real" elseif @_mode == 2 temp = _min_idist ; "Min Imag" elseif @_mode == 3 temp = _min_tdist ; "Min Triang" elseif @_mode == 4 temp = _min_cdist ; "Min Cubus" elseif @_mode == 5 temp = _max_dist ; "Max Dist" elseif @_mode == 6 temp = _max_rdist ; "Max Real" elseif @_mode == 7 temp = _max_idist ; "Max Imag" elseif @_mode == 8 temp = _max_tdist ; "Max Triang" elseif @_mode == 9 temp = _max_cdist ; "Max Cubus" elseif @_mode == 10 temp = cabs(_zz - #pixel) ; "Act Dist" elseif @_mode == 11 temp = abs(real(_zz-#pixel)) ; "Act Real" elseif @_mode == 12 temp = abs(imag(_zz-#pixel)) ; "Act Imag" elseif @_mode == 13 temp = _dist ; "Last Dist" elseif @_mode == 14 temp = _rdist ; "Last Real" elseif @_mode == 15 temp = _idist ; "Last Imag" elseif @_mode == 16 temp = _tdist ; "Last Triang" elseif @_mode == 17 temp = _cdist ; "Last Cubus" elseif @_mode == 18 temp = abs(cabs(_zz)-cabs(#pixel)) ; "Difference" elseif @_mode == 19 temp = _trap ; "Trap Dist" elseif @_mode == 20 temp = _rtrap ; "Trap Real" elseif @_mode == 21 temp = _itrap ; "Trap Imag" elseif @_mode == 22 temp = _ttrap ; "Trap Triang" elseif @_mode == 23 temp = _ctrap ; "Trap Cubus" elseif @_mode == 24 temp = _sum ; "Sum Dist" elseif @_mode == 25 temp = _rsum ; "Sum Real" elseif @_mode == 26 temp = _isum ; "Sum Imag" elseif @_mode == 27 temp = _tsum ; "Sum Triang" elseif @_mode == 28 temp = _csum ; "Sum Cubus" elseif @_mode == 29 temp = _min_qdist ; "Min MinQuot" elseif @_mode == 30 temp = _max_qdist ; "Max MinQuot" elseif @_mode == 31 temp = _qsum ; "Sum MinQuot" elseif @_mode == 32 temp = _qdist ; "Last MinQuot" elseif @_mode == 33 temp = _sum_w elseif @_mode == 34 temp = _rsum_w elseif @_mode == 35 temp = _isum_w elseif @_mode == 36 temp = _tsum_w elseif @_mode == 37 temp = _csum_w elseif @_mode == 38 temp = _qsum_w elseif @_mode == 39 temp = _sum_w2 elseif @_mode == 40 temp = _rsum_w2 elseif @_mode == 41 temp = _isum_w2 elseif @_mode == 42 temp = _tsum_w2 elseif @_mode == 43 temp = _csum_w2 elseif @_mode == 44 temp = _qsum_w2 endif float mask = 0 bool no_mask = true if (@masking > 0) if (@maskType == 0) ; Index mask = temp elseif (@maskType == 1) ; Re z mask = real(zStart) elseif (@maskType == 2) ; Im z mask = imag(zStart) elseif (@maskType == 3) ; Angle mask = atan2(zStart)/(2*#pi) if mask < 0 mask = mask + 1 endif mask = mask*360 elseif (@maskType == 4) ; Iteration mask = iter elseif (@maskType == 5) ; Re Mixel mask = real(zStart+#pixel)/2 elseif (@maskType == 6) ; Im Mixel mask = imag(zStart+#pixel)/2 elseif (@maskType == 7) ; Abs Mixel mask = cabs(zStart+#pixel)/2 elseif (@maskType == 8) ; Dist(z,Pixel) mask = cabs(zStart-#pixel) elseif (@maskType == 9) ; |z| mask = cabs(zStart) endif endif if (@masking == 1) ; Lower if (mask < @threshold_l) #solid = true no_mask = false endif elseif (@masking == 2) ; Upper if (mask > @threshold_u) #solid = true no_mask = false endif elseif (@masking == 3) ; Between if (mask > @threshold_l && mask < @threshold_u) #solid = true no_mask = false endif elseif (@masking == 4) ; Outside if (mask < @threshold_l || mask > @threshold_u) #solid = true no_mask = false endif else no_mask = true endif if (no_mask) float to_index = real(@fkt(temp)) if (@base4txtr == 1) _zz = #pixel elseif (@base4txtr == 2) _zz = (#pixel+_zz)/2 elseif (@base4txtr == 3) _zz = abs(#pixel-_zz) elseif (@base4txtr == 4) _zz = cabs(#pixel-_zz) endif if (@colour_limit != 0) to_index = to_index%@colour_limit endif if (@f_randomness != 0) to_index = to_index + @f_randomness * real(#random) endif if (@txtr_gnarl != 0) complex zGnarl = _zz zGnarl = zGnarl-trunc(zGnarl*@txtr_gnarl_scale)/@txtr_gnarl_scale if (@txtr_gnarl_size != 0 && @txtr_gnarl_size != 1) zGnarl = zGnarl/@txtr_gnarl_size endif if (@reachThrough) _zz = zGnarl endif float x = real(zGnarl) float y = imag(zGnarl) float xOld = 0 int iter3 = @txtr_gnarl_octaves while (iter3 > 0) iter3 = iter3-1 xOld = x x = x - sin(y + sin(y)) y = y - sin(xOld + sin(xOld)) endwhile float textureGnarl = 0 if (@txtr_gnarl_type == 0) textureGnarl = abs(x) elseif (@txtr_gnarl_type == 1) textureGnarl = abs(x)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_gnarl_type == 2) textureGnarl = abs(x-y) elseif (@txtr_gnarl_type == 3) textureGnarl = abs(x-y)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_gnarl_type == 4) textureGnarl = abs(x+y)/2 elseif (@txtr_gnarl_type == 5) textureGnarl = abs(x*y)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_gnarl_type == 6) textureGnarl = atan2(x+1i*y)/(2*#pi) if (textureGnarl < 0) textureGnarl = textureGnarl + 1 endif elseif (@txtr_gnarl_type == 7) textureGnarl = sqrt(x^2+y^2) endif if (@txtr_Gnarl_limit != 0) textureGnarl = textureGnarl%@txtr_Gnarl_limit endif to_index = to_index + @txtr_gnarl*textureGnarl endif if (@txtr_PopCorn != 0) complex zPopCorn = _zz zPopCorn = zPopCorn-trunc(zPopCorn*@txtr_PopCorn_scale)/@txtr_PopCorn_scale if (@txtr_PopCorn_size != 0 && @txtr_PopCorn_size != 1) zPopCorn = zPopCorn/@txtr_PopCorn_size endif if (@reachThrough) _zz = zPopCorn endif float x = real(zPopCorn) float y = imag(zPopCorn) float xOld = 0 int iter3 = @txtr_PopCorn_octaves while (iter3 > 0) iter3 = iter3-1 xOld = x x = x - sin(y + log(y + cos(y))) y = y - sin(xOld + log(xOld + cos(xOld))) endwhile float texturePopCorn = 0 if (@txtr_PopCorn_type == 0) texturePopCorn = abs(x) elseif (@txtr_PopCorn_type == 1) texturePopCorn = abs(x)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_PopCorn_type == 2) texturePopCorn = abs(x-y) elseif (@txtr_PopCorn_type == 3) texturePopCorn = abs(x-y)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_PopCorn_type == 4) texturePopCorn = abs(x+y)/2 elseif (@txtr_PopCorn_type == 5) texturePopCorn = abs(x*y)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_PopCorn_type == 6) texturePopCorn = atan2(x+1i*y)/(2*#pi) if (texturePopCorn < 0) texturePopCorn = texturePopCorn + 1 endif elseif (@txtr_PopCorn_type == 7) texturePopCorn = sqrt(x^2+y^2) endif if (@txtr_PopCorn_limit != 0) texturePopCorn = texturePopCorn%@txtr_PopCorn_limit endif to_index = to_index + @txtr_PopCorn*texturePopCorn endif if (@txtr_SFBM != 0) float mod = 1 float d1 = 0 float d2 = 0 float d3 = 0 float d4 = 0 float nindex = 0 float textureSFBM = 0 float scale = 0 cr1 = 0 cr2 = 0 cr3 = 0 cr4 = 0 float crp1 = 0 float crp2 = 0 float crp3 = 0 float crp4 = 0 complex tv1 = 0 complex tv2 = 0 complex tv3 = 0 complex tv4 = 0 complex seed = @txtr_SFBM_seed rotAngleFBM = exp(1i*pi/180*@txtr_SFBM_rot) if (@txtr_SFBM_scaledis == 4) ; min textureSFBM = 1e20 elseif (@txtr_SFBM_scaledis == 5) ; max textureSFBM = -1e20 endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; complex zSFBM = _zz zSFBM = zSFBM-trunc(zSFBM*@txtr_SFBM_scale)/@txtr_SFBM_scale if (@txtr_SFBM_size != 0 && @txtr_SFBM_size != 1) zSFBM = zSFBM/@txtr_SFBM_size endif if (@reachThrough) _zz = zSFBM endif int iter3 = 0 complex ttmp = 0 while (iter3 < @txtr_SFBM_octaves) scale = @txtr_SFBM_magn^iter3 zSFBM = zSFBM*rotAngleFBM iter3 = iter3 + 1 if @txtr_SFBM_mod == 1 mod = sqrt(iter3) endif zc = round(scale*_zz)/scale zc1 = zc + (.5,.5)/scale zc2 = zc + (-.5,.5)/scale zc3 = zc + (.5,-.5)/scale zc4 = zc + (-.5,-.5)/scale ttmp = seed/(mod*zc1+124), cr1 = ttmp-floor(ttmp) ttmp = seed/(mod*zc2+124), cr2 = ttmp-floor(ttmp) ttmp = seed/(mod*zc3+124), cr3 = ttmp-floor(ttmp) ttmp = seed/(mod*zc4+124), cr4 = ttmp-floor(ttmp) if (@txtr_SFBM_mode == 0) tv1 = (zSFBM - zc1)*scale tv2 = (zSFBM - zc2)*scale tv3 = (zSFBM - zc3)*scale tv4 = (zSFBM - zc4)*scale crp1 = real(cr1)*real(tv1) + imag(cr1)*imag(tv1) crp2 = real(cr2)*real(tv2) + imag(cr2)*imag(tv2) crp3 = real(cr3)*real(tv3) + imag(cr3)*imag(tv3) crp4 = real(cr4)*real(tv4) + imag(cr4)*imag(tv4) endif ttmp = zSFBM - zc d1 = real(ttmp)*scale + 0.5 d2 = 1 - d1 d3 = imag(ttmp)*scale + 0.5 d4 = 1 - d3 if (@txtr_SFBM_power != 1) d1 = d1^@txtr_SFBM_power d2 = d2^@txtr_SFBM_power d3 = d3^@txtr_SFBM_power d4 = d4^@txtr_SFBM_power endif if @txtr_SFBM_mode == 0 nindex = 10 + crp1*d1*d3 + crp3*d1*d4 + crp2*d2*d3 + crp4*d2*d4 elseif @txtr_SFBM_mode == 1 nindex = cabs(cr1*d1*d3 + cr3*d1*d4 + cr2*d2*d3 + cr4*d2*d4) endif if (@txtr_SFBM_scaledis == 0) textureSFBM = textureSFBM + nindex/scale elseif (@txtr_SFBM_scaledis == 1) textureSFBM = textureSFBM + nindex/sqrt(scale) elseif (@txtr_SFBM_scaledis == 2) textureSFBM = textureSFBM + nindex/(scale^(1/scale)) elseif (@txtr_SFBM_scaledis == 3) textureSFBM = textureSFBM + nindex/iter3 elseif (@txtr_SFBM_scaledis == 4) if (nindex < textureSFBM) textureSFBM = nindex endif elseif (@txtr_SFBM_scaledis == 5) if (nindex > textureSFBM) textureSFBM = nindex endif endif endwhile if (@txtr_SFBM_limit != 0) textureSFBM = textureSFBM%@txtr_SFBM_limit endif to_index = to_index + @txtr_SFBM*textureSFBM endif if (@txtr_primes != 0) complex zPrimes = _zz zPrimes = zPrimes-trunc(zPrimes*@txtr_Primes_scale)/@txtr_Primes_scale if (@txtr_Primes_size != 0 && @txtr_Primes_size != 1) zPrimes = zPrimes/@txtr_Primes_size endif if (@reachThrough) _zz = zPrimes endif float texturePrimes = 0 float trz = 0 float tiz = 0 float t_rz = 0 float t_iz = 0 float tstartSnip = 10^@txtr_primes_where2start float tendOfSnip = 10^(@txtr_primes_where2start+@txtr_primes_lengthOfSnip) if (@txtr_primes_mode == 0) trz = |real(zPrimes)| tiz = |imag(zPrimes)| elseif (@txtr_primes_mode == 1) trz = |real(zPrimes)| tiz = trz elseif (@txtr_primes_mode == 2) tiz = |imag(zPrimes)| trz = tiz elseif (@txtr_primes_mode == 3) trz = |zPrimes| tiz = trz elseif (@txtr_primes_mode == 4) trz = atan2(zPrimes) if (trz < 0) trz = trz + 2*#pi endif tiz = trz elseif (@txtr_primes_mode == 5) trz = real(atan(zPrimes)) if (trz < 0) trz = trz + 2*#pi endif tiz = imag(atan(zPrimes)) if (tiz < 0) tiz = tiz + 2*#pi endif elseif (@txtr_primes_mode == 6) trz = atan2(zPrimes) if (trz < 0) trz = trz + 2*#pi endif tiz = |zPrimes| endif t_rz = (trz - trunc(trz*tstartSnip)/tstartSnip)*tendOfSnip t_iz = (tiz - trunc(tiz*tstartSnip)/tstartSnip)*tendOfSnip if (@txtr_primes_withFinalTrunc) t_rz = trunc(t_rz) t_iz = trunc(t_iz) endif texturePrimes = 10*((t_rz%821) + (t_iz%823))/1644 if (@txtr_Primes_limit != 0) texturePrimes = texturePrimes%@txtr_Primes_limit endif to_index = to_index + @txtr_Primes*texturePrimes endif ; @txtr_primes != 0 if (@txtr_Gauss != 0) complex zGauss = _zz zGauss = zGauss-trunc(zGauss*@txtr_Gauss_scale)/@txtr_Gauss_scale if (@txtr_Gauss_size != 0 && @txtr_Gauss_size != 1) zGauss = zGauss/@txtr_Gauss_size endif if (@reachThrough) _zz = zGauss endif float textureGauss = 0 float t_d = cabs(zGauss) float t_r = real(zGauss) float t_i = imag(zGauss) if (@txtr_Gauss_type == 0) textureGauss = t_d elseif (@txtr_Gauss_type == 1) textureGauss = |t_r| elseif (@txtr_Gauss_type == 2) textureGauss = |t_i| elseif (@txtr_Gauss_type == 3) textureGauss = |t_i-t_r| elseif (@txtr_Gauss_type == 4) textureGauss = |t_i*t_r| elseif (@txtr_Gauss_type == 5) textureGauss = |t_i/t_r| elseif (@txtr_Gauss_type == 6) if (|t_i| < |t_r|) textureGauss = |t_i| else textureGauss = |t_r| endif elseif (@txtr_Gauss_type == 7) if (|t_i| > |t_r|) textureGauss = |t_i| else textureGauss = |t_r| endif elseif (@txtr_Gauss_type == 8) textureGauss = atan2(zGauss)/(2*#pi) if textureGauss < 0 textureGauss = textureGauss + 1 endif elseif (@txtr_Gauss_type == 9) textureGauss = (|t_i|+|t_r|+t_d)/3 elseif (@txtr_Gauss_type == 10) textureGauss = (|t_i|*|t_r|*t_d)^(1/3) endif if (@txtr_Gauss_limit != 0) textureGauss = textureGauss%@txtr_Gauss_limit endif to_index = to_index + @txtr_Gauss*textureGauss endif #index = to_index endif ; no_mask else if (@spareMask) #solid = true endif endif ; no_spare default: title = "AGM #2 (Arithm. Geom. Mean)" param _mode caption = "Dist. Mode" enum = "Min Dist" "Min Real" "Min Imag" "Min Triang" "Min Cubus" \ "Max Dist" "Max Real" "Max Imag" "Max Triang" "Max Cubus" \ "Act Dist" "Act Real" "Act Imag" \ "Last Dist" "Last Real" "Last Imag" "Last Triang" "Last Cubus" \ "Difference" \ "Trap Dist" "Trap Real" "Trap Imag" "Trap Triang" "Trap Cubus" \ "Sum Dist" "Sum Real" "Sum Imag" "Sum Triang" "Sum Cubus" \ "Min MinQuot" "Max MinQuot" "Sum MinQuot" "Last MinQuot" \ "W-Sum Dist" "W-Sum Real" "W-Sum Imag" "W-Sum Triang" "W-Sum Cubus" \ "W^2-Sum Dist" "W^2-Sum Real" "W^2-Sum Imag" \ "W^2-Sum Triang" "W^2-Sum Cubus" endparam param coord caption = "Coordinates" enum = "Rectangular" \ "Polar" "PolarH" "aPolar" "aPolarH" \ "sin/cos" "sinh/cosh" "asin/acos" "asinh/acosh" \ "z/inv(z)" "z/conj(z)" "z/flip(z)" \ "?sin/cos" "?sin/i*cos" "?asin/acos" "?asin/i*acos" \ "?sinh/cosh" "?sinh/i*cosh" "?asinh/acosh" "?asinh/i*acosh" default = 0 endparam param coordLoop caption = "# Coord Loops" default = 1 min = 1 endparam param coordMode caption = "Mode Coord Loop" enum = "Static" "Dynamic" default = 0 endparam param _trap_min caption = "Lower Border for Trap" default = 1.0 min = 0.0 hint = "Only usefull with Traps" endparam param _trap_max caption = "Upper Border for Trap" default = 2.0 min = 0.0 hint = "Only usefull with Traps" endparam param epsilon caption = "epsilon" default = 0.1 min = 0.0 endparam param pure caption= "With Pixel Addition" default=TRUE endparam param granulation caption = "Granulation" default = 1.0 min = 0.0001 endparam param maxIter caption = "Maximum Iterations" default = 200 min = 1 endparam param colour_limit caption = "Colour Limitation" default = 0.0 min = 0.0 max = 400.0 endparam param init_z caption = "Z Initialisation" enum = "Always New" \ "Sum Up" "W-Sum Up" "W^2-Sum Up" \ "Summm" "Pixel" "Mixel" default = 0 endparam param turnMode caption = "L: Turnaround Mode" default = false endparam param turnScale caption = "L: Turn Scale" default = 1.0 min = 0.0 endparam param corte1 caption = "L: Turnaround #1" default = 4.0 endparam param corte2 caption = "L: Turnaround #2" default = 2.0 endparam param l_randomness caption = "L: Randomness" hint = "This adds a randomness in the outlines." default = 0.0 endparam param f_randomness caption = "T: Random Texture" hint = "This adds a random texture the the coloring." default = 0.0 endparam param base4txtr caption = "Texture Base" enum = "Z" "Pixel" "Mixel" "Diff(Z,Pixel)" "Dist(Z,Pixel)" default = 0 endparam param reachThrough caption = "T: Reach Through Scales" default = false hint = "Reaches the Scale and Pattern Size from one \ Texture to the next. Every Texture changes all \ that follow." endparam param txtr_gnarl caption = "T: Gnarl Texture" hint = "This adds a Gnarl texture the the coloring." default = 0.0 endparam param txtr_gnarl_type caption = "T: Gnarl Type" enum = "x" "x/d" "x-y" "(x-y)/d" "(x+y)/2" "x*y/d" "Angle" "d" default = 0 endparam param txtr_gnarl_scale caption = "T: Gnarl Scale" hint = "Scaling Factor for this Gnarl texture." default = 1.0 endparam param txtr_gnarl_size caption = "T: Gnarl Pattern Size" default = 1.0 endparam param txtr_gnarl_limit caption = "T: Gnarl Limitation" default = 0.0 min = 0.0 endparam param txtr_gnarl_octaves caption = "T: Gnarl Octaves" default = 5 min = 1 endparam param txtr_PopCorn caption = "T: PopCorn Texture" hint = "This adds a PopCorn texture the the coloring." default = 0.0 endparam param txtr_PopCorn_type caption = "T: PopCorn Type" enum = "x" "x/d" "x-y" "(x-y)/d" "(x+y)/2" "x*y/d" "Angle" "d" default = 0 endparam param txtr_PopCorn_scale caption = "T: PopCorn Scale" hint = "Scaling Factor for this PopCorn texture." default = 1.0 endparam param txtr_PopCorn_size caption = "T: PopCorn Pattern Size" default = 1.0 endparam param txtr_PopCorn_limit caption = "T: PopCorn Limitation" default = 0.0 min = 0.0 endparam param txtr_PopCorn_octaves caption = "T: PopCorn Octaves" default = 5 min = 1 endparam param txtr_SFBM caption = "T: SFBM Texture" hint = "This adds a SFBM texture to the coloring." default = 0.0 endparam param txtr_SFBM_mode caption = "T: SFBM Noise type" default = 1 enum = "Perlin's" "Raw... (Sam's)" endparam param txtr_SFBM_scale caption = "T: SFBM Scale" hint = "Scaling Factor for this SFBM texture." default = 1.0 endparam param txtr_SFBM_scaledis caption = "T: SFBM Scale Distribution" default = 0 enum = "1/scale" "1/sqrt(scale)" "Fancy" "1/i" endparam param txtr_SFBM_size caption = "T: SFBM Pattern Size" default = 0.1 endparam param txtr_SFBM_magn caption = "T: SFBM Magnification Step" default = 1.2 endparam param txtr_SFBM_limit caption = "T: SFBM Limitation" default = 0.0 min = 0.0 endparam param txtr_SFBM_rot caption = "T: SFBM Rotation Step" default = 28.0 endparam param txtr_SFBM_power caption = "T: SFBM Power" default = 1.0 endparam param txtr_SFBM_mod caption = "Vary Random Numbers?" default = 1 enum = "No" "Use sqrt(i)" endparam param txtr_SFBM_seed caption = "T: SFBM Seed" default = 123094 endparam param txtr_SFBM_octaves caption = "T: SFBM Octaves" default = 5 min = 1 endparam param txtr_Primes caption = "T: Primes Texture" hint = "This adds a Primes texture to the coloring." default = 0.0 endparam param txtr_Primes_scale caption = "T: Primes Scale" hint = "Scaling Factor for this Primes texture." default = 1.0 endparam param txtr_Primes_size caption = "T: Primes Pattern Size" default = 0.5 endparam param txtr_primes_withFinalTrunc caption = "With Final Truncation" default = TRUE endparam param txtr_primes_where2start caption = "T: Start of Snip" default = 1 min = 0 endparam param txtr_primes_lengthOfSnip caption = "T: Length of Snip" default = 1 min = 1 endparam param txtr_primes_Mode caption = "T: Primes Mode" enum = "Real,Imag" "Real" "Imag" "|z|" "Angle" "Angel" "Polar" default = 5 endparam param txtr_primes_limit caption = "T: Primes Limitation" default = 0.0 min = 0.0 endparam param txtr_Gauss caption = "T: Gauss Texture" hint = "This adds a Gauss texture to the coloring." default = 0.0 endparam param txtr_Gauss_type caption = "T: Gauss Type" enum = "d" "x" "y" "x-y" "x*y" "y/x" "min x,y" "max x,y" "Angle" \ "Pyth. am" "Pyth. gm" default = 0 endparam param txtr_Gauss_scale caption = "T: Gauss Scale" hint = "Scaling Factor for this Gauss texture." default = 1.0 endparam param txtr_Gauss_size caption = "T: Gauss Pattern Size" default = 1.0 endparam param txtr_Gauss_limit caption = "T: Gauss Limitation" default = 0.0 min = 0.0 endparam param masking caption = "Masking" enum = "None" "Lower" "Upper" "Between" "Outside" default = 0 endparam param maskType caption = "Mask Type" enum = "Index" "Re z" "Im z" "Angle" "Iteration" \ "Re Mixel" "Im Mixel" "Abs Mixel" \ "Dist(z,Pixel)" "|z|" default = 0 endparam param threshold_l caption = "Lower Mask Threshold" default = 0.5 endparam param threshold_u caption = "Upper Mask Threshold" default = 1.0 endparam param spareMode caption = "Cut Out" enum = "None" "Upper" "Lower" \ "Left" "Right" \ "Upper + Left" "Upper + Right" "Lower + Left" "Lower + Right" \ "Upper & Left" "Upper & Right" "Lower & Left" "Lower & Right" \ "Inside Rectangle" "Outside Rectangle" \ "Between Vertical" "Outside Vertical" \ "Between Horizontal" "Outside Horizontal" \ "Inside Circle" "Outside Circle" default = 0 endparam param sparePoint caption = "Line of Cut, 1. Point" default = (0,0) endparam param sparePoint2 caption = "Add. Point/Line for Cut" default = (1,1) endparam param spareRot caption = "Rotate Cut" default = 0.0 min = -90.0 max = 90.0 endparam param spareMask caption = "Mask Cut" default = true endparam func trf caption = "Transfer Function" default = ident() endfunc func fn1 caption = "Real Part Init Function" default = ident() endfunc func fn2 caption = "Imag Part Init Function" default = ident() endfunc func startFct caption = "Start Function" default = ident() endfunc func fkt caption = "Additional Function" default = recip() endfunc } ; agm2 agm3 { ; ; AGM means "Arithmetic Geometric Mean". ; AM and GM are normally different. ; But if they are iterated on their ; new values, they begin to come ; nearer and nearer... ; ; let AM_n be AM(AM_(n-1),GM_(n-1)) ; Then you have ; lim (AM(AM_n,GM_n) - GM(AM_n,GM_n)) = 0 ; ; All the AGM colourings measure the "n" ; when the above number series are near ; a certain small value called epsilon... ; ; Andreas Lober, July 30, 2000 ; init: bool no_spare = true if (@spareMode > 0) float spareVert = real(@sparePoint) float spareHori = imag(@sparePoint) complex pixpix = #pixel float rePix = 0 float imPix = 0 if (@spareMode <= 18) if (@spareRot%360 != 0) complex rotCentre = @sparePoint if (@spareMode > 12 && @spareMode < 19) rotCentre = (@sparePoint+@sparePoint2)/2 endif pixpix = (pixpix-rotCentre)*exp(-1i*#pi*@spareRot/180) + rotCentre endif rePix = real(pixpix) imPix = imag(pixpix) endif if (@spareMode <= 12) if (@spareMode == 1 || @spareMode == 5 || @spareMode == 6 \ || @spareMode == 9 || @spareMode == 10) ; upper upper+right upper+left ; upper&right upper&left if (imPix >= spareHori) if (@spareMode == 9) if (rePix < spareVert) no_spare = false endif elseif (@spareMode == 10) if (rePix >= spareVert) no_spare = false endif else no_spare = false endif endif elseif (@spareMode == 2 || @spareMode == 7 || @spareMode == 8 \ || @spareMode == 11 || @spareMode == 12) ; lower lower+right lower+left ; lower&right lower&left if (imPix < spareHori) if (@spareMode == 11) if (rePix < spareVert) no_spare = false endif elseif (@spareMode == 12) if (rePix >= spareVert) no_spare = false endif else no_spare = false endif endif endif if (@spareMode == 3 || @spareMode == 5 || @spareMode == 7) ; left upper+left lower+left if (rePix < spareVert) no_spare = false endif elseif (@spareMode == 4 || @spareMode == 6 || @spareMode == 8) ; right upper+right lower+right if (rePix >= spareVert) no_spare = false endif endif elseif (@spareMode <= 18) float rePnt = real(@sparePoint2) float imPnt = imag(@sparePoint2) float upper = imPnt float lower = spareHori float left = spareVert float right = rePnt if (imPnt < spareHori) upper = spareHori lower = imPnt endif if (spareVert > rePnt) left = rePnt right = spareVert endif if (@spareMode == 13) ; inside rect if (rePix > left && rePix < right && imPix > lower && imPix < upper) no_spare = false endif elseif (@spareMode == 14) ; outside rect if (rePix < left || rePix > right || imPix < lower || imPix > upper) no_spare = false endif elseif (@spareMode == 15) ; inside vert if (rePix > left && rePix < right) no_spare = false endif elseif (@spareMode == 16) ; outside vert if (rePix < left || rePix > right) no_spare = false endif elseif (@spareMode == 17) ; inside hori if (imPix > lower && imPix < upper) no_spare = false endif elseif (@spareMode == 18) ; outside hori if (imPix < lower || imPix > upper) no_spare = false endif endif elseif (@spareMode <= 20) float radiusOFCutCircle = cabs(@sparePoint-@sparePoint2) if (@spareMode == 19) ; inside circle if (cabs(#pixel-@sparePoint) < radiusOFCutCircle) no_spare = false endif elseif (@spareMode == 20) ; outside circle if (cabs(#pixel-@sparePoint) > radiusOFCutCircle) no_spare = false endif endif endif ; spareMode > 12 endif ; @spareMode > 0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; float _dist = 0 float _rdist = 0 float _idist = 0 float _tdist = 0 float _cdist = 0 float _qdist = 0 float _rd = 0 float _id = 0 float _min_dist = 1e20 float _max_dist = -1 float _min_rdist = 1e20 float _max_rdist = -1 float _min_idist = 1e20 float _max_idist = -1 float _min_tdist = 1e20 float _max_tdist = -1 float _min_cdist = 1e20 float _max_cdist = -1 float _min_qdist = 1e20 float _max_qdist = -1 float temp = -1 ; ; Traps ; bool _do_trap = true float _trap = 0.01 bool _do_rtrap = true float _rtrap = 0.01 bool _do_itrap = true float _itrap = 0.01 bool _do_ttrap = true float _ttrap = 0.01 bool _do_ctrap = true float _ctrap = 0.01 ; ; Sums ; float _sum = 0 float _rsum = 0 float _isum = 0 float _tsum = 0 float _csum = 0 float _qsum = 0 ; ; Weighted Sums ; float _sum_w = 0 float _rsum_w = 0 float _isum_w = 0 float _tsum_w = 0 float _csum_w = 0 float _qsum_w = 0 ; ; Square-Weighted Sums ; float _sum_w2 = 0 float _rsum_w2 = 0 float _isum_w2 = 0 float _tsum_w2 = 0 float _csum_w2 = 0 float _qsum_w2 = 0 complex ar = |real(@fn1(#pixel))| complex ge = |imag(@fn2(#pixel))| complex arit = 0 complex geom = 0 complex _zz = #pixel int iter = 0 bool do_loop = TRUE complex zStart = 0 int l_coord = @coordLoop int koord = @coord float testAngle1 = #pi/@corte1 float testAngle2 = 3*testAngle1 complex rotAngle1 = @corte2*1i*testAngle1 complex rotAngle2 = @corte2*1i*testAngle2 loop: if (no_spare) zStart = #z ; init zStart int loop_i = 0 while (loop_i < l_coord) loop_i = loop_i + 1 if (@coordMode == 1) ; cyclic koord = (koord+1)%19 endif if (koord == 1) zStart = cabs(zStart) + 1i*atan2(zStart) elseif (koord == 2) float rad = cabs(zStart) float phi = atan2(zStart) zStart = rad*(sinh(phi) + 1i*cosh(phi)) elseif (koord == 3) float rad = cabs(zStart) float phi = atan2(zStart) zStart = rad*(asin(phi) + 1i*acos(phi)) elseif (koord == 4) float rad = cabs(zStart) float phi = atan2(zStart) zStart = rad*(asinh(phi) + 1i*acosh(phi)) elseif (koord == 5) zStart = real(sin(zStart)) + 1i*cos(zStart) elseif (koord == 6) zStart = real(sinh(zStart)) + 1i*cosh(zStart) elseif (koord == 7) zStart = real(asin(zStart)) + 1i*acos(zStart) elseif (koord == 8) zStart = real(asinh(zStart)) + 1i*acosh(zStart) elseif (koord == 9) zStart = abs(zStart) + conj(zStart)/(|zStart|+1e-20) elseif (koord >= 10 && koord <= 19) if (zStart != 0) float rad = cabs(zStart) float re = real(zStart)/rad float im = imag(zStart)/rad if (koord == 10) zStart = re*zStart + im*conj(zStart) elseif (koord == 11) zStart = re*zStart + im*flip(zStart) elseif (koord == 12) zStart = re*sin(zStart) + im*cos(zStart) elseif (koord == 13) zStart = re*sin(zStart) + 1i*im*cos(zStart) elseif (koord == 14) zStart = re*asin(zStart) + im*acos(zStart) elseif (koord == 15) zStart = re*asin(zStart) + 1i*im*acos(zStart) elseif (koord == 16) zStart = re*sinh(zStart) + im*cosh(zStart) elseif (koord == 17) zStart = re*sinh(zStart) + 1i*im*cosh(zStart) elseif (koord == 18) zStart = re*asinh(zStart) + im*acosh(zStart) elseif (koord == 19) zStart = re*asinh(zStart) + 1i*im*acosh(zStart) endif endif endif endwhile ; Schleife über die Koordinaten zStart = @startFct(zStart) if (@l_randomness != 0) zStart = zStart + @l_randomness * #random endif ; ; Start with the lattices ; if (@lattice == 1) zStart = round(@lattFac1*zStart) - @lattFac2*zStart elseif (@lattice == 2) zStart = trunc(@lattFac1*zStart) - @lattFac2*zStart elseif (@lattice == 3) zStart = floor(@lattFac1*zStart) - @lattFac2*zStart elseif (@lattice == 4) zStart = ceil(@lattFac1*zStart) - @lattFac2*zStart elseif (@lattice == 5) zStart = abs(@lattFac1*zStart) - @lattFac2*zStart^2 elseif (@lattice == 6) zStart = round(@lattFac1*zStart) \ - @lattFac2*sqrt(real(zStart)*imag(zStart)) elseif (@lattice == 7) zStart = trunc(@lattFac1*zStart) \ - @lattFac2*sqrt(real(zStart)*imag(zStart)) elseif (@lattice == 8) zStart = floor(@lattFac1*zStart) \ - @lattFac2*sqrt(real(zStart)*imag(zStart)) elseif (@lattice == 9) zStart = ceil(@lattFac1*zStart) \ - @lattFac2*sqrt(real(zStart)*imag(zStart)) elseif (@lattice == 10) zStart = abs(@lattFac1*zStart) \ - @lattFac2*sqrt(real(zStart)*imag(zStart)) elseif (@lattice == 11) zStart = round((round(@lattFac1*zStart) \ - @lattFac1*zStart)^2) \ - @lattFac2*zStart^2 elseif (@lattice == 12) zStart = trunc((trunc(@lattFac1*zStart) \ - @lattFac1*zStart)^2) \ - @lattFac2*zStart^2 elseif (@lattice == 13) zStart = floor((floor(@lattFac1*zStart) \ - @lattFac1*zStart)^2) \ - @lattFac2*zStart^2 elseif (@lattice == 14) zStart = ceil((ceil(@lattFac1*zStart) \ - @lattFac1*zStart)^2) \ - @lattFac2*zStart^2 elseif (@lattice == 15) zStart = abs((abs(@lattFac1*zStart) \ - @lattFac1*zStart^2)^2) \ - @lattFac2*zStart^2 elseif (@lattice == 16) zStart = round((round(@lattFac1*zStart) \ - @lattFac1*sqrt(real(zStart)*imag(zStart)))^2) \ - @lattFac2*zStart^2 elseif (@lattice == 17) zStart = trunc((trunc(@lattFac1*zStart) \ - @lattFac1*sqrt(real(zStart)*imag(zStart)))^2) \ - @lattFac2*zStart^2 elseif (@lattice == 18) zStart = floor((floor(@lattFac1*zStart) \ - @lattFac1*sqrt(real(zStart)*imag(zStart)))^2) \ - @lattFac2*zStart^2 elseif (@lattice == 19) zStart = ceil((ceil(@lattFac1*zStart) \ - @lattFac1*sqrt(real(zStart)*imag(zStart)))^2) \ - @lattFac2*zStart^2 elseif (@lattice == 20) zStart = abs((abs(@lattFac1*zStart) \ - @lattFac1*sqrt(real(zStart)*imag(zStart)))^2) \ - @lattFac2*zStart^2 elseif (@lattice >= 21 && @lattice <= 23) float reL1 = real(@lattFac1) float imL1 = imag(@lattFac1) float reL2 = real(@lattFac2) float imL2 = imag(@lattFac2) float reZ = reL1*real(zStart) float imZ = imL1*imag(zStart) if (reL2 != 0) reZ = reZ%reL2 endif if (imL2 != 0) imZ = imZ%imL2 endif if (@lattice == 21) zStart = reZ + 1i*imZ elseif (@lattice == 22) zStart = reZ/@lattFac1 + 1i*imZ/@lattFac2 elseif (@lattice == 23) zStart = @lattFac1/reZ + 1i*@lattFac2/imZ endif endif ; lattices if (@turnMode) complex zRound = 0 complex zZ = zStart if (@turnScale != 0) complex zRound = round(zStart*@turnScale)/@turnScale complex zZ = zStart-zRound endif float targ = atan2(zZ) ; "Turn around" part taken from Sam if (abs(targ) < testAngle1) zStart = zZ*exp(rotAngle1)+zRound elseif (abs(targ) > testAngle2) zStart = zZ*exp(rotAngle2)+zRound endif endif ; @turnMode _zz = zStart if (do_loop) iter = iter +1 ; Calculate new values of arithmetical ; and geometrical mean arit = (ar+ge)/2.0 geom = sqrt(ar*ge) ; give these values back ; for the next loop-run ar = arit ge = geom ; stop the loop if (|@fkt(ar)-@fkt(ge)| < @epsilon/@granulation || \ iter > @maxIter*@granulation) do_loop = FALSE endif if (_zz != 0) _zz = _zz^iter + 1/_zz ; endif if (@pure) _zz = _zz + #pixel endif endif ; ; Calculate distances ; _dist = cabs(_zz - #z) _rd = real(_zz - #z) _id = imag(_zz - #z) _rdist = abs(_rd) _idist = abs(_id) if _rd > _id _tdist = _rdist _cdist = _idist if _id == 0 _qdist = _rdist else _qdist = _rdist / _idist endif else _tdist = _idist _cdist = _rdist if _rd == 0 _qdist = _idist else _qdist = _idist / _rdist endif endif ; ; Calculate Min ; if @_mode == 0 && _dist < _min_dist _min_dist = _dist endif if @_mode == 1 && _rdist < _min_rdist _min_rdist = _rdist endif if @_mode == 2 && _idist < _min_idist _min_idist = _idist endif if @_mode == 3 && _tdist < _min_tdist _min_tdist = _tdist endif if @_mode == 4 && _tdist < _min_cdist _min_cdist = _cdist endif if @_mode == 29 && _qdist < _min_qdist _min_qdist = _qdist endif ; ; Calculate Max ; if @_mode == 5 && _dist > _max_dist _max_dist = _dist endif if @_mode == 6 && _rdist > _max_rdist _max_rdist = _rdist endif if @_mode == 7 && _rdist > _max_rdist _max_idist = _idist endif if @_mode == 8 && _tdist > _max_tdist _max_tdist = _tdist endif if @_mode == 9 && _cdist > _max_cdist _max_cdist = _cdist endif if @_mode == 30 && _qdist > _max_qdist _max_qdist = _qdist endif ; ; Calculate the traps ; if @_mode == 19 && _do_trap && _dist > @_trap_min && _dist < @_trap_max _do_trap = false _trap =_dist endif if @_mode == 20 && _do_rtrap && _rdist > @_trap_min && _rdist < @_trap_max _do_rtrap = false _rtrap =_rdist endif if @_mode == 21 && _do_itrap && _idist > @_trap_min && _idist < @_trap_max _do_itrap = false _itrap =_idist endif if @_mode == 22 && _do_ttrap && _tdist > @_trap_min && _tdist < @_trap_max _do_ttrap = false _ttrap =_tdist endif if @_mode == 23 && _do_ctrap && _cdist > @_trap_min && _cdist < @_trap_max _do_ctrap = false _ctrap =_cdist endif ; ; Calculate the sums ; if @_mode == 24 _sum = _sum + _dist endif if @_mode == 25 _rsum = _rsum + _rdist endif if @_mode == 26 _isum = _isum + _idist endif if @_mode == 27 _tsum = _tsum + _tdist endif if @_mode == 28 _csum = _csum + _cdist endif if @_mode == 31 _qsum = _qsum + _qdist endif ; ; Calculate the weighted sums ; if @_mode == 33 _sum_w = _sum_w + _dist/iter endif if @_mode == 34 _rsum_w = _rsum_w + _rdist/iter endif if @_mode == 35 _isum_w = _isum_w + _idist/iter endif if @_mode == 36 _tsum_w = _tsum_w + _tdist/iter endif if @_mode == 37 _csum_w = _csum_w + _cdist/iter endif if @_mode == 38 _qsum_w = _qsum_w + _qdist/iter endif ; ; Calculate the square-weighted sums ; if @_mode == 39 _sum_w2 = _sum_w2 + _dist/iter^2 endif if @_mode == 40 _rsum_w2 = _rsum_w2 + _rdist/iter^2 endif if @_mode == 41 _isum_w2 = _isum_w2 + _idist/iter^2 endif if @_mode == 42 _tsum_w2 = _tsum_w2 + _tdist/iter^2 endif if @_mode == 43 _csum_w2 = _csum_w2 + _cdist/iter^2 endif if @_mode == 44 _qsum_w2 = _qsum_w2 + _qdist/iter^2 endif endif ; no_spare final: if (no_spare) if @_mode == 0 temp = _min_dist ; "Min Dist" elseif @_mode == 1 temp = _min_rdist ; "Min Real" elseif @_mode == 2 temp = _min_idist ; "Min Imag" elseif @_mode == 3 temp = _min_tdist ; "Min Triang" elseif @_mode == 4 temp = _min_cdist ; "Min Cubus" elseif @_mode == 5 temp = _max_dist ; "Max Dist" elseif @_mode == 6 temp = _max_rdist ; "Max Real" elseif @_mode == 7 temp = _max_idist ; "Max Imag" elseif @_mode == 8 temp = _max_tdist ; "Max Triang" elseif @_mode == 9 temp = _max_cdist ; "Max Cubus" elseif @_mode == 10 temp = cabs(_zz - #pixel) ; "Act Dist" elseif @_mode == 11 temp = abs(real(_zz-#pixel)) ; "Act Real" elseif @_mode == 12 temp = abs(imag(_zz-#pixel)) ; "Act Imag" elseif @_mode == 13 temp = _dist ; "Last Dist" elseif @_mode == 14 temp = _rdist ; "Last Real" elseif @_mode == 15 temp = _idist ; "Last Imag" elseif @_mode == 16 temp = _tdist ; "Last Triang" elseif @_mode == 17 temp = _cdist ; "Last Cubus" elseif @_mode == 18 temp = abs(cabs(_zz)-cabs(#pixel)) ; "Difference" elseif @_mode == 19 temp = _trap ; "Trap Dist" elseif @_mode == 20 temp = _rtrap ; "Trap Real" elseif @_mode == 21 temp = _itrap ; "Trap Imag" elseif @_mode == 22 temp = _ttrap ; "Trap Triang" elseif @_mode == 23 temp = _ctrap ; "Trap Cubus" elseif @_mode == 24 temp = _sum ; "Sum Dist" elseif @_mode == 25 temp = _rsum ; "Sum Real" elseif @_mode == 26 temp = _isum ; "Sum Imag" elseif @_mode == 27 temp = _tsum ; "Sum Triang" elseif @_mode == 28 temp = _csum ; "Sum Cubus" elseif @_mode == 29 temp = _min_qdist ; "Min MinQuot" elseif @_mode == 30 temp = _max_qdist ; "Max MinQuot" elseif @_mode == 31 temp = _qsum ; "Sum MinQuot" elseif @_mode == 32 temp = _qdist ; "Last MinQuot" elseif @_mode == 33 temp = _sum_w elseif @_mode == 34 temp = _rsum_w elseif @_mode == 35 temp = _isum_w elseif @_mode == 36 temp = _tsum_w elseif @_mode == 37 temp = _csum_w elseif @_mode == 38 temp = _qsum_w elseif @_mode == 39 temp = _sum_w2 elseif @_mode == 40 temp = _rsum_w2 elseif @_mode == 41 temp = _isum_w2 elseif @_mode == 42 temp = _tsum_w2 elseif @_mode == 43 temp = _csum_w2 elseif @_mode == 44 temp = _qsum_w2 endif float mask = 0 bool no_mask = true if (@masking > 0) if (@maskType == 0) ; Index mask = temp elseif (@maskType == 1) ; Re z mask = real(zStart) elseif (@maskType == 2) ; Im z mask = imag(zStart) elseif (@maskType == 3) ; Angle mask = atan2(zStart)/(2*#pi) if mask < 0 mask = mask + 1 endif mask = mask*360 elseif (@maskType == 4) ; Iteration mask = iter elseif (@maskType == 5) ; Re Mixel mask = real(zStart+#pixel)/2 elseif (@maskType == 6) ; Im Mixel mask = imag(zStart+#pixel)/2 elseif (@maskType == 7) ; Abs Mixel mask = cabs(zStart+#pixel)/2 elseif (@maskType == 8) ; Dist(z,Pixel) mask = cabs(zStart-#pixel) elseif (@maskType == 9) ; |z| mask = cabs(zStart) endif endif if (@masking == 1) ; Lower if (mask < @threshold_l) #solid = true no_mask = false endif elseif (@masking == 2) ; Upper if (mask > @threshold_u) #solid = true no_mask = false endif elseif (@masking == 3) ; Between if (mask > @threshold_l && mask < @threshold_u) #solid = true no_mask = false endif elseif (@masking == 4) ; Outside if (mask < @threshold_l || mask > @threshold_u) #solid = true no_mask = false endif else no_mask = true endif if (no_mask) float to_index = real(@fkt(temp)) if (@base4txtr == 1) _zz = #pixel elseif (@base4txtr == 2) _zz = (#pixel+_zz)/2 elseif (@base4txtr == 3) _zz = abs(#pixel-_zz) elseif (@base4txtr == 4) _zz = cabs(#pixel-_zz) endif if (@colour_limit != 0) to_index = to_index%@colour_limit endif if (@f_randomness != 0) to_index = to_index + @f_randomness * real(#random) endif if (@txtr_gnarl != 0) complex zGnarl = _zz zGnarl = zGnarl-trunc(zGnarl*@txtr_gnarl_scale)/@txtr_gnarl_scale if (@txtr_gnarl_size != 0 && @txtr_gnarl_size != 1) zGnarl = zGnarl/@txtr_gnarl_size endif if (@reachThrough) _zz = zGnarl endif float x = real(zGnarl) float y = imag(zGnarl) float xOld = 0 int iter3 = @txtr_gnarl_octaves while (iter3 > 0) iter3 = iter3-1 xOld = x x = x - sin(y + sin(y)) y = y - sin(xOld + sin(xOld)) endwhile float textureGnarl = 0 if (@txtr_gnarl_type == 0) textureGnarl = abs(x) elseif (@txtr_gnarl_type == 1) textureGnarl = abs(x)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_gnarl_type == 2) textureGnarl = abs(x-y) elseif (@txtr_gnarl_type == 3) textureGnarl = abs(x-y)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_gnarl_type == 4) textureGnarl = abs(x+y)/2 elseif (@txtr_gnarl_type == 5) textureGnarl = abs(x*y)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_gnarl_type == 6) textureGnarl = atan2(x+1i*y)/(2*#pi) if (textureGnarl < 0) textureGnarl = textureGnarl + 1 endif elseif (@txtr_gnarl_type == 7) textureGnarl = sqrt(x^2+y^2) endif if (@txtr_Gnarl_limit != 0) textureGnarl = textureGnarl%@txtr_Gnarl_limit endif to_index = to_index + @txtr_gnarl*textureGnarl endif if (@txtr_PopCorn != 0) complex zPopCorn = _zz zPopCorn = zPopCorn-trunc(zPopCorn*@txtr_PopCorn_scale)/@txtr_PopCorn_scale if (@txtr_PopCorn_size != 0 && @txtr_PopCorn_size != 1) zPopCorn = zPopCorn/@txtr_PopCorn_size endif if (@reachThrough) _zz = zPopCorn endif float x = real(zPopCorn) float y = imag(zPopCorn) float xOld = 0 int iter3 = @txtr_PopCorn_octaves while (iter3 > 0) iter3 = iter3-1 xOld = x x = x - sin(y + log(y + cos(y))) y = y - sin(xOld + log(xOld + cos(xOld))) endwhile float texturePopCorn = 0 if (@txtr_PopCorn_type == 0) texturePopCorn = abs(x) elseif (@txtr_PopCorn_type == 1) texturePopCorn = abs(x)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_PopCorn_type == 2) texturePopCorn = abs(x-y) elseif (@txtr_PopCorn_type == 3) texturePopCorn = abs(x-y)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_PopCorn_type == 4) texturePopCorn = abs(x+y)/2 elseif (@txtr_PopCorn_type == 5) texturePopCorn = abs(x*y)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_PopCorn_type == 6) texturePopCorn = atan2(x+1i*y)/(2*#pi) if (texturePopCorn < 0) texturePopCorn = texturePopCorn + 1 endif elseif (@txtr_PopCorn_type == 7) texturePopCorn = sqrt(x^2+y^2) endif if (@txtr_PopCorn_limit != 0) texturePopCorn = texturePopCorn%@txtr_PopCorn_limit endif to_index = to_index + @txtr_PopCorn*texturePopCorn endif if (@txtr_SFBM != 0) float mod = 1 float d1 = 0 float d2 = 0 float d3 = 0 float d4 = 0 float nindex = 0 float textureSFBM = 0 float scale = 0 cr1 = 0 cr2 = 0 cr3 = 0 cr4 = 0 float crp1 = 0 float crp2 = 0 float crp3 = 0 float crp4 = 0 complex tv1 = 0 complex tv2 = 0 complex tv3 = 0 complex tv4 = 0 complex seed = @txtr_SFBM_seed rotAngleFBM = exp(1i*pi/180*@txtr_SFBM_rot) if (@txtr_SFBM_scaledis == 4) ; min textureSFBM = 1e20 elseif (@txtr_SFBM_scaledis == 5) ; max textureSFBM = -1e20 endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; complex zSFBM = _zz zSFBM = zSFBM-trunc(zSFBM*@txtr_SFBM_scale)/@txtr_SFBM_scale if (@txtr_SFBM_size != 0 && @txtr_SFBM_size != 1) zSFBM = zSFBM/@txtr_SFBM_size endif if (@reachThrough) _zz = zSFBM endif int iter3 = 0 complex ttmp = 0 while (iter3 < @txtr_SFBM_octaves) scale = @txtr_SFBM_magn^iter3 zSFBM = zSFBM*rotAngleFBM iter3 = iter3 + 1 if @txtr_SFBM_mod == 1 mod = sqrt(iter3) endif zc = round(scale*_zz)/scale zc1 = zc + (.5,.5)/scale zc2 = zc + (-.5,.5)/scale zc3 = zc + (.5,-.5)/scale zc4 = zc + (-.5,-.5)/scale ttmp = seed/(mod*zc1+124), cr1 = ttmp-floor(ttmp) ttmp = seed/(mod*zc2+124), cr2 = ttmp-floor(ttmp) ttmp = seed/(mod*zc3+124), cr3 = ttmp-floor(ttmp) ttmp = seed/(mod*zc4+124), cr4 = ttmp-floor(ttmp) if (@txtr_SFBM_mode == 0) tv1 = (zSFBM - zc1)*scale tv2 = (zSFBM - zc2)*scale tv3 = (zSFBM - zc3)*scale tv4 = (zSFBM - zc4)*scale crp1 = real(cr1)*real(tv1) + imag(cr1)*imag(tv1) crp2 = real(cr2)*real(tv2) + imag(cr2)*imag(tv2) crp3 = real(cr3)*real(tv3) + imag(cr3)*imag(tv3) crp4 = real(cr4)*real(tv4) + imag(cr4)*imag(tv4) endif ttmp = zSFBM - zc d1 = real(ttmp)*scale + 0.5 d2 = 1 - d1 d3 = imag(ttmp)*scale + 0.5 d4 = 1 - d3 if (@txtr_SFBM_power != 1) d1 = d1^@txtr_SFBM_power d2 = d2^@txtr_SFBM_power d3 = d3^@txtr_SFBM_power d4 = d4^@txtr_SFBM_power endif if @txtr_SFBM_mode == 0 nindex = 10 + crp1*d1*d3 + crp3*d1*d4 + crp2*d2*d3 + crp4*d2*d4 elseif @txtr_SFBM_mode == 1 nindex = cabs(cr1*d1*d3 + cr3*d1*d4 + cr2*d2*d3 + cr4*d2*d4) endif if (@txtr_SFBM_scaledis == 0) textureSFBM = textureSFBM + nindex/scale elseif (@txtr_SFBM_scaledis == 1) textureSFBM = textureSFBM + nindex/sqrt(scale) elseif (@txtr_SFBM_scaledis == 2) textureSFBM = textureSFBM + nindex/(scale^(1/scale)) elseif (@txtr_SFBM_scaledis == 3) textureSFBM = textureSFBM + nindex/iter3 elseif (@txtr_SFBM_scaledis == 4) if (nindex < textureSFBM) textureSFBM = nindex endif elseif (@txtr_SFBM_scaledis == 5) if (nindex > textureSFBM) textureSFBM = nindex endif endif endwhile if (@txtr_SFBM_limit != 0) textureSFBM = textureSFBM%@txtr_SFBM_limit endif to_index = to_index + @txtr_SFBM*textureSFBM endif if (@txtr_primes != 0) complex zPrimes = _zz zPrimes = zPrimes-trunc(zPrimes*@txtr_Primes_scale)/@txtr_Primes_scale if (@txtr_Primes_size != 0 && @txtr_Primes_size != 1) zPrimes = zPrimes/@txtr_Primes_size endif if (@reachThrough) _zz = zPrimes endif float texturePrimes = 0 float trz = 0 float tiz = 0 float t_rz = 0 float t_iz = 0 float tstartSnip = 10^@txtr_primes_where2start float tendOfSnip = 10^(@txtr_primes_where2start+@txtr_primes_lengthOfSnip) if (@txtr_primes_mode == 0) trz = |real(zPrimes)| tiz = |imag(zPrimes)| elseif (@txtr_primes_mode == 1) trz = |real(zPrimes)| tiz = trz elseif (@txtr_primes_mode == 2) tiz = |imag(zPrimes)| trz = tiz elseif (@txtr_primes_mode == 3) trz = |zPrimes| tiz = trz elseif (@txtr_primes_mode == 4) trz = atan2(zPrimes) if (trz < 0) trz = trz + 2*#pi endif tiz = trz elseif (@txtr_primes_mode == 5) trz = real(atan(zPrimes)) if (trz < 0) trz = trz + 2*#pi endif tiz = imag(atan(zPrimes)) if (tiz < 0) tiz = tiz + 2*#pi endif elseif (@txtr_primes_mode == 6) trz = atan2(zPrimes) if (trz < 0) trz = trz + 2*#pi endif tiz = |zPrimes| endif t_rz = (trz - trunc(trz*tstartSnip)/tstartSnip)*tendOfSnip t_iz = (tiz - trunc(tiz*tstartSnip)/tstartSnip)*tendOfSnip if (@txtr_primes_withFinalTrunc) t_rz = trunc(t_rz) t_iz = trunc(t_iz) endif texturePrimes = 10*((t_rz%821) + (t_iz%823))/1644 if (@txtr_Primes_limit != 0) texturePrimes = texturePrimes%@txtr_Primes_limit endif to_index = to_index + @txtr_Primes*texturePrimes endif ; @txtr_primes != 0 if (@txtr_Gauss != 0) complex zGauss = _zz zGauss = zGauss-trunc(zGauss*@txtr_Gauss_scale)/@txtr_Gauss_scale if (@txtr_Gauss_size != 0 && @txtr_Gauss_size != 1) zGauss = zGauss/@txtr_Gauss_size endif if (@reachThrough) _zz = zGauss endif float textureGauss = 0 float t_d = cabs(zGauss) float t_r = real(zGauss) float t_i = imag(zGauss) if (@txtr_Gauss_type == 0) textureGauss = t_d elseif (@txtr_Gauss_type == 1) textureGauss = |t_r| elseif (@txtr_Gauss_type == 2) textureGauss = |t_i| elseif (@txtr_Gauss_type == 3) textureGauss = |t_i-t_r| elseif (@txtr_Gauss_type == 4) textureGauss = |t_i*t_r| elseif (@txtr_Gauss_type == 5) textureGauss = |t_i/t_r| elseif (@txtr_Gauss_type == 6) if (|t_i| < |t_r|) textureGauss = |t_i| else textureGauss = |t_r| endif elseif (@txtr_Gauss_type == 7) if (|t_i| > |t_r|) textureGauss = |t_i| else textureGauss = |t_r| endif elseif (@txtr_Gauss_type == 8) textureGauss = atan2(zGauss)/(2*#pi) if textureGauss < 0 textureGauss = textureGauss + 1 endif elseif (@txtr_Gauss_type == 9) textureGauss = (|t_i|+|t_r|+t_d)/3 elseif (@txtr_Gauss_type == 10) textureGauss = (|t_i|*|t_r|*t_d)^(1/3) endif if (@txtr_Gauss_limit != 0) textureGauss = textureGauss%@txtr_Gauss_limit endif to_index = to_index + @txtr_Gauss*textureGauss endif #index = to_index endif ; no_mask else if (@spareMask) #solid = true endif endif ; no_spare default: title = "AGM #3 (Arithm. Geom. Mean)" param _mode caption = "Dist. Mode" enum = "Min Dist" "Min Real" "Min Imag" "Min Triang" "Min Cubus" \ "Max Dist" "Max Real" "Max Imag" "Max Triang" "Max Cubus" \ "Act Dist" "Act Real" "Act Imag" \ "Last Dist" "Last Real" "Last Imag" "Last Triang" "Last Cubus" \ "Difference" \ "Trap Dist" "Trap Real" "Trap Imag" "Trap Triang" "Trap Cubus" \ "Sum Dist" "Sum Real" "Sum Imag" "Sum Triang" "Sum Cubus" \ "Min MinQuot" "Max MinQuot" "Sum MinQuot" "Last MinQuot" \ "W-Sum Dist" "W-Sum Real" "W-Sum Imag" "W-Sum Triang" "W-Sum Cubus" \ "W^2-Sum Dist" "W^2-Sum Real" "W^2-Sum Imag" \ "W^2-Sum Triang" "W^2-Sum Cubus" endparam param _trap_min caption = "Lower Border for Trap" default = 1.0 min = 0.0 hint = "Only usefull with Traps" endparam param _trap_max caption = "Upper Border for Trap" default = 2.0 min = 0.0 hint = "Only usefull with Traps" endparam param epsilon caption = "epsilon" default = 0.1 min = 0.0 endparam param pure caption= "With Pixel Addition" default=TRUE endparam param granulation caption = "Granulation" default = 1.0 min = 0.0001 endparam param maxIter caption = "Maximum Iterations" default = 200 min = 1 endparam param coord caption = "Coordinates" enum = "Rectangular" \ "Polar" "PolarH" "aPolar" "aPolarH" \ "sin/cos" "sinh/cosh" "asin/acos" "asinh/acosh" \ "z/inv(z)" "z/conj(z)" "z/flip(z)" \ "?sin/cos" "?sin/i*cos" "?asin/acos" "?asin/i*acos" \ "?sinh/cosh" "?sinh/i*cosh" "?asinh/acosh" "?asinh/i*acosh" default = 0 endparam param coordLoop caption = "# Coord Loops" default = 1 min = 1 endparam param coordMode caption = "Mode Coord Loop" enum = "Static" "Dynamic" default = 0 endparam param lattice caption = "Lattice Type" enum = "None" \ "round" "trunc" "floor" "ceil" "abs" \ "r-round" "r-trunc" "r-floor" "r-ceil" "r-abs" \ "round^2" "trunc^2" "floor^2" "ceil^2" "abs^2" \ "r-round^2" "r-trunc^2" "r-floor^2" "r-ceil^2" "r-abs^2" \ "Modulo" "Mod Quot" "Mod Inv" default = 0 endparam param lattFac1 caption = "Lattice Factor 1" default = (1.0,0.0) endparam param lattFac2 caption = "Lattice Factor 2" default = (1.0,0.0) endparam param colour_limit caption = "Colour Limitation" default = 0.0 min = 0.0 max = 400.0 endparam param with_zStart caption = "zStart everywhere Y/N" default = false hint = "Works with the lattices" endparam param turnMode caption = "L: Turnaround Mode" default = false endparam param turnScale caption = "L: Turn Scale" default = 1.0 min = 0.0 endparam param corte1 caption = "L: Turnaround #1" default = 4.0 endparam param corte2 caption = "L: Turnaround #2" default = 2.0 endparam param l_randomness caption = "L: Randomness" hint = "This adds a randomness in the outlines." default = 0.0 endparam param f_randomness caption = "T: Random Texture" hint = "This adds a random texture the the coloring." default = 0.0 endparam param base4txtr caption = "Texture Base" enum = "Z" "Pixel" "Mixel" "Diff(Z,Pixel)" "Dist(Z,Pixel)" default = 0 endparam param reachThrough caption = "T: Reach Through Scales" default = false hint = "Reaches the Scale and Pattern Size from one \ Texture to the next. Every Texture changes all \ that follow." endparam param txtr_gnarl caption = "T: Gnarl Texture" hint = "This adds a Gnarl texture the the coloring." default = 0.0 endparam param txtr_gnarl_type caption = "T: Gnarl Type" enum = "x" "x/d" "x-y" "(x-y)/d" "(x+y)/2" "x*y/d" "Angle" "d" default = 0 endparam param txtr_gnarl_scale caption = "T: Gnarl Scale" hint = "Scaling Factor for this Gnarl texture." default = 1.0 endparam param txtr_gnarl_size caption = "T: Gnarl Pattern Size" default = 1.0 endparam param txtr_gnarl_limit caption = "T: Gnarl Limitation" default = 0.0 min = 0.0 endparam param txtr_gnarl_octaves caption = "T: Gnarl Octaves" default = 5 min = 1 endparam param txtr_PopCorn caption = "T: PopCorn Texture" hint = "This adds a PopCorn texture the the coloring." default = 0.0 endparam param txtr_PopCorn_type caption = "T: PopCorn Type" enum = "x" "x/d" "x-y" "(x-y)/d" "(x+y)/2" "x*y/d" "Angle" "d" default = 0 endparam param txtr_PopCorn_scale caption = "T: PopCorn Scale" hint = "Scaling Factor for this PopCorn texture." default = 1.0 endparam param txtr_PopCorn_size caption = "T: PopCorn Pattern Size" default = 1.0 endparam param txtr_PopCorn_limit caption = "T: PopCorn Limitation" default = 0.0 min = 0.0 endparam param txtr_PopCorn_octaves caption = "T: PopCorn Octaves" default = 5 min = 1 endparam param txtr_SFBM caption = "T: SFBM Texture" hint = "This adds a SFBM texture to the coloring." default = 0.0 endparam param txtr_SFBM_mode caption = "T: SFBM Noise type" default = 1 enum = "Perlin's" "Raw... (Sam's)" endparam param txtr_SFBM_scale caption = "T: SFBM Scale" hint = "Scaling Factor for this SFBM texture." default = 1.0 endparam param txtr_SFBM_scaledis caption = "T: SFBM Scale Distribution" default = 0 enum = "1/scale" "1/sqrt(scale)" "Fancy" "1/i" endparam param txtr_SFBM_size caption = "T: SFBM Pattern Size" default = 0.1 endparam param txtr_SFBM_magn caption = "T: SFBM Magnification Step" default = 1.2 endparam param txtr_SFBM_limit caption = "T: SFBM Limitation" default = 0.0 min = 0.0 endparam param txtr_SFBM_rot caption = "T: SFBM Rotation Step" default = 28.0 endparam param txtr_SFBM_power caption = "T: SFBM Power" default = 1.0 endparam param txtr_SFBM_mod caption = "Vary Random Numbers?" default = 1 enum = "No" "Use sqrt(i)" endparam param txtr_SFBM_seed caption = "T: SFBM Seed" default = 123094 endparam param txtr_SFBM_octaves caption = "T: SFBM Octaves" default = 5 min = 1 endparam param txtr_Primes caption = "T: Primes Texture" hint = "This adds a Primes texture to the coloring." default = 0.0 endparam param txtr_Primes_scale caption = "T: Primes Scale" hint = "Scaling Factor for this Primes texture." default = 1.0 endparam param txtr_Primes_size caption = "T: Primes Pattern Size" default = 0.5 endparam param txtr_primes_withFinalTrunc caption = "With Final Truncation" default = TRUE endparam param txtr_primes_where2start caption = "T: Start of Snip" default = 1 min = 0 endparam param txtr_primes_lengthOfSnip caption = "T: Length of Snip" default = 1 min = 1 endparam param txtr_primes_Mode caption = "T: Primes Mode" enum = "Real,Imag" "Real" "Imag" "|z|" "Angle" "Angel" "Polar" default = 5 endparam param txtr_primes_limit caption = "T: Primes Limitation" default = 0.0 min = 0.0 endparam param txtr_Gauss caption = "T: Gauss Texture" hint = "This adds a Gauss texture to the coloring." default = 0.0 endparam param txtr_Gauss_type caption = "T: Gauss Type" enum = "d" "x" "y" "x-y" "x*y" "y/x" "min x,y" "max x,y" "Angle" \ "Pyth. am" "Pyth. gm" default = 0 endparam param txtr_Gauss_scale caption = "T: Gauss Scale" hint = "Scaling Factor for this Gauss texture." default = 1.0 endparam param txtr_Gauss_size caption = "T: Gauss Pattern Size" default = 1.0 endparam param txtr_Gauss_limit caption = "T: Gauss Limitation" default = 0.0 min = 0.0 endparam param masking caption = "Masking" enum = "None" "Lower" "Upper" "Between" "Outside" default = 0 endparam param maskType caption = "Mask Type" enum = "Index" "Re z" "Im z" "Angle" "Iteration" \ "Re Mixel" "Im Mixel" "Abs Mixel" \ "Dist(z,Pixel)" "|z|" default = 0 endparam param threshold_l caption = "Lower Mask Threshold" default = 0.5 endparam param threshold_u caption = "Upper Mask Threshold" default = 1.0 endparam param spareMode caption = "Cut Out" enum = "None" "Upper" "Lower" \ "Left" "Right" \ "Upper + Left" "Upper + Right" "Lower + Left" "Lower + Right" \ "Upper & Left" "Upper & Right" "Lower & Left" "Lower & Right" \ "Inside Rectangle" "Outside Rectangle" \ "Between Vertical" "Outside Vertical" \ "Between Horizontal" "Outside Horizontal" \ "Inside Circle" "Outside Circle" default = 0 endparam param sparePoint caption = "Line of Cut, 1. Point" default = (0,0) endparam param sparePoint2 caption = "Add. Point/Line for Cut" default = (1,1) endparam param spareRot caption = "Rotate Cut" default = 0.0 min = -90.0 max = 90.0 endparam param spareMask caption = "Mask Cut" default = true endparam func trf caption = "Transfer Function" default = ident() endfunc func fn1 caption = "Real Part Init Function" default = ident() endfunc func fn2 caption = "Imag Part Init Function" default = ident() endfunc func startFct caption = "Start Function" default = ident() endfunc func fkt caption = "Additional Function" default = recip() endfunc } ; agm3 agm4 { ; ; AGM means "Arithmetic Geometric Mean". ; AM and GM are normally different. ; But if they are iterated on their ; new values, they begin to come ; nearer and nearer... ; ; let AM_n be AM(AM_(n-1),GM_(n-1)) ; Then you have ; lim (AM(AM_n,GM_n) - GM(AM_n,GM_n)) = 0 ; ; All the AGM colourings measure the "n" ; when the above number series are near ; a certain small value called epsilon... ; ; Andreas Lober, July 30, 2000 ; init: bool no_spare = true if (@spareMode > 0) float spareVert = real(@sparePoint) float spareHori = imag(@sparePoint) complex pixpix = #pixel float rePix = 0 float imPix = 0 if (@spareMode <= 18) if (@spareRot%360 != 0) complex rotCentre = @sparePoint if (@spareMode > 12 && @spareMode < 19) rotCentre = (@sparePoint+@sparePoint2)/2 endif pixpix = (pixpix-rotCentre)*exp(-1i*#pi*@spareRot/180) + rotCentre endif rePix = real(pixpix) imPix = imag(pixpix) endif if (@spareMode <= 12) if (@spareMode == 1 || @spareMode == 5 || @spareMode == 6 \ || @spareMode == 9 || @spareMode == 10) ; upper upper+right upper+left ; upper&right upper&left if (imPix >= spareHori) if (@spareMode == 9) if (rePix < spareVert) no_spare = false endif elseif (@spareMode == 10) if (rePix >= spareVert) no_spare = false endif else no_spare = false endif endif elseif (@spareMode == 2 || @spareMode == 7 || @spareMode == 8 \ || @spareMode == 11 || @spareMode == 12) ; lower lower+right lower+left ; lower&right lower&left if (imPix < spareHori) if (@spareMode == 11) if (rePix < spareVert) no_spare = false endif elseif (@spareMode == 12) if (rePix >= spareVert) no_spare = false endif else no_spare = false endif endif endif if (@spareMode == 3 || @spareMode == 5 || @spareMode == 7) ; left upper+left lower+left if (rePix < spareVert) no_spare = false endif elseif (@spareMode == 4 || @spareMode == 6 || @spareMode == 8) ; right upper+right lower+right if (rePix >= spareVert) no_spare = false endif endif elseif (@spareMode <= 18) float rePnt = real(@sparePoint2) float imPnt = imag(@sparePoint2) float upper = imPnt float lower = spareHori float left = spareVert float right = rePnt if (imPnt < spareHori) upper = spareHori lower = imPnt endif if (spareVert > rePnt) left = rePnt right = spareVert endif if (@spareMode == 13) ; inside rect if (rePix > left && rePix < right && imPix > lower && imPix < upper) no_spare = false endif elseif (@spareMode == 14) ; outside rect if (rePix < left || rePix > right || imPix < lower || imPix > upper) no_spare = false endif elseif (@spareMode == 15) ; inside vert if (rePix > left && rePix < right) no_spare = false endif elseif (@spareMode == 16) ; outside vert if (rePix < left || rePix > right) no_spare = false endif elseif (@spareMode == 17) ; inside hori if (imPix > lower && imPix < upper) no_spare = false endif elseif (@spareMode == 18) ; outside hori if (imPix < lower || imPix > upper) no_spare = false endif endif elseif (@spareMode <= 20) float radiusOFCutCircle = cabs(@sparePoint-@sparePoint2) if (@spareMode == 19) ; inside circle if (cabs(#pixel-@sparePoint) < radiusOFCutCircle) no_spare = false endif elseif (@spareMode == 20) ; outside circle if (cabs(#pixel-@sparePoint) > radiusOFCutCircle) no_spare = false endif endif endif ; spareMode > 12 endif ; @spareMode > 0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; float _dist = 0 float _rdist = 0 float _idist = 0 float _tdist = 0 float _cdist = 0 float _qdist = 0 float _rd = 0 float _id = 0 float _min_dist = 1e20 float _max_dist = -1 float _min_rdist = 1e20 float _max_rdist = -1 float _min_idist = 1e20 float _max_idist = -1 float _min_tdist = 1e20 float _max_tdist = -1 float _min_cdist = 1e20 float _max_cdist = -1 float _min_qdist = 1e20 float _max_qdist = -1 float temp = -1 ; ; Traps ; bool _do_trap = true float _trap = 0.01 bool _do_rtrap = true float _rtrap = 0.01 bool _do_itrap = true float _itrap = 0.01 bool _do_ttrap = true float _ttrap = 0.01 bool _do_ctrap = true float _ctrap = 0.01 ; ; Sums ; float _sum = 0 float _rsum = 0 float _isum = 0 float _tsum = 0 float _csum = 0 float _qsum = 0 ; ; Weighted Sums ; float _sum_w = 0 float _rsum_w = 0 float _isum_w = 0 float _tsum_w = 0 float _csum_w = 0 float _qsum_w = 0 ; ; Square-Weighted Sums ; float _sum_w2 = 0 float _rsum_w2 = 0 float _isum_w2 = 0 float _tsum_w2 = 0 float _csum_w2 = 0 float _qsum_w2 = 0 complex ar = |real(@fn1(#pixel))| complex ge = |imag(@fn2(#pixel))| complex arit = 0 complex geom = 0 complex _zz = #pixel int iter = 0 bool do_loop = TRUE int l_coord = @coordLoop int koord = @coord float testAngle1 = #pi/@corte1 float testAngle2 = 3*testAngle1 complex rotAngle1 = @corte2*1i*testAngle1 complex rotAngle2 = @corte2*1i*testAngle2 loop: if (no_spare) zStart = #pixel ; init zStart int loop_i = 0 while (loop_i < l_coord) loop_i = loop_i + 1 if (@coordMode == 1) ; cyclic koord = (koord+1)%19 endif if (koord == 1) zStart = cabs(zStart) + 1i*atan2(zStart) elseif (koord == 2) float rad = cabs(zStart) float phi = atan2(zStart) zStart = rad*(sinh(phi) + 1i*cosh(phi)) elseif (koord == 3) float rad = cabs(zStart) float phi = atan2(zStart) zStart = rad*(asin(phi) + 1i*acos(phi)) elseif (koord == 4) float rad = cabs(zStart) float phi = atan2(zStart) zStart = rad*(asinh(phi) + 1i*acosh(phi)) elseif (koord == 5) zStart = real(sin(zStart)) + 1i*cos(zStart) elseif (koord == 6) zStart = real(sinh(zStart)) + 1i*cosh(zStart) elseif (koord == 7) zStart = real(asin(zStart)) + 1i*acos(zStart) elseif (koord == 8) zStart = real(asinh(zStart)) + 1i*acosh(zStart) elseif (koord == 9) zStart = abs(zStart) + conj(zStart)/(|zStart|+1e-20) elseif (koord >= 10 && koord <= 19) if (zStart != 0) float rad = cabs(zStart) float re = real(zStart)/rad float im = imag(zStart)/rad if (koord == 10) zStart = re*zStart + im*conj(zStart) elseif (koord == 11) zStart = re*zStart + im*flip(zStart) elseif (koord == 12) zStart = re*sin(zStart) + im*cos(zStart) elseif (koord == 13) zStart = re*sin(zStart) + 1i*im*cos(zStart) elseif (koord == 14) zStart = re*asin(zStart) + im*acos(zStart) elseif (koord == 15) zStart = re*asin(zStart) + 1i*im*acos(zStart) elseif (koord == 16) zStart = re*sinh(zStart) + im*cosh(zStart) elseif (koord == 17) zStart = re*sinh(zStart) + 1i*im*cosh(zStart) elseif (koord == 18) zStart = re*asinh(zStart) + im*acosh(zStart) elseif (koord == 19) zStart = re*asinh(zStart) + 1i*im*acosh(zStart) endif endif endif endwhile ; Schleife über die Koordinaten zStart = @startFct(zStart) if (@l_randomness != 0) zStart = zStart + @l_randomness * #random endif ; ; Start with the lattices ; if (@lattice == 1) zStart = round(@lattFac1*zStart) - @lattFac2*zStart elseif (@lattice == 2) zStart = trunc(@lattFac1*zStart) - @lattFac2*zStart elseif (@lattice == 3) zStart = floor(@lattFac1*zStart) - @lattFac2*zStart elseif (@lattice == 4) zStart = ceil(@lattFac1*zStart) - @lattFac2*zStart elseif (@lattice == 5) zStart = abs(@lattFac1*zStart) - @lattFac2*zStart^2 elseif (@lattice == 6) zStart = round(@lattFac1*zStart) \ - @lattFac2*sqrt(real(zStart)*imag(zStart)) elseif (@lattice == 7) zStart = trunc(@lattFac1*zStart) \ - @lattFac2*sqrt(real(zStart)*imag(zStart)) elseif (@lattice == 8) zStart = floor(@lattFac1*zStart) \ - @lattFac2*sqrt(real(zStart)*imag(zStart)) elseif (@lattice == 9) zStart = ceil(@lattFac1*zStart) \ - @lattFac2*sqrt(real(zStart)*imag(zStart)) elseif (@lattice == 10) zStart = abs(@lattFac1*zStart) \ - @lattFac2*sqrt(real(zStart)*imag(zStart)) elseif (@lattice == 11) zStart = round((round(@lattFac1*zStart) \ - @lattFac1*zStart)^2) \ - @lattFac2*zStart^2 elseif (@lattice == 12) zStart = trunc((trunc(@lattFac1*zStart) \ - @lattFac1*zStart)^2) \ - @lattFac2*zStart^2 elseif (@lattice == 13) zStart = floor((floor(@lattFac1*zStart) \ - @lattFac1*zStart)^2) \ - @lattFac2*zStart^2 elseif (@lattice == 14) zStart = ceil((ceil(@lattFac1*zStart) \ - @lattFac1*zStart)^2) \ - @lattFac2*zStart^2 elseif (@lattice == 15) zStart = abs((abs(@lattFac1*zStart) \ - @lattFac1*zStart^2)^2) \ - @lattFac2*zStart^2 elseif (@lattice == 16) zStart = round((round(@lattFac1*zStart) \ - @lattFac1*sqrt(real(zStart)*imag(zStart)))^2) \ - @lattFac2*zStart^2 elseif (@lattice == 17) zStart = trunc((trunc(@lattFac1*zStart) \ - @lattFac1*sqrt(real(zStart)*imag(zStart)))^2) \ - @lattFac2*zStart^2 elseif (@lattice == 18) zStart = floor((floor(@lattFac1*zStart) \ - @lattFac1*sqrt(real(zStart)*imag(zStart)))^2) \ - @lattFac2*zStart^2 elseif (@lattice == 19) zStart = ceil((ceil(@lattFac1*zStart) \ - @lattFac1*sqrt(real(zStart)*imag(zStart)))^2) \ - @lattFac2*zStart^2 elseif (@lattice == 20) zStart = abs((abs(@lattFac1*zStart) \ - @lattFac1*sqrt(real(zStart)*imag(zStart)))^2) \ - @lattFac2*zStart^2 elseif (@lattice >= 21 && @lattice <= 23) float reL1 = real(@lattFac1) float imL1 = imag(@lattFac1) float reL2 = real(@lattFac2) float imL2 = imag(@lattFac2) float reZ = reL1*real(zStart) float imZ = imL1*imag(zStart) if (reL2 != 0) reZ = reZ%reL2 endif if (imL2 != 0) imZ = imZ%imL2 endif if (@lattice == 21) zStart = reZ + 1i*imZ elseif (@lattice == 22) zStart = reZ/@lattFac1 + 1i*imZ/@lattFac2 elseif (@lattice == 23) zStart = @lattFac1/reZ + 1i*@lattFac2/imZ endif endif ; lattices if (@turnMode) complex zRound = 0 complex zZ = zStart if (@turnScale != 0) complex zRound = round(zStart*@turnScale)/@turnScale complex zZ = zStart-zRound endif float targ = atan2(zZ) ; "Turn around" part taken from Sam if (abs(targ) < testAngle1) zStart = zZ*exp(rotAngle1)+zRound elseif (abs(targ) > testAngle2) zStart = zZ*exp(rotAngle2)+zRound endif endif ; @turnMode ar = |real(@fn1(zStart))| ge = |imag(@fn2(zStart))| _zz = zStart if (do_loop) iter = iter + 1 ; Calculate new values of arithmetical ; and geometrical mean arit = (ar+ge)/2.0 geom = sqrt(ar*ge) ; give these values back ; for the next loop-run ar = arit ge = geom ; stop the loop if (|@fkt(ar)-@fkt(ge)| < @epsilon/@granulation || \ iter > @maxIter*@granulation) do_loop = FALSE endif if (_zz != 0) _zz = _zz^iter + 1/_zz ; endif if (@pure) _zz = _zz + #pixel endif endif ; ; Calculate distances ; _dist = cabs(_zz - #z) _rd = real(_zz - #z) _id = imag(_zz - #z) _rdist = abs(_rd) _idist = abs(_id) if _rd > _id _tdist = _rdist _cdist = _idist if _id == 0 _qdist = _rdist else _qdist = _rdist / _idist endif else _tdist = _idist _cdist = _rdist if _rd == 0 _qdist = _idist else _qdist = _idist / _rdist endif endif ; ; Calculate Min ; if @_mode == 0 && _dist < _min_dist _min_dist = _dist endif if @_mode == 1 && _rdist < _min_rdist _min_rdist = _rdist endif if @_mode == 2 && _idist < _min_idist _min_idist = _idist endif if @_mode == 3 && _tdist < _min_tdist _min_tdist = _tdist endif if @_mode == 4 && _tdist < _min_cdist _min_cdist = _cdist endif if @_mode == 29 && _qdist < _min_qdist _min_qdist = _qdist endif ; ; Calculate Max ; if @_mode == 5 && _dist > _max_dist _max_dist = _dist endif if @_mode == 6 && _rdist > _max_rdist _max_rdist = _rdist endif if @_mode == 7 && _rdist > _max_rdist _max_idist = _idist endif if @_mode == 8 && _tdist > _max_tdist _max_tdist = _tdist endif if @_mode == 9 && _cdist > _max_cdist _max_cdist = _cdist endif if @_mode == 30 && _qdist > _max_qdist _max_qdist = _qdist endif ; ; Calculate the traps ; if @_mode == 19 && _do_trap && _dist > @_trap_min && _dist < @_trap_max _do_trap = false _trap =_dist endif if @_mode == 20 && _do_rtrap && _rdist > @_trap_min && _rdist < @_trap_max _do_rtrap = false _rtrap =_rdist endif if @_mode == 21 && _do_itrap && _idist > @_trap_min && _idist < @_trap_max _do_itrap = false _itrap =_idist endif if @_mode == 22 && _do_ttrap && _tdist > @_trap_min && _tdist < @_trap_max _do_ttrap = false _ttrap =_tdist endif if @_mode == 23 && _do_ctrap && _cdist > @_trap_min && _cdist < @_trap_max _do_ctrap = false _ctrap =_cdist endif ; ; Calculate the sums ; if @_mode == 24 _sum = _sum + _dist endif if @_mode == 25 _rsum = _rsum + _rdist endif if @_mode == 26 _isum = _isum + _idist endif if @_mode == 27 _tsum = _tsum + _tdist endif if @_mode == 28 _csum = _csum + _cdist endif if @_mode == 31 _qsum = _qsum + _qdist endif ; ; Calculate the weighted sums ; if @_mode == 33 _sum_w = _sum_w + _dist/iter endif if @_mode == 34 _rsum_w = _rsum_w + _rdist/iter endif if @_mode == 35 _isum_w = _isum_w + _idist/iter endif if @_mode == 36 _tsum_w = _tsum_w + _tdist/iter endif if @_mode == 37 _csum_w = _csum_w + _cdist/iter endif if @_mode == 38 _qsum_w = _qsum_w + _qdist/iter endif ; ; Calculate the square-weighted sums ; if @_mode == 39 _sum_w2 = _sum_w2 + _dist/iter^2 endif if @_mode == 40 _rsum_w2 = _rsum_w2 + _rdist/iter^2 endif if @_mode == 41 _isum_w2 = _isum_w2 + _idist/iter^2 endif if @_mode == 42 _tsum_w2 = _tsum_w2 + _tdist/iter^2 endif if @_mode == 43 _csum_w2 = _csum_w2 + _cdist/iter^2 endif if @_mode == 44 _qsum_w2 = _qsum_w2 + _qdist/iter^2 endif endif ; no_spare final: if (no_spare) if @_mode == 0 temp = _min_dist ; "Min Dist" elseif @_mode == 1 temp = _min_rdist ; "Min Real" elseif @_mode == 2 temp = _min_idist ; "Min Imag" elseif @_mode == 3 temp = _min_tdist ; "Min Triang" elseif @_mode == 4 temp = _min_cdist ; "Min Cubus" elseif @_mode == 5 temp = _max_dist ; "Max Dist" elseif @_mode == 6 temp = _max_rdist ; "Max Real" elseif @_mode == 7 temp = _max_idist ; "Max Imag" elseif @_mode == 8 temp = _max_tdist ; "Max Triang" elseif @_mode == 9 temp = _max_cdist ; "Max Cubus" elseif @_mode == 10 temp = cabs(_zz - #pixel) ; "Act Dist" elseif @_mode == 11 temp = abs(real(_zz-#pixel)) ; "Act Real" elseif @_mode == 12 temp = abs(imag(_zz-#pixel)) ; "Act Imag" elseif @_mode == 13 temp = _dist ; "Last Dist" elseif @_mode == 14 temp = _rdist ; "Last Real" elseif @_mode == 15 temp = _idist ; "Last Imag" elseif @_mode == 16 temp = _tdist ; "Last Triang" elseif @_mode == 17 temp = _cdist ; "Last Cubus" elseif @_mode == 18 temp = abs(cabs(_zz)-cabs(#pixel)) ; "Difference" elseif @_mode == 19 temp = _trap ; "Trap Dist" elseif @_mode == 20 temp = _rtrap ; "Trap Real" elseif @_mode == 21 temp = _itrap ; "Trap Imag" elseif @_mode == 22 temp = _ttrap ; "Trap Triang" elseif @_mode == 23 temp = _ctrap ; "Trap Cubus" elseif @_mode == 24 temp = _sum ; "Sum Dist" elseif @_mode == 25 temp = _rsum ; "Sum Real" elseif @_mode == 26 temp = _isum ; "Sum Imag" elseif @_mode == 27 temp = _tsum ; "Sum Triang" elseif @_mode == 28 temp = _csum ; "Sum Cubus" elseif @_mode == 29 temp = _min_qdist ; "Min MinQuot" elseif @_mode == 30 temp = _max_qdist ; "Max MinQuot" elseif @_mode == 31 temp = _qsum ; "Sum MinQuot" elseif @_mode == 32 temp = _qdist ; "Last MinQuot" elseif @_mode == 33 temp = _sum_w elseif @_mode == 34 temp = _rsum_w elseif @_mode == 35 temp = _isum_w elseif @_mode == 36 temp = _tsum_w elseif @_mode == 37 temp = _csum_w elseif @_mode == 38 temp = _qsum_w elseif @_mode == 39 temp = _sum_w2 elseif @_mode == 40 temp = _rsum_w2 elseif @_mode == 41 temp = _isum_w2 elseif @_mode == 42 temp = _tsum_w2 elseif @_mode == 43 temp = _csum_w2 elseif @_mode == 44 temp = _qsum_w2 endif float mask = 0 bool no_mask = true if (@masking > 0) if (@maskType == 0) ; Index mask = temp elseif (@maskType == 1) ; Re z mask = real(zStart) elseif (@maskType == 2) ; Im z mask = imag(zStart) elseif (@maskType == 3) ; Angle mask = atan2(zStart)/(2*#pi) if mask < 0 mask = mask + 1 endif mask = mask*360 elseif (@maskType == 4) ; Iteration mask = iter elseif (@maskType == 5) ; Re Mixel mask = real(zStart+#pixel)/2 elseif (@maskType == 6) ; Im Mixel mask = imag(zStart+#pixel)/2 elseif (@maskType == 7) ; Abs Mixel mask = cabs(zStart+#pixel)/2 elseif (@maskType == 8) ; Dist(z,Pixel) mask = cabs(zStart-#pixel) elseif (@maskType == 9) ; |z| mask = cabs(zStart) endif endif if (@masking == 1) ; Lower if (mask < @threshold_l) #solid = true no_mask = false endif elseif (@masking == 2) ; Upper if (mask > @threshold_u) #solid = true no_mask = false endif elseif (@masking == 3) ; Between if (mask > @threshold_l && mask < @threshold_u) #solid = true no_mask = false endif elseif (@masking == 4) ; Outside if (mask < @threshold_l || mask > @threshold_u) #solid = true no_mask = false endif else no_mask = true endif if (no_mask) float to_index = real(@trf(temp)) if (@base4txtr == 1) _zz = #pixel elseif (@base4txtr == 2) _zz = (#pixel+_zz)/2 elseif (@base4txtr == 3) _zz = abs(#pixel-_zz) elseif (@base4txtr == 4) _zz = cabs(#pixel-_zz) endif if (@colour_limit != 0) to_index = to_index%@colour_limit endif if (@f_randomness != 0) to_index = to_index + @f_randomness * real(#random) endif if (@txtr_gnarl != 0) complex zGnarl = _zz zGnarl = zGnarl-trunc(zGnarl*@txtr_gnarl_scale)/@txtr_gnarl_scale if (@txtr_gnarl_size != 0 && @txtr_gnarl_size != 1) zGnarl = zGnarl/@txtr_gnarl_size endif if (@reachThrough) _zz = zGnarl endif float x = real(zGnarl) float y = imag(zGnarl) float xOld = 0 int iter3 = @txtr_gnarl_octaves while (iter3 > 0) iter3 = iter3-1 xOld = x x = x - sin(y + sin(y)) y = y - sin(xOld + sin(xOld)) endwhile float textureGnarl = 0 if (@txtr_gnarl_type == 0) textureGnarl = abs(x) elseif (@txtr_gnarl_type == 1) textureGnarl = abs(x)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_gnarl_type == 2) textureGnarl = abs(x-y) elseif (@txtr_gnarl_type == 3) textureGnarl = abs(x-y)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_gnarl_type == 4) textureGnarl = abs(x+y)/2 elseif (@txtr_gnarl_type == 5) textureGnarl = abs(x*y)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_gnarl_type == 6) textureGnarl = atan2(x+1i*y)/(2*#pi) if (textureGnarl < 0) textureGnarl = textureGnarl + 1 endif elseif (@txtr_gnarl_type == 7) textureGnarl = sqrt(x^2+y^2) endif if (@txtr_Gnarl_limit != 0) textureGnarl = textureGnarl%@txtr_Gnarl_limit endif to_index = to_index + @txtr_gnarl*textureGnarl endif if (@txtr_PopCorn != 0) complex zPopCorn = _zz zPopCorn = zPopCorn-trunc(zPopCorn*@txtr_PopCorn_scale)/@txtr_PopCorn_scale if (@txtr_PopCorn_size != 0 && @txtr_PopCorn_size != 1) zPopCorn = zPopCorn/@txtr_PopCorn_size endif if (@reachThrough) _zz = zPopCorn endif float x = real(zPopCorn) float y = imag(zPopCorn) float xOld = 0 int iter3 = @txtr_PopCorn_octaves while (iter3 > 0) iter3 = iter3-1 xOld = x x = x - sin(y + log(y + cos(y))) y = y - sin(xOld + log(xOld + cos(xOld))) endwhile float texturePopCorn = 0 if (@txtr_PopCorn_type == 0) texturePopCorn = abs(x) elseif (@txtr_PopCorn_type == 1) texturePopCorn = abs(x)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_PopCorn_type == 2) texturePopCorn = abs(x-y) elseif (@txtr_PopCorn_type == 3) texturePopCorn = abs(x-y)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_PopCorn_type == 4) texturePopCorn = abs(x+y)/2 elseif (@txtr_PopCorn_type == 5) texturePopCorn = abs(x*y)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_PopCorn_type == 6) texturePopCorn = atan2(x+1i*y)/(2*#pi) if (texturePopCorn < 0) texturePopCorn = texturePopCorn + 1 endif elseif (@txtr_PopCorn_type == 7) texturePopCorn = sqrt(x^2+y^2) endif if (@txtr_PopCorn_limit != 0) texturePopCorn = texturePopCorn%@txtr_PopCorn_limit endif to_index = to_index + @txtr_PopCorn*texturePopCorn endif if (@txtr_SFBM != 0) float mod = 1 float d1 = 0 float d2 = 0 float d3 = 0 float d4 = 0 float nindex = 0 float textureSFBM = 0 float scale = 0 cr1 = 0 cr2 = 0 cr3 = 0 cr4 = 0 float crp1 = 0 float crp2 = 0 float crp3 = 0 float crp4 = 0 complex tv1 = 0 complex tv2 = 0 complex tv3 = 0 complex tv4 = 0 complex seed = @txtr_SFBM_seed rotAngleFBM = exp(1i*pi/180*@txtr_SFBM_rot) if (@txtr_SFBM_scaledis == 4) ; min textureSFBM = 1e20 elseif (@txtr_SFBM_scaledis == 5) ; max textureSFBM = -1e20 endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; complex zSFBM = _zz zSFBM = zSFBM-trunc(zSFBM*@txtr_SFBM_scale)/@txtr_SFBM_scale if (@txtr_SFBM_size != 0 && @txtr_SFBM_size != 1) zSFBM = zSFBM/@txtr_SFBM_size endif if (@reachThrough) _zz = zSFBM endif int iter3 = 0 complex ttmp = 0 while (iter3 < @txtr_SFBM_octaves) scale = @txtr_SFBM_magn^iter3 zSFBM = zSFBM*rotAngleFBM iter3 = iter3 + 1 if @txtr_SFBM_mod == 1 mod = sqrt(iter3) endif zc = round(scale*_zz)/scale zc1 = zc + (.5,.5)/scale zc2 = zc + (-.5,.5)/scale zc3 = zc + (.5,-.5)/scale zc4 = zc + (-.5,-.5)/scale ttmp = seed/(mod*zc1+124), cr1 = ttmp-floor(ttmp) ttmp = seed/(mod*zc2+124), cr2 = ttmp-floor(ttmp) ttmp = seed/(mod*zc3+124), cr3 = ttmp-floor(ttmp) ttmp = seed/(mod*zc4+124), cr4 = ttmp-floor(ttmp) if (@txtr_SFBM_mode == 0) tv1 = (zSFBM - zc1)*scale tv2 = (zSFBM - zc2)*scale tv3 = (zSFBM - zc3)*scale tv4 = (zSFBM - zc4)*scale crp1 = real(cr1)*real(tv1) + imag(cr1)*imag(tv1) crp2 = real(cr2)*real(tv2) + imag(cr2)*imag(tv2) crp3 = real(cr3)*real(tv3) + imag(cr3)*imag(tv3) crp4 = real(cr4)*real(tv4) + imag(cr4)*imag(tv4) endif ttmp = zSFBM - zc d1 = real(ttmp)*scale + 0.5 d2 = 1 - d1 d3 = imag(ttmp)*scale + 0.5 d4 = 1 - d3 if (@txtr_SFBM_power != 1) d1 = d1^@txtr_SFBM_power d2 = d2^@txtr_SFBM_power d3 = d3^@txtr_SFBM_power d4 = d4^@txtr_SFBM_power endif if @txtr_SFBM_mode == 0 nindex = 10 + crp1*d1*d3 + crp3*d1*d4 + crp2*d2*d3 + crp4*d2*d4 elseif @txtr_SFBM_mode == 1 nindex = cabs(cr1*d1*d3 + cr3*d1*d4 + cr2*d2*d3 + cr4*d2*d4) endif if (@txtr_SFBM_scaledis == 0) textureSFBM = textureSFBM + nindex/scale elseif (@txtr_SFBM_scaledis == 1) textureSFBM = textureSFBM + nindex/sqrt(scale) elseif (@txtr_SFBM_scaledis == 2) textureSFBM = textureSFBM + nindex/(scale^(1/scale)) elseif (@txtr_SFBM_scaledis == 3) textureSFBM = textureSFBM + nindex/iter3 elseif (@txtr_SFBM_scaledis == 4) if (nindex < textureSFBM) textureSFBM = nindex endif elseif (@txtr_SFBM_scaledis == 5) if (nindex > textureSFBM) textureSFBM = nindex endif endif endwhile if (@txtr_SFBM_limit != 0) textureSFBM = textureSFBM%@txtr_SFBM_limit endif to_index = to_index + @txtr_SFBM*textureSFBM endif if (@txtr_primes != 0) complex zPrimes = _zz zPrimes = zPrimes-trunc(zPrimes*@txtr_Primes_scale)/@txtr_Primes_scale if (@txtr_Primes_size != 0 && @txtr_Primes_size != 1) zPrimes = zPrimes/@txtr_Primes_size endif if (@reachThrough) _zz = zPrimes endif float texturePrimes = 0 float trz = 0 float tiz = 0 float t_rz = 0 float t_iz = 0 float tstartSnip = 10^@txtr_primes_where2start float tendOfSnip = 10^(@txtr_primes_where2start+@txtr_primes_lengthOfSnip) if (@txtr_primes_mode == 0) trz = |real(zPrimes)| tiz = |imag(zPrimes)| elseif (@txtr_primes_mode == 1) trz = |real(zPrimes)| tiz = trz elseif (@txtr_primes_mode == 2) tiz = |imag(zPrimes)| trz = tiz elseif (@txtr_primes_mode == 3) trz = |zPrimes| tiz = trz elseif (@txtr_primes_mode == 4) trz = atan2(zPrimes) if (trz < 0) trz = trz + 2*#pi endif tiz = trz elseif (@txtr_primes_mode == 5) trz = real(atan(zPrimes)) if (trz < 0) trz = trz + 2*#pi endif tiz = imag(atan(zPrimes)) if (tiz < 0) tiz = tiz + 2*#pi endif elseif (@txtr_primes_mode == 6) trz = atan2(zPrimes) if (trz < 0) trz = trz + 2*#pi endif tiz = |zPrimes| endif t_rz = (trz - trunc(trz*tstartSnip)/tstartSnip)*tendOfSnip t_iz = (tiz - trunc(tiz*tstartSnip)/tstartSnip)*tendOfSnip if (@txtr_primes_withFinalTrunc) t_rz = trunc(t_rz) t_iz = trunc(t_iz) endif texturePrimes = 10*((t_rz%821) + (t_iz%823))/1644 if (@txtr_Primes_limit != 0) texturePrimes = texturePrimes%@txtr_Primes_limit endif to_index = to_index + @txtr_Primes*texturePrimes endif ; @txtr_primes != 0 if (@txtr_Gauss != 0) complex zGauss = _zz zGauss = zGauss-trunc(zGauss*@txtr_Gauss_scale)/@txtr_Gauss_scale if (@txtr_Gauss_size != 0 && @txtr_Gauss_size != 1) zGauss = zGauss/@txtr_Gauss_size endif if (@reachThrough) _zz = zGauss endif float textureGauss = 0 float t_d = cabs(zGauss) float t_r = real(zGauss) float t_i = imag(zGauss) if (@txtr_Gauss_type == 0) textureGauss = t_d elseif (@txtr_Gauss_type == 1) textureGauss = |t_r| elseif (@txtr_Gauss_type == 2) textureGauss = |t_i| elseif (@txtr_Gauss_type == 3) textureGauss = |t_i-t_r| elseif (@txtr_Gauss_type == 4) textureGauss = |t_i*t_r| elseif (@txtr_Gauss_type == 5) textureGauss = |t_i/t_r| elseif (@txtr_Gauss_type == 6) if (|t_i| < |t_r|) textureGauss = |t_i| else textureGauss = |t_r| endif elseif (@txtr_Gauss_type == 7) if (|t_i| > |t_r|) textureGauss = |t_i| else textureGauss = |t_r| endif elseif (@txtr_Gauss_type == 8) textureGauss = atan2(zGauss)/(2*#pi) if textureGauss < 0 textureGauss = textureGauss + 1 endif elseif (@txtr_Gauss_type == 9) textureGauss = (|t_i|+|t_r|+t_d)/3 elseif (@txtr_Gauss_type == 10) textureGauss = (|t_i|*|t_r|*t_d)^(1/3) endif if (@txtr_Gauss_limit != 0) textureGauss = textureGauss%@txtr_Gauss_limit endif to_index = to_index + @txtr_Gauss*textureGauss endif #index = to_index endif ; no_mask else if (@spareMask) #solid = true endif endif ; no_spare default: title = "AGM #4 (Arithm. Geom. Mean)" param _mode caption = "Dist. Mode" enum = "Min Dist" "Min Real" "Min Imag" "Min Triang" "Min Cubus" \ "Max Dist" "Max Real" "Max Imag" "Max Triang" "Max Cubus" \ "Act Dist" "Act Real" "Act Imag" \ "Last Dist" "Last Real" "Last Imag" "Last Triang" "Last Cubus" \ "Difference" \ "Trap Dist" "Trap Real" "Trap Imag" "Trap Triang" "Trap Cubus" \ "Sum Dist" "Sum Real" "Sum Imag" "Sum Triang" "Sum Cubus" \ "Min MinQuot" "Max MinQuot" "Sum MinQuot" "Last MinQuot" \ "W-Sum Dist" "W-Sum Real" "W-Sum Imag" "W-Sum Triang" "W-Sum Cubus" \ "W^2-Sum Dist" "W^2-Sum Real" "W^2-Sum Imag" \ "W^2-Sum Triang" "W^2-Sum Cubus" endparam param _trap_min caption = "Lower Border for Trap" default = 1.0 min = 0.0 hint = "Only usefull with Traps" endparam param _trap_max caption = "Upper Border for Trap" default = 2.0 min = 0.0 hint = "Only usefull with Traps" endparam param epsilon caption = "epsilon" default = 0.1 min = 0.0 endparam param pure caption= "With Pixel Addition" default=TRUE endparam param granulation caption = "Granulation" default = 1.0 min = 0.0001 endparam param maxIter caption = "Maximum Iterations" default = 200 min = 1 endparam param coord caption = "Coordinates" enum = "Rectangular" \ "Polar" "PolarH" "aPolar" "aPolarH" \ "sin/cos" "sinh/cosh" "asin/acos" "asinh/acosh" \ "z/inv(z)" "z/conj(z)" "z/flip(z)" \ "?sin/cos" "?sin/i*cos" "?asin/acos" "?asin/i*acos" \ "?sinh/cosh" "?sinh/i*cosh" "?asinh/acosh" "?asinh/i*acosh" default = 0 endparam param coordLoop caption = "# Coord Loops" default = 1 min = 1 endparam param coordMode caption = "Mode Coord Loop" enum = "Static" "Dynamic" default = 0 endparam param lattice caption = "Lattice Type" enum = "None" \ "round" "trunc" "floor" "ceil" "abs" \ "r-round" "r-trunc" "r-floor" "r-ceil" "r-abs" \ "round^2" "trunc^2" "floor^2" "ceil^2" "abs^2" \ "r-round^2" "r-trunc^2" "r-floor^2" "r-ceil^2" "r-abs^2" \ "Modulo" "Mod Quot" "Mod Inv" default = 0 endparam param lattFac1 caption = "Lattice Factor 1" default = (1.0,0.0) endparam param lattFac2 caption = "Lattice Factor 2" default = (1.0,0.0) endparam param colour_limit caption = "Colour Limitation" default = 0.0 min = 0.0 max = 400.0 endparam param with_zStart caption = "zStart everywhere Y/N" default = false hint = "Works with the lattices" endparam param turnMode caption = "L: Turnaround Mode" default = false endparam param turnScale caption = "L: Turn Scale" default = 1.0 min = 0.0 endparam param corte1 caption = "L: Turnaround #1" default = 4.0 endparam param corte2 caption = "L: Turnaround #2" default = 2.0 endparam param l_randomness caption = "L: Randomness" hint = "This adds a randomness in the outlines." default = 0.0 endparam param f_randomness caption = "T: Random Texture" hint = "This adds a random texture the the coloring." default = 0.0 endparam param base4txtr caption = "Texture Base" enum = "Z" "Pixel" "Mixel" "Diff(Z,Pixel)" "Dist(Z,Pixel)" default = 0 endparam param reachThrough caption = "T: Reach Through Scales" default = false hint = "Reaches the Scale and Pattern Size from one \ Texture to the next. Every Texture changes all \ that follow." endparam param txtr_gnarl caption = "T: Gnarl Texture" hint = "This adds a Gnarl texture the the coloring." default = 0.0 endparam param txtr_gnarl_type caption = "T: Gnarl Type" enum = "x" "x/d" "x-y" "(x-y)/d" "(x+y)/2" "x*y/d" "Angle" "d" default = 0 endparam param txtr_gnarl_scale caption = "T: Gnarl Scale" hint = "Scaling Factor for this Gnarl texture." default = 1.0 endparam param txtr_gnarl_size caption = "T: Gnarl Pattern Size" default = 1.0 endparam param txtr_gnarl_limit caption = "T: Gnarl Limitation" default = 0.0 min = 0.0 endparam param txtr_gnarl_octaves caption = "T: Gnarl Octaves" default = 5 min = 1 endparam param txtr_PopCorn caption = "T: PopCorn Texture" hint = "This adds a PopCorn texture the the coloring." default = 0.0 endparam param txtr_PopCorn_type caption = "T: PopCorn Type" enum = "x" "x/d" "x-y" "(x-y)/d" "(x+y)/2" "x*y/d" "Angle" "d" default = 0 endparam param txtr_PopCorn_scale caption = "T: PopCorn Scale" hint = "Scaling Factor for this PopCorn texture." default = 1.0 endparam param txtr_PopCorn_size caption = "T: PopCorn Pattern Size" default = 1.0 endparam param txtr_PopCorn_limit caption = "T: PopCorn Limitation" default = 0.0 min = 0.0 endparam param txtr_PopCorn_octaves caption = "T: PopCorn Octaves" default = 5 min = 1 endparam param txtr_SFBM caption = "T: SFBM Texture" hint = "This adds a SFBM texture to the coloring." default = 0.0 endparam param txtr_SFBM_mode caption = "T: SFBM Noise type" default = 1 enum = "Perlin's" "Raw... (Sam's)" endparam param txtr_SFBM_scale caption = "T: SFBM Scale" hint = "Scaling Factor for this SFBM texture." default = 1.0 endparam param txtr_SFBM_scaledis caption = "T: SFBM Scale Distribution" default = 0 enum = "1/scale" "1/sqrt(scale)" "Fancy" "1/i" endparam param txtr_SFBM_size caption = "T: SFBM Pattern Size" default = 0.1 endparam param txtr_SFBM_magn caption = "T: SFBM Magnification Step" default = 1.2 endparam param txtr_SFBM_limit caption = "T: SFBM Limitation" default = 0.0 min = 0.0 endparam param txtr_SFBM_rot caption = "T: SFBM Rotation Step" default = 28.0 endparam param txtr_SFBM_power caption = "T: SFBM Power" default = 1.0 endparam param txtr_SFBM_mod caption = "Vary Random Numbers?" default = 1 enum = "No" "Use sqrt(i)" endparam param txtr_SFBM_seed caption = "T: SFBM Seed" default = 123094 endparam param txtr_SFBM_octaves caption = "T: SFBM Octaves" default = 5 min = 1 endparam param txtr_Primes caption = "T: Primes Texture" hint = "This adds a Primes texture to the coloring." default = 0.0 endparam param txtr_Primes_scale caption = "T: Primes Scale" hint = "Scaling Factor for this Primes texture." default = 1.0 endparam param txtr_Primes_size caption = "T: Primes Pattern Size" default = 0.5 endparam param txtr_primes_withFinalTrunc caption = "With Final Truncation" default = TRUE endparam param txtr_primes_where2start caption = "T: Start of Snip" default = 1 min = 0 endparam param txtr_primes_lengthOfSnip caption = "T: Length of Snip" default = 1 min = 1 endparam param txtr_primes_Mode caption = "T: Primes Mode" enum = "Real,Imag" "Real" "Imag" "|z|" "Angle" "Angel" "Polar" default = 5 endparam param txtr_primes_limit caption = "T: Primes Limitation" default = 0.0 min = 0.0 endparam param txtr_Gauss caption = "T: Gauss Texture" hint = "This adds a Gauss texture to the coloring." default = 0.0 endparam param txtr_Gauss_type caption = "T: Gauss Type" enum = "d" "x" "y" "x-y" "x*y" "y/x" "min x,y" "max x,y" "Angle" \ "Pyth. am" "Pyth. gm" default = 0 endparam param txtr_Gauss_scale caption = "T: Gauss Scale" hint = "Scaling Factor for this Gauss texture." default = 1.0 endparam param txtr_Gauss_size caption = "T: Gauss Pattern Size" default = 1.0 endparam param txtr_Gauss_limit caption = "T: Gauss Limitation" default = 0.0 min = 0.0 endparam param masking caption = "Masking" enum = "None" "Lower" "Upper" "Between" "Outside" default = 0 endparam param maskType caption = "Mask Type" enum = "Index" "Re z" "Im z" "Angle" "Iteration" \ "Re Mixel" "Im Mixel" "Abs Mixel" \ "Dist(z,Pixel)" "|z|" default = 0 endparam param threshold_l caption = "Lower Mask Threshold" default = 0.5 endparam param threshold_u caption = "Upper Mask Threshold" default = 1.0 endparam param spareMode caption = "Cut Out" enum = "None" "Upper" "Lower" \ "Left" "Right" \ "Upper + Left" "Upper + Right" "Lower + Left" "Lower + Right" \ "Upper & Left" "Upper & Right" "Lower & Left" "Lower & Right" \ "Inside Rectangle" "Outside Rectangle" \ "Between Vertical" "Outside Vertical" \ "Between Horizontal" "Outside Horizontal" \ "Inside Circle" "Outside Circle" default = 0 endparam param sparePoint caption = "Line of Cut, 1. Point" default = (0,0) endparam param sparePoint2 caption = "Add. Point/Line for Cut" default = (1,1) endparam param spareRot caption = "Rotate Cut" default = 0.0 min = -90.0 max = 90.0 endparam param spareMask caption = "Mask Cut" default = true endparam func trf caption = "Transfer Function" default = ident() endfunc func fn1 caption = "Real Part Init Function" default = ident() endfunc func fn2 caption = "Imag Part Init Function" default = ident() endfunc func startFct caption = "Start Function" default = ident() endfunc func fkt caption = "Additional Function" default = recip() endfunc } ; agm4 agm5 { ; ; AGM means "Arithmetic Geometric Mean". ; AM and GM are normally different. ; But if they are iterated on their ; new values, they begin to come ; nearer and nearer... ; ; let AM_n be AM(AM_(n-1),GM_(n-1)) ; Then you have ; lim (AM(AM_n,GM_n) - GM(AM_n,GM_n)) = 0 ; ; All the AGM colourings measure the "n" ; when the above number series are near ; a certain small value called epsilon... ; ; ; Try out lattices... ; ; Andreas Lober, July 30, 2000 ; init: bool no_spare = true if (@spareMode > 0) float spareVert = real(@sparePoint) float spareHori = imag(@sparePoint) complex pixpix = #pixel float rePix = 0 float imPix = 0 if (@spareMode <= 18) if (@spareRot%360 != 0) complex rotCentre = @sparePoint if (@spareMode > 12 && @spareMode < 19) rotCentre = (@sparePoint+@sparePoint2)/2 endif pixpix = (pixpix-rotCentre)*exp(-1i*#pi*@spareRot/180) + rotCentre endif rePix = real(pixpix) imPix = imag(pixpix) endif if (@spareMode <= 12) if (@spareMode == 1 || @spareMode == 5 || @spareMode == 6 \ || @spareMode == 9 || @spareMode == 10) ; upper upper+right upper+left ; upper&right upper&left if (imPix >= spareHori) if (@spareMode == 9) if (rePix < spareVert) no_spare = false endif elseif (@spareMode == 10) if (rePix >= spareVert) no_spare = false endif else no_spare = false endif endif elseif (@spareMode == 2 || @spareMode == 7 || @spareMode == 8 \ || @spareMode == 11 || @spareMode == 12) ; lower lower+right lower+left ; lower&right lower&left if (imPix < spareHori) if (@spareMode == 11) if (rePix < spareVert) no_spare = false endif elseif (@spareMode == 12) if (rePix >= spareVert) no_spare = false endif else no_spare = false endif endif endif if (@spareMode == 3 || @spareMode == 5 || @spareMode == 7) ; left upper+left lower+left if (rePix < spareVert) no_spare = false endif elseif (@spareMode == 4 || @spareMode == 6 || @spareMode == 8) ; right upper+right lower+right if (rePix >= spareVert) no_spare = false endif endif elseif (@spareMode <= 18) float rePnt = real(@sparePoint2) float imPnt = imag(@sparePoint2) float upper = imPnt float lower = spareHori float left = spareVert float right = rePnt if (imPnt < spareHori) upper = spareHori lower = imPnt endif if (spareVert > rePnt) left = rePnt right = spareVert endif if (@spareMode == 13) ; inside rect if (rePix > left && rePix < right && imPix > lower && imPix < upper) no_spare = false endif elseif (@spareMode == 14) ; outside rect if (rePix < left || rePix > right || imPix < lower || imPix > upper) no_spare = false endif elseif (@spareMode == 15) ; inside vert if (rePix > left && rePix < right) no_spare = false endif elseif (@spareMode == 16) ; outside vert if (rePix < left || rePix > right) no_spare = false endif elseif (@spareMode == 17) ; inside hori if (imPix > lower && imPix < upper) no_spare = false endif elseif (@spareMode == 18) ; outside hori if (imPix < lower || imPix > upper) no_spare = false endif endif elseif (@spareMode <= 20) float radiusOFCutCircle = cabs(@sparePoint-@sparePoint2) if (@spareMode == 19) ; inside circle if (cabs(#pixel-@sparePoint) < radiusOFCutCircle) no_spare = false endif elseif (@spareMode == 20) ; outside circle if (cabs(#pixel-@sparePoint) > radiusOFCutCircle) no_spare = false endif endif endif ; spareMode > 12 endif ; @spareMode > 0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; float _dist = 0 float _rdist = 0 float _idist = 0 float _tdist = 0 float _cdist = 0 float _qdist = 0 float _rd = 0 float _id = 0 float _min_dist = 1e20 float _max_dist = -1 float _min_rdist = 1e20 float _max_rdist = -1 float _min_idist = 1e20 float _max_idist = -1 float _min_tdist = 1e20 float _max_tdist = -1 float _min_cdist = 1e20 float _max_cdist = -1 float _min_qdist = 1e20 float _max_qdist = -1 float temp = -1 ; ; Traps ; bool _do_trap = true float _trap = 0.01 bool _do_rtrap = true float _rtrap = 0.01 bool _do_itrap = true float _itrap = 0.01 bool _do_ttrap = true float _ttrap = 0.01 bool _do_ctrap = true float _ctrap = 0.01 ; ; Sums ; float _sum = 0 float _rsum = 0 float _isum = 0 float _tsum = 0 float _csum = 0 float _qsum = 0 ; ; Weighted Sums ; float _sum_w = 0 float _rsum_w = 0 float _isum_w = 0 float _tsum_w = 0 float _csum_w = 0 float _qsum_w = 0 ; ; Square-Weighted Sums ; float _sum_w2 = 0 float _rsum_w2 = 0 float _isum_w2 = 0 float _tsum_w2 = 0 float _csum_w2 = 0 float _qsum_w2 = 0 complex ar = |real(@fn1(#pixel))| complex ge = |imag(@fn2(#pixel))| complex arit = 0 complex geom = 0 complex _zz = #pixel complex zStart = 0 int iter = 0 int l_coord = @coordLoop int koord = @coord float testAngle1 = #pi/@corte1 float testAngle2 = 3*testAngle1 complex rotAngle1 = @corte2*1i*testAngle1 complex rotAngle2 = @corte2*1i*testAngle2 loop: if (no_spare) zStart = #pixel ; init zStart int loop_i = 0 while (loop_i < l_coord) loop_i = loop_i + 1 if (@coordMode == 1) ; cyclic koord = (koord+1)%19 endif if (koord == 1) zStart = cabs(zStart) + 1i*atan2(zStart) elseif (koord == 2) float rad = cabs(zStart) float phi = atan2(zStart) zStart = rad*(sinh(phi) + 1i*cosh(phi)) elseif (koord == 3) float rad = cabs(zStart) float phi = atan2(zStart) zStart = rad*(asin(phi) + 1i*acos(phi)) elseif (koord == 4) float rad = cabs(zStart) float phi = atan2(zStart) zStart = rad*(asinh(phi) + 1i*acosh(phi)) elseif (koord == 5) zStart = real(sin(zStart)) + 1i*cos(zStart) elseif (koord == 6) zStart = real(sinh(zStart)) + 1i*cosh(zStart) elseif (koord == 7) zStart = real(asin(zStart)) + 1i*acos(zStart) elseif (koord == 8) zStart = real(asinh(zStart)) + 1i*acosh(zStart) elseif (koord == 9) zStart = abs(zStart) + conj(zStart)/(|zStart|+1e-20) elseif (koord >= 10 && koord <= 19) if (zStart != 0) float rad = cabs(zStart) float re = real(zStart)/rad float im = imag(zStart)/rad if (koord == 10) zStart = re*zStart + im*conj(zStart) elseif (koord == 11) zStart = re*zStart + im*flip(zStart) elseif (koord == 12) zStart = re*sin(zStart) + im*cos(zStart) elseif (koord == 13) zStart = re*sin(zStart) + 1i*im*cos(zStart) elseif (koord == 14) zStart = re*asin(zStart) + im*acos(zStart) elseif (koord == 15) zStart = re*asin(zStart) + 1i*im*acos(zStart) elseif (koord == 16) zStart = re*sinh(zStart) + im*cosh(zStart) elseif (koord == 17) zStart = re*sinh(zStart) + 1i*im*cosh(zStart) elseif (koord == 18) zStart = re*asinh(zStart) + im*acosh(zStart) elseif (koord == 19) zStart = re*asinh(zStart) + 1i*im*acosh(zStart) endif endif endif endwhile ; Schleife über die Koordinaten zStart = @startFct(zStart) if (@l_randomness != 0) zStart = zStart + @l_randomness * #random endif ; ; Start with the lattices ; if (@lattice == 1) zStart = round(@lattFac1*zStart) - @lattFac2*zStart elseif (@lattice == 2) zStart = trunc(@lattFac1*zStart) - @lattFac2*zStart elseif (@lattice == 3) zStart = floor(@lattFac1*zStart) - @lattFac2*zStart elseif (@lattice == 4) zStart = ceil(@lattFac1*zStart) - @lattFac2*zStart elseif (@lattice == 5) zStart = abs(@lattFac1*zStart) - @lattFac2*zStart^2 elseif (@lattice == 6) zStart = round(@lattFac1*zStart) \ - @lattFac2*sqrt(real(zStart)*imag(zStart)) elseif (@lattice == 7) zStart = trunc(@lattFac1*zStart) \ - @lattFac2*sqrt(real(zStart)*imag(zStart)) elseif (@lattice == 8) zStart = floor(@lattFac1*zStart) \ - @lattFac2*sqrt(real(zStart)*imag(zStart)) elseif (@lattice == 9) zStart = ceil(@lattFac1*zStart) \ - @lattFac2*sqrt(real(zStart)*imag(zStart)) elseif (@lattice == 10) zStart = abs(@lattFac1*zStart) \ - @lattFac2*sqrt(real(zStart)*imag(zStart)) elseif (@lattice == 11) zStart = round((round(@lattFac1*zStart) \ - @lattFac1*zStart)^2) \ - @lattFac2*zStart^2 elseif (@lattice == 12) zStart = trunc((trunc(@lattFac1*zStart) \ - @lattFac1*zStart)^2) \ - @lattFac2*zStart^2 elseif (@lattice == 13) zStart = floor((floor(@lattFac1*zStart) \ - @lattFac1*zStart)^2) \ - @lattFac2*zStart^2 elseif (@lattice == 14) zStart = ceil((ceil(@lattFac1*zStart) \ - @lattFac1*zStart)^2) \ - @lattFac2*zStart^2 elseif (@lattice == 15) zStart = abs((abs(@lattFac1*zStart) \ - @lattFac1*zStart^2)^2) \ - @lattFac2*zStart^2 elseif (@lattice == 16) zStart = round((round(@lattFac1*zStart) \ - @lattFac1*sqrt(real(zStart)*imag(zStart)))^2) \ - @lattFac2*zStart^2 elseif (@lattice == 17) zStart = trunc((trunc(@lattFac1*zStart) \ - @lattFac1*sqrt(real(zStart)*imag(zStart)))^2) \ - @lattFac2*zStart^2 elseif (@lattice == 18) zStart = floor((floor(@lattFac1*zStart) \ - @lattFac1*sqrt(real(zStart)*imag(zStart)))^2) \ - @lattFac2*zStart^2 elseif (@lattice == 19) zStart = ceil((ceil(@lattFac1*zStart) \ - @lattFac1*sqrt(real(zStart)*imag(zStart)))^2) \ - @lattFac2*zStart^2 elseif (@lattice == 20) zStart = abs((abs(@lattFac1*zStart) \ - @lattFac1*sqrt(real(zStart)*imag(zStart)))^2) \ - @lattFac2*zStart^2 elseif (@lattice >= 21 && @lattice <= 23) float reL1 = real(@lattFac1) float imL1 = imag(@lattFac1) float reL2 = real(@lattFac2) float imL2 = imag(@lattFac2) float reZ = reL1*real(zStart) float imZ = imL1*imag(zStart) if (reL2 != 0) reZ = reZ%reL2 endif if (imL2 != 0) imZ = imZ%imL2 endif if (@lattice == 21) zStart = reZ + 1i*imZ elseif (@lattice == 22) zStart = reZ/@lattFac1 + 1i*imZ/@lattFac2 elseif (@lattice == 23) zStart = @lattFac1/reZ + 1i*@lattFac2/imZ endif endif ; lattices if (@turnMode) complex zRound = 0 complex zZ = zStart if (@turnScale != 0) complex zRound = round(zStart*@turnScale)/@turnScale complex zZ = zStart-zRound endif float targ = atan2(zZ) ; "Turn around" part taken from Sam if (abs(targ) < testAngle1) zStart = zZ*exp(rotAngle1)+zRound elseif (abs(targ) > testAngle2) zStart = zZ*exp(rotAngle2)+zRound endif endif ; @turnMode ar = |real(@fn1(zStart))| ge = |imag(@fn2(zStart))| _zz = zStart iter = 0 while (|@fkt(ar)-@fkt(ge)| > @epsilon/@granulation && \ iter < @maxIter*@granulation) iter = iter + 1 ; Calculate new values of arithmetical ; and geometrical mean arit = (ar+ge)/2.0 geom = sqrt(ar*ge) ; give these values back ; for the next loop-run ar = arit ge = geom endwhile ; ; Calculate distances ; if (@iterMode == 0) ; Sum _dist = cabs(_zz - #z) + iter _rd = real(_zz - #z) + iter _id = imag(_zz - #z) + iter elseif (@iterMode == 1) ; Difference _dist = cabs(_zz - #z) - iter _rd = real(_zz - #z) - iter _id = imag(_zz - #z) - iter elseif (@iterMode == 2) ; Product _dist = cabs(_zz - #z) * iter _rd = real(_zz - #z) * iter _id = imag(_zz - #z) * iter elseif (@iterMode == 3) ; Quotient _dist = cabs(_zz - #z) / iter _rd = real(_zz - #z) / iter _id = imag(_zz - #z) / iter elseif (@iterMode == 4) ; Exponent _dist = cabs(_zz - #z)^iter _rd = real(_zz - #z)^iter _id = imag(_zz - #z)^iter elseif (@iterMode == 5) ; i-Sum _dist = cabs(_zz - #z + iter) _rd = real(_zz - #z + iter) _id = imag(_zz - #z + iter) elseif (@iterMode == 6) ; i-Difference _dist = cabs(_zz - #z - iter) _rd = real(_zz - #z - iter) _id = imag(_zz - #z - iter) elseif (@iterMode == 7) ; i-Product _dist = cabs(_zz*iter - #z) _rd = real(_zz*iter - #z) _id = imag(_zz*iter - #z) elseif (@iterMode == 8) ; i-Quotient _dist = cabs(_zz/iter - #z) _rd = real(_zz/iter - #z) _id = imag(_zz/iter - #z) elseif (@iterMode == 9) ; i-Exponent _dist = cabs(_zz^iter - #z) _rd = real(_zz^iter - #z) _id = imag(_zz^iter - #z) endif _dist = _dist*@granulation _rd = _rd*@granulation _id = _id*@granulation _rdist = abs(_rd) _idist = abs(_id) if _rd > _id _tdist = _rdist _cdist = _idist if _id == 0 _qdist = _rdist else _qdist = _rdist / _idist endif else _tdist = _idist _cdist = _rdist if _rd == 0 _qdist = _idist else _qdist = _idist / _rdist endif endif ; ; Calculate Min ; if @_mode == 0 && _dist < _min_dist _min_dist = _dist endif if @_mode == 1 && _rdist < _min_rdist _min_rdist = _rdist endif if @_mode == 2 && _idist < _min_idist _min_idist = _idist endif if @_mode == 3 && _tdist < _min_tdist _min_tdist = _tdist endif if @_mode == 4 && _tdist < _min_cdist _min_cdist = _cdist endif if @_mode == 29 && _qdist < _min_qdist _min_qdist = _qdist endif ; ; Calculate Max ; if @_mode == 5 && _dist > _max_dist _max_dist = _dist endif if @_mode == 6 && _rdist > _max_rdist _max_rdist = _rdist endif if @_mode == 7 && _rdist > _max_rdist _max_idist = _idist endif if @_mode == 8 && _tdist > _max_tdist _max_tdist = _tdist endif if @_mode == 9 && _cdist > _max_cdist _max_cdist = _cdist endif if @_mode == 30 && _qdist > _max_qdist _max_qdist = _qdist endif ; ; Calculate the traps ; if @_mode == 19 && _do_trap && _dist > @_trap_min && _dist < @_trap_max _do_trap = false _trap =_dist endif if @_mode == 20 && _do_rtrap && _rdist > @_trap_min && _rdist < @_trap_max _do_rtrap = false _rtrap =_rdist endif if @_mode == 21 && _do_itrap && _idist > @_trap_min && _idist < @_trap_max _do_itrap = false _itrap =_idist endif if @_mode == 22 && _do_ttrap && _tdist > @_trap_min && _tdist < @_trap_max _do_ttrap = false _ttrap =_tdist endif if @_mode == 23 && _do_ctrap && _cdist > @_trap_min && _cdist < @_trap_max _do_ctrap = false _ctrap =_cdist endif ; ; Calculate the sums ; if @_mode == 24 _sum = _sum + _dist endif if @_mode == 25 _rsum = _rsum + _rdist endif if @_mode == 26 _isum = _isum + _idist endif if @_mode == 27 _tsum = _tsum + _tdist endif if @_mode == 28 _csum = _csum + _cdist endif if @_mode == 31 _qsum = _qsum + _qdist endif ; ; Calculate the weighted sums ; if @_mode == 33 _sum_w = _sum_w + _dist/iter endif if @_mode == 34 _rsum_w = _rsum_w + _rdist/iter endif if @_mode == 35 _isum_w = _isum_w + _idist/iter endif if @_mode == 36 _tsum_w = _tsum_w + _tdist/iter endif if @_mode == 37 _csum_w = _csum_w + _cdist/iter endif if @_mode == 38 _qsum_w = _qsum_w + _qdist/iter endif ; ; Calculate the square-weighted sums ; if @_mode == 39 _sum_w2 = _sum_w2 + _dist/iter^2 endif if @_mode == 40 _rsum_w2 = _rsum_w2 + _rdist/iter^2 endif if @_mode == 41 _isum_w2 = _isum_w2 + _idist/iter^2 endif if @_mode == 42 _tsum_w2 = _tsum_w2 + _tdist/iter^2 endif if @_mode == 43 _csum_w2 = _csum_w2 + _cdist/iter^2 endif if @_mode == 44 _qsum_w2 = _qsum_w2 + _qdist/iter^2 endif endif ; no_spare final: if (no_spare) if @_mode == 0 temp = _min_dist ; "Min Dist" elseif @_mode == 1 temp = _min_rdist ; "Min Real" elseif @_mode == 2 temp = _min_idist ; "Min Imag" elseif @_mode == 3 temp = _min_tdist ; "Min Triang" elseif @_mode == 4 temp = _min_cdist ; "Min Cubus" elseif @_mode == 5 temp = _max_dist ; "Max Dist" elseif @_mode == 6 temp = _max_rdist ; "Max Real" elseif @_mode == 7 temp = _max_idist ; "Max Imag" elseif @_mode == 8 temp = _max_tdist ; "Max Triang" elseif @_mode == 9 temp = _max_cdist ; "Max Cubus" elseif @_mode == 10 temp = cabs(_zz - #pixel) ; "Act Dist" elseif @_mode == 11 temp = abs(real(_zz-#pixel)) ; "Act Real" elseif @_mode == 12 temp = abs(imag(_zz-#pixel)) ; "Act Imag" elseif @_mode == 13 temp = _dist ; "Last Dist" elseif @_mode == 14 temp = _rdist ; "Last Real" elseif @_mode == 15 temp = _idist ; "Last Imag" elseif @_mode == 16 temp = _tdist ; "Last Triang" elseif @_mode == 17 temp = _cdist ; "Last Cubus" elseif @_mode == 18 temp = abs(cabs(_zz)-cabs(#pixel)) ; "Difference" elseif @_mode == 19 temp = _trap ; "Trap Dist" elseif @_mode == 20 temp = _rtrap ; "Trap Real" elseif @_mode == 21 temp = _itrap ; "Trap Imag" elseif @_mode == 22 temp = _ttrap ; "Trap Triang" elseif @_mode == 23 temp = _ctrap ; "Trap Cubus" elseif @_mode == 24 temp = _sum ; "Sum Dist" elseif @_mode == 25 temp = _rsum ; "Sum Real" elseif @_mode == 26 temp = _isum ; "Sum Imag" elseif @_mode == 27 temp = _tsum ; "Sum Triang" elseif @_mode == 28 temp = _csum ; "Sum Cubus" elseif @_mode == 29 temp = _min_qdist ; "Min MinQuot" elseif @_mode == 30 temp = _max_qdist ; "Max MinQuot" elseif @_mode == 31 temp = _qsum ; "Sum MinQuot" elseif @_mode == 32 temp = _qdist ; "Last MinQuot" elseif @_mode == 33 temp = _sum_w elseif @_mode == 34 temp = _rsum_w elseif @_mode == 35 temp = _isum_w elseif @_mode == 36 temp = _tsum_w elseif @_mode == 37 temp = _csum_w elseif @_mode == 38 temp = _qsum_w elseif @_mode == 39 temp = _sum_w2 elseif @_mode == 40 temp = _rsum_w2 elseif @_mode == 41 temp = _isum_w2 elseif @_mode == 42 temp = _tsum_w2 elseif @_mode == 43 temp = _csum_w2 elseif @_mode == 44 temp = _qsum_w2 endif float mask = 0 bool no_mask = true if (@masking > 0) if (@maskType == 0) ; Index mask = temp elseif (@maskType == 1) ; Re z mask = real(zStart) elseif (@maskType == 2) ; Im z mask = imag(zStart) elseif (@maskType == 3) ; Angle mask = atan2(zStart)/(2*#pi) if mask < 0 mask = mask + 1 endif mask = mask*360 elseif (@maskType == 4) ; Iteration mask = iter elseif (@maskType == 5) ; Re Mixel mask = real(zStart+#pixel)/2 elseif (@maskType == 6) ; Im Mixel mask = imag(zStart+#pixel)/2 elseif (@maskType == 7) ; Abs Mixel mask = cabs(zStart+#pixel)/2 elseif (@maskType == 8) ; Dist(z,Pixel) mask = cabs(zStart-#pixel) elseif (@maskType == 9) ; |z| mask = cabs(zStart) endif endif if (@masking == 1) ; Lower if (mask < @threshold_l) #solid = true no_mask = false endif elseif (@masking == 2) ; Upper if (mask > @threshold_u) #solid = true no_mask = false endif elseif (@masking == 3) ; Between if (mask > @threshold_l && mask < @threshold_u) #solid = true no_mask = false endif elseif (@masking == 4) ; Outside if (mask < @threshold_l || mask > @threshold_u) #solid = true no_mask = false endif else no_mask = true endif if (no_mask) float to_index = real(@trf(temp)) if (@base4txtr == 1) _zz = #pixel elseif (@base4txtr == 2) _zz = (#pixel+_zz)/2 elseif (@base4txtr == 3) _zz = abs(#pixel-_zz) elseif (@base4txtr == 4) _zz = cabs(#pixel-_zz) endif if (@colour_limit != 0) to_index = to_index%@colour_limit endif if (@f_randomness != 0) to_index = to_index + @f_randomness * real(#random) endif if (@txtr_gnarl != 0) complex zGnarl = _zz zGnarl = zGnarl-trunc(zGnarl*@txtr_gnarl_scale)/@txtr_gnarl_scale if (@txtr_gnarl_size != 0 && @txtr_gnarl_size != 1) zGnarl = zGnarl/@txtr_gnarl_size endif if (@reachThrough) _zz = zGnarl endif float x = real(zGnarl) float y = imag(zGnarl) float xOld = 0 int iter3 = @txtr_gnarl_octaves while (iter3 > 0) iter3 = iter3-1 xOld = x x = x - sin(y + sin(y)) y = y - sin(xOld + sin(xOld)) endwhile float textureGnarl = 0 if (@txtr_gnarl_type == 0) textureGnarl = abs(x) elseif (@txtr_gnarl_type == 1) textureGnarl = abs(x)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_gnarl_type == 2) textureGnarl = abs(x-y) elseif (@txtr_gnarl_type == 3) textureGnarl = abs(x-y)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_gnarl_type == 4) textureGnarl = abs(x+y)/2 elseif (@txtr_gnarl_type == 5) textureGnarl = abs(x*y)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_gnarl_type == 6) textureGnarl = atan2(x+1i*y)/(2*#pi) if (textureGnarl < 0) textureGnarl = textureGnarl + 1 endif elseif (@txtr_gnarl_type == 7) textureGnarl = sqrt(x^2+y^2) endif if (@txtr_Gnarl_limit != 0) textureGnarl = textureGnarl%@txtr_Gnarl_limit endif to_index = to_index + @txtr_gnarl*textureGnarl endif if (@txtr_PopCorn != 0) complex zPopCorn = _zz zPopCorn = zPopCorn-trunc(zPopCorn*@txtr_PopCorn_scale)/@txtr_PopCorn_scale if (@txtr_PopCorn_size != 0 && @txtr_PopCorn_size != 1) zPopCorn = zPopCorn/@txtr_PopCorn_size endif if (@reachThrough) _zz = zPopCorn endif float x = real(zPopCorn) float y = imag(zPopCorn) float xOld = 0 int iter3 = @txtr_PopCorn_octaves while (iter3 > 0) iter3 = iter3-1 xOld = x x = x - sin(y + log(y + cos(y))) y = y - sin(xOld + log(xOld + cos(xOld))) endwhile float texturePopCorn = 0 if (@txtr_PopCorn_type == 0) texturePopCorn = abs(x) elseif (@txtr_PopCorn_type == 1) texturePopCorn = abs(x)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_PopCorn_type == 2) texturePopCorn = abs(x-y) elseif (@txtr_PopCorn_type == 3) texturePopCorn = abs(x-y)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_PopCorn_type == 4) texturePopCorn = abs(x+y)/2 elseif (@txtr_PopCorn_type == 5) texturePopCorn = abs(x*y)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_PopCorn_type == 6) texturePopCorn = atan2(x+1i*y)/(2*#pi) if (texturePopCorn < 0) texturePopCorn = texturePopCorn + 1 endif elseif (@txtr_PopCorn_type == 7) texturePopCorn = sqrt(x^2+y^2) endif if (@txtr_PopCorn_limit != 0) texturePopCorn = texturePopCorn%@txtr_PopCorn_limit endif to_index = to_index + @txtr_PopCorn*texturePopCorn endif if (@txtr_SFBM != 0) float mod = 1 float d1 = 0 float d2 = 0 float d3 = 0 float d4 = 0 float nindex = 0 float textureSFBM = 0 float scale = 0 cr1 = 0 cr2 = 0 cr3 = 0 cr4 = 0 float crp1 = 0 float crp2 = 0 float crp3 = 0 float crp4 = 0 complex tv1 = 0 complex tv2 = 0 complex tv3 = 0 complex tv4 = 0 complex seed = @txtr_SFBM_seed rotAngleFBM = exp(1i*pi/180*@txtr_SFBM_rot) if (@txtr_SFBM_scaledis == 4) ; min textureSFBM = 1e20 elseif (@txtr_SFBM_scaledis == 5) ; max textureSFBM = -1e20 endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; complex zSFBM = _zz zSFBM = zSFBM-trunc(zSFBM*@txtr_SFBM_scale)/@txtr_SFBM_scale if (@txtr_SFBM_size != 0 && @txtr_SFBM_size != 1) zSFBM = zSFBM/@txtr_SFBM_size endif if (@reachThrough) _zz = zSFBM endif int iter3 = 0 complex ttmp = 0 while (iter3 < @txtr_SFBM_octaves) scale = @txtr_SFBM_magn^iter3 zSFBM = zSFBM*rotAngleFBM iter3 = iter3 + 1 if @txtr_SFBM_mod == 1 mod = sqrt(iter3) endif zc = round(scale*_zz)/scale zc1 = zc + (.5,.5)/scale zc2 = zc + (-.5,.5)/scale zc3 = zc + (.5,-.5)/scale zc4 = zc + (-.5,-.5)/scale ttmp = seed/(mod*zc1+124), cr1 = ttmp-floor(ttmp) ttmp = seed/(mod*zc2+124), cr2 = ttmp-floor(ttmp) ttmp = seed/(mod*zc3+124), cr3 = ttmp-floor(ttmp) ttmp = seed/(mod*zc4+124), cr4 = ttmp-floor(ttmp) if (@txtr_SFBM_mode == 0) tv1 = (zSFBM - zc1)*scale tv2 = (zSFBM - zc2)*scale tv3 = (zSFBM - zc3)*scale tv4 = (zSFBM - zc4)*scale crp1 = real(cr1)*real(tv1) + imag(cr1)*imag(tv1) crp2 = real(cr2)*real(tv2) + imag(cr2)*imag(tv2) crp3 = real(cr3)*real(tv3) + imag(cr3)*imag(tv3) crp4 = real(cr4)*real(tv4) + imag(cr4)*imag(tv4) endif ttmp = zSFBM - zc d1 = real(ttmp)*scale + 0.5 d2 = 1 - d1 d3 = imag(ttmp)*scale + 0.5 d4 = 1 - d3 if (@txtr_SFBM_power != 1) d1 = d1^@txtr_SFBM_power d2 = d2^@txtr_SFBM_power d3 = d3^@txtr_SFBM_power d4 = d4^@txtr_SFBM_power endif if @txtr_SFBM_mode == 0 nindex = 10 + crp1*d1*d3 + crp3*d1*d4 + crp2*d2*d3 + crp4*d2*d4 elseif @txtr_SFBM_mode == 1 nindex = cabs(cr1*d1*d3 + cr3*d1*d4 + cr2*d2*d3 + cr4*d2*d4) endif if (@txtr_SFBM_scaledis == 0) textureSFBM = textureSFBM + nindex/scale elseif (@txtr_SFBM_scaledis == 1) textureSFBM = textureSFBM + nindex/sqrt(scale) elseif (@txtr_SFBM_scaledis == 2) textureSFBM = textureSFBM + nindex/(scale^(1/scale)) elseif (@txtr_SFBM_scaledis == 3) textureSFBM = textureSFBM + nindex/iter3 elseif (@txtr_SFBM_scaledis == 4) if (nindex < textureSFBM) textureSFBM = nindex endif elseif (@txtr_SFBM_scaledis == 5) if (nindex > textureSFBM) textureSFBM = nindex endif endif endwhile if (@txtr_SFBM_limit != 0) textureSFBM = textureSFBM%@txtr_SFBM_limit endif to_index = to_index + @txtr_SFBM*textureSFBM endif if (@txtr_primes != 0) complex zPrimes = _zz zPrimes = zPrimes-trunc(zPrimes*@txtr_Primes_scale)/@txtr_Primes_scale if (@txtr_Primes_size != 0 && @txtr_Primes_size != 1) zPrimes = zPrimes/@txtr_Primes_size endif if (@reachThrough) _zz = zPrimes endif float texturePrimes = 0 float trz = 0 float tiz = 0 float t_rz = 0 float t_iz = 0 float tstartSnip = 10^@txtr_primes_where2start float tendOfSnip = 10^(@txtr_primes_where2start+@txtr_primes_lengthOfSnip) if (@txtr_primes_mode == 0) trz = |real(zPrimes)| tiz = |imag(zPrimes)| elseif (@txtr_primes_mode == 1) trz = |real(zPrimes)| tiz = trz elseif (@txtr_primes_mode == 2) tiz = |imag(zPrimes)| trz = tiz elseif (@txtr_primes_mode == 3) trz = |zPrimes| tiz = trz elseif (@txtr_primes_mode == 4) trz = atan2(zPrimes) if (trz < 0) trz = trz + 2*#pi endif tiz = trz elseif (@txtr_primes_mode == 5) trz = real(atan(zPrimes)) if (trz < 0) trz = trz + 2*#pi endif tiz = imag(atan(zPrimes)) if (tiz < 0) tiz = tiz + 2*#pi endif elseif (@txtr_primes_mode == 6) trz = atan2(zPrimes) if (trz < 0) trz = trz + 2*#pi endif tiz = |zPrimes| endif t_rz = (trz - trunc(trz*tstartSnip)/tstartSnip)*tendOfSnip t_iz = (tiz - trunc(tiz*tstartSnip)/tstartSnip)*tendOfSnip if (@txtr_primes_withFinalTrunc) t_rz = trunc(t_rz) t_iz = trunc(t_iz) endif texturePrimes = 10*((t_rz%821) + (t_iz%823))/1644 if (@txtr_Primes_limit != 0) texturePrimes = texturePrimes%@txtr_Primes_limit endif to_index = to_index + @txtr_Primes*texturePrimes endif ; @txtr_primes != 0 if (@txtr_Gauss != 0) complex zGauss = _zz zGauss = zGauss-trunc(zGauss*@txtr_Gauss_scale)/@txtr_Gauss_scale if (@txtr_Gauss_size != 0 && @txtr_Gauss_size != 1) zGauss = zGauss/@txtr_Gauss_size endif if (@reachThrough) _zz = zGauss endif float textureGauss = 0 float t_d = cabs(zGauss) float t_r = real(zGauss) float t_i = imag(zGauss) if (@txtr_Gauss_type == 0) textureGauss = t_d elseif (@txtr_Gauss_type == 1) textureGauss = |t_r| elseif (@txtr_Gauss_type == 2) textureGauss = |t_i| elseif (@txtr_Gauss_type == 3) textureGauss = |t_i-t_r| elseif (@txtr_Gauss_type == 4) textureGauss = |t_i*t_r| elseif (@txtr_Gauss_type == 5) textureGauss = |t_i/t_r| elseif (@txtr_Gauss_type == 6) if (|t_i| < |t_r|) textureGauss = |t_i| else textureGauss = |t_r| endif elseif (@txtr_Gauss_type == 7) if (|t_i| > |t_r|) textureGauss = |t_i| else textureGauss = |t_r| endif elseif (@txtr_Gauss_type == 8) textureGauss = atan2(zGauss)/(2*#pi) if textureGauss < 0 textureGauss = textureGauss + 1 endif elseif (@txtr_Gauss_type == 9) textureGauss = (|t_i|+|t_r|+t_d)/3 elseif (@txtr_Gauss_type == 10) textureGauss = (|t_i|*|t_r|*t_d)^(1/3) endif if (@txtr_Gauss_limit != 0) textureGauss = textureGauss%@txtr_Gauss_limit endif to_index = to_index + @txtr_Gauss*textureGauss endif #index = to_index endif ; no_mask else if (@spareMask) #solid = true endif endif ; no_spare default: title = "AGM #5 (Arithm. Geom. Mean)" param _mode caption = "Dist. Mode" enum = "Min Dist" "Min Real" "Min Imag" "Min Triang" "Min Cubus" \ "Max Dist" "Max Real" "Max Imag" "Max Triang" "Max Cubus" \ "Act Dist" "Act Real" "Act Imag" \ "Last Dist" "Last Real" "Last Imag" "Last Triang" "Last Cubus" \ "Difference" \ "Trap Dist" "Trap Real" "Trap Imag" "Trap Triang" "Trap Cubus" \ "Sum Dist" "Sum Real" "Sum Imag" "Sum Triang" "Sum Cubus" \ "Min MinQuot" "Max MinQuot" "Sum MinQuot" "Last MinQuot" \ "W-Sum Dist" "W-Sum Real" "W-Sum Imag" "W-Sum Triang" "W-Sum Cubus" \ "W^2-Sum Dist" "W^2-Sum Real" "W^2-Sum Imag" \ "W^2-Sum Triang" "W^2-Sum Cubus" endparam param iterMode caption = "Iter. Mode" enum = "Sum" "Difference" "Product" "Quotient" "Exponent" \ "i-Sum" "i-Difference" "i-Product" "i-Quotient" "i-Exponent" endparam param _trap_min caption = "Lower Border for Trap" default = 1.0 min = 0.0 hint = "Only usefull with Traps" endparam param _trap_max caption = "Upper Border for Trap" default = 2.0 min = 0.0 hint = "Only usefull with Traps" endparam param epsilon caption = "epsilon" default = 0.1 min = 0.0 endparam param pure caption= "With Pixel Addition" default=TRUE endparam param granulation caption = "Granulation" default = 1.0 min = 0.0001 endparam param maxIter caption = "Maximum Iterations" default = 200 min = 1 endparam param coord caption = "Coordinates" enum = "Rectangular" \ "Polar" "PolarH" "aPolar" "aPolarH" \ "sin/cos" "sinh/cosh" "asin/acos" "asinh/acosh" \ "z/inv(z)" "z/conj(z)" "z/flip(z)" \ "?sin/cos" "?sin/i*cos" "?asin/acos" "?asin/i*acos" \ "?sinh/cosh" "?sinh/i*cosh" "?asinh/acosh" "?asinh/i*acosh" default = 0 endparam param coordLoop caption = "# Coord Loops" default = 1 min = 1 endparam param coordMode caption = "Mode Coord Loop" enum = "Static" "Dynamic" default = 0 endparam param lattice caption = "Lattice Type" enum = "None" \ "round" "trunc" "floor" "ceil" "abs" \ "r-round" "r-trunc" "r-floor" "r-ceil" "r-abs" \ "round^2" "trunc^2" "floor^2" "ceil^2" "abs^2" \ "r-round^2" "r-trunc^2" "r-floor^2" "r-ceil^2" "r-abs^2" \ "Modulo" "Mod Quot" "Mod Inv" default = 1 endparam param lattFac1 caption = "Lattice Factor 1" default = (1.0,0.0) endparam param lattFac2 caption = "Lattice Factor 2" default = (1.0,0.0) endparam param colour_limit caption = "Colour Limitation" default = 0.0 min = 0.0 max = 400.0 endparam param with_zStart caption = "zStart everywhere Y/N" default = false hint = "Works with the lattices" endparam param turnMode caption = "L: Turnaround Mode" default = false endparam param turnScale caption = "L: Turn Scale" default = 1.0 min = 0.0 endparam param corte1 caption = "L: Turnaround #1" default = 4.0 endparam param corte2 caption = "L: Turnaround #2" default = 2.0 endparam param l_randomness caption = "L: Randomness" hint = "This adds a randomness in the outlines." default = 0.0 endparam param f_randomness caption = "T: Random Texture" hint = "This adds a random texture the the coloring." default = 0.0 endparam param base4txtr caption = "Texture Base" enum = "Z" "Pixel" "Mixel" "Diff(Z,Pixel)" "Dist(Z,Pixel)" default = 0 endparam param reachThrough caption = "T: Reach Through Scales" default = false hint = "Reaches the Scale and Pattern Size from one \ Texture to the next. Every Texture changes all \ that follow." endparam param txtr_gnarl caption = "T: Gnarl Texture" hint = "This adds a Gnarl texture the the coloring." default = 0.0 endparam param txtr_gnarl_type caption = "T: Gnarl Type" enum = "x" "x/d" "x-y" "(x-y)/d" "(x+y)/2" "x*y/d" "Angle" "d" default = 0 endparam param txtr_gnarl_scale caption = "T: Gnarl Scale" hint = "Scaling Factor for this Gnarl texture." default = 1.0 endparam param txtr_gnarl_size caption = "T: Gnarl Pattern Size" default = 1.0 endparam param txtr_gnarl_limit caption = "T: Gnarl Limitation" default = 0.0 min = 0.0 endparam param txtr_gnarl_octaves caption = "T: Gnarl Octaves" default = 5 min = 1 endparam param txtr_PopCorn caption = "T: PopCorn Texture" hint = "This adds a PopCorn texture the the coloring." default = 0.0 endparam param txtr_PopCorn_type caption = "T: PopCorn Type" enum = "x" "x/d" "x-y" "(x-y)/d" "(x+y)/2" "x*y/d" "Angle" "d" default = 0 endparam param txtr_PopCorn_scale caption = "T: PopCorn Scale" hint = "Scaling Factor for this PopCorn texture." default = 1.0 endparam param txtr_PopCorn_size caption = "T: PopCorn Pattern Size" default = 1.0 endparam param txtr_PopCorn_limit caption = "T: PopCorn Limitation" default = 0.0 min = 0.0 endparam param txtr_PopCorn_octaves caption = "T: PopCorn Octaves" default = 5 min = 1 endparam param txtr_SFBM caption = "T: SFBM Texture" hint = "This adds a SFBM texture to the coloring." default = 0.0 endparam param txtr_SFBM_mode caption = "T: SFBM Noise type" default = 1 enum = "Perlin's" "Raw... (Sam's)" endparam param txtr_SFBM_scale caption = "T: SFBM Scale" hint = "Scaling Factor for this SFBM texture." default = 1.0 endparam param txtr_SFBM_scaledis caption = "T: SFBM Scale Distribution" default = 0 enum = "1/scale" "1/sqrt(scale)" "Fancy" "1/i" endparam param txtr_SFBM_size caption = "T: SFBM Pattern Size" default = 0.1 endparam param txtr_SFBM_magn caption = "T: SFBM Magnification Step" default = 1.2 endparam param txtr_SFBM_limit caption = "T: SFBM Limitation" default = 0.0 min = 0.0 endparam param txtr_SFBM_rot caption = "T: SFBM Rotation Step" default = 28.0 endparam param txtr_SFBM_power caption = "T: SFBM Power" default = 1.0 endparam param txtr_SFBM_mod caption = "Vary Random Numbers?" default = 1 enum = "No" "Use sqrt(i)" endparam param txtr_SFBM_seed caption = "T: SFBM Seed" default = 123094 endparam param txtr_SFBM_octaves caption = "T: SFBM Octaves" default = 5 min = 1 endparam param txtr_Primes caption = "T: Primes Texture" hint = "This adds a Primes texture to the coloring." default = 0.0 endparam param txtr_Primes_scale caption = "T: Primes Scale" hint = "Scaling Factor for this Primes texture." default = 1.0 endparam param txtr_Primes_size caption = "T: Primes Pattern Size" default = 0.5 endparam param txtr_primes_withFinalTrunc caption = "With Final Truncation" default = TRUE endparam param txtr_primes_where2start caption = "T: Start of Snip" default = 1 min = 0 endparam param txtr_primes_lengthOfSnip caption = "T: Length of Snip" default = 1 min = 1 endparam param txtr_primes_Mode caption = "T: Primes Mode" enum = "Real,Imag" "Real" "Imag" "|z|" "Angle" "Angel" "Polar" default = 5 endparam param txtr_primes_limit caption = "T: Primes Limitation" default = 0.0 min = 0.0 endparam param txtr_Gauss caption = "T: Gauss Texture" hint = "This adds a Gauss texture to the coloring." default = 0.0 endparam param txtr_Gauss_type caption = "T: Gauss Type" enum = "d" "x" "y" "x-y" "x*y" "y/x" "min x,y" "max x,y" "Angle" \ "Pyth. am" "Pyth. gm" default = 0 endparam param txtr_Gauss_scale caption = "T: Gauss Scale" hint = "Scaling Factor for this Gauss texture." default = 1.0 endparam param txtr_Gauss_size caption = "T: Gauss Pattern Size" default = 1.0 endparam param txtr_Gauss_limit caption = "T: Gauss Limitation" default = 0.0 min = 0.0 endparam param masking caption = "Masking" enum = "None" "Lower" "Upper" "Between" "Outside" default = 0 endparam param maskType caption = "Mask Type" enum = "Index" "Re z" "Im z" "Angle" "Iteration" \ "Re Mixel" "Im Mixel" "Abs Mixel" \ "Dist(z,Pixel)" "|z|" default = 0 endparam param threshold_l caption = "Lower Mask Threshold" default = 0.5 endparam param threshold_u caption = "Upper Mask Threshold" default = 1.0 endparam param spareMode caption = "Cut Out" enum = "None" "Upper" "Lower" \ "Left" "Right" \ "Upper + Left" "Upper + Right" "Lower + Left" "Lower + Right" \ "Upper & Left" "Upper & Right" "Lower & Left" "Lower & Right" \ "Inside Rectangle" "Outside Rectangle" \ "Between Vertical" "Outside Vertical" \ "Between Horizontal" "Outside Horizontal" \ "Inside Circle" "Outside Circle" default = 0 endparam param sparePoint caption = "Line of Cut, 1. Point" default = (0,0) endparam param sparePoint2 caption = "Add. Point/Line for Cut" default = (1,1) endparam param spareRot caption = "Rotate Cut" default = 0.0 min = -90.0 max = 90.0 endparam param spareMask caption = "Mask Cut" default = true endparam func trf caption = "Transfer Function" default = ident() endfunc func fn1 caption = "Real Part Init Function" default = ident() endfunc func fn2 caption = "Imag Part Init Function" default = ident() endfunc func startFct caption = "Start Function" default = ident() endfunc func fkt caption = "Additional Function" default = recip() hint = "Useful are recip() sqrt() log()" endfunc } ; agm5 agm6 { ; ; AGM means "Arithmetic Geometric Mean". ; AM and GM are normally different. ; But if they are iterated on their ; new values, they begin to come ; nearer and nearer... ; ; let AM_n be AM(AM_(n-1),GM_(n-1)) ; Then you have ; lim (AM(AM_n,GM_n) - GM(AM_n,GM_n)) = 0 ; ; All the AGM colourings measure the "n" ; when the above number series are near ; a certain small value called epsilon... ; ; Andreas Lober, July 30, 2000 ; init: bool no_spare = true if (@spareMode > 0) float spareVert = real(@sparePoint) float spareHori = imag(@sparePoint) complex pixpix = #pixel float rePix = 0 float imPix = 0 if (@spareMode <= 18) if (@spareRot%360 != 0) complex rotCentre = @sparePoint if (@spareMode > 12 && @spareMode < 19) rotCentre = (@sparePoint+@sparePoint2)/2 endif pixpix = (pixpix-rotCentre)*exp(-1i*#pi*@spareRot/180) + rotCentre endif rePix = real(pixpix) imPix = imag(pixpix) endif if (@spareMode <= 12) if (@spareMode == 1 || @spareMode == 5 || @spareMode == 6 \ || @spareMode == 9 || @spareMode == 10) ; upper upper+right upper+left ; upper&right upper&left if (imPix >= spareHori) if (@spareMode == 9) if (rePix < spareVert) no_spare = false endif elseif (@spareMode == 10) if (rePix >= spareVert) no_spare = false endif else no_spare = false endif endif elseif (@spareMode == 2 || @spareMode == 7 || @spareMode == 8 \ || @spareMode == 11 || @spareMode == 12) ; lower lower+right lower+left ; lower&right lower&left if (imPix < spareHori) if (@spareMode == 11) if (rePix < spareVert) no_spare = false endif elseif (@spareMode == 12) if (rePix >= spareVert) no_spare = false endif else no_spare = false endif endif endif if (@spareMode == 3 || @spareMode == 5 || @spareMode == 7) ; left upper+left lower+left if (rePix < spareVert) no_spare = false endif elseif (@spareMode == 4 || @spareMode == 6 || @spareMode == 8) ; right upper+right lower+right if (rePix >= spareVert) no_spare = false endif endif elseif (@spareMode <= 18) float rePnt = real(@sparePoint2) float imPnt = imag(@sparePoint2) float upper = imPnt float lower = spareHori float left = spareVert float right = rePnt if (imPnt < spareHori) upper = spareHori lower = imPnt endif if (spareVert > rePnt) left = rePnt right = spareVert endif if (@spareMode == 13) ; inside rect if (rePix > left && rePix < right && imPix > lower && imPix < upper) no_spare = false endif elseif (@spareMode == 14) ; outside rect if (rePix < left || rePix > right || imPix < lower || imPix > upper) no_spare = false endif elseif (@spareMode == 15) ; inside vert if (rePix > left && rePix < right) no_spare = false endif elseif (@spareMode == 16) ; outside vert if (rePix < left || rePix > right) no_spare = false endif elseif (@spareMode == 17) ; inside hori if (imPix > lower && imPix < upper) no_spare = false endif elseif (@spareMode == 18) ; outside hori if (imPix < lower || imPix > upper) no_spare = false endif endif elseif (@spareMode <= 20) float radiusOFCutCircle = cabs(@sparePoint-@sparePoint2) if (@spareMode == 19) ; inside circle if (cabs(#pixel-@sparePoint) < radiusOFCutCircle) no_spare = false endif elseif (@spareMode == 20) ; outside circle if (cabs(#pixel-@sparePoint) > radiusOFCutCircle) no_spare = false endif endif endif ; spareMode > 12 endif ; @spareMode > 0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; float _dist = 0 float _rdist = 0 float _idist = 0 float _tdist = 0 float _cdist = 0 float _qdist = 0 float _rd = 0 float _id = 0 float _min_dist = 1e20 float _max_dist = -1 float _min_rdist = 1e20 float _max_rdist = -1 float _min_idist = 1e20 float _max_idist = -1 float _min_tdist = 1e20 float _max_tdist = -1 float _min_cdist = 1e20 float _max_cdist = -1 float _min_qdist = 1e20 float _max_qdist = -1 float temp = -1 ; ; Traps ; bool _do_trap = true float _trap = 0.01 bool _do_rtrap = true float _rtrap = 0.01 bool _do_itrap = true float _itrap = 0.01 bool _do_ttrap = true float _ttrap = 0.01 bool _do_ctrap = true float _ctrap = 0.01 ; ; Sums ; float _sum = 0 float _rsum = 0 float _isum = 0 float _tsum = 0 float _csum = 0 float _qsum = 0 ; ; Weighted Sums ; float _sum_w = 0 float _rsum_w = 0 float _isum_w = 0 float _tsum_w = 0 float _csum_w = 0 float _qsum_w = 0 ; ; Square-Weighted Sums ; float _sum_w2 = 0 float _rsum_w2 = 0 float _isum_w2 = 0 float _tsum_w2 = 0 float _csum_w2 = 0 float _qsum_w2 = 0 complex ar = |real(@fn1(#pixel))| complex ge = |imag(@fn2(#pixel))| complex arit = 0 complex geom = 0 complex _zz = #pixel complex old_zz = 0 int iter = 0 int l_coord = @coordLoop int koord = @coord complex zStart = 0 float testAngle1 = #pi/@corte1 float testAngle2 = 3*testAngle1 complex rotAngle1 = @corte2*1i*testAngle1 complex rotAngle2 = @corte2*1i*testAngle2 loop: if (no_spare) zStart = #pixel ; init zStart int loop_i = 0 while (loop_i < l_coord) loop_i = loop_i + 1 if (@coordMode == 1) ; cyclic koord = (koord+1)%19 endif if (koord == 1) zStart = cabs(zStart) + 1i*atan2(zStart) elseif (koord == 2) float rad = cabs(zStart) float phi = atan2(zStart) zStart = rad*(sinh(phi) + 1i*cosh(phi)) elseif (koord == 3) float rad = cabs(zStart) float phi = atan2(zStart) zStart = rad*(asin(phi) + 1i*acos(phi)) elseif (koord == 4) float rad = cabs(zStart) float phi = atan2(zStart) zStart = rad*(asinh(phi) + 1i*acosh(phi)) elseif (koord == 5) zStart = real(sin(zStart)) + 1i*cos(zStart) elseif (koord == 6) zStart = real(sinh(zStart)) + 1i*cosh(zStart) elseif (koord == 7) zStart = real(asin(zStart)) + 1i*acos(zStart) elseif (koord == 8) zStart = real(asinh(zStart)) + 1i*acosh(zStart) elseif (koord == 9) zStart = abs(zStart) + conj(zStart)/(|zStart|+1e-20) elseif (koord >= 10 && koord <= 19) if (zStart != 0) float rad = cabs(zStart) float re = real(zStart)/rad float im = imag(zStart)/rad if (koord == 10) zStart = re*zStart + im*conj(zStart) elseif (koord == 11) zStart = re*zStart + im*flip(zStart) elseif (koord == 12) zStart = re*sin(zStart) + im*cos(zStart) elseif (koord == 13) zStart = re*sin(zStart) + 1i*im*cos(zStart) elseif (koord == 14) zStart = re*asin(zStart) + im*acos(zStart) elseif (koord == 15) zStart = re*asin(zStart) + 1i*im*acos(zStart) elseif (koord == 16) zStart = re*sinh(zStart) + im*cosh(zStart) elseif (koord == 17) zStart = re*sinh(zStart) + 1i*im*cosh(zStart) elseif (koord == 18) zStart = re*asinh(zStart) + im*acosh(zStart) elseif (koord == 19) zStart = re*asinh(zStart) + 1i*im*acosh(zStart) endif endif endif endwhile ; Schleife über die Koordinaten zStart = @startFct(zStart) if (@l_randomness != 0) zStart = zStart + @l_randomness * #random endif old_zz = _zz ; ; Start with the lattices ; if (@lattice == 1) zStart = round(@lattFac1*zStart) - @lattFac2*zStart elseif (@lattice == 2) zStart = trunc(@lattFac1*zStart) - @lattFac2*zStart elseif (@lattice == 3) zStart = floor(@lattFac1*zStart) - @lattFac2*zStart elseif (@lattice == 4) zStart = ceil(@lattFac1*zStart) - @lattFac2*zStart elseif (@lattice == 5) zStart = abs(@lattFac1*zStart) - @lattFac2*zStart^2 elseif (@lattice == 6) zStart = round(@lattFac1*zStart) \ - @lattFac2*sqrt(real(zStart)*imag(zStart)) elseif (@lattice == 7) zStart = trunc(@lattFac1*zStart) \ - @lattFac2*sqrt(real(zStart)*imag(zStart)) elseif (@lattice == 8) zStart = floor(@lattFac1*zStart) \ - @lattFac2*sqrt(real(zStart)*imag(zStart)) elseif (@lattice == 9) zStart = ceil(@lattFac1*zStart) \ - @lattFac2*sqrt(real(zStart)*imag(zStart)) elseif (@lattice == 10) zStart = abs(@lattFac1*zStart) \ - @lattFac2*sqrt(real(zStart)*imag(zStart)) elseif (@lattice == 11) zStart = round((round(@lattFac1*zStart) \ - @lattFac1*zStart)^2) \ - @lattFac2*zStart^2 elseif (@lattice == 12) zStart = trunc((trunc(@lattFac1*zStart) \ - @lattFac1*zStart)^2) \ - @lattFac2*zStart^2 elseif (@lattice == 13) zStart = floor((floor(@lattFac1*zStart) \ - @lattFac1*zStart)^2) \ - @lattFac2*zStart^2 elseif (@lattice == 14) zStart = ceil((ceil(@lattFac1*zStart) \ - @lattFac1*zStart)^2) \ - @lattFac2*zStart^2 elseif (@lattice == 15) zStart = abs((abs(@lattFac1*zStart) \ - @lattFac1*zStart^2)^2) \ - @lattFac2*zStart^2 elseif (@lattice == 16) zStart = round((round(@lattFac1*zStart) \ - @lattFac1*sqrt(real(zStart)*imag(zStart)))^2) \ - @lattFac2*zStart^2 elseif (@lattice == 17) zStart = trunc((trunc(@lattFac1*zStart) \ - @lattFac1*sqrt(real(zStart)*imag(zStart)))^2) \ - @lattFac2*zStart^2 elseif (@lattice == 18) zStart = floor((floor(@lattFac1*zStart) \ - @lattFac1*sqrt(real(zStart)*imag(zStart)))^2) \ - @lattFac2*zStart^2 elseif (@lattice == 19) zStart = ceil((ceil(@lattFac1*zStart) \ - @lattFac1*sqrt(real(zStart)*imag(zStart)))^2) \ - @lattFac2*zStart^2 elseif (@lattice == 20) zStart = abs((abs(@lattFac1*zStart) \ - @lattFac1*sqrt(real(zStart)*imag(zStart)))^2) \ - @lattFac2*zStart^2 elseif (@lattice >= 21 && @lattice <= 23) float reL1 = real(@lattFac1) float imL1 = imag(@lattFac1) float reL2 = real(@lattFac2) float imL2 = imag(@lattFac2) float reZ = reL1*real(zStart) float imZ = imL1*imag(zStart) if (reL2 != 0) reZ = reZ%reL2 endif if (imL2 != 0) imZ = imZ%imL2 endif if (@lattice == 21) zStart = reZ + 1i*imZ elseif (@lattice == 22) zStart = reZ/@lattFac1 + 1i*imZ/@lattFac2 elseif (@lattice == 23) zStart = @lattFac1/reZ + 1i*@lattFac2/imZ endif endif ; lattices if (@turnMode) complex zRound = 0 complex zZ = zStart if (@turnScale != 0) complex zRound = round(zStart*@turnScale)/@turnScale complex zZ = zStart-zRound endif float targ = atan2(zZ) ; "Turn around" part taken from Sam if (abs(targ) < testAngle1) zStart = zZ*exp(rotAngle1)+zRound elseif (abs(targ) > testAngle2) zStart = zZ*exp(rotAngle2)+zRound endif endif ; @turnMode ar = |real(@fn1(zStart))| ge = |imag(@fn2(old_zz))| _zz = zStart iter = 0 while (|@fkt(ar)-@fkt(ge)| > @epsilon/@granulation && \ iter < @maxIter*@granulation) iter = iter + 1 ; Calculate new values of arithmetical ; and geometrical mean arit = (ar+ge)/2.0 geom = sqrt(ar*ge) ; give these values back ; for the next loop-run ar = arit ge = geom endwhile ; ; Calculate distances ; if (@iterMode == 0) ; Sum _dist = cabs(_zz - #z) + iter _rd = real(_zz - #z) + iter _id = imag(_zz - #z) + iter elseif (@iterMode == 1) ; Difference _dist = cabs(_zz - #z) - iter _rd = real(_zz - #z) - iter _id = imag(_zz - #z) - iter elseif (@iterMode == 2) ; Product _dist = cabs(_zz - #z) * iter _rd = real(_zz - #z) * iter _id = imag(_zz - #z) * iter elseif (@iterMode == 3) ; Quotient _dist = cabs(_zz - #z) / iter _rd = real(_zz - #z) / iter _id = imag(_zz - #z) / iter elseif (@iterMode == 4) ; Exponent _dist = cabs(_zz - #z)^iter _rd = real(_zz - #z)^iter _id = imag(_zz - #z)^iter _dist = cabs(_zz - #z)^iter _rd = real(_zz - #z)^iter _id = imag(_zz - #z)^iter elseif (@iterMode == 5) ; i-Sum _dist = cabs(_zz - #z + iter) _rd = real(_zz - #z + iter) _id = imag(_zz - #z + iter) elseif (@iterMode == 6) ; i-Difference _dist = cabs(_zz - #z - iter) _rd = real(_zz - #z - iter) _id = imag(_zz - #z - iter) elseif (@iterMode == 7) ; i-Product _dist = cabs(_zz*iter - #z) _rd = real(_zz*iter - #z) _id = imag(_zz*iter - #z) elseif (@iterMode == 8) ; i-Quotient _dist = cabs(_zz/iter - #z) _rd = real(_zz/iter - #z) _id = imag(_zz/iter - #z) elseif (@iterMode == 9) ; i-Exponent _dist = cabs(_zz^iter - #z) _rd = real(_zz^iter - #z) _id = imag(_zz^iter - #z) endif _dist = _dist*@granulation _rd = _rd*@granulation _id = _id*@granulation _rdist = abs(_rd) _idist = abs(_id) if _rd > _id _tdist = _rdist _cdist = _idist if _id == 0 _qdist = _rdist else _qdist = _rdist / _idist endif else _tdist = _idist _cdist = _rdist if _rd == 0 _qdist = _idist else _qdist = _idist / _rdist endif endif ; ; Calculate Min ; if @_mode == 0 && _dist < _min_dist _min_dist = _dist endif if @_mode == 1 && _rdist < _min_rdist _min_rdist = _rdist endif if @_mode == 2 && _idist < _min_idist _min_idist = _idist endif if @_mode == 3 && _tdist < _min_tdist _min_tdist = _tdist endif if @_mode == 4 && _tdist < _min_cdist _min_cdist = _cdist endif if @_mode == 29 && _qdist < _min_qdist _min_qdist = _qdist endif ; ; Calculate Max ; if @_mode == 5 && _dist > _max_dist _max_dist = _dist endif if @_mode == 6 && _rdist > _max_rdist _max_rdist = _rdist endif if @_mode == 7 && _rdist > _max_rdist _max_idist = _idist endif if @_mode == 8 && _tdist > _max_tdist _max_tdist = _tdist endif if @_mode == 9 && _cdist > _max_cdist _max_cdist = _cdist endif if @_mode == 30 && _qdist > _max_qdist _max_qdist = _qdist endif ; ; Calculate the traps ; if @_mode == 19 && _do_trap && _dist > @_trap_min && _dist < @_trap_max _do_trap = false _trap =_dist endif if @_mode == 20 && _do_rtrap && _rdist > @_trap_min && _rdist < @_trap_max _do_rtrap = false _rtrap =_rdist endif if @_mode == 21 && _do_itrap && _idist > @_trap_min && _idist < @_trap_max _do_itrap = false _itrap =_idist endif if @_mode == 22 && _do_ttrap && _tdist > @_trap_min && _tdist < @_trap_max _do_ttrap = false _ttrap =_tdist endif if @_mode == 23 && _do_ctrap && _cdist > @_trap_min && _cdist < @_trap_max _do_ctrap = false _ctrap =_cdist endif ; ; Calculate the sums ; if @_mode == 24 _sum = _sum + _dist endif if @_mode == 25 _rsum = _rsum + _rdist endif if @_mode == 26 _isum = _isum + _idist endif if @_mode == 27 _tsum = _tsum + _tdist endif if @_mode == 28 _csum = _csum + _cdist endif if @_mode == 31 _qsum = _qsum + _qdist endif ; ; Calculate the weighted sums ; if @_mode == 33 _sum_w = _sum_w + _dist/iter endif if @_mode == 34 _rsum_w = _rsum_w + _rdist/iter endif if @_mode == 35 _isum_w = _isum_w + _idist/iter endif if @_mode == 36 _tsum_w = _tsum_w + _tdist/iter endif if @_mode == 37 _csum_w = _csum_w + _cdist/iter endif if @_mode == 38 _qsum_w = _qsum_w + _qdist/iter endif ; ; Calculate the square-weighted sums ; if @_mode == 39 _sum_w2 = _sum_w2 + _dist/iter^2 endif if @_mode == 40 _rsum_w2 = _rsum_w2 + _rdist/iter^2 endif if @_mode == 41 _isum_w2 = _isum_w2 + _idist/iter^2 endif if @_mode == 42 _tsum_w2 = _tsum_w2 + _tdist/iter^2 endif if @_mode == 43 _csum_w2 = _csum_w2 + _cdist/iter^2 endif if @_mode == 44 _qsum_w2 = _qsum_w2 + _qdist/iter^2 endif endif ; no_spare final: if (no_spare) if @_mode == 0 temp = _min_dist ; "Min Dist" elseif @_mode == 1 temp = _min_rdist ; "Min Real" elseif @_mode == 2 temp = _min_idist ; "Min Imag" elseif @_mode == 3 temp = _min_tdist ; "Min Triang" elseif @_mode == 4 temp = _min_cdist ; "Min Cubus" elseif @_mode == 5 temp = _max_dist ; "Max Dist" elseif @_mode == 6 temp = _max_rdist ; "Max Real" elseif @_mode == 7 temp = _max_idist ; "Max Imag" elseif @_mode == 8 temp = _max_tdist ; "Max Triang" elseif @_mode == 9 temp = _max_cdist ; "Max Cubus" elseif @_mode == 10 temp = cabs(_zz - #pixel) ; "Act Dist" elseif @_mode == 11 temp = abs(real(_zz-#pixel)) ; "Act Real" elseif @_mode == 12 temp = abs(imag(_zz-#pixel)) ; "Act Imag" elseif @_mode == 13 temp = _dist ; "Last Dist" elseif @_mode == 14 temp = _rdist ; "Last Real" elseif @_mode == 15 temp = _idist ; "Last Imag" elseif @_mode == 16 temp = _tdist ; "Last Triang" elseif @_mode == 17 temp = _cdist ; "Last Cubus" elseif @_mode == 18 temp = abs(cabs(_zz)-cabs(#pixel)) ; "Difference" elseif @_mode == 19 temp = _trap ; "Trap Dist" elseif @_mode == 20 temp = _rtrap ; "Trap Real" elseif @_mode == 21 temp = _itrap ; "Trap Imag" elseif @_mode == 22 temp = _ttrap ; "Trap Triang" elseif @_mode == 23 temp = _ctrap ; "Trap Cubus" elseif @_mode == 24 temp = _sum ; "Sum Dist" elseif @_mode == 25 temp = _rsum ; "Sum Real" elseif @_mode == 26 temp = _isum ; "Sum Imag" elseif @_mode == 27 temp = _tsum ; "Sum Triang" elseif @_mode == 28 temp = _csum ; "Sum Cubus" elseif @_mode == 29 temp = _min_qdist ; "Min MinQuot" elseif @_mode == 30 temp = _max_qdist ; "Max MinQuot" elseif @_mode == 31 temp = _qsum ; "Sum MinQuot" elseif @_mode == 32 temp = _qdist ; "Last MinQuot" elseif @_mode == 33 temp = _sum_w elseif @_mode == 34 temp = _rsum_w elseif @_mode == 35 temp = _isum_w elseif @_mode == 36 temp = _tsum_w elseif @_mode == 37 temp = _csum_w elseif @_mode == 38 temp = _qsum_w elseif @_mode == 39 temp = _sum_w2 elseif @_mode == 40 temp = _rsum_w2 elseif @_mode == 41 temp = _isum_w2 elseif @_mode == 42 temp = _tsum_w2 elseif @_mode == 43 temp = _csum_w2 elseif @_mode == 44 temp = _qsum_w2 endif float mask = 0 bool no_mask = true if (@masking > 0) if (@maskType == 0) ; Index mask = temp elseif (@maskType == 1) ; Re z mask = real(zStart) elseif (@maskType == 2) ; Im z mask = imag(zStart) elseif (@maskType == 3) ; Angle mask = atan2(zStart)/(2*#pi) if mask < 0 mask = mask + 1 endif mask = mask*360 elseif (@maskType == 4) ; Iteration mask = iter elseif (@maskType == 5) ; Re Mixel mask = real(zStart+#pixel)/2 elseif (@maskType == 6) ; Im Mixel mask = imag(zStart+#pixel)/2 elseif (@maskType == 7) ; Abs Mixel mask = cabs(zStart+#pixel)/2 elseif (@maskType == 8) ; Dist(z,Pixel) mask = cabs(zStart-#pixel) elseif (@maskType == 9) ; |z| mask = cabs(zStart) endif endif if (@masking == 1) ; Lower if (mask < @threshold_l) #solid = true no_mask = false endif elseif (@masking == 2) ; Upper if (mask > @threshold_u) #solid = true no_mask = false endif elseif (@masking == 3) ; Between if (mask > @threshold_l && mask < @threshold_u) #solid = true no_mask = false endif elseif (@masking == 4) ; Outside if (mask < @threshold_l || mask > @threshold_u) #solid = true no_mask = false endif else no_mask = true endif if (no_mask) float to_index = real(@trf(temp)) if (@base4txtr == 1) _zz = #pixel elseif (@base4txtr == 2) _zz = (#pixel+_zz)/2 elseif (@base4txtr == 3) _zz = abs(#pixel-_zz) elseif (@base4txtr == 4) _zz = cabs(#pixel-_zz) endif if (@colour_limit != 0) to_index = to_index%@colour_limit endif if (@f_randomness != 0) to_index = to_index + @f_randomness * real(#random) endif if (@txtr_gnarl != 0) complex zGnarl = _zz zGnarl = zGnarl-trunc(zGnarl*@txtr_gnarl_scale)/@txtr_gnarl_scale if (@txtr_gnarl_size != 0 && @txtr_gnarl_size != 1) zGnarl = zGnarl/@txtr_gnarl_size endif if (@reachThrough) _zz = zGnarl endif float x = real(zGnarl) float y = imag(zGnarl) float xOld = 0 int iter3 = @txtr_gnarl_octaves while (iter3 > 0) iter3 = iter3-1 xOld = x x = x - sin(y + sin(y)) y = y - sin(xOld + sin(xOld)) endwhile float textureGnarl = 0 if (@txtr_gnarl_type == 0) textureGnarl = abs(x) elseif (@txtr_gnarl_type == 1) textureGnarl = abs(x)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_gnarl_type == 2) textureGnarl = abs(x-y) elseif (@txtr_gnarl_type == 3) textureGnarl = abs(x-y)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_gnarl_type == 4) textureGnarl = abs(x+y)/2 elseif (@txtr_gnarl_type == 5) textureGnarl = abs(x*y)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_gnarl_type == 6) textureGnarl = atan2(x+1i*y)/(2*#pi) if (textureGnarl < 0) textureGnarl = textureGnarl + 1 endif elseif (@txtr_gnarl_type == 7) textureGnarl = sqrt(x^2+y^2) endif if (@txtr_Gnarl_limit != 0) textureGnarl = textureGnarl%@txtr_Gnarl_limit endif to_index = to_index + @txtr_gnarl*textureGnarl endif if (@txtr_PopCorn != 0) complex zPopCorn = _zz zPopCorn = zPopCorn-trunc(zPopCorn*@txtr_PopCorn_scale)/@txtr_PopCorn_scale if (@txtr_PopCorn_size != 0 && @txtr_PopCorn_size != 1) zPopCorn = zPopCorn/@txtr_PopCorn_size endif if (@reachThrough) _zz = zPopCorn endif float x = real(zPopCorn) float y = imag(zPopCorn) float xOld = 0 int iter3 = @txtr_PopCorn_octaves while (iter3 > 0) iter3 = iter3-1 xOld = x x = x - sin(y + log(y + cos(y))) y = y - sin(xOld + log(xOld + cos(xOld))) endwhile float texturePopCorn = 0 if (@txtr_PopCorn_type == 0) texturePopCorn = abs(x) elseif (@txtr_PopCorn_type == 1) texturePopCorn = abs(x)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_PopCorn_type == 2) texturePopCorn = abs(x-y) elseif (@txtr_PopCorn_type == 3) texturePopCorn = abs(x-y)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_PopCorn_type == 4) texturePopCorn = abs(x+y)/2 elseif (@txtr_PopCorn_type == 5) texturePopCorn = abs(x*y)/(sqrt(x^2+y^2)+1e-20) elseif (@txtr_PopCorn_type == 6) texturePopCorn = atan2(x+1i*y)/(2*#pi) if (texturePopCorn < 0) texturePopCorn = texturePopCorn + 1 endif elseif (@txtr_PopCorn_type == 7) texturePopCorn = sqrt(x^2+y^2) endif if (@txtr_PopCorn_limit != 0) texturePopCorn = texturePopCorn%@txtr_PopCorn_limit endif to_index = to_index + @txtr_PopCorn*texturePopCorn endif if (@txtr_SFBM != 0) float mod = 1 float d1 = 0 float d2 = 0 float d3 = 0 float d4 = 0 float nindex = 0 float textureSFBM = 0 float scale = 0 cr1 = 0 cr2 = 0 cr3 = 0 cr4 = 0 float crp1 = 0 float crp2 = 0 float crp3 = 0 float crp4 = 0 complex tv1 = 0 complex tv2 = 0 complex tv3 = 0 complex tv4 = 0 complex seed = @txtr_SFBM_seed rotAngleFBM = exp(1i*pi/180*@txtr_SFBM_rot) if (@txtr_SFBM_scaledis == 4) ; min textureSFBM = 1e20 elseif (@txtr_SFBM_scaledis == 5) ; max textureSFBM = -1e20 endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; complex zSFBM = _zz zSFBM = zSFBM-trunc(zSFBM*@txtr_SFBM_scale)/@txtr_SFBM_scale if (@txtr_SFBM_size != 0 && @txtr_SFBM_size != 1) zSFBM = zSFBM/@txtr_SFBM_size endif if (@reachThrough) _zz = zSFBM endif int iter3 = 0 complex ttmp = 0 while (iter3 < @txtr_SFBM_octaves) scale = @txtr_SFBM_magn^iter3 zSFBM = zSFBM*rotAngleFBM iter3 = iter3 + 1 if @txtr_SFBM_mod == 1 mod = sqrt(iter3) endif zc = round(scale*zSFBM)/scale zc1 = zc + (.5,.5)/scale zc2 = zc + (-.5,.5)/scale zc3 = zc + (.5,-.5)/scale zc4 = zc + (-.5,-.5)/scale ttmp = seed/(mod*zc1+124), cr1 = ttmp-floor(ttmp) ttmp = seed/(mod*zc2+124), cr2 = ttmp-floor(ttmp) ttmp = seed/(mod*zc3+124), cr3 = ttmp-floor(ttmp) ttmp = seed/(mod*zc4+124), cr4 = ttmp-floor(ttmp) if (@txtr_SFBM_mode == 0) tv1 = (zSFBM - zc1)*scale tv2 = (zSFBM - zc2)*scale tv3 = (zSFBM - zc3)*scale tv4 = (zSFBM - zc4)*scale crp1 = real(cr1)*real(tv1) + imag(cr1)*imag(tv1) crp2 = real(cr2)*real(tv2) + imag(cr2)*imag(tv2) crp3 = real(cr3)*real(tv3) + imag(cr3)*imag(tv3) crp4 = real(cr4)*real(tv4) + imag(cr4)*imag(tv4) endif ttmp = zSFBM - zc d1 = real(ttmp)*scale + 0.5 d2 = 1 - d1 d3 = imag(ttmp)*scale + 0.5 d4 = 1 - d3 if (@txtr_SFBM_power != 1) d1 = d1^@txtr_SFBM_power d2 = d2^@txtr_SFBM_power d3 = d3^@txtr_SFBM_power d4 = d4^@txtr_SFBM_power endif if @txtr_SFBM_mode == 0 nindex = 10 + crp1*d1*d3 + crp3*d1*d4 + crp2*d2*d3 + crp4*d2*d4 elseif @txtr_SFBM_mode == 1 nindex = cabs(cr1*d1*d3 + cr3*d1*d4 + cr2*d2*d3 + cr4*d2*d4) endif if (@txtr_SFBM_scaledis == 0) textureSFBM = textureSFBM + nindex/scale elseif (@txtr_SFBM_scaledis == 1) textureSFBM = textureSFBM + nindex/sqrt(scale) elseif (@txtr_SFBM_scaledis == 2) textureSFBM = textureSFBM + nindex/(scale^(1/scale)) elseif (@txtr_SFBM_scaledis == 3) textureSFBM = textureSFBM + nindex/iter3 elseif (@txtr_SFBM_scaledis == 4) if (nindex < textureSFBM) textureSFBM = nindex endif elseif (@txtr_SFBM_scaledis == 5) if (nindex > textureSFBM) textureSFBM = nindex endif endif endwhile if (@txtr_SFBM_limit != 0) textureSFBM = textureSFBM%@txtr_SFBM_limit endif to_index = to_index + @txtr_SFBM*textureSFBM endif if (@txtr_primes != 0) complex zPrimes = _zz zPrimes = zPrimes-trunc(zPrimes*@txtr_Primes_scale)/@txtr_Primes_scale if (@txtr_Primes_size != 0 && @txtr_Primes_size != 1) zPrimes = zPrimes/@txtr_Primes_size endif if (@reachThrough) _zz = zPrimes endif float texturePrimes = 0 float trz = 0 float tiz = 0 float t_rz = 0 float t_iz = 0 float tstartSnip = 10^@txtr_primes_where2start float tendOfSnip = 10^(@txtr_primes_where2start+@txtr_primes_lengthOfSnip) if (@txtr_primes_mode == 0) trz = |real(zPrimes)| tiz = |imag(zPrimes)| elseif (@txtr_primes_mode == 1) trz = |real(zPrimes)| tiz = trz elseif (@txtr_primes_mode == 2) tiz = |imag(zPrimes)| trz = tiz elseif (@txtr_primes_mode == 3) trz = |zPrimes| tiz = trz elseif (@txtr_primes_mode == 4) trz = atan2(zPrimes) if (trz < 0) trz = trz + 2*#pi endif tiz = trz elseif (@txtr_primes_mode == 5) trz = real(atan(zPrimes)) if (trz < 0) trz = trz + 2*#pi endif tiz = imag(atan(zPrimes)) if (tiz < 0) tiz = tiz + 2*#pi endif elseif (@txtr_primes_mode == 6) trz = atan2(zPrimes) if (trz < 0) trz = trz + 2*#pi endif tiz = |zPrimes| endif t_rz = (trz - trunc(trz*tstartSnip)/tstartSnip)*tendOfSnip t_iz = (tiz - trunc(tiz*tstartSnip)/tstartSnip)*tendOfSnip if (@txtr_primes_withFinalTrunc) t_rz = trunc(t_rz) t_iz = trunc(t_iz) endif texturePrimes = 10*((t_rz%821) + (t_iz%823))/1644 if (@txtr_Primes_limit != 0) texturePrimes = texturePrimes%@txtr_Primes_limit endif to_index = to_index + @txtr_Primes*texturePrimes endif ; @txtr_primes != 0 if (@txtr_Gauss != 0) complex zGauss = _zz zGauss = zGauss-trunc(zGauss*@txtr_Gauss_scale)/@txtr_Gauss_scale if (@txtr_Gauss_size != 0 && @txtr_Gauss_size != 1) zGauss = zGauss/@txtr_Gauss_size endif if (@reachThrough) _zz = zGauss endif float textureGauss = 0 float t_d = cabs(zGauss) float t_r = real(zGauss) float t_i = imag(zGauss) if (@txtr_Gauss_type == 0) textureGauss = t_d elseif (@txtr_Gauss_type == 1) textureGauss = |t_r| elseif (@txtr_Gauss_type == 2) textureGauss = |t_i| elseif (@txtr_Gauss_type == 3) textureGauss = |t_i-t_r| elseif (@txtr_Gauss_type == 4) textureGauss = |t_i*t_r| elseif (@txtr_Gauss_type == 5) textureGauss = |t_i/t_r| elseif (@txtr_Gauss_type == 6) if (|t_i| < |t_r|) textureGauss = |t_i| else textureGauss = |t_r| endif elseif (@txtr_Gauss_type == 7) if (|t_i| > |t_r|) textureGauss = |t_i| else textureGauss = |t_r| endif elseif (@txtr_Gauss_type == 8) textureGauss = atan2(zGauss)/(2*#pi) if textureGauss < 0 textureGauss = textureGauss + 1 endif elseif (@txtr_Gauss_type == 9) textureGauss = (|t_i|+|t_r|+t_d)/3 elseif (@txtr_Gauss_type == 10) textureGauss = (|t_i|*|t_r|*t_d)^(1/3) endif if (@txtr_Gauss_limit != 0) textureGauss = textureGauss%@txtr_Gauss_limit endif to_index = to_index + @txtr_Gauss*textureGauss endif #index = to_index endif ; no_mask else if (@spareMask) #solid = true endif endif ; no_spare default: title = "AGM #6 (Arithm. Geom. Mean)" param _mode caption = "Dist. Mode" enum = "Min Dist" "Min Real" "Min Imag" "Min Triang" "Min Cubus" \ "Max Dist" "Max Real" "Max Imag" "Max Triang" "Max Cubus" \ "Act Dist" "Act Real" "Act Imag" \ "Last Dist" "Last Real" "Last Imag" "Last Triang" "Last Cubus" \ "Difference" \ "Trap Dist" "Trap Real" "Trap Imag" "Trap Triang" "Trap Cubus" \ "Sum Dist" "Sum Real" "Sum Imag" "Sum Triang" "Sum Cubus" \ "Min MinQuot" "Max MinQuot" "Sum MinQuot" "Last MinQuot" \ "W-Sum Dist" "W-Sum Real" "W-Sum Imag" "W-Sum Triang" "W-Sum Cubus" \ "W^2-Sum Dist" "W^2-Sum Real" "W^2-Sum Imag" \ "W^2-Sum Triang" "W^2-Sum Cubus" endparam param iterMode caption = "Iter. Mode" enum = "Sum" "Difference" "Product" "Quotient" "Exponent" \ "i-Sum" "i-Difference" "i-Product" "i-Quotient" "i-Exponent" endparam param _trap_min caption = "Lower Border for Trap" default = 1.0 min = 0.0 hint = "Only usefull with Traps" endparam param _trap_max caption = "Upper Border for Trap" default = 2.0 min = 0.0 hint = "Only usefull with Traps" endparam param epsilon caption = "epsilon" default = 0.1 min = 0.0 endparam param pure caption= "With Pixel Addition" default=TRUE endparam param granulation caption = "Granulation" default = 1.0 min = 0.0001 endparam param maxIter caption = "Maximum Iterations" default = 200 min = 1 endparam param coord caption = "Coordinates" enum = "Rectangular" \ "Polar" "PolarH" "aPolar" "aPolarH" \ "sin/cos" "sinh/cosh" "asin/acos" "asinh/acosh" \ "z/inv(z)" "z/conj(z)" "z/flip(z)" \ "?sin/cos" "?sin/i*cos" "?asin/acos" "?asin/i*acos" \ "?sinh/cosh" "?sinh/i*cosh" "?asinh/acosh" "?asinh/i*acosh" default = 0 endparam param coordLoop caption = "# Coord Loops" default = 1 min = 1 endparam param coordMode caption = "Mode Coord Loop" enum = "Static" "Dynamic" default = 0 endparam param lattice caption = "Lattice Type" enum = "None" \ "round" "trunc" "floor" "ceil" "abs" \ "r-round" "r-trunc" "r-floor" "r-ceil" "r-abs" \ "round^2" "trunc^2" "floor^2" "ceil^2" "abs^2" \ "r-round^2" "r-trunc^2" "r-floor^2" "r-ceil^2" "r-abs^2" \ "Modulo" "Mod Quot" "Mod Inv" default = 0 endparam param lattFac1 caption = "Lattice Factor 1" default = (1.0,0.0) endparam param lattFac2 caption = "Lattice Factor 2" default = (1.0,0.0) endparam param colour_limit caption = "Colour Limitation" default = 0.0 min = 0.0 max = 400.0 endparam param with_zStart caption = "zStart everywhere Y/N" default = false hint = "Works with the lattices" endparam param turnMode caption = "L: Turnaround Mode" default = false endparam param turnScale caption = "L: Turn Scale" default = 1.0 min = 0.0 endparam param corte1 caption = "L: Turnaround #1" default = 4.0 endparam param corte2 caption = "L: Turnaround #2" default = 2.0 endparam param l_randomness caption = "L: Randomness" hint = "This adds a randomness in the outlines." default = 0.0 endparam param f_randomness caption = "T: Random Texture" hint = "This adds a random texture the the coloring." default = 0.0 endparam param base4txtr caption = "Texture Base" enum = "Z" "Pixel" "Mixel" "Diff(Z,Pixel)" "Dist(Z,Pixel)" default = 0 endparam param reachThrough caption = "T: Reach Through Scales" default = false hint = "Reaches the Scale and Pattern Size from one \ Texture to the next. Every Texture changes all \ that follow." endparam param txtr_gnarl caption = "T: Gnarl Texture" hint = "This adds a Gnarl texture the the coloring." default = 0.0 endparam param txtr_gnarl_type caption = "T: Gnarl Type" enum = "x" "x/d" "x-y" "(x-y)/d" "(x+y)/2" "x*y/d" "Angle" "d" default = 0 endparam param txtr_gnarl_scale caption = "T: Gnarl Scale" hint = "Scaling Factor for this Gnarl texture." default = 1.0 endparam param txtr_gnarl_size caption = "T: Gnarl Pattern Size" default = 1.0 endparam param txtr_gnarl_limit caption = "T: Gnarl Limitation" default = 0.0 min = 0.0 endparam param txtr_gnarl_octaves caption = "T: Gnarl Octaves" default = 5 min = 1 endparam param txtr_PopCorn caption = "T: PopCorn Texture" hint = "This adds a PopCorn texture the the coloring." default = 0.0 endparam param txtr_PopCorn_type caption = "T: PopCorn Type" enum = "x" "x/d" "x-y" "(x-y)/d" "(x+y)/2" "x*y/d" "Angle" "d" default = 0 endparam param txtr_PopCorn_scale caption = "T: PopCorn Scale" hint = "Scaling Factor for this PopCorn texture." default = 1.0 endparam param txtr_PopCorn_size caption = "T: PopCorn Pattern Size" default = 1.0 endparam param txtr_PopCorn_limit caption = "T: PopCorn Limitation" default = 0.0 min = 0.0 endparam param txtr_PopCorn_octaves caption = "T: PopCorn Octaves" default = 5 min = 1 endparam param txtr_SFBM caption = "T: SFBM Texture" hint = "This adds a SFBM texture to the coloring." default = 0.0 endparam param txtr_SFBM_mode caption = "T: SFBM Noise type" default = 1 enum = "Perlin's" "Raw... (Sam's)" endparam param txtr_SFBM_scale caption = "T: SFBM Scale" hint = "Scaling Factor for this SFBM texture." default = 1.0 endparam param txtr_SFBM_scaledis caption = "T: SFBM Scale Distribution" default = 0 enum = "1/scale" "1/sqrt(scale)" "Fancy" "1/i" endparam param txtr_SFBM_size caption = "T: SFBM Pattern Size" default = 0.1 endparam param txtr_SFBM_magn caption = "T: SFBM Magnification Step" default = 1.2 endparam param txtr_SFBM_limit caption = "T: SFBM Limitation" default = 0.0 min = 0.0 endparam param txtr_SFBM_rot caption = "T: SFBM Rotation Step" default = 28.0 endparam param txtr_SFBM_power caption = "T: SFBM Power" default = 1.0 endparam param txtr_SFBM_mod caption = "Vary Random Numbers?" default = 1 enum = "No" "Use sqrt(i)" endparam param txtr_SFBM_seed caption = "T: SFBM Seed" default = 123094 endparam param txtr_SFBM_octaves caption = "T: SFBM Octaves" default = 5 min = 1 endparam param txtr_Primes caption = "T: Primes Texture" hint = "This adds a Primes texture to the coloring." default = 0.0 endparam param txtr_Primes_scale caption = "T: Primes Scale" hint = "Scaling Factor for this Primes texture." default = 1.0 endparam param txtr_Primes_size caption = "T: Primes Pattern Size" default = 0.5 endparam param txtr_primes_withFinalTrunc caption = "With Final Truncation" default = TRUE endparam param txtr_primes_where2start caption = "T: Start of Snip" default = 1 min = 0 endparam param txtr_primes_lengthOfSnip caption = "T: Length of Snip" default = 1 min = 1 endparam param txtr_primes_Mode caption = "T: Primes Mode" enum = "Real,Imag" "Real" "Imag" "|z|" "Angle" "Angel" "Polar" default = 5 endparam param txtr_primes_limit caption = "T: Primes Limitation" default = 0.0 min = 0.0 endparam param txtr_Gauss caption = "T: Gauss Texture" hint = "This adds a Gauss texture to the coloring." default = 0.0 endparam param txtr_Gauss_type caption = "T: Gauss Type" enum = "d" "x" "y" "x-y" "x*y" "y/x" "min x,y" "max x,y" "Angle" \ "Pyth. am" "Pyth. gm" default = 0 endparam param txtr_Gauss_scale caption = "T: Gauss Scale" hint = "Scaling Factor for this Gauss texture." default = 1.0 endparam param txtr_Gauss_size caption = "T: Gauss Pattern Size" default = 1.0 endparam param txtr_Gauss_limit caption = "T: Gauss Limitation" default = 0.0 min = 0.0 endparam param masking caption = "Masking" enum = "None" "Lower" "Upper" "Between" "Outside" default = 0 endparam param maskType caption = "Mask Type" enum = "Index" "Re z" "Im z" "Angle" "Iteration" \ "Re Mixel" "Im Mixel" "Abs Mixel" \ "Dist(z,Pixel)" "|z|" default = 0 endparam param threshold_l caption = "Lower Mask Threshold" default = 0.5 endparam param threshold_u caption = "Upper Mask Threshold" default = 1.0 endparam param spareMode caption = "Cut Out" enum = "None" "Upper" "Lower" \ "Left" "Right" \ "Upper + Left" "Upper + Right" "Lower + Left" "Lower + Right" \ "Upper & Left" "Upper & Right" "Lower & Left" "Lower & Right" \ "Inside Rectangle" "Outside Rectangle" \ "Between Vertical" "Outside Vertical" \ "Between Horizontal" "Outside Horizontal" \ "Inside Circle" "Outside Circle" default = 0 endparam param sparePoint caption = "Line of Cut, 1. Point" default = (0,0) endparam param sparePoint2 caption = "Add. Point/Line for Cut" default = (1,1) endparam param spareRot caption = "Rotate Cut" default = 0.0 min = -90.0 max = 90.0 endparam param spareMask caption = "Mask Cut" default = true endparam func trf caption = "Transfer Function" default = ident() endfunc func fn1 caption = "Real Part Init Function" default = ident() endfunc func fn2 caption = "Imag Part Init Function" default = ident() endfunc func startFct caption = "Start Function" default = ident() endfunc func fkt caption = "Additional Function" default = recip() hint = "Useful are recip() sqrt() log()" endfunc } ; agm6