comment { Helpfiles / Fichiers d'aide: http://www.pruniermei.ca/mde-help.zip Pour me contacter / To contact me: http://www.pruniermei.ca - Le code fBm vient de Damien Jones. Merci Damien pour ta permission. - The fBm code comes from Damien Jones. Thanks Damien for your permission. - Le code de masquage vient de Andreas Lober. Merci Andreas. - The code for masking comes from Andreas Lober. Danke Schön, Andreas. - Le code pour trapper et pour popgnarl est inspiré de Andreas Lober. - The code for trapping and for popgnarl is inspired from Andreas Lober. - Gros bisous à Mark Towsend pour sa permision de publier Autre sinus, ma version personnelle de son 'Sine'. - Lots of kisses to Mark Townsend for his permission to let me publish Autre sinus, my personal version of his 'Sine'. - Merci à Kerry Mitchell pour la permission de publier fBm Gauss et fBm Pythagore, ma version personnelle de Gaussian Integer & Pythagorician Triple. - Thanks to Kerry Mitchell for the permission to publish fBm Gauss & fBm Pythogore, ma personal versions of his Gaussian Interger & Pythagorician Triple. -Merci à ceux qui ont essayé Courbes++, Courbes polaires++, Fourier, Autre sinus avant publication: -Thanks to those who tried Courbes++, Courbes polaires++, Fourier, Autre sinus before their releasing: Linda Allison (Gumbycat) Linda Bucklin Paul Decelle Emily Garlick Eva Peter K. Klaus-Peter Kubik Daniel Kuzmenka Andreas Lober Bob Margolis Richard Molnar Tina Oloyede Elenyte Paulauskas Edward Perry Karen Trottier Angela Wilczinsky (Wizzle) Faye Williams } md-ifs { ; Michèle Dessureault, 30 décembre 1999 ; ; D'après Roger Stevens, "Fractal programming in C", ; p.394 à 397 ; ; Mark Townsend m'a inspiré pour les modes de coloration ; Le code de masquage vient de Andreas Lober, 11 juin 2000 ; Merci pour la permission de publier ; init: float x = 0 float y = 0 int iter = 0 float dist = 0 int min_trap_iter = 0 int max_trap_iter = 0 float min_dist = 1e20 float max_dist = 0.0 float a1=0 float a2=0 float a3=0 float a4=0 float b1=0 float b2=0 float b3=0 float b4=0 float c1=0 float c2=0 float c3=0 float c4=0 float d1=0 float d2=0 float d3=0 float d4=0 float e1=0 float e2=0 float e3=0 float e4=0 float f1=0 float f2=0 float f3=0 float f4=0 float a=0 float b=0 float c=0 float d=0 float e0=0 float f=0 float p=0 float r1=0 float r2=0 float r3=0 float r4=0 float phi=0 min_trap_z=0 max_trap_z=0 if @figure == 0 ;Sierpinsky a1=a2=a3=d1=d2=d3=e3=f3=0.5 e2=1.0 r1=10813.0 r2=21626.0 r3=32767.0 endif if @figure == 1 ;fougère a2=f2=f3=f4=0.2 a3=-0.15 a4=d4=0.85 b2=-0.26 b3=0.28 b4=0.04 c2=0.23 c3=0.26 c4=-0.04 d1=0.16 d2=0.22 d3=0.24 r1=328.0 r2=2621.0 r3=4915.0 r4=32767.0 endif if @figure == 2 ; arbre a2=d2=0.1 a3=b4=c3=d3=d4=0.42 a4=b3=c4=-0.42 d1=0.5 f2=f3=f4=0.2 r1=1638.0 r2=6553.0 r3=19660.0 r4=32767.0 endif if @figure == 3 ; arbre de Cantor a1=a2=d1=d2=0.333 a3=d3=0.667 e2=1.0 e3=f3=0.5 r1=10813.0 r2=21626.0 r3=32767.0 endif loop: if @hasard == 1 p = real(#random*#z)*32767.0 elseif @hasard == 2 p = imag(#random*#z)*32767.0 elseif @hasard == 0 ; pas de hasard p = (real(#z)+imag(#z)) % 32767 elseif @hasard == 3 p = (real(#random*#z)+imag(#random*#z)) *32767.0 elseif @hasard == 4 p = (real(#random*#z)-imag(#random*#z)) *32767.0 elseif @hasard == 5 p = (real(#random*#z)*imag(#random*#z)) *32767.0 elseif @hasard == 6 p = (real(#random*#z)/imag(#random*#z)) *32767.0 elseif @hasard == 7 p = (imag(#random*#z)/real(#random*#z)) *32767.0 elseif @hasard == 8 p = (real(#random*#z)^imag(#random*#z)) *32767.0 else p = (imag(#random*#z)^real(#random*#z)) *32767.0 endif if p <= r1 a = a1 b = b1 c = c1 d = d1 e0 = e1 f = f1 endif if p > r1 && p <= r2 a = a2 b = b2 c = c2 d = d2 e0 = e2 f = f2 endif if p > r2 && p <= r3 a = a3 b = b3 c = c3 d = d3 e0 = e3 f = f3 endif if p > r3 && p <= r4 && (@figure == 1 || @figure == 2) a = a4 b = b4 c = c4 d = d4 e0 = e4 f = f4 endif x = a*real(#z) + b*imag(#z) + e0 y = c*real(#z) + d*imag(#z) + f w = x + flip(y) dist = cabs(#z-w) phi = atan2(#z) phi = phi/#pi if phi < 0.0 phi = phi + 2.0 endif if dist < min_dist min_dist = dist min_trap_z = #z min_trap_iter = iter endif if dist > max_dist max_dist = dist max_trap_z = #z max_trap_iter = iter endif iter = iter + 1 final: float mask = 0 if (@masking > 0) if @mask_type == 0 mask = real(@fm(#pixel)) elseif @mask_type == 1 mask =imag(@fm(#pixel)) elseif @mask_type == 2 mask =real(@fm(#z)) elseif @mask_type == 3 mask =imag(@fm(#z)) elseif @mask_type == 4 mask =real(@fm(dist+0i)) elseif @mask_type == 5 mask =real(@fm(phi+0i)) elseif @mask_type == 6 mask =real(@fm(iter+0i)) endif if (@masking == 1) ; Lower if (mask < @threshold_l) #solid = true endif elseif (@masking == 2) ; Upper if (mask > @threshold_u) #solid = true endif elseif (@masking == 3) ; Between if (mask > @threshold_l && mask < @threshold_u) #solid = true endif elseif (@masking == 4) ; Outside if (mask < @threshold_l || mask > @threshold_u) #solid = true endif endif endif if @color == 0 #index = min_dist elseif @color == 1 #index = cabs(min_trap_z) elseif @color == 2 #index = 0.01 * min_trap_iter elseif @color == 3 #index = abs(real(min_trap_z)) elseif @color == 4 #index = abs(imag(min_trap_z)) elseif @color == 5 theta = atan2(min_trap_z) if theta < 0 theta = theta + 2 * #pi endif theta = 1 / (2 * #pi) * theta #index = real(theta) elseif @color == 6 #index = max_dist elseif @color == 7 #index = cabs(max_trap_z) elseif @color == 8 #index = 0.01 * max_trap_iter elseif @color == 9 #index = abs(real(max_trap_z)) elseif @color == 10 #index = abs(imag(max_trap_z)) elseif @color == 11 theta = atan2(max_trap_z) if theta < 0 theta = theta + 2 * #pi endif theta = 1 / (2 * #pi) * theta #index = real(theta) endif default: title = "Ifs" helpfile="mde-help\mde-IFS.htm" param color caption = "Colouring mode" enum = "Distance min" "Magnitude min" "Itération min" "Réel min" \ "Imaginaire min" "Angle min" "Distance max" "Magnitude max" \ "Itération max" "Réel max" "Imaginaire max" "Angle max" hint="Translation: itération=iteration, réel=real, imaginaire=imaginary" endparam param figure caption = "Figure" enum = "Sierpinsky" "Fougère" "Arbre" "Arbre de Cantor" hint = "Translation: fougère=fern, arbre=tree, \ arbre de Cantor=Cantor tree" endparam param hasard caption ="Chaos" enum="Non" "réel" "imaginaire" "réel+imag" "réel-imag" "réel*imag" \ "réel/imag" "imag/réel" "réel^imag" "imag^réel" hint = "How to apply randomizing on IFS formulas. \ Translation: non=no, réel=real, imaginaire=imaginary" endparam param mask_type caption = "Mask Type" enum = "Real Pixel" "Imag Pixel" "Real z" "Imag z" "Distance" \ "Angle" "Iteration" endparam param masking caption = "Masking" enum = "None" "Lower" "Upper" "Between" "Outside" 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 func fm caption = "Masking Function" default = ident() endfunc } md-courbes { ; Michèle Dessureault, 12 décembre 1999 ; d'après les pages 390 des Standard Mathematical Tables ; 22ème édition ; ; Avec emprunt d'une portion de 'Gaussian Integer' ; de Kerry Mitchell ; ; Équations paramétriques de l'épicycloïde (spirographe) ; x = (a+b)*cos(z) - b*cos(((a+b)/b)*z) ; y = (a+b)*sin(z) - b*sin(((a+b)/b)*z) ; Équations paramétriques des figures de Lissajou: ; x = cos(a*z) ; y = sin(b*z) ; ; Ajout d'un paramètre 'hasard' le 22 mars 2000 ; et d'autres courbes. ; ; Ajout d'une texture fBm le 8 avril 2000 ; Le code vient de Damien Jones & Mark Townsend ; Merci à eux pour la permission de publier ; ; Le code de masquage vient de Andreas Lober, 11 juin 2000 ; Merci pour la permission de publier ; init: float r=0.0 float rmin=1.0e12 float rmax=0.0 float rave=0.0 float total=0.0 float t=0.0 int iter=0 int itermin=0 int itermax=0 zmin=(0.0,0.0) zmax=(0.0,0.0) z=(0.0,0.0) x=(0.0,0.0) y=(0.0,0.0) float texture=0.0 float phi=0.0 p=(0.0,0.0) loop: if @courbe == 0 ;épicycloïde x = (@a+@b)*cos(#z)- @b*cos(((@a+@b)/@b)*#z) y = (@a+@b)*sin(#z)- @b*sin(((@a+@b)/@b)*#z) elseif @courbe == 1 ;lissajou x = real(cos(@a*#z)) y = imag(sin(@b*#z)) elseif @courbe == 2 ;compagnon du cycloïde x = real(@a*#z) y = imag(@a*(1-cos(#z))) elseif @courbe == 3 ;cycloïde x = real(@a*#z - @b*sin(#z)) y = imag(@a*-@b*cos(#z)) elseif @courbe == 4 x = real(@a*cos(#z)) ;ellipse y = imag(@b*sin(#z)) elseif @courbe == 5 x = real(@a*cos(#z)*cos(#z)*cos(#z)) ;évolute de l'ellipse y = imag(@b*sin(#z)*sin(#z)*sin(#z)) elseif @courbe == 6 x = real(@b*@a*#z / (1+#z^3)) ;folium de Descartes y = imag(@b*@a+#z^2 / (1+#z^3)) elseif @courbe == 7 ;involute du cercle x = real(@a*cos(#z) + @a*#z*sin(#z)) y = imag(@a*sin(#z) - @a*#z*cos(#z)) elseif @courbe == 8 ;nephroïde x = real(@a*.5*(@b*cos(#z) - cos(@b*#z))) y = imag(@a*.5*(@b*sin(#z) - sin(@b*#z))) elseif @courbe == 9 ;courbe serpentine x = real(@a*cotan(#z)) y = imag(@b*sin(#z)*cos(#z)) elseif @courbe == 10 ;sorcière d'Agnesi x = real(@a*cotan(#z)) y = imag(@b*sin(#z)*sin(#z)) elseif @courbe == 11 ;tractrice x = real(#z-@a*tanh(#z/@a)) y = imag(@a/sinh(#z/@a)) elseif @courbe == 12 ;épicycloïde 2 x = real((@a+@b)*cos(#z)- @b*cos(((@a+@b)/@b)*#z)) y = imag((@a+@b)*sin(#z)- @b*sin(((@a+@b)/@b)*#z)) endif if @coord == 1 rho = sqrt(sqr(x)+sqr(y)) theta = atan2(y/x) if theta < 0 theta = theta + 2 * #pi endif x = rho y = theta endif if @applic == 0 z= x * (1.0,0.0) + y * (0.0,1.0) elseif @applic == 1 z= @fn1(x * (1.0,0.0)) + y * (0.0,1.0) elseif @applic == 2 z= x * (1.0,0.0) + @fn1(y * (0.0,1.0)) elseif @applic == 3 z= @fn2(x * (1.0,0.0)) + y * (0.0,1.0) elseif @applic == 4 z= x * (1.0,0.0) + @fn2(y * (0.0,1.0)) elseif @applic == 5 z= @fn1(x * (1.0,0.0)) + @fn2(y * (0.0,1.0)) elseif @applic == 6 z= @fn2(x * (1.0,0.0)) + @fn1(y * (0.0,1.0)) endif iter=iter+1 remain=#z-z r=cabs(remain) total=total+r rave=total/iter phi = atan2(#z) phi = phi/#pi if phi < 0.0 phi = phi + 2.0 endif if(rrmax) rmax=r zmax=#z itermax=iter endif final: float mask = 0 bool is_masked = false if (@masking > 0) if @mask_type == 0 mask = real(@fm(#pixel)) elseif @mask_type == 1 mask =imag(@fm(#pixel)) elseif @mask_type == 2 mask =real(@fm(#z)) elseif @mask_type == 3 mask =imag(@fm(#z)) elseif @mask_type == 4 mask =real(@fm(r+0i)) elseif @mask_type == 5 mask =real(@fm(phi+0i)) elseif @mask_type == 6 mask =real(@fm(iter+0i)) endif if (@masking == 1) ; Lower if (mask < @threshold_l) #solid = is_masked = true endif elseif (@masking == 2) ; Upper if (mask > @threshold_u) #solid = is_masked = true endif elseif (@masking == 3) ; Between if (mask > @threshold_l && mask < @threshold_u) #solid = is_masked = true endif elseif (@masking == 4) ; Outside if (mask < @threshold_l || mask > @threshold_u) #solid = is_masked = true endif endif endif if !is_masked if (@text_type == 0) ;Random complex hasard = #random texture = @rnd * (real(hasard)+ imag(hasard)) elseif (@text_type == 1) ; fBm if (@rnd != 0) complex r1 = (0,1) ^ (@fbmangle / 90.0) complex r2 = (0,1) ^ (@fbmastep / 90.0) if @fbminit == 0 p = #pixel * @fbmscale * r1 + @fbmoffset elseif @fbminit == 1 p = #z * @fbmscale * r1 + @fbmoffset elseif @fbminit == 2 p = r * @fbmscale * r1 + @fbmoffset elseif @fbminit == 3 p = phi * @fbmscale * r1 + @fbmoffset endif float sum = 0.0 float freq = 1.0 int i = @fbmoct while (i > 0) ; determine integer coordinate for corners of square ; surrounding p float bx0 = floor(real(p)) % 256 float by0 = floor(imag(p)) % 256 IF (bx0 < 0) bx0 = bx0 + 256 ENDIF IF (by0 < 0) by0 = by0 + 256 ENDIF float bx1 = (bx0 + 1) % 256 float by1 = (by0 + 1) % 256 float rx0 = real(p) - floor(real(p)) float ry0 = imag(p) - floor(imag(p)) float rx1 = rx0 - 1 float ry1 = ry0 - 1 float b00 = (bx0^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b10 = (bx1^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b01 = (bx0^@fbmpower % 65536 + by1)^@fbmpower % 65536 float b11 = (bx1^@fbmpower % 65536 + by1)^@fbmpower % 65536 float g_b00_0 = (b00)^@fbmpower*0.25 % 512 - 256 float g_b10_0 = (b10)^@fbmpower*0.25 % 512 - 256 float g_b01_0 = (b01)^@fbmpower*0.25 % 512 - 256 float g_b11_0 = (b11)^@fbmpower*0.25 % 512 - 256 float g_b00_1 = (b00+1)^@fbmpower*0.25 % 512 - 256 float g_b10_1 = (b10+1)^@fbmpower*0.25 % 512 - 256 float g_b01_1 = (b01+1)^@fbmpower*0.25 % 512 - 256 float g_b11_1 = (b11+1)^@fbmpower*0.25 % 512 - 256 float d = 0.0; d = 1 / sqrt(sqr(g_b00_0) + sqr(g_b00_1)) g_b00_0 = g_b00_0 * d g_b00_1 = g_b00_1 * d d = 1 / sqrt(sqr(g_b10_0) + sqr(g_b10_1)) g_b10_0 = g_b10_0 * d g_b10_1 = g_b10_1 * d d = 1 / sqrt(sqr(g_b01_0) + sqr(g_b01_1)) g_b01_0 = g_b01_0 * d g_b01_1 = g_b01_1 * d d = 1 / sqrt(sqr(g_b11_0) + sqr(g_b11_1)) g_b11_0 = g_b11_0 * d g_b11_1 = g_b11_1 * d float u1 = rx0 * g_b00_0 + ry0 * g_b00_1 float v1 = rx1 * g_b10_0 + ry0 * g_b10_1 float u2 = rx0 * g_b01_0 + ry1 * g_b01_1 float v2 = rx1 * g_b11_0 + ry1 * g_b11_1 float sx = sqr(rx0) * (3 - rx0*2) float sy = sqr(ry0) * (3 - ry0*2) float a = u1 + sx*(v1-u1) float b = u2 + sx*(v2-u2) sum = sum + (a + sy*(b-a))*freq freq = freq * @fbmstep p = p * r2 / @fbmstep i = i - 1 endwhile texture = @rnd * sum endif endif endif if(@colorby==0) ; minimum distance #index=rmin + texture elseif(@colorby==1) ; iteration @ min #index=0.01*itermin + texture elseif(@colorby==2) ; angle @ min t=atan2(zmin) t=t/pi if(t<0.0) t=t+2.0 endif #index=0.5*t + texture elseif(@colorby==3) ; maximum distance #index=rmax + texture elseif(@colorby==4) ; iteration @ max #index=0.01*itermax + texture elseif(@colorby==5) ; angle @ max t=atan2(zmax) t=t/pi if(t<0.0) t=t+2.0 endif #index=0.5*t + texture elseif @colorby==6 #index=rave + texture ; average distance else ; opérations if @oper == 0 #index = real(z) + texture ; réel elseif @oper == 1 #index = imag(z) + texture ; imaginaire elseif @oper == 2 #index = real(z)+imag(z) + texture ; real+imag elseif @oper == 3 #index = real(z)*imag(z) + texture ; real*imag elseif @oper == 4 #index = real(z)-imag(z) + texture ; real-imag elseif @oper == 5 #index = imag(z)+real(z) + texture ; imag-real elseif @oper == 6 #index = real(z)/imag(z) + texture ; real/imag elseif @oper == 7 #index = imag(z)/real(z) + texture ; imag/real elseif @oper == 8 #index = real(z)^imag(z) + texture ; real^imag else #index = imag(z)+real(z) + texture ; imag^real endif endif default: title="Courbes" helpfile="mde-help\mde-courbes-fonctions-ucl.htm" param courbe caption = "Curve" enum="Épicycloïde" "Lissajou" "Compagnon" "Cycloïde" \ "Ellipse" "Évolute" "Folium" "Involute" \ "Nephroïde" "Serpentine" "Agnesi" "Tractrice" \ "Épicycloïde 2" default = 1 hint="Translation: épicycloïde=epicycloid, compagnon=companion, \ cycloïde=cycloid, évolute=evolute, nephroïde=nephroid, \ tractrice=tractrix" endparam param coord caption = "Coordinates" enum="Cartésien" "Polaire" default = 0 hint= "Translation: cartésien=cartesian, polaire=polar" endparam param colorby caption="Colouring Mode" default=0 enum="minimum distance" "iteration @ min" "angle @ min" \ "maximum distance" "iteration @ max" "angle @ max" "average distance" \ "opérations" hint="Translation: opérations=operations" endparam param oper caption="Operations" default=0 enum="réel" "imaginaire" "real+imag" "real*imag" "real-imag" \ "imag-real" "real/imag" "imag/real" "real^imag" "imag^real" hint="Works only with the 'opérations' colouring mode. \ Translation: réel=real, imaginaire=imaginary" endparam param a caption = "a" default = 1.0 endparam param b caption = "b" default = 1.0 endparam param applic caption = "Function Application" default = 0 enum = "aucune" "f(x)-> réel" "f(x)-> imaginaire" "f(y)-> réel" \ "f(y)-> imaginaire" "f(x)->ré et f(y)->im" "f(x)->im et f(y)->ré" hint= "Works with the function parameters. \ Translation: aucune=no, réel=real, imaginaire=imaginary, ré=re" endparam param text_type caption = "Texture Type" enum = "hasard" "fBm" hint="Translation: hasard=random" endparam param rnd caption = "Texture Strength" default = 0.0 hint= "If different than 0, texture is applied with this strength" endparam param fbminit caption = "fBm Initialization" enum = "Pixel" "z" "Distance" "Angle" endparam param fbmscale caption = "fBm Scale" default = 1.0 endparam param fbmoffset caption = "fBm Offset" default = (0,0) endparam param fbmangle caption = "fBm Rotation" default = 0.0 endparam param fbmstep caption = "fBm Scale Step" default = 0.5 endparam param fbmastep caption = "fBm Rotation Step" default = 37.0 endparam param fbmoct caption = "fBm Octaves" default = 7 min = 1 endparam param fbmpower caption = "fBm Exponent" default = 2.0 endparam param mask_type caption = "Mask Type" enum = "Real Pixel" "Imag Pixel" "Real z" "Imag z" "Distance" \ "Angle" "Iteration" endparam param masking caption = "Masking" enum = "None" "Lower" "Upper" "Between" "Outside" 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 func fn1 caption = "F(x)" default = ident() endfunc func fn2 caption = "F(y)" default = ident() endfunc func fm caption = "Masking Function" default = ident() endfunc } md-courbes-polaires { ; Michèle Dessureault, 20 avril 2000 ; d'après les pages 390 des Standard Mathematical Tables ; 22ème édition ; Comme la méthode 'Courbes', mais celles en coordonnées ; polaires de ce manuel ; ; Avec emprunt d'une portion de 'Gaussian Integer' ; de Kerry Mitchell ; ; Le code du fBm vient de Damien Jones & Mark Townsend ; Merci à eux pour la permission de publier ; ; Le code de masquage vient de Andreas Lober, 11 juin 2000 ; Merci pour la permission de publier ; init: float r=0.0 float rmin=1.0e12 float rmax=0.0 float rave=0.0 float total=0.0 float t=0.0 int iter=0 int itermin=0 int itermax=0 zmin=(0.0,0.0) zmax=(0.0,0.0) z=(0.0,0.0) x=(0.0,0.0) y=(0.0,0.0) rho=(0.0,0.0) float texture=0.0 float phi=0.0 p=(0.0,0.0) loop: if @courbe == 0 ;bifolium rho = @a*sin(#z)*cos(#z)*cos(#z) elseif @courbe == 1 ;limaçon de Pascal ; si a=b-> cardioïde rho = @a*cos(#z)+@b elseif @courbe == 2 ;cissoïde de Dioclès rho = @a*sin(#z)*tan(#z) elseif @courbe == 3 ;cochléoïde rho = @a*sin(#z)/#z elseif @courbe == 4 ;conchoïde de Nicomède rho = @a/sin(#z)+@b elseif @courbe == 5 rho = (@a^2*cos(2*#z))^.5 ;lemniscate de Bernouilli elseif @courbe == 6 rho = (@a^2/#z)^.5 ;lituus elseif @courbe == 7 ;pétales rho = @a*cos(@b*#z) elseif @courbe == 8 ;parabole rho = 2*@a/(1-cos(#z)) elseif @courbe == 9 ;spirale d'Archimède rho = @a*#z elseif @courbe == 10 ;spirale hyperbolique rho = @a/#z elseif @courbe == 11 ;spirale logarithmique rho = exp(@a*#z) elseif @courbe == 12 ;strophoïde rho = @a*cos(2*#z)/cos(#z) endif x = real(rho) y = imag(rho) if @coord == 1 x = rho * cos(real(#z)) y = rho * sin(imag(#z)) elseif @coord ==2 x = rho * cosh(real(#z)) y = rho * sinh(imag(#z)) endif if @applic == 0 z= x * (1.0,0.0) + y * (0.0,1.0) elseif @applic == 1 z= @fn1(x * (1.0,0.0)) + y * (0.0,1.0) elseif @applic == 2 z= x * (1.0,0.0) + @fn1(y * (0.0,1.0)) elseif @applic == 3 z= @fn2(x * (1.0,0.0)) + y * (0.0,1.0) elseif @applic == 4 z= x * (1.0,0.0) + @fn2(y * (0.0,1.0)) elseif @applic == 5 z= @fn1(x * (1.0,0.0)) + @fn2(y * (0.0,1.0)) elseif @applic == 6 z= @fn2(x * (1.0,0.0)) + @fn1(y * (0.0,1.0)) endif iter=iter+1 remain=#z-z r=cabs(remain) total=total+r rave=total/iter phi = atan2(#z) phi = phi/#pi if phi < 0.0 phi = phi + 2.0 endif if(rrmax) rmax=r zmax=#z itermax=iter endif final: float mask = 0 bool is_masked = false if (@masking > 0) if @mask_type == 0 mask = real(@fm(#pixel)) elseif @mask_type == 1 mask =imag(@fm(#pixel)) elseif @mask_type == 2 mask =real(@fm(#z)) elseif @mask_type == 3 mask =imag(@fm(#z)) elseif @mask_type == 4 mask =real(@fm(r+0i)) elseif @mask_type == 5 mask =real(@fm(phi+0i)) elseif @mask_type == 6 mask =real(@fm(iter+0i)) endif if (@masking == 1) ; Lower if (mask < @threshold_l) #solid = is_masked = true endif elseif (@masking == 2) ; Upper if (mask > @threshold_u) #solid = is_masked = true endif elseif (@masking == 3) ; Between if (mask > @threshold_l && mask < @threshold_u) #solid = is_masked = true endif elseif (@masking == 4) ; Outside if (mask < @threshold_l || mask > @threshold_u) #solid = is_masked = true endif endif endif if !is_masked if (@text_type == 0) ;Random complex hasard = #random texture = @rnd * (real(hasard)+ imag(hasard)) elseif (@text_type == 1) ; fBm if (@rnd != 0) complex r1 = (0,1) ^ (@fbmangle / 90.0) complex r2 = (0,1) ^ (@fbmastep / 90.0) if @fbminit == 0 p = #pixel * @fbmscale * r1 + @fbmoffset elseif @fbminit == 1 p = #z * @fbmscale * r1 + @fbmoffset elseif @fbminit == 2 p = r * @fbmscale * r1 + @fbmoffset elseif @fbminit == 3 p = phi * @fbmscale * r1 + @fbmoffset endif float sum = 0.0 float freq = 1.0 int i = @fbmoct while (i > 0) ; determine integer coordinate for corners of square ; surrounding p float bx0 = floor(real(p)) % 256 float by0 = floor(imag(p)) % 256 IF (bx0 < 0) bx0 = bx0 + 256 ENDIF IF (by0 < 0) by0 = by0 + 256 ENDIF float bx1 = (bx0 + 1) % 256 float by1 = (by0 + 1) % 256 float rx0 = real(p) - floor(real(p)) float ry0 = imag(p) - floor(imag(p)) float rx1 = rx0 - 1 float ry1 = ry0 - 1 float b00 = (bx0^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b10 = (bx1^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b01 = (bx0^@fbmpower % 65536 + by1)^@fbmpower % 65536 float b11 = (bx1^@fbmpower % 65536 + by1)^@fbmpower % 65536 float g_b00_0 = (b00)^@fbmpower*0.25 % 512 - 256 float g_b10_0 = (b10)^@fbmpower*0.25 % 512 - 256 float g_b01_0 = (b01)^@fbmpower*0.25 % 512 - 256 float g_b11_0 = (b11)^@fbmpower*0.25 % 512 - 256 float g_b00_1 = (b00+1)^@fbmpower*0.25 % 512 - 256 float g_b10_1 = (b10+1)^@fbmpower*0.25 % 512 - 256 float g_b01_1 = (b01+1)^@fbmpower*0.25 % 512 - 256 float g_b11_1 = (b11+1)^@fbmpower*0.25 % 512 - 256 float d = 0.0; d = 1 / sqrt(sqr(g_b00_0) + sqr(g_b00_1)) g_b00_0 = g_b00_0 * d g_b00_1 = g_b00_1 * d d = 1 / sqrt(sqr(g_b10_0) + sqr(g_b10_1)) g_b10_0 = g_b10_0 * d g_b10_1 = g_b10_1 * d d = 1 / sqrt(sqr(g_b01_0) + sqr(g_b01_1)) g_b01_0 = g_b01_0 * d g_b01_1 = g_b01_1 * d d = 1 / sqrt(sqr(g_b11_0) + sqr(g_b11_1)) g_b11_0 = g_b11_0 * d g_b11_1 = g_b11_1 * d float u1 = rx0 * g_b00_0 + ry0 * g_b00_1 float v1 = rx1 * g_b10_0 + ry0 * g_b10_1 float u2 = rx0 * g_b01_0 + ry1 * g_b01_1 float v2 = rx1 * g_b11_0 + ry1 * g_b11_1 float sx = sqr(rx0) * (3 - rx0*2) float sy = sqr(ry0) * (3 - ry0*2) float a = u1 + sx*(v1-u1) float b = u2 + sx*(v2-u2) sum = sum + (a + sy*(b-a))*freq freq = freq * @fbmstep p = p * r2 / @fbmstep i = i - 1 endwhile texture = @rnd * sum endif endif endif if(@colorby==0) ; minimum distance #index=rmin + texture elseif(@colorby==1) ; iteration @ min #index=0.01*itermin + texture elseif(@colorby==2) ; angle @ min t=atan2(zmin) t=t/pi if(t<0.0) t=t+2.0 endif #index=0.5*t + texture elseif(@colorby==3) ; maximum distance #index=rmax + texture elseif(@colorby==4) ; iteration @ max #index=0.01*itermax + texture elseif(@colorby==5) ; angle @ max t=atan2(zmax) t=t/pi if(t<0.0) t=t+2.0 endif #index=0.5*t + texture elseif @colorby==6 #index=rave + texture ; average distance else ; opérations if @oper == 0 #index = real(z) + texture ; réel elseif @oper == 1 #index = imag(z) + texture ; imaginaire elseif @oper == 2 #index = real(z)+imag(z) + texture ; real+imag elseif @oper == 3 #index = real(z)*imag(z) + texture ; real*imag elseif @oper == 4 #index = real(z)-imag(z) + texture ; real-imag elseif @oper == 5 #index = imag(z)+real(z) + texture ; imag-real elseif @oper == 6 #index = real(z)/imag(z) + texture ; real/imag elseif @oper == 7 #index = imag(z)/real(z) + texture ; imag/real elseif @oper == 8 #index = real(z)^imag(z) + texture ; real^imag else #index = imag(z)+real(z) + texture ; imag^real endif endif default: title="Courbes polaires" helpfile="mde-help\mde-courbes-fonctions-polaires-ucl.htm" param courbe caption = "Curve" enum="Bifolium" "Limaçon" "Cissoïde" "Cochléoïde" \ "Conchoïde" "Lemniscate" "Lituus" "Pétales" "Parabole" \ "Spir. Archimède" "Spir. hyperbolique" \ "Spir. logarithmique" "Strophoïde" default = 0 hint="Translation: cissoïde=cissoid, cochléoïde=cochleoid, \ conchoïde=conchoid, pétales=petals, parabole=parabola, \ Archimède=Archimedes, hyperbolique=hyperbolic, \ logarithmique=logarithmic, strophoïde=strophoid" endparam param coord caption = "Coordinates" enum="Polaire" "Cartésien" "Hyperbolique" default = 0 hint= "Translation: cartésien=cartesian, polaire=polar, \ hyperbolique=hyperbolic" endparam param colorby caption="Colouring mode" default=0 enum="minimum distance" "iteration @ min" "angle @ min" \ "maximum distance" "iteration @ max" "angle @ max" "average distance" \ "opérations" hint="Translation: opérations=operations" endparam param oper caption="Operations" default=0 enum="réel" "imaginaire" "real+imag" "real*imag" "real-imag" \ "imag-real" "real/imag" "imag/real" "real^imag" "imag^real" hint="Works only with the 'opérations' colouring mode. \ Translation: réel=real, imaginaire=imaginary" endparam param a caption = "a" default = 1.0 endparam param b caption = "b" default = 1.0 endparam param applic caption = "Function Application" default = 0 enum = "aucune" "f(x)-> réel" "f(x)-> imaginaire" "f(y)-> réel" \ "f(y)-> imaginaire" "f(x)->ré et f(y)->im" "f(x)->im et f(y)->ré" hint= "Works with the function parameters. \ Translation: aucune=no, réel=real, imaginaire=imaginary, ré=re" endparam param text_type caption = "Texture Type" enum = "hasard" "fBm" hint="Translation: hasard=random" endparam param rnd caption = "Texture Strength" default = 0.0 hint= "If different than 0, texture is applied with this strength" endparam param fbminit caption = "fBm Initialization" enum = "Pixel" "z" "Distance" "Angle" endparam param fbmscale caption = "fBm Scale" default = 1.0 endparam param fbmoffset caption = "fBm Offset" default = (0,0) endparam param fbmangle caption = "fBm Rotation" default = 0.0 endparam param fbmstep caption = "fBm Scale Step" default = 0.5 endparam param fbmastep caption = "fBm Rotation Step" default = 37.0 endparam param fbmoct caption = "fBm Octaves" default = 7 min = 1 endparam param fbmpower caption = "fBm Exponent" default = 2.0 endparam param mask_type caption = "Mask Type" enum = "Real Pixel" "Imag Pixel" "Real z" "Imag z" "Distance" \ "Angle" "Iteration" endparam param masking caption = "Masking" enum = "None" "Lower" "Upper" "Between" "Outside" 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 func fn1 caption = "F(x)" default = ident() endfunc func fn2 caption = "F(y)" default = ident() endfunc func fm caption = "Masking Function" default = ident() endfunc } md-gauss { ; Kerry Mitchell 20sep98, updated 02apr99 ; Michèle Dessureault - novembre 1999, avril 2000 ; ; Colors by orbit's relationship ; to Gaussian Integers. See comment ; block for more information. ; ; Updated 02apr99 to include options for finding ; the integer: added trunc, floor, and ceil. ; Thanks to Marcelo Anelli for the idea. ; ; 12/11/99 - j'ai ajouté la balance des fonctions de UF ; à l'original pour les avoir toutes ; avril 2000 - j'ai ajouté fBm d'après Mark Townsend & Damien Jones ; Merci à Kerry Mitchell, Damien Jones et Mark Townsend ; pour la permission de publier ; Thanks to Damien Jones, Kerry Mitchell & Mark Townsend for the ; permission to publish. ; ; Le code de masquage vient de Andreas Lober, 11 juin 2000 ; Merci pour la permission de publier ; init: float r=0.0 float rmin=1.0e12 float rmax=0.0 float rave=0.0 float total=0.0 float t=0.0 int iter=0 int itermin=0 int itermax=0 zmin=(0.0,0.0) zmax=(0.0,0.0) float texture=0.0 float phi=0.0 p=(0.0,0.0) if(@norm==1) ; pixel normalization normfac=#pixel elseif(@norm==2) ; factor normalization normfac=@fac else ; no normalization normfac=(1.0,0.0) endif loop: iter=iter+1 temp=@fn(#z/normfac) remain=#z-temp*normfac r=cabs(remain) total=total+r rave=total/iter phi = atan2(#z) phi = phi/#pi if phi < 0.0 phi = phi + 2.0 endif if(rrmax) rmax=r zmax=#z itermax=iter endif final: float mask = 0 bool is_masked = false if (@masking > 0) if @mask_type == 0 mask = real(@fm(#pixel)) elseif @mask_type == 1 mask =imag(@fm(#pixel)) elseif @mask_type == 2 mask =real(@fm(#z)) elseif @mask_type == 3 mask =imag(@fm(#z)) elseif @mask_type == 4 mask =real(@fm(r+0i)) elseif @mask_type == 5 mask =real(@fm(phi+0i)) elseif @mask_type == 6 mask =real(@fm(iter+0i)) endif if (@masking == 1) ; Lower if (mask < @threshold_l) #solid = is_masked = true endif elseif (@masking == 2) ; Upper if (mask > @threshold_u) #solid = is_masked = true endif elseif (@masking == 3) ; Between if (mask > @threshold_l && mask < @threshold_u) #solid = is_masked = true endif elseif (@masking == 4) ; Outside if (mask < @threshold_l || mask > @threshold_u) #solid = is_masked = true endif endif endif if !is_masked if (@text_type == 0) ;Random complex hasard = #random texture = @rnd * (real(hasard)+ imag(hasard)) elseif (@text_type == 1) ; fBm if (@rnd != 0) complex r1 = (0,1) ^ (@fbmangle / 90.0) complex r2 = (0,1) ^ (@fbmastep / 90.0) if @fbminit == 0 p = #pixel * @fbmscale * r1 + @fbmoffset elseif @fbminit == 1 p = #z * @fbmscale * r1 + @fbmoffset elseif @fbminit == 2 p = r * @fbmscale * r1 + @fbmoffset elseif @fbminit == 3 p = phi * @fbmscale * r1 + @fbmoffset endif float sum = 0.0 float freq = 1.0 int i = @fbmoct while (i > 0) ; determine integer coordinate for corners of square ; surrounding p float bx0 = floor(real(p)) % 256 float by0 = floor(imag(p)) % 256 IF (bx0 < 0) bx0 = bx0 + 256 ENDIF IF (by0 < 0) by0 = by0 + 256 ENDIF float bx1 = (bx0 + 1) % 256 float by1 = (by0 + 1) % 256 float rx0 = real(p) - floor(real(p)) float ry0 = imag(p) - floor(imag(p)) float rx1 = rx0 - 1 float ry1 = ry0 - 1 float b00 = (bx0^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b10 = (bx1^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b01 = (bx0^@fbmpower % 65536 + by1)^@fbmpower % 65536 float b11 = (bx1^@fbmpower % 65536 + by1)^@fbmpower % 65536 float g_b00_0 = (b00)^@fbmpower*0.25 % 512 - 256 float g_b10_0 = (b10)^@fbmpower*0.25 % 512 - 256 float g_b01_0 = (b01)^@fbmpower*0.25 % 512 - 256 float g_b11_0 = (b11)^@fbmpower*0.25 % 512 - 256 float g_b00_1 = (b00+1)^@fbmpower*0.25 % 512 - 256 float g_b10_1 = (b10+1)^@fbmpower*0.25 % 512 - 256 float g_b01_1 = (b01+1)^@fbmpower*0.25 % 512 - 256 float g_b11_1 = (b11+1)^@fbmpower*0.25 % 512 - 256 float d = 0.0; d = 1 / sqrt(sqr(g_b00_0) + sqr(g_b00_1)) g_b00_0 = g_b00_0 * d g_b00_1 = g_b00_1 * d d = 1 / sqrt(sqr(g_b10_0) + sqr(g_b10_1)) g_b10_0 = g_b10_0 * d g_b10_1 = g_b10_1 * d d = 1 / sqrt(sqr(g_b01_0) + sqr(g_b01_1)) g_b01_0 = g_b01_0 * d g_b01_1 = g_b01_1 * d d = 1 / sqrt(sqr(g_b11_0) + sqr(g_b11_1)) g_b11_0 = g_b11_0 * d g_b11_1 = g_b11_1 * d float u1 = rx0 * g_b00_0 + ry0 * g_b00_1 float v1 = rx1 * g_b10_0 + ry0 * g_b10_1 float u2 = rx0 * g_b01_0 + ry1 * g_b01_1 float v2 = rx1 * g_b11_0 + ry1 * g_b11_1 float sx = sqr(rx0) * (3 - rx0*2) float sy = sqr(ry0) * (3 - ry0*2) float a = u1 + sx*(v1-u1) float b = u2 + sx*(v2-u2) sum = sum + (a + sy*(b-a))*freq freq = freq * @fbmstep p = p * r2 / @fbmstep i = i - 1 endwhile texture = @rnd * sum endif endif endif if(@colorby==0) ; minimum distance #index=rmin + texture elseif(@colorby==1) ; iteration @ min #index=0.01*itermin + texture elseif(@colorby==2) ; angle @ min t=atan2(zmin) t=t/pi if(t<0.0) t=t+2.0 endif #index=0.5*t + texture elseif(@colorby==3) ; maximum distance #index=rmax + texture elseif(@colorby==4) ; iteration @ max #index=0.01*itermax + texture elseif(@colorby==5) ; angle @ max t=atan2(zmax) t=t/pi if(t<0.0) t=t+2.0 endif #index=0.5*t + texture else #index=rave + texture ; average distance endif default: title="fBm Gauss" param colorby caption="Colouring Mode" default=0 enum="minimum distance" "iteration @ min" "angle @ min" \ "maximum distance" "iteration @ max" "angle @ max" "average distance" endparam param norm caption="normalization" default=0 enum="none" "pixel" "factor" endparam param fac caption="normalizing factor" default=(2.0,1.0) endparam param text_type caption = "Texture Type" enum = "hasard" "fBm" hint="Translation: hasard=random" endparam param rnd caption = "Texture Strength" default = 0.0 hint= "If different than 0, texture is applied with this strength" endparam param fbminit caption = "fBm Initialization" enum = "Pixel" "z" "Distance" "Angle" endparam param fbmscale caption = "fBm Scale" default = 1.0 endparam param fbmoffset caption = "fBm Offset" default = (0,0) endparam param fbmangle caption = "fBm Rotation" default = 0.0 endparam param fbmstep caption = "fBm Scale Step" default = 0.5 endparam param fbmastep caption = "fBm Rotation Step" default = 37.0 endparam param fbmoct caption = "fBm Octaves" default = 7 min = 1 endparam param fbmpower caption = "fBm Exponent" default = 2.0 endparam param mask_type caption = "Mask Type" enum = "Real Pixel" "Imag Pixel" "Real z" "Imag z" "Distance" \ "Angle" "Iteration" endparam param masking caption = "Masking" enum = "None" "Lower" "Upper" "Between" "Outside" 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 func fn caption="Function" default= round() endfunc func fm caption = "Masking Function" default = ident() endfunc } md-pythagore { ; Kerry Mitchell 06feb00 ; Michèle Dessureault, mars & avril 2000 ; ; Colors by the approach of the orbit to a Pythagorean ; triple: when x, y, and r are all integers. Uses ; several different ways to find the closest integer ; to determine the distance. Colors according to ; the closest approach, the furthest approach, or ; combinations thereof. ; ; See the helpfile for more information. ; ; Mes modifs du 6 mars et du 13 avril 2000 ; J'ai modifié le code original de Kerry pour pouvoir utiliser ; toutes les fonctions disponibles en UF comme ma version de Gauss. ; Le code pour fBm est inspiré de Mark Townsend & Damien Jones ; Merci à Kerry Mitchell, Damien Jones et Mark Townsend ; pour la permission de publier ; Thanks to Damien Jones, Kerry Mitchell & Mark Townsend for the ; permission to publish. ; ; Le code de masquage vient de Andreas Lober, 11 juin 2000 ; Merci pour la permission de publier ; init: float rx=0.0 float ry=0.0 float rr=0.0 float r=0.0 float rmin=1.0e12 float rmax=0.0 float rsum=0.0 float rproduct=1.0 float temp=0.0 float temp2=0.0 int iter=0 int itermin=0 int itermax=0 float texture=0.0 float phi=0.0 p=(0.0,0.0) zmin=(0.0,0.0) zmax=(0.0,0.0) loop: iter=iter+1 ; ; generate closest integer ; temp=cabs(#z) rr=abs(temp-real(@fn(temp))) temp=real(#z) rx=abs(temp-real(@fn(temp))) temp=imag(#z) ry=abs(temp-real(@fn(temp))) ; ; find distance to integer ; if(@rtype==1) ; minimum r=rr if(rxr) r=rx endif if(ry>r) r=ry endif elseif(@rtype==3) ; sum r=rr+rx+ry elseif(@rtype==4) ; product r=(rr*rx*ry)^(1/3) else ; euclidean r=(rx^@power+ry^@power+rr^@power)^(1/@power) endif phi = atan2(#z) phi = phi/#pi if phi < 0.0 phi = phi + 2.0 endif ; ; find min, max & build tallies for means ; rsum=rsum+r rproduct=rproduct*r if(rrmax) rmax=r zmax=#z itermax=iter endif final: float mask = 0 bool is_masked = false if (@masking > 0) if @mask_type == 0 mask = real(@fm(#pixel)) elseif @mask_type == 1 mask =imag(@fm(#pixel)) elseif @mask_type == 2 mask =real(@fm(#z)) elseif @mask_type == 3 mask =imag(@fm(#z)) elseif @mask_type == 4 mask =real(@fm(r+0i)) elseif @mask_type == 5 mask =real(@fm(phi+0i)) elseif @mask_type == 6 mask =real(@fm(iter+0i)) endif if (@masking == 1) ; Lower if (mask < @threshold_l) #solid = is_masked = true endif elseif (@masking == 2) ; Upper if (mask > @threshold_u) #solid = is_masked = true endif elseif (@masking == 3) ; Between if (mask > @threshold_l && mask < @threshold_u) #solid = is_masked = true endif elseif (@masking == 4) ; Outside if (mask < @threshold_l || mask > @threshold_u) #solid = is_masked = true endif endif endif if !is_masked if (@text_type == 0) ;Random complex hasard = #random texture = @rnd * (real(hasard)+ imag(hasard)) elseif (@text_type == 1) ; fBm if (@rnd != 0) complex r1 = (0,1) ^ (@fbmangle / 90.0) complex r2 = (0,1) ^ (@fbmastep / 90.0) if @fbminit == 0 p = #pixel * @fbmscale * r1 + @fbmoffset elseif @fbminit == 1 p = #z * @fbmscale * r1 + @fbmoffset elseif @fbminit == 2 p = r * @fbmscale * r1 + @fbmoffset elseif @fbminit == 3 p = phi * @fbmscale * r1 + @fbmoffset endif float sum = 0.0 float freq = 1.0 int i = @fbmoct while (i > 0) ; determine integer coordinate for corners of square ; surrounding p float bx0 = floor(real(p)) % 256 float by0 = floor(imag(p)) % 256 IF (bx0 < 0) bx0 = bx0 + 256 ENDIF IF (by0 < 0) by0 = by0 + 256 ENDIF float bx1 = (bx0 + 1) % 256 float by1 = (by0 + 1) % 256 float rx0 = real(p) - floor(real(p)) float ry0 = imag(p) - floor(imag(p)) float rx1 = rx0 - 1 float ry1 = ry0 - 1 float b00 = (bx0^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b10 = (bx1^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b01 = (bx0^@fbmpower % 65536 + by1)^@fbmpower % 65536 float b11 = (bx1^@fbmpower % 65536 + by1)^@fbmpower % 65536 float g_b00_0 = (b00)^@fbmpower*0.25 % 512 - 256 float g_b10_0 = (b10)^@fbmpower*0.25 % 512 - 256 float g_b01_0 = (b01)^@fbmpower*0.25 % 512 - 256 float g_b11_0 = (b11)^@fbmpower*0.25 % 512 - 256 float g_b00_1 = (b00+1)^@fbmpower*0.25 % 512 - 256 float g_b10_1 = (b10+1)^@fbmpower*0.25 % 512 - 256 float g_b01_1 = (b01+1)^@fbmpower*0.25 % 512 - 256 float g_b11_1 = (b11+1)^@fbmpower*0.25 % 512 - 256 float d = 0.0; d = 1 / sqrt(sqr(g_b00_0) + sqr(g_b00_1)) g_b00_0 = g_b00_0 * d g_b00_1 = g_b00_1 * d d = 1 / sqrt(sqr(g_b10_0) + sqr(g_b10_1)) g_b10_0 = g_b10_0 * d g_b10_1 = g_b10_1 * d d = 1 / sqrt(sqr(g_b01_0) + sqr(g_b01_1)) g_b01_0 = g_b01_0 * d g_b01_1 = g_b01_1 * d d = 1 / sqrt(sqr(g_b11_0) + sqr(g_b11_1)) g_b11_0 = g_b11_0 * d g_b11_1 = g_b11_1 * d float u1 = rx0 * g_b00_0 + ry0 * g_b00_1 float v1 = rx1 * g_b10_0 + ry0 * g_b10_1 float u2 = rx0 * g_b01_0 + ry1 * g_b01_1 float v2 = rx1 * g_b11_0 + ry1 * g_b11_1 float sx = sqr(rx0) * (3 - rx0*2) float sy = sqr(ry0) * (3 - ry0*2) float a = u1 + sx*(v1-u1) float b = u2 + sx*(v2-u2) sum = sum + (a + sy*(b-a))*freq freq = freq * @fbmstep p = p * r2 / @fbmstep i = i - 1 endwhile texture = @rnd * sum endif endif endif if(@colorby==0) ; minimum distance #index=rmin + texture elseif(@colorby==1) ; iteration @ min #index=0.01*itermin + texture elseif(@colorby==2) ; angle @ min temp=atan2(zmin)/#pi if(temp<0.0) temp=temp+2.0 endif #index=0.5*temp + texture elseif(@colorby==3) ; maximum distance #index=rmax + texture elseif(@colorby==4) ; iteration @ max #index=0.01*itermax + texture elseif(@colorby==5) ; angle @ max temp=atan2(zmax)/#pi if(temp<0.0) temp=temp+2.0 endif #index=0.5*temp + texture elseif(@colorby==6) ; min/max distance angle zmin=rmin+flip(rmax) temp=atan2(zmin)/#pi if(temp<0.0) temp=temp+2.0 endif #index=0.5*temp + texture elseif(@colorby==7) ; arithmetic mean #index=rsum/iter + texture elseif(@colorby==8) ; geometric mean temp=log(rproduct)/iter #index=exp(temp) + texture elseif(@colorby==9) ; amean/gmean angle temp=rsum/iter temp2=log(rproduct)/iter temp2=exp(temp2) zmax=temp+flip(temp2) temp=atan2(zmax)/#pi if(temp<0.0) temp=temp+2.0 endif #index=0.5*temp + texture endif default: title="fBm Pythagore" helpfile="mde-help\mde-fbm-pythagore.htm" param rtype caption="Distance Type" default=0 enum="Euclidean" "minimum" "maximum" "sum" "product" endparam param colorby caption="Colouring Mode" default=0 enum="minimum distance" "iteration @ min" "angle @ min" \ "maximum distance" "iteration @ max" "angle @ max" \ "min/max combo" "arithmetic mean" \ "geometric mean" "amean/gmean combo" endparam param power caption="Power" default=2.0 hint="Exponent for the 'Euclidean' type. Use 2 for \ standard Pythagorean distance." endparam param text_type caption = "Texture Type" enum = "hasard" "fBm" hint="Translation: hasard=random" endparam param rnd caption = "Texture Strength" default = 0.0 hint= "If different than 0, texture is applied with this strength" endparam param fbminit caption = "fBm Initialization" enum = "Pixel" "z" "Distance" "Angle" endparam param fbmscale caption = "fBm Scale" default = 1.0 endparam param fbmoffset caption = "fBm Offset" default = (0,0) endparam param fbmangle caption = "fBm Rotation" default = 0.0 endparam param fbmstep caption = "fBm Scale Step" default = 0.5 endparam param fbmastep caption = "fBm Rotation Step" default = 37.0 endparam param fbmoct caption = "fBm Octaves" default = 7 min = 1 endparam param fbmpower caption = "fBm Exponent" default = 2.0 endparam param mask_type caption = "Mask Type" enum = "Real Pixel" "Imag Pixel" "Real z" "Imag z" "Distance" \ "Angle" "Iteration" endparam param masking caption = "Masking" enum = "None" "Lower" "Upper" "Between" "Outside" 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 func fn caption="Function" default= round() endfunc func fm caption = "Masking Function" default = ident() endfunc } md-fonctions { ; Michèle Dessureault, 12 décembre 1999 ; d'après les pages 390 des Standard Mathematical Tables ; 22ème édition ; Avec emprunt d'une portion de 'Gaussian Integer' ; de Kerry Mitchell ; Équations paramétriques de l'épicycloïde (spirographe) ; x = (a+b)*cos(z) - b*cos(((a+b)/b)*z) ; y = (a+b)*sin(z) - b*sin(((a+b)/b)*z) ; Équations paramétriques des figures de Lissajou: ; x = cos(a*z) ; y = sin(b*z) ; ; Ajout d'un paramètre 'hasard' le 22 mars 2000 ; et d'autres courbes. ; ; Ajout d'une texture fBm le 8 avril 2000 ; Le code vient de Damien Jones & Mark Townsend ; Merci à Damien Jones et Mark Townsend ; pour la permission de publier ; ; Le code de masquage vient de Andreas Lober, 11 juin 2000 ; Merci pour la permission de publier ; init: float r=0.0 float rmin=1.0e12 float rmax=0.0 float rave=0.0 float total=0.0 float t=0.0 int iter=0 int itermin=0 int itermax=0 zmin=(0.0,0.0) zmax=(0.0,0.0) z=(0.0,0.0) x=(0.0,0.0) y=(0.0,0.0) float texture=0.0 float phi=0.0 p=(0.0,0.0) loop: if @courbe == 0 ;épicycloïde x = (@a+@b)*@fn1(#z)- @b*@fn1(((@a+@b)/@b)*#z) y = (@a+@b)*@fn2(#z)- @b*@fn2(((@a+@b)/@b)*#z) elseif @courbe == 1 ;lissajou x = real(@fn1(@a*#z)) y = imag(@fn2(@b*#z)) elseif @courbe == 2 ;compagnon du cycloïde x = real(@a*#z) y = imag(@a*(1-@fn1(#z))) elseif @courbe == 3 ;cycloïde x = real(@a*#z - @b*@fn2(z)) y = imag(@a*-@b*@fn1(#z)) elseif @courbe == 4 x = real(@a*@fn1(#z)) ;ellipse y = imag(@b*@fn2(#z)) elseif @courbe == 5 x = real(@a*@fn1(#z)*@fn1(#z)*@fn1(#z)) ;évolute de l'ellipse y = imag(@b*@fn2(#z)*@fn2(#z)*@fn2(#z)) elseif @courbe == 6 x = real(@b*@a*#z / (1+#z^3)) ;folium de Descartes y = imag(@b*@a+#z^2 / (1+#z^3)) elseif @courbe == 7 ;involute du cercle x = real(@a*@fn1(#z) + @a*#z*@fn2(#z)) y = imag(@a*@fn2(#z) - @a*#z*@fn1(#z)) elseif @courbe == 8 ;nephroïde x = real(@a*.5*(@b*@fn1(#z) - @fn1(@b*#z))) y = imag(@a*.5*(@b*@fn2(#z) - @fn2(@b*#z))) elseif @courbe == 9 ;courbe serpentine x = real(@a*@fn1(#z)/@fn2(#z)) y = imag(@b*@fn2(#z)*@fn1(#z)) elseif @courbe == 10 ;sorcière d'Agnesi x = real(@a*@fn1(#z)/@fn2(#z)) y = imag(@b*@fn2(#z)*@fn2(#z)) elseif @courbe == 11 ;tractrice x = real(#z-@a*@fn2(#z/@a)/@fn1(#z/@a)) y = imag(@a/@fn2(#z/@a)) elseif @courbe == 12 ;épicycloïde 2 x = real((@a+@b)*@fn1(#z)- @b*@fn1(((@a+@b)/@b)*#z)) y = imag((@a+@b)*@fn2(#z)- @b*@fn2(((@a+@b)/@b)*#z)) endif if @coord == 1 rho = sqrt(sqr(x)+sqr(y)) theta = atan2(y/x) if theta < 0 theta = theta + 2 * #pi endif x = rho y = theta endif if @applic == 0 z= x * (1.0,0.0) + y * (0.0,1.0) elseif @applic == 1 z= @fn1(x * (1.0,0.0)) + y * (0.0,1.0) elseif @applic == 2 z= x * (1.0,0.0) + @fn1(y * (0.0,1.0)) elseif @applic == 3 z= @fn2(x * (1.0,0.0)) + y * (0.0,1.0) elseif @applic == 4 z= x * (1.0,0.0) + @fn2(y * (0.0,1.0)) elseif @applic == 5 z= @fn1(x * (1.0,0.0)) + @fn2(y * (0.0,1.0)) elseif @applic == 6 z= @fn2(x * (1.0,0.0)) + @fn1(y * (0.0,1.0)) endif iter=iter+1 remain=#z-z r=cabs(remain) total=total+r rave=total/iter phi = atan2(#z) phi = phi/#pi if phi < 0.0 phi = phi + 2.0 endif if(rrmax) rmax=r zmax=#z itermax=iter endif final: float mask = 0 bool is_masked = false if (@masking > 0) if @mask_type == 0 mask = real(@fm(#pixel)) elseif @mask_type == 1 mask =imag(@fm(#pixel)) elseif @mask_type == 2 mask =real(@fm(#z)) elseif @mask_type == 3 mask =imag(@fm(#z)) elseif @mask_type == 4 mask =real(@fm(r+0i)) elseif @mask_type == 5 mask =real(@fm(phi+0i)) elseif @mask_type == 6 mask =real(@fm(iter+0i)) endif if (@masking == 1) ; Lower if (mask < @threshold_l) #solid = is_masked = true endif elseif (@masking == 2) ; Upper if (mask > @threshold_u) #solid = is_masked = true endif elseif (@masking == 3) ; Between if (mask > @threshold_l && mask < @threshold_u) #solid = is_masked = true endif elseif (@masking == 4) ; Outside if (mask < @threshold_l || mask > @threshold_u) #solid = is_masked = true endif endif endif if !is_masked if (@text_type == 0) ;Random complex hasard = #random texture = @rnd * (real(hasard)+ imag(hasard)) elseif (@text_type == 1) ; fBm if (@rnd != 0) complex r1 = (0,1) ^ (@fbmangle / 90.0) complex r2 = (0,1) ^ (@fbmastep / 90.0) if @fbminit == 0 p = #pixel * @fbmscale * r1 + @fbmoffset elseif @fbminit == 1 p = #z * @fbmscale * r1 + @fbmoffset elseif @fbminit == 2 p = r * @fbmscale * r1 + @fbmoffset elseif @fbminit == 3 p = phi * @fbmscale * r1 + @fbmoffset endif float sum = 0.0 float freq = 1.0 int i = @fbmoct while (i > 0) ; determine integer coordinate for corners of square ; surrounding p float bx0 = floor(real(p)) % 256 float by0 = floor(imag(p)) % 256 IF (bx0 < 0) bx0 = bx0 + 256 ENDIF IF (by0 < 0) by0 = by0 + 256 ENDIF float bx1 = (bx0 + 1) % 256 float by1 = (by0 + 1) % 256 float rx0 = real(p) - floor(real(p)) float ry0 = imag(p) - floor(imag(p)) float rx1 = rx0 - 1 float ry1 = ry0 - 1 float b00 = (bx0^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b10 = (bx1^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b01 = (bx0^@fbmpower % 65536 + by1)^@fbmpower % 65536 float b11 = (bx1^@fbmpower % 65536 + by1)^@fbmpower % 65536 float g_b00_0 = (b00)^@fbmpower*0.25 % 512 - 256 float g_b10_0 = (b10)^@fbmpower*0.25 % 512 - 256 float g_b01_0 = (b01)^@fbmpower*0.25 % 512 - 256 float g_b11_0 = (b11)^@fbmpower*0.25 % 512 - 256 float g_b00_1 = (b00+1)^@fbmpower*0.25 % 512 - 256 float g_b10_1 = (b10+1)^@fbmpower*0.25 % 512 - 256 float g_b01_1 = (b01+1)^@fbmpower*0.25 % 512 - 256 float g_b11_1 = (b11+1)^@fbmpower*0.25 % 512 - 256 float d = 0.0; d = 1 / sqrt(sqr(g_b00_0) + sqr(g_b00_1)) g_b00_0 = g_b00_0 * d g_b00_1 = g_b00_1 * d d = 1 / sqrt(sqr(g_b10_0) + sqr(g_b10_1)) g_b10_0 = g_b10_0 * d g_b10_1 = g_b10_1 * d d = 1 / sqrt(sqr(g_b01_0) + sqr(g_b01_1)) g_b01_0 = g_b01_0 * d g_b01_1 = g_b01_1 * d d = 1 / sqrt(sqr(g_b11_0) + sqr(g_b11_1)) g_b11_0 = g_b11_0 * d g_b11_1 = g_b11_1 * d float u1 = rx0 * g_b00_0 + ry0 * g_b00_1 float v1 = rx1 * g_b10_0 + ry0 * g_b10_1 float u2 = rx0 * g_b01_0 + ry1 * g_b01_1 float v2 = rx1 * g_b11_0 + ry1 * g_b11_1 float sx = sqr(rx0) * (3 - rx0*2) float sy = sqr(ry0) * (3 - ry0*2) float a = u1 + sx*(v1-u1) float b = u2 + sx*(v2-u2) sum = sum + (a + sy*(b-a))*freq freq = freq * @fbmstep p = p * r2 / @fbmstep i = i - 1 endwhile texture = @rnd * sum endif endif endif if(@colorby==0) ; minimum distance #index=rmin + texture elseif(@colorby==1) ; iteration @ min #index=0.01*itermin + texture elseif(@colorby==2) ; angle @ min t=atan2(zmin) t=t/pi if(t<0.0) t=t+2.0 endif #index=0.5*t + texture elseif(@colorby==3) ; maximum distance #index=rmax + texture elseif(@colorby==4) ; iteration @ max #index=0.01*itermax + texture elseif(@colorby==5) ; angle @ max t=atan2(zmax) t=t/pi if(t<0.0) t=t+2.0 endif #index=0.5*t + texture elseif @colorby==6 #index=rave + texture ; average distance else ; opérations if @oper == 0 #index = real(z) + texture ; réel elseif @oper == 1 #index = imag(z) + texture ; imaginaire elseif @oper == 2 #index = real(z)+imag(z) + texture ; real+imag elseif @oper == 3 #index = real(z)*imag(z) + texture ; real*imag elseif @oper == 4 #index = real(z)-imag(z) + texture ; real-imag elseif @oper == 5 #index = imag(z)+real(z) + texture ; imag-real elseif @oper == 6 #index = real(z)/imag(z) + texture ; real/imag elseif @oper == 7 #index = imag(z)/real(z) + texture ; imag/real elseif @oper == 8 #index = real(z)^imag(z) + texture ; real^imag else #index = imag(z)+real(z) + texture ; imag^real endif endif default: title="Fonctions" helpfile="mde-help\mde-courbes-fonctions-ucl.htm" param courbe caption = "Curve" enum="Épicycloïde" "Lissajou" "Compagnon" "Cycloïde" \ "Ellipse" "Évolute" "Folium" "Involute" \ "Nephroïde" "Serpentine" "Agnesi" "Tractrice" \ "Épicycloïde 2" default = 1 hint="Translation: épicycloïde=epicycloid, compagnon=companion, \ cycloïde=cycloid, évolute=evolute, nephroïde=nephroid, \ tractrice=tractrix" endparam param coord caption = "Coordinates" enum="Cartésien" "Polaire" default = 0 hint= "Translation: cartésien=cartesian, polaire=polar" endparam param colorby caption="Colouring Mode" default=0 enum="minimum distance" "iteration @ min" "angle @ min" \ "maximum distance" "iteration @ max" "angle @ max" "average distance" \ "opérations" hint="Translation: opérations=operations" endparam param oper caption="Operations" default=0 enum="réel" "imaginaire" "real+imag" "real*imag" "real-imag" \ "imag-real" "real/imag" "imag/real" "real^imag" "imag^real" hint="Works only with the 'opérations' colouring mode. \ Translation: réel=real, imaginaire=imaginary" endparam param a caption = "a" default = 1.0 endparam param b caption = "b" default = 1.0 endparam param applic caption = "Function Application" default = 0 enum = "aucune" "f(x)-> réel" "f(x)-> imaginaire" "f(y)-> réel" \ "f(y)-> imaginaire" "f(x)->ré et f(y)->im" "f(x)->im et f(y)->ré" hint= "Works with the function parameters. \ Translation: aucune=no, réel=real, imaginaire=imaginary, ré=re" endparam param text_type caption = "Texture Type" enum = "hasard" "fBm" hint="Translation: hasard=random" endparam param rnd caption = "Texture Strength" default = 0.0 hint= "If different than 0, texture is applied with this strength" endparam param fbminit caption = "fBm Initialization" enum = "Pixel" "z" "Distance" "Angle" endparam param fbmscale caption = "fBm Scale" default = 1.0 endparam param fbmoffset caption = "fBm Offset" default = (0,0) endparam param fbmangle caption = "fBm Rotation" default = 0.0 endparam param fbmstep caption = "fBm Scale Step" default = 0.5 endparam param fbmastep caption = "fBm Rotation Step" default = 37.0 endparam param fbmoct caption = "fBm Octaves" default = 7 min = 1 endparam param fbmpower caption = "fBm Exponent" default = 2.0 endparam param mask_type caption = "Mask Type" enum = "Real Pixel" "Imag Pixel" "Real z" "Imag z" "Distance" \ "Angle" "Iteration" endparam param masking caption = "Masking" enum = "None" "Lower" "Upper" "Between" "Outside" 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 func fn1 caption = "Function 1 / f(x)" default = cos() endfunc func fn2 caption = "Function 2 / f(y)" default = sin() endfunc func fm caption = "Masking Function" default = ident() endfunc } md-fonctions-polaires {; Michèle Dessureault, 24 avril 2000 ; d'après les pages 390 des Standard Mathematical Tables ; 22ème édition ; Vient de 'Courbes polaires'. Similaire à 'Fonctions' ; ; Avec emprunt d'une portion de 'Gaussian Integer' ; de Kerry Mitchell ; Pour fBm, le code vient de Damien Jones & Mark Townsend ; ; Merci à Damien Jones, Mark Townsend ; pour la permission de publier ; ; Le code de masquage vient de Andreas Lober, 11 juin 2000 ; Merci pour la permission de publier ; init: float r=0.0 float rmin=1.0e12 float rmax=0.0 float rave=0.0 float total=0.0 float t=0.0 int iter=0 int itermin=0 int itermax=0 zmin=(0.0,0.0) zmax=(0.0,0.0) z=(0.0,0.0) x=(0.0,0.0) y=(0.0,0.0) rho=(0.0,0.0) float texture=0.0 float phi=0.0 p=(0.0,0.0) loop: if @courbe == 0 ;bifolium rho = @a*@fn2(#z)*@fn1(#z)*@fn1(#z) elseif @courbe == 1 ;limaçon de Pascal ; si a=b-> cardioïde rho = @a*@fn1(#z)+@b elseif @courbe == 2 ;cissoïde de Dioclès rho = @a*@fn2(#z)*@fn2(#z)/@fn1(#z) elseif @courbe == 3 ;cochléoïde rho = @a*@fn2(#z)/#z elseif @courbe == 4 ;conchoïde de Nicomède rho = @a/@fn2(#z)+@b elseif @courbe == 5 rho = (@a^2*@fn1(2*#z))^.5 ;lemniscate de Bernouilli elseif @courbe == 6 ; pétales rho = @a*@fn1(@b*#z) elseif @courbe == 7 ;parabole rho = 2*@a/(1-@fn1(#z)) elseif @courbe == 8 ;strophoïde rho = @a*@fn1(2*#z)/@fn1(#z) endif x = real(rho) y = imag(rho) if @coord == 1 x = rho * cos(real(#z)) y = rho * sin(imag(#z)) elseif @coord ==2 x = rho * cosh(real(#z)) y = rho * sinh(imag(#z)) endif if @applic == 0 z= x * (1.0,0.0) + y * (0.0,1.0) elseif @applic == 1 z= @fn1(x * (1.0,0.0)) + y * (0.0,1.0) elseif @applic == 2 z= x * (1.0,0.0) + @fn1(y * (0.0,1.0)) elseif @applic == 3 z= @fn2(x * (1.0,0.0)) + y * (0.0,1.0) elseif @applic == 4 z= x * (1.0,0.0) + @fn2(y * (0.0,1.0)) elseif @applic == 5 z= @fn1(x * (1.0,0.0)) + @fn2(y * (0.0,1.0)) elseif @applic == 6 z= @fn2(x * (1.0,0.0)) + @fn1(y * (0.0,1.0)) endif iter=iter+1 remain=#z-z r=cabs(remain) total=total+r rave=total/iter phi = atan2(#z) phi = phi/#pi if phi < 0.0 phi = phi + 2.0 endif if(rrmax) rmax=r zmax=#z itermax=iter endif final: float mask = 0 bool is_masked = false if (@masking > 0) if @mask_type == 0 mask = real(@fm(#pixel)) elseif @mask_type == 1 mask =imag(@fm(#pixel)) elseif @mask_type == 2 mask =real(@fm(#z)) elseif @mask_type == 3 mask =imag(@fm(#z)) elseif @mask_type == 4 mask =real(@fm(r+0i)) elseif @mask_type == 5 mask =real(@fm(phi+0i)) elseif @mask_type == 6 mask =real(@fm(iter+0i)) endif if (@masking == 1) ; Lower if (mask < @threshold_l) #solid = is_masked = true endif elseif (@masking == 2) ; Upper if (mask > @threshold_u) #solid = is_masked = true endif elseif (@masking == 3) ; Between if (mask > @threshold_l && mask < @threshold_u) #solid = is_masked = true endif elseif (@masking == 4) ; Outside if (mask < @threshold_l || mask > @threshold_u) #solid = is_masked = true endif endif endif if !is_masked if (@text_type == 0) ;Random complex hasard = #random texture = @rnd * (real(hasard)+ imag(hasard)) elseif (@text_type == 1) ; fBm if (@rnd != 0) complex r1 = (0,1) ^ (@fbmangle / 90.0) complex r2 = (0,1) ^ (@fbmastep / 90.0) if @fbminit == 0 p = #pixel * @fbmscale * r1 + @fbmoffset elseif @fbminit == 1 p = #z * @fbmscale * r1 + @fbmoffset elseif @fbminit == 2 p = r * @fbmscale * r1 + @fbmoffset elseif @fbminit == 3 p = phi * @fbmscale * r1 + @fbmoffset endif float sum = 0.0 float freq = 1.0 int i = @fbmoct while (i > 0) ; determine integer coordinate for corners of square ; surrounding p float bx0 = floor(real(p)) % 256 float by0 = floor(imag(p)) % 256 IF (bx0 < 0) bx0 = bx0 + 256 ENDIF IF (by0 < 0) by0 = by0 + 256 ENDIF float bx1 = (bx0 + 1) % 256 float by1 = (by0 + 1) % 256 float rx0 = real(p) - floor(real(p)) float ry0 = imag(p) - floor(imag(p)) float rx1 = rx0 - 1 float ry1 = ry0 - 1 float b00 = (bx0^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b10 = (bx1^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b01 = (bx0^@fbmpower % 65536 + by1)^@fbmpower % 65536 float b11 = (bx1^@fbmpower % 65536 + by1)^@fbmpower % 65536 float g_b00_0 = (b00)^@fbmpower*0.25 % 512 - 256 float g_b10_0 = (b10)^@fbmpower*0.25 % 512 - 256 float g_b01_0 = (b01)^@fbmpower*0.25 % 512 - 256 float g_b11_0 = (b11)^@fbmpower*0.25 % 512 - 256 float g_b00_1 = (b00+1)^@fbmpower*0.25 % 512 - 256 float g_b10_1 = (b10+1)^@fbmpower*0.25 % 512 - 256 float g_b01_1 = (b01+1)^@fbmpower*0.25 % 512 - 256 float g_b11_1 = (b11+1)^@fbmpower*0.25 % 512 - 256 float d = 0.0; d = 1 / sqrt(sqr(g_b00_0) + sqr(g_b00_1)) g_b00_0 = g_b00_0 * d g_b00_1 = g_b00_1 * d d = 1 / sqrt(sqr(g_b10_0) + sqr(g_b10_1)) g_b10_0 = g_b10_0 * d g_b10_1 = g_b10_1 * d d = 1 / sqrt(sqr(g_b01_0) + sqr(g_b01_1)) g_b01_0 = g_b01_0 * d g_b01_1 = g_b01_1 * d d = 1 / sqrt(sqr(g_b11_0) + sqr(g_b11_1)) g_b11_0 = g_b11_0 * d g_b11_1 = g_b11_1 * d float u1 = rx0 * g_b00_0 + ry0 * g_b00_1 float v1 = rx1 * g_b10_0 + ry0 * g_b10_1 float u2 = rx0 * g_b01_0 + ry1 * g_b01_1 float v2 = rx1 * g_b11_0 + ry1 * g_b11_1 float sx = sqr(rx0) * (3 - rx0*2) float sy = sqr(ry0) * (3 - ry0*2) float a = u1 + sx*(v1-u1) float b = u2 + sx*(v2-u2) sum = sum + (a + sy*(b-a))*freq freq = freq * @fbmstep p = p * r2 / @fbmstep i = i - 1 endwhile texture = @rnd * sum endif endif endif if(@colorby==0) ; minimum distance #index=rmin + texture elseif(@colorby==1) ; iteration @ min #index=0.01*itermin + texture elseif(@colorby==2) ; angle @ min t=atan2(zmin) t=t/pi if(t<0.0) t=t+2.0 endif #index=0.5*t + texture elseif(@colorby==3) ; maximum distance #index=rmax + texture elseif(@colorby==4) ; iteration @ max #index=0.01*itermax + texture elseif(@colorby==5) ; angle @ max t=atan2(zmax) t=t/pi if(t<0.0) t=t+2.0 endif #index=0.5*t + texture elseif @colorby==6 #index=rave + texture ; average distance else ; opérations if @oper == 0 #index = real(z) + texture ; réel elseif @oper == 1 #index = imag(z) + texture ; imaginaire elseif @oper == 2 #index = real(z)+imag(z) + texture ; real+imag elseif @oper == 3 #index = real(z)*imag(z) + texture ; real*imag elseif @oper == 4 #index = real(z)-imag(z) + texture ; real-imag elseif @oper == 5 #index = imag(z)+real(z) + texture ; imag-real elseif @oper == 6 #index = real(z)/imag(z) + texture ; real/imag elseif @oper == 7 #index = imag(z)/real(z) + texture ; imag/real elseif @oper == 8 #index = real(z)^imag(z) + texture ; real^imag else #index = imag(z)+real(z) + texture ; imag^real endif endif default: title="Fonctions polaires" helpfile="mde-help\mde-courbes-fonctions-polaires-ucl.htm" param courbe caption = "Curve" enum="Bifolium" "Limaçon" "Cissoïde" "Cochléoïde" \ "Conchoïde" "Lemniscate" "Pétales" "Parabole" \ "Strophoïde" default = 0 hint="Translation: cissoïde=cissoid, cochléoïde=cochleoid, \ conchoïde=conchoid, pétales=petals, parabole=parabola, \ strophoïde=strophoid" endparam param coord caption = "Coordinates" enum="Polaire" "Cartésien" "Hyperbolique" default = 0 hint= "Translation: cartésien=cartesian, polaire=polar, \ hyperbolique=hyperbolic" endparam param colorby caption="Colouring Mode" default=0 enum="minimum distance" "iteration @ min" "angle @ min" \ "maximum distance" "iteration @ max" "angle @ max" "average distance" \ "opérations" hint="Translation: opérations=operations" endparam param oper caption="Operations" default=0 enum="réel" "imaginaire" "real+imag" "real*imag" "real-imag" \ "imag-real" "real/imag" "imag/real" "real^imag" "imag^real" hint="Works only with the 'opérations' colouring mode. \ Translation: réel=real, imaginaire=imaginary" endparam param a caption = "a" default = 1.0 endparam param b caption = "b" default = 1.0 endparam param applic caption = "Function Application" default = 0 enum = "aucune" "f(x)-> réel" "f(x)-> imaginaire" "f(y)-> réel" \ "f(y)-> imaginaire" "f(x)->ré et f(y)->im" "f(x)->im et f(y)->ré" hint= "Works with the function parameters. \ Translation: aucune=no, réel=real, imaginaire=imaginary, ré=re" endparam param text_type caption = "Texture Type" enum = "hasard" "fBm" hint="Translation: hasard=random" endparam param rnd caption = "Texture Strength" default = 0.0 hint= "If different than 0, texture is applied with this strength" endparam param fbminit caption = "fBm Initialization" enum = "Pixel" "z" "Distance" "Angle" endparam param fbmscale caption = "fBm Scale" default = 1.0 endparam param fbmoffset caption = "fBm Offset" default = (0,0) endparam param fbmangle caption = "fBm Rotation" default = 0.0 endparam param fbmstep caption = "fBm Scale Step" default = 0.5 endparam param fbmastep caption = "fBm Rotation Step" default = 37.0 endparam param fbmoct caption = "fBm Octaves" default = 7 min = 1 endparam param fbmpower caption = "fBm Exponent" default = 2.0 endparam param mask_type caption = "Mask Type" enum = "Real Pixel" "Imag Pixel" "Real z" "Imag z" "Distance" \ "Angle" "Iteration" endparam param masking caption = "Masking" enum = "None" "Lower" "Upper" "Between" "Outside" 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 func fn1 caption = "Function 1 / f(x)" default = cos() endfunc func fn2 caption = "Function 2 / f(y)" default = sin() endfunc func fm caption = "Masking Function" default = ident() endfunc } md-sinus-bx{ ; Michèle Dessureault, 22 mars 2000 ; D'après la méthode de coloration 'Sinus' ; de Mark Townsend ; ; See also comments in the comments part of this file ; update october 2001 ; init: float r=0.0 float rmin=1.0e12 float rmax=0.0 float t=0.0 int iter=0 int itermin=0 int itermax=0 float mask = 0 bool is_masked = false zmin=(0.0,0.0) zmax=(0.0,0.0) z=(0.0,0.0) x =(0.0,0.0) y =(0.0,0.0) w =(0.0,0.0) float xx =0 float yy =0 float path = 0.0 float pathmin = 0.0 float pathmax = 0.0 float trap_path = 0.0 float trap_dist = 0.0 float trap_magn = 0.0 float trap_iter = 0.0 float _index = 0.0 float texture=0.0 float texture_rnd = 0.0 float texture_fbm = 0.0 float texture_dec = 0.0 float texture_gna = 0.0 float phi=0.0 float trap_a=0.0 float ro =0 float teta =0 p=(0.0,0.0) float pd=0.0 trap_p = 0 bool do_trap = true bool est_pair = true int temp1 = 0 temp2 = (0.0,0.0) float signe = 1.0 temp3 = (0.0,0.0) trp_iter = trunc(@trap_min) if trp_iter > #maxiter trp_iter = #maxiter elseif trp_iter < 1 trp_iter = 1 endif loop: if @var == 0 x = @ha * real(@fn3(@ht * imag(@fn1(#z))+0i)) y = @va * real(@fn3(@vt * real(@fn2(#z))+0i)) elseif @var == 1 x = @ha * real(@fn1(@ht * imag(@fn3(#z))+0i)) y = @va * real(@fn2(@vt * real(@fn3(#z))+0i)) elseif @var == 2 x = @ha * real(@fn1(@ht * imag(@fn3(#z))+0i)) y = @va * real(@fn3(@vt * real(@fn2(#z))+0i)) elseif @var == 3 x = @ha * real(@fn3(@ht * imag(@fn2(#z))+0i)) y = @va * real(@fn1(@vt * real(@fn3(#z))+0i)) elseif @var == 4 x = cabs(@fn1(#z)) y = atan2(@fn2(#z)) elseif @var == 5 ro = cabs(@fn1(#z)) teta = atan2(@fn2(#z)) if teta < 0 teta = teta + 2 * #pi endif float or = ro ro = ro + @ha * sin(@ht * teta) teta = teta + @va * cos(@vt * or) x = ro * cos(teta) y = ro * sin(teta) endif w = x + flip(y) if @coord == 1 rho = sqrt(sqr(x)+sqr(y)) theta = atan2(y/x) if theta < 0 theta = theta + 2 * #pi endif x = rho y = theta elseif @coord ==2 rho = sqrt(sqr(x)+sqr(y)) x = rho * cosh(real(w)) y = rho * sinh(imag(w)) endif z= @fnx(x * (1.0,0.0)) + @fny(y * (0.0,1.0)) iter=iter+1 if @barn > 0 if @barn == 1 && real(z) >= @barn_offset z = @fnb(z) endif if @barn == 2 && imag(z) >= @barn_offset z = @fnb(z) endif if @barn == 3 && (real(z) * imag(z)) >= @barn_offset z = @fnb(z) endif if @barn == 4 && (real(z) + imag(z)) >= @barn_offset z = @fnb(z) endif if @barn == 5 && r >= @barn_offset z = @fnb(z) endif if @barn == 6 && phi >= @barn_offset z = @fnb(z) endif if @barn == 7 && cabs(z) >= @barn_offset z = @fnb(z) endif if @barn == 8 && path >= @barn_offset z = @fnb(z) endif if @barn == 9 && real(trap_p) >= @barn_offset z = @fnb(z) endif if @barn == 10 && imag(trap_p) >= @barn_offset z = @fnb(z) endif if @barn == 11 && (real(trap_p)*imag(trap_p)) >= @barn_offset z = @fnb(z) endif if @barn == 12 && (real(trap_p)+imag(trap_p)) >= @barn_offset z = @fnb(z) endif if @barn == 13 && trap_dist >= @barn_offset z = @fnb(z) endif if @barn == 14 && trap_a >= @barn_offset z = @fnb(z) endif if @barn == 15 && trap_magn >= @barn_offset z = @fnb(z) endif if @barn == 16 && trap_path >= @barn_offset z = @fnb(z) endif if @barn == 17 && iter >= @barn_offset z = @fnb(z) endif if @barn == 18 && trap_iter >= @barn_offset z = @fnb(z) endif if (@masking > 0) && @mask_type == 17 mask = real(@fm(z)) endif endif if @pairimp > 0 if @pairimp == 1 temp2 = real(z) elseif @pairimp == 2 temp2 = imag(z) elseif @pairimp == 3 temp2 = real(z) * imag(z) elseif @pairimp == 4 temp2 = real(z) + imag(z) elseif @pairimp == 5 temp2 = r elseif @pairimp == 6 temp2 = phi elseif @pairimp == 7 temp2 = cabs(z) elseif @pairimp == 8 temp2 = path elseif @pairimp == 9 temp2 = real(trap_p) elseif @pairimp == 10 temp2 = imag(trap_p) elseif @pairimp == 11 temp2 = real(trap_p)*imag(trap_p) elseif @pairimp == 12 temp2 = real(trap_p)+imag(trap_p) elseif @pairimp == 13 temp2 = trap_dist elseif @pairimp == 14 temp2 = trap_a elseif @pairimp == 15 temp2 = trap_magn elseif @pairimp == 16 temp2 = trap_path elseif @pairimp == 17 temp2 = iter elseif @pairimp == 18 temp2 = trap_iter endif if @sgn == true temp3 = real(z) * imag(z) if temp3 < 0 signe = -1.0 endif endif if @intf == 0 temp1 = ceil(signe*cabs(temp2)) elseif @intf == 1 temp1 = floor(signe*cabs(temp2)) elseif @intf == 2 temp1 = trunc(signe*cabs(temp2)) elseif @intf == 3 temp1 = round(signe*cabs(temp2)) endif if temp1 % 2 == 0 est_pair = true else est_pair = false endif IF est_pair z = @fnpi(z) endif if (@masking > 0) && @mask_type == 18 mask = real(@fm(z)) endif endif remain=#z-z r=cabs(remain) path = path + r phi = atan2(#z) phi = phi/#pi if phi < 0.0 phi = phi + 2.0 endif if(rrmax) rmax=r zmax=#z itermax=iter pathmax = path endif ; trappes if do_trap && \ ((@trp==0 && @trapping == 0 && iter<=trp_iter) || \ (@trp==0 && @trapping == 1 && iter>trp_iter) || \ (@trp==1 && @trapping == 0 && |z|<=@trap_min) || \ (@trp==1 && @trapping == 1 && |z|>@trap_min) || \ (@trp==2 && @trapping == 0 && r<=@trap_min) || \ (@trp==2 && @trapping == 1 && r>@trap_min) || \ (@trp==3 && @trapping == 0 && phi<=@trap_min) || \ (@trp==3 && @trapping == 1 && phi>@trap_min) || \ (@trp==4 && @trapping == 0 && real(z)<=@trap_min) || \ (@trp==4 && @trapping == 1 && real(z)>@trap_min) || \ (@trp==5 && @trapping == 0 && imag(z)<=@trap_min) || \ (@trp==5 && @trapping == 1 && imag(z)>@trap_min) || \ (@trp==6 && @trapping == 0 && path<=@trap_min) || \ (@trp==6 && @trapping == 1 && path>@trap_min)) do_trap = false trap_dist = r ; trap distance trap_p = z ;trap trap_a = phi ;trap angle trap_iter = iter trap_magn = cabs(z) trap_path = path endif final: ; masquage if (@masking > 0) if @mask_type == 0 mask = real(@fm(#pixel)) elseif @mask_type == 1 mask =imag(@fm(#pixel)) elseif @mask_type == 2 mask =real(@fm(#z)) elseif @mask_type == 3 mask =imag(@fm(#z)) elseif @mask_type == 4 mask =real(@fm(r+0i)) elseif @mask_type == 5 mask =real(@fm(phi+0i)) elseif @mask_type == 6 mask =real(@fm(iter+0i)) elseif @mask_type == 7 mask =cabs(@fm(z)) elseif @mask_type == 8 mask =real(@fm(path+0i)) elseif @mask_type == 9 mask =real(@fm(trap_dist+0i)) elseif @mask_type == 10 mask =real(@fm(trap_a+0i)) elseif @mask_type == 11 mask =real(@fm(trap_p+0i)) elseif @mask_type == 12 mask =imag(@fm(trap_p+0i)) elseif @mask_type == 13 mask =real(@fm(trap_magn+0i)) elseif @mask_type == 14 mask =real(@fm(trap_iter+0i)) elseif @mask_type == 15 mask =real(@fm(trap_path+0i)) elseif @mask_type == 16 mask =real(@fm(rmin+0i)) endif if (@masking == 1) ; Lower if (mask < @threshold_l) #solid = is_masked = true endif elseif (@masking == 2) ; Upper if (mask > @threshold_u) #solid = is_masked = true endif elseif (@masking == 3) ; Between if (mask > @threshold_l && mask < @threshold_u) #solid = is_masked = true endif elseif (@masking == 4) ; Outside if (mask < @threshold_l || mask > @threshold_u) #solid = is_masked = true endif endif endif if !is_masked ;Random complex hasard = #random texture_rnd = @rnd * (real(hasard)+ imag(hasard)) ; fBm if (@fbmtxt != 0) r1 = (0,1) ^ (@fbmangle / 90.0) r2 = (0,1) ^ (@fbmastep / 90.0) if @fbminit == 0 p = #pixel * @fbmscale * r1 + @fbmoffset elseif @fbminit == 1 p = z * @fbmscale * r1 + @fbmoffset elseif @fbminit == 2 p = r * @fbmscale * r1 + @fbmoffset elseif @fbminit == 3 p = phi * @fbmscale * r1 + @fbmoffset elseif @fbminit == 4 p = cabs(z) * @fbmscale * r1 + @fbmoffset elseif @fbminit == 5 p = path * @fbmscale * r1 + @fbmoffset elseif @fbminit == 6 p = trap_p * @fbmscale * r1 + @fbmoffset elseif @fbminit == 7 p = trap_dist * @fbmscale * r1 + @fbmoffset elseif @fbminit == 8 p = trap_a * @fbmscale * r1 + @fbmoffset elseif @fbminit == 9 p = trap_magn * @fbmscale * r1 + @fbmoffset elseif @fbminit == 10 p = trap_path * @fbmscale * r1 + @fbmoffset elseif @fbminit == 11 p = #z * @fbmscale * r1 + @fbmoffset elseif @fbminit == 12 p = texture_rnd * @fbmscale * r1 + @fbmoffset endif float sum = 0.0 float freq = 1.0 int i = @fbmoct while (i > 0) ; determine integer coordinate for corners of square ; surrounding p float bx0 = floor(real(p)) % 256 float by0 = floor(imag(p)) % 256 IF (bx0 < 0) bx0 = bx0 + 256 ENDIF IF (by0 < 0) by0 = by0 + 256 ENDIF float bx1 = (bx0 + 1) % 256 float by1 = (by0 + 1) % 256 float rx0 = real(p) - floor(real(p)) float ry0 = imag(p) - floor(imag(p)) float rx1 = rx0 - 1 float ry1 = ry0 - 1 float b00 = (bx0^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b10 = (bx1^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b01 = (bx0^@fbmpower % 65536 + by1)^@fbmpower % 65536 float b11 = (bx1^@fbmpower % 65536 + by1)^@fbmpower % 65536 float g_b00_0 = (b00)^@fbmpower*0.25 % 512 - 256 float g_b10_0 = (b10)^@fbmpower*0.25 % 512 - 256 float g_b01_0 = (b01)^@fbmpower*0.25 % 512 - 256 float g_b11_0 = (b11)^@fbmpower*0.25 % 512 - 256 float g_b00_1 = (b00+1)^@fbmpower*0.25 % 512 - 256 float g_b10_1 = (b10+1)^@fbmpower*0.25 % 512 - 256 float g_b01_1 = (b01+1)^@fbmpower*0.25 % 512 - 256 float g_b11_1 = (b11+1)^@fbmpower*0.25 % 512 - 256 float d = 0.0; d = 1 / sqrt(sqr(g_b00_0) + sqr(g_b00_1)) g_b00_0 = g_b00_0 * d g_b00_1 = g_b00_1 * d d = 1 / sqrt(sqr(g_b10_0) + sqr(g_b10_1)) g_b10_0 = g_b10_0 * d g_b10_1 = g_b10_1 * d d = 1 / sqrt(sqr(g_b01_0) + sqr(g_b01_1)) g_b01_0 = g_b01_0 * d g_b01_1 = g_b01_1 * d d = 1 / sqrt(sqr(g_b11_0) + sqr(g_b11_1)) g_b11_0 = g_b11_0 * d g_b11_1 = g_b11_1 * d float u1 = rx0 * g_b00_0 + ry0 * g_b00_1 float v1 = rx1 * g_b10_0 + ry0 * g_b10_1 float u2 = rx0 * g_b01_0 + ry1 * g_b01_1 float v2 = rx1 * g_b11_0 + ry1 * g_b11_1 float sx = sqr(rx0) * (3 - rx0*2) float sy = sqr(ry0) * (3 - ry0*2) float a = u1 + sx*(v1-u1) float b = u2 + sx*(v2-u2) sum = sum + (a + sy*(b-a))*freq freq = freq * @fbmstep p = p * r2 / @fbmstep i = i - 1 endwhile texture_fbm = @fbmtxt * sum endif ;decimal if @dectxt > 0 if @dec_init == 0 pd = real(#z) elseif @dec_init == 1 pd = imag(#z) elseif @dec_init == 2 pd = r elseif @dec_init == 3 pd = phi elseif @dec_init == 4 pd = cabs(z) elseif @dec_init == 5 pd = path elseif @dec_init == 6 pd = real(trap_p) elseif @dec_init == 7 pd = imag(trap_p) elseif @dec_init == 8 pd = trap_dist elseif @dec_init == 9 pd = trap_a elseif @dec_init == 10 pd = trap_magn elseif @dec_init == 11 pd = trap_path elseif @dec_init == 12 pd = texture_rnd+texture_fbm endif if @dec_type == 0 pd = pd-ceil(pd*@dec_scale)/@dec_scale elseif @dec_type == 1 pd = pd-floor(pd*@dec_scale)/@dec_scale elseif @dec_type == 2 pd = pd-trunc(pd*@dec_scale)/@dec_scale elseif @dec_type == 3 pd = pd-round(pd*@dec_scale)/@dec_scale endif if @dec_size != 0 pd = pd/@dec_size endif texture_dec = @dectxt*pd if @dec_limit !=0 texture_dec= texture_dec%@dec_limit endif if @dec_sgn == true texture_dec = abs(texture_dec) endif endif if (@txtr_gnarl != 0) if @gnarl_init == 0 p = #pixel elseif @gnarl_init == 1 p = z elseif @gnarl_init == 2 p = r elseif @gnarl_init == 3 p = phi elseif @gnarl_init == 4 p = cabs(z) elseif @gnarl_init == 5 p = path elseif @gnarl_init == 6 p = trap_p elseif @gnarl_init == 7 p = trap_dist elseif @gnarl_init == 8 p = trap_a elseif @gnarl_init == 9 p = trap_magn elseif @gnarl_init == 10 p = trap_path elseif @gnarl_init == 11 p = #z elseif @gnarl_init == 12 p = texture_rnd+texture_fbm+texture_dec endif ; p = p-trunc(p*@gnarl_scale)/@gnarl_scale if @gnarl_scaling == 0 p = p-ceil(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 1 p = p-floor(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 2 p = p-trunc(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 3 p = p-round(p*@gnarl_scale)/@gnarl_scale endif if @gnarl_size != 0 p = p/@gnarl_size endif xx = real(p) yy = imag(p) float xOld = 0 int iter3 = @gnarl_octaves while (iter3 > 0) iter3 = iter3-1 xOld = xx if @gnarl_form == 0 xx = xx - sin(yy + sin(yy)) yy = yy - sin(xOld + sin(xOld)) elseif @gnarl_form == 1 xx = xx - sin(yy + log(yy + cos(yy))) yy = yy - sin(xOld + log(xOld + cos(xOld))) elseif @gnarl_form == 2 xx = xx - sin(yy + cos(yy)) yy = yy - sin(xOld + cos(xOld)) elseif @gnarl_form == 3 xx = xx - sin(yy + log(yy + tan(yy))) yy = yy - sin(xOld + log(xOld + tan(xOld))) elseif @gnarl_form == 4 xx = xx - sin(yy + log(yy + sin(yy))) yy = yy - sin(xOld + log(xOld + sin(xOld))) endif endwhile if (@gnarl_type == 0) texture_gna = abs(xx) elseif (@gnarl_type == 1) texture_gna = abs(yy) elseif (@gnarl_type == 2) texture_gna = abs(xx+yy) elseif (@gnarl_type == 3) texture_gna = abs(xx*yy) elseif (@gnarl_type == 4) texture_gna = abs(xx-yy) elseif (@gnarl_type == 5) texture_gna = abs(xx/yy) elseif (@gnarl_type == 6) texture_gna = abs(yy/xx) elseif (@gnarl_type == 7) texture_gna = abs(xx^yy) elseif (@gnarl_type == 8) texture_gna = abs(yy^xx) elseif (@gnarl_type == 9) texture_gna = abs(1/xx) elseif (@gnarl_type == 10) texture_gna = abs(1/yy) elseif (@gnarl_type == 11) texture_gna = atan2(xx+1i*yy)/(2*#pi) if (texture_gna < 0) texture_gna = texture_gna + 1 endif elseif (@gnarl_type == 12) texture_gna = |xx+1i*yy| elseif (@gnarl_type == 13) texture_gna = (xx+yy+|xx+1i*yy|)/3 elseif (@gnarl_type == 14) texture_gna = (xx*yy*|xx+1i*yy|)^(1/3) endif if @gnarl_limit !=0 texture_gna= texture_gna%@gnarl_limit endif endif endif texture = texture_rnd + texture_fbm + texture_dec + texture_gna if @colorfix ==0 if(@colorby==0) ; minimum distance _index=rmin elseif @colorby==1 ; iteration @ min _index=0.01*itermin elseif(@colorby==2) ; angle @ min t=atan2(zmin) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(zmin) ; magnitude @min elseif(@colorby==4) _index = pathmin ; path @min endif xx = real(zmin) yy = imag(zmin) endif if @colorfix == 1 if(@colorby==0) ; maximum distance _index=rmax elseif(@colorby==1) ; iteration @ max _index=0.01*itermax elseif(@colorby==2) ; angle @ max t=atan2(zmax) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(zmax) ; magnitude @max elseif(@colorby==4) _index = pathmax ; path @max endif xx = real(zmax) yy = imag(zmax) endif if @colorfix == 2 z = (zmin + zmax)/2 if(@colorby==0) ; average distance _index=path/iter elseif(@colorby==1) ; iteration @ average _index=0.01*iter/2 elseif(@colorby==2) ; angle @ average t=atan2(z) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(z) ; magnitude @average elseif(@colorby==4) _index = (pathmin + pathmax)/2 ; path @average endif xx = real(z) yy = imag(z) endif if @colorfix == 3 if(@colorby==0) ; last distance _index=r elseif(@colorby==1) ; iteration @ last _index=0.01*iter elseif(@colorby==2) ; angle @ last t=atan2(z) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(z) ; magnitude @last elseif(@colorby==4) _index = path ; path @last endif xx = real(z) yy = imag(z) endif if @colorfix == 4 if(@colorby==0) ; distance @trap _index=trap_dist elseif(@colorby==1) ; iteration @ trap _index=0.01*trap_iter elseif(@colorby==2) ; angle @ trap t=atan2(trap_p) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = trap_magn ; magnitude @trap elseif(@colorby==4) _index = trap_path ; path @trap endif xx = real(trap_p) yy = imag(trap_p) endif if @colorby == 5 _index = (xx+yy+|xx+1i*yy|)/3 ; arith.mean elseif @colorby == 6 _index = (xx*yy*|xx+1i*yy|)^(1/3) ; geom.mean elseif @colorby == 7 _index = xx ; réel elseif @colorby == 8 _index = yy ; imaginaire elseif @colorby == 9 _index = xx + yy ; real+imag elseif @colorby == 10 _index = xx * yy ; real*imag elseif @colorby == 11 _index = xx - yy ; real-imag elseif @colorby == 12 _index = yy - xx ; imag-real elseif @colorby == 13 _index = xx / yy ; real/imag elseif @colorby ==14 _index = yy / xx ; imag/real elseif @colorby == 15 _index = xx ^ yy ; real^imag elseif @colorby == 16 _index = yy ^ xx ; imag^real elseif @colorby == 17 _index = 1/xx ; 1/real elseif @colorby == 18 _index = 1/yy ; 1/imag endif #index = _index + texture default: title="Autre sinus" helpfile="mde-help\mde-autre-sinus.htm" param var caption = "Flavour" enum = "1st" "2nd" "3rd" "4th" "5th" "6th" endparam param ht caption = "Horizontal Frequency" default = 10.0 endparam param ha caption = "Horizontal Amplitude" default = 0.5 endparam param vt caption = "Vertical Frequency" default = 10.0 endparam param va caption = "Vertical Amplitude" default = 0.5 endparam param coord caption = "Coordinates" enum="cartesian" "polar" "hyperbolic" default = 0 endparam param colorby caption="Colouring Mode" default=0 enum="distance" "iteration" "angle" "magnitude" "path" \ "arith. mean" "geom. mean" \ "real" "imag" "real+imag" "real*imag" "real-imag" \ "imag-real" "real/imag" "imag/real" "real^imag" "imag^real" \ "1/real" "1/imag" endparam param colorfix caption ="Colouring Fix" enum = "@minimum" "@maximum" "average" "@last Z" "@trap" endparam param barn caption = "Barnsley type" enum = "none" "real" "imag" "real*imag" "real+imag" \ "distance" "angle" "magnitude" "path" "trap real" \ "trap imag" "trap r*i" "trap r+i" "trap distance" \ "trap angle" "trap magnitude" "trap path" "iteration" \ "trap iter" endparam param barn_offset caption = "Barnsley Offset" default = 0.0 endparam param pairimp caption = "Odd-even type" enum = "none" "real" "imag" "real*imag" "real+imag" \ "distance" "angle" "magnitude" "path" "trap real" \ "trap imag" "trap r*i" "trap r+i" "trap distance" \ "trap angle" "trap magnitude" "trap path" "iteration" \ "trap iter" endparam param sgn caption = "Apply Odd-even Sign?" default = false endparam param intf caption = "Odd-Even factor" enum = "ceil" "floor" "trunc" "round" endparam param rnd caption = "Random Texture Amount" default = 0.0 endparam param fbmtxt caption = "fBm Texture Amount" default = 0.0 endparam param fbminit caption = "fBm Initialization" enum = "pixel" "z" "distance" "angle" "magnitude" "path" "trap z" \ "trap distance" "trap angle" "trap magnitude" "trap path" \ "Z" "hand over" endparam param fbmscale caption = "fBm Scale" default = 1.0 endparam param fbmoffset caption = "fBm Offset" default = (0,0) endparam param fbmangle caption = "fBm Rotation" default = 0.0 endparam param fbmstep caption = "fBm Scale Step" default = 0.5 endparam param fbmastep caption = "fBm Rotation Step" default = 37.0 endparam param fbmoct caption = "fBm Octaves" default = 7 min = 1 endparam param fbmpower caption = "fBm Exponent" default = 2.0 endparam param dectxt caption = "Decimal Texture Amount" default = 0.0 endparam param dec_init caption = "Decimal Initialisation" enum = "real z" "imag z" "distance" "angle" "magnitude" "path" \ "real trap" "imag trap" "trap distance" "trap angle" \ "trap magnitude" "trap path" "hand over" endparam param dec_sgn caption = "Apply Decimal Sign?" default = true endparam param dec_type caption = "Decimal Type" enum = "Ceil" "Floor" "Trunc" "Round" endparam param dec_scale caption = "Decimal Scale" default = 1.0 endparam param dec_size caption = "Decimal Size" default = 1.0 endparam param dec_limit caption = "Decimal Limit" default = 1.0 min = 0.0 endparam param txtr_gnarl caption = "Popgnarl Texture Amount" default = 0.0 endparam param gnarl_init caption = "Popgnarl Initialization" enum = "pixel" "z" "distance" "angle" "magnitude" "path" "trap z" \ "trap distance" "trap angle" "trap magnitude" "trap path" \ "Z" "hand over" default = 1 endparam param gnarl_type caption = "Popgnarl Mode" enum = "real" "imag" "real+imag" "real*imag" "real-imag" \ "real/imag" "imag/real" "real^imag" "imag^real" \ "1/real" "1/imag" "angle" "magnitude" "arith. mean" \ "geom. mean" endparam param gnarl_form caption = "Popgnarl Formula" enum = "gnarl" "popcorn" "popsicle" "tannous" "narlog" endparam param gnarl_scale caption = "Popgnarl Scale" default = 1.0 endparam param gnarl_scaling caption = "Popgnarl Scaling" enum = "Ceil" "Floor" "trunc" "round" endparam param gnarl_size caption = "Popgnarl Size" default = 1.0 endparam param gnarl_limit caption = "Popgnarl Limit" default = 1.0 min = 0.0 endparam param gnarl_octaves caption = "Popgnarl Octaves" default = 5 min = 1 endparam param masking caption = "Masking" enum = "none" "lower" "upper" "between" "outside" default = 0 endparam param mask_type caption = "Mask Type" enum = "real pixel" "imag pixel" "real z" "imag z" "distance" \ "angle" "iteration" "magnitude" "path" "trap distance" \ "trap angle" "real trap" "imag trap" "trap magnitude" \ "trap iter" "trap path" "shape" "Barnsley" "odd-even" endparam param threshold_l caption = "Lower Mask Threshold" default = 0.5 endparam param threshold_u caption = "Upper Mask Threshold" default = 1.0 endparam param trapping caption = "Trapping" enum = "lower" "upper" endparam param trp caption = "Trap Type" enum = "iteration" "magnitude" "distance" "angle" "real" "imag" "path" endparam param trap_min caption = "Trap Threshold" default = 1.0 min = 0.0 endparam func fn1 caption = "First Function" default = ident() endfunc func fn2 caption = "Second Function" default = ident() endfunc func fn3 caption = "Third Function" default = tan() endfunc func fnx caption = "Apply F(x)" default = ident() endfunc func fny caption = "Apply F(y)" default = ident() endfunc func fnb caption = "Barnsley Function" default = flip() endfunc func fnpi caption = "Odd-even Function" default = flip() endfunc func fm caption = "Masking Function" default = ident() endfunc } md-courbes-eb{ ; Michèle Dessureault, 12 décembre 1999 ; d'après les pages 390 des Standard Mathematical Tables ; 22ème édition ; ; See also comments in the comments part of this file. ; Update october 2001 ; init: float r=0.0 float rmin=1.0e12 float rmax=0.0 float t=0.0 float mask = 0 bool is_masked = false int iter=0 int itermin=0 int itermax=0 zmin=(0.0,0.0) zmax=(0.0,0.0) z=(0.0,0.0) x =(0.0,0.0) y =(0.0,0.0) w =(0.0,0.0) float xx =0 float yy =0 float path = 0.0 float pathmin = 0.0 float pathmax = 0.0 float trap_path = 0.0 float trap_dist = 0.0 float trap_magn = 0.0 float trap_iter = 0.0 float _index = 0.0 float texture=0.0 float texture_rnd = 0.0 float texture_fbm = 0.0 float texture_dec = 0.0 float texture_gna = 0.0 float phi=0.0 float trap_a=0.0 p=(0.0,0.0) float pd=0.0 trap_p = 0 bool do_trap = true bool est_pair = true int temp1 = 0 temp2 = (0.0,0.0) float signe = 1.0 temp3 = (0.0,0.0) trp_iter = trunc(@trap_min) if trp_iter > #maxiter trp_iter = #maxiter elseif trp_iter < 1 trp_iter = 1 endif loop: if @courbe == 0 ;lissajou x = real(@fn1(@a*#z)) y = imag(@fn2(@b*#z)) elseif @courbe == 1 ;épicycloïde x = real((@a+@b)*@fn1(#z)- @b*@fn1(((@a+@b)/@b)*#z)) y = imag((@a+@b)*@fn2(#z)- @b*@fn2(((@a+@b)/@b)*#z)) elseif @courbe == 2 ;compagnon du cycloïde x = real(@a*#z) y = imag(@a*(1-@fn1(#z))) elseif @courbe == 3 ;cycloïde x = real(@a*#z - @b*@fn2(#z)) y = imag(@a*-@b*@fn1(#z)) elseif @courbe == 4 x = real(@a*@fn1(#z)) ;ellipse y = imag(@b*@fn2(#z)) elseif @courbe == 5 x = real(@a*@fn1(#z)*@fn1(#z)*@fn1(#z)) ;évolute de l'ellipse y = imag(@b*@fn2(#z)*@fn2(#z)*@fn2(#z)) elseif @courbe == 6 x = real(@b*@a*#z / (1+#z^3)) ;folium de Descartes y = imag(@b*@a+#z^2 / (1+#z^3)) elseif @courbe == 7 ;involute du cercle x = real(@a*@fn1(#z) + @a*#z*@fn2(#z)) y = imag(@a*@fn2(#z) - @a*#z*@fn1(#z)) elseif @courbe == 8 ;nephroïde x = real(@a*.5*(@b*@fn1(#z) - @fn1(@b*#z))) y = imag(@a*.5*(@b*@fn2(#z) - @fn2(@b*#z))) elseif @courbe == 9 ;courbe serpentine x = real(@a*@fn1(#z)/@fn2(#z)) y = imag(@b*@fn2(#z)*@fn1(#z)) elseif @courbe == 10 ;sorcière d'Agnesi x = real(@a*@fn1(#z)/@fn2(#z)) y = imag(@b*@fn2(#z)*@fn2(#z)) elseif @courbe == 11 ;tractrice x = real(#z-@a*@fn2(#z/@a)/@fn1(#z/@a)) y = imag(@a/@fn2(#z/@a)) elseif @courbe == 12 ;lissajou 2 x = @fn1(@a*#z) y = @fn2(@b*#z) elseif @courbe == 13 ;épicycloïde 2 x = (@a+@b)*@fn1(#z)- @b*@fn1(((@a+@b)/@b)*#z) y = (@a+@b)*@fn2(#z)- @b*@fn2(((@a+@b)/@b)*#z) elseif @courbe == 14 ;compagnon du cycloïde 2 x = @a*#z y = @a*(1-@fn1(#z)) elseif @courbe == 15 ;cycloïde 2 x = @a*#z - @b*@fn2(#z) y = @a*-@b*@fn1(#z) elseif @courbe == 16 x = @a*@fn1(#z) ;ellipse 2 y = @b*@fn2(#z) elseif @courbe == 17 x = @a*@fn1(#z)*@fn1(#z)*@fn1(#z) ;évolute de l'ellipse 2 y = @b*@fn2(#z)*@fn2(#z)*@fn2(#z) elseif @courbe == 18 x = @b*@a*#z / (1+#z^3) ;folium de Descartes 2 y = @b*@a+#z^2 / (1+#z^3) elseif @courbe == 19 ;involute du cercle 2 x = @a*@fn1(#z) + @a*#z*@fn2(#z) y = @a*@fn2(#z) - @a*#z*@fn1(#z) elseif @courbe == 20 ;nephroïde 2 x = @a*.5*(@b*@fn1(#z) - @fn1(@b*#z)) y = @a*.5*(@b*@fn2(#z) - @fn2(@b*#z)) elseif @courbe == 21 ;courbe serpentine 2 x = @a*@fn1(#z)/@fn2(#z) y = @b*@fn2(#z)*@fn1(#z) elseif @courbe == 22 ;sorcière d'Agnesi 2 x = @a*@fn1(#z)/@fn2(#z) y = @b*@fn2(#z)*@fn2(#z) elseif @courbe == 23 ;tractrice 2 x = #z-@a*@fn2(#z/@a)/@fn1(#z/@a) y = @a/@fn2(#z/@a) endif if @coord == 1 rho = sqrt(sqr(x)+sqr(y)) theta = atan2(y/x) if theta < 0 theta = theta + 2 * #pi endif x = rho y = theta elseif @coord ==2 rho = sqrt(sqr(x)+sqr(y)) x = rho * cosh(real(w)) y = rho * sinh(imag(w)) endif z= @fnx(x * (1.0,0.0)) + @fny(y * (0.0,1.0)) iter=iter+1 if @barn > 0 if @barn == 1 && real(z) >= @barn_offset z = @fnb(z) endif if @barn == 2 && imag(z) >= @barn_offset z = @fnb(z) endif if @barn == 3 && (real(z) * imag(z)) >= @barn_offset z = @fnb(z) endif if @barn == 4 && (real(z) + imag(z)) >= @barn_offset z = @fnb(z) endif if @barn == 5 && r >= @barn_offset z = @fnb(z) endif if @barn == 6 && phi >= @barn_offset z = @fnb(z) endif if @barn == 7 && cabs(z) >= @barn_offset z = @fnb(z) endif if @barn == 8 && path >= @barn_offset z = @fnb(z) endif if @barn == 9 && real(trap_p) >= @barn_offset z = @fnb(z) endif if @barn == 10 && imag(trap_p) >= @barn_offset z = @fnb(z) endif if @barn == 11 && (real(trap_p)*imag(trap_p)) >= @barn_offset z = @fnb(z) endif if @barn == 12 && (real(trap_p)+imag(trap_p)) >= @barn_offset z = @fnb(z) endif if @barn == 13 && trap_dist >= @barn_offset z = @fnb(z) endif if @barn == 14 && trap_a >= @barn_offset z = @fnb(z) endif if @barn == 15 && trap_magn >= @barn_offset z = @fnb(z) endif if @barn == 16 && trap_path >= @barn_offset z = @fnb(z) endif if @barn == 17 && iter >= @barn_offset z = @fnb(z) endif if @barn == 18 && trap_iter >= @barn_offset z = @fnb(z) endif if (@masking > 0) && @mask_type == 17 mask = real(@fm(z)) endif endif if @pairimp > 0 if @pairimp == 1 temp2 = real(z) elseif @pairimp == 2 temp2 = imag(z) elseif @pairimp == 3 temp2 = real(z) * imag(z) elseif @pairimp == 4 temp2 = real(z) + imag(z) elseif @pairimp == 5 temp2 = r elseif @pairimp == 6 temp2 = phi elseif @pairimp == 7 temp2 = cabs(z) elseif @pairimp == 8 temp2 = path elseif @pairimp == 9 temp2 = real(trap_p) elseif @pairimp == 10 temp2 = imag(trap_p) elseif @pairimp == 11 temp2 = real(trap_p)*imag(trap_p) elseif @pairimp == 12 temp2 = real(trap_p)+imag(trap_p) elseif @pairimp == 13 temp2 = trap_dist elseif @pairimp == 14 temp2 = trap_a elseif @pairimp == 15 temp2 = trap_magn elseif @pairimp == 16 temp2 = trap_path elseif @pairimp == 17 temp2 = iter elseif @pairimp == 18 temp2 = trap_iter endif if @sgn == true temp3 = real(z) * imag(z) if temp3 < 0 signe = -1.0 endif endif if @intf == 0 temp1 = ceil(signe*cabs(temp2)) elseif @intf == 1 temp1 = floor(signe*cabs(temp2)) elseif @intf == 2 temp1 = trunc(signe*cabs(temp2)) elseif @intf == 3 temp1 = round(signe*cabs(temp2)) endif if temp1 % 2 == 0 est_pair = true else est_pair = false endif IF est_pair z = @fnpi(z) endif if (@masking > 0) && @mask_type == 18 mask = real(@fm(z)) endif endif remain=#z-z r=cabs(remain) path = path + r phi = atan2(#z) phi = phi/#pi if phi < 0.0 phi = phi + 2.0 endif if(rrmax) rmax=r zmax=#z itermax=iter pathmax = path endif ; trappes if do_trap && \ ((@trp==0 && @trapping == 0 && iter<=trp_iter) || \ (@trp==0 && @trapping == 1 && iter>trp_iter) || \ (@trp==1 && @trapping == 0 && |z|<=@trap_min) || \ (@trp==1 && @trapping == 1 && |z|>@trap_min) || \ (@trp==2 && @trapping == 0 && r<=@trap_min) || \ (@trp==2 && @trapping == 1 && r>@trap_min) || \ (@trp==3 && @trapping == 0 && phi<=@trap_min) || \ (@trp==3 && @trapping == 1 && phi>@trap_min) || \ (@trp==4 && @trapping == 0 && real(z)<=@trap_min) || \ (@trp==4 && @trapping == 1 && real(z)>@trap_min) || \ (@trp==5 && @trapping == 0 && imag(z)<=@trap_min) || \ (@trp==5 && @trapping == 1 && imag(z)>@trap_min) || \ (@trp==6 && @trapping == 0 && path<=@trap_min) || \ (@trp==6 && @trapping == 1 && path>@trap_min)) do_trap = false trap_dist = r ; trap distance trap_p = z ;trap trap_a = phi ;trap angle trap_iter = iter trap_magn = cabs(z) trap_path = path endif final: ; masquage if (@masking > 0) if @mask_type == 0 mask = real(@fm(#pixel)) elseif @mask_type == 1 mask =imag(@fm(#pixel)) elseif @mask_type == 2 mask =real(@fm(#z)) elseif @mask_type == 3 mask =imag(@fm(#z)) elseif @mask_type == 4 mask =real(@fm(r+0i)) elseif @mask_type == 5 mask =real(@fm(phi+0i)) elseif @mask_type == 6 mask =real(@fm(iter+0i)) elseif @mask_type == 7 mask =cabs(@fm(z)) elseif @mask_type == 8 mask =real(@fm(path+0i)) elseif @mask_type == 9 mask =real(@fm(trap_dist+0i)) elseif @mask_type == 10 mask =real(@fm(trap_a+0i)) elseif @mask_type == 11 mask =real(@fm(trap_p+0i)) elseif @mask_type == 12 mask =imag(@fm(trap_p+0i)) elseif @mask_type == 13 mask =real(@fm(trap_magn+0i)) elseif @mask_type == 14 mask =real(@fm(trap_iter+0i)) elseif @mask_type == 15 mask =real(@fm(trap_path+0i)) elseif @mask_type == 16 mask =real(@fm(rmin+0i)) endif if (@masking == 1) ; Lower if (mask < @threshold_l) #solid = is_masked = true endif elseif (@masking == 2) ; Upper if (mask > @threshold_u) #solid = is_masked = true endif elseif (@masking == 3) ; Between if (mask > @threshold_l && mask < @threshold_u) #solid = is_masked = true endif elseif (@masking == 4) ; Outside if (mask < @threshold_l || mask > @threshold_u) #solid = is_masked = true endif endif endif if !is_masked ;Random complex hasard = #random texture_rnd = @rnd * (real(hasard)+ imag(hasard)) ; fBm if (@fbmtxt != 0) r1 = (0,1) ^ (@fbmangle / 90.0) r2 = (0,1) ^ (@fbmastep / 90.0) if @fbminit == 0 p = #pixel * @fbmscale * r1 + @fbmoffset elseif @fbminit == 1 p = z * @fbmscale * r1 + @fbmoffset elseif @fbminit == 2 p = r * @fbmscale * r1 + @fbmoffset elseif @fbminit == 3 p = phi * @fbmscale * r1 + @fbmoffset elseif @fbminit == 4 p = cabs(z) * @fbmscale * r1 + @fbmoffset elseif @fbminit == 5 p = path * @fbmscale * r1 + @fbmoffset elseif @fbminit == 6 p = trap_p * @fbmscale * r1 + @fbmoffset elseif @fbminit == 7 p = trap_dist * @fbmscale * r1 + @fbmoffset elseif @fbminit == 8 p = trap_a * @fbmscale * r1 + @fbmoffset elseif @fbminit == 9 p = trap_magn * @fbmscale * r1 + @fbmoffset elseif @fbminit == 10 p = trap_path * @fbmscale * r1 + @fbmoffset elseif @fbminit == 11 p = #z * @fbmscale * r1 + @fbmoffset elseif @fbminit == 12 p = texture_rnd * @fbmscale * r1 + @fbmoffset endif float sum = 0.0 float freq = 1.0 int i = @fbmoct while (i > 0) ; determine integer coordinate for corners of square ; surrounding p float bx0 = floor(real(p)) % 256 float by0 = floor(imag(p)) % 256 IF (bx0 < 0) bx0 = bx0 + 256 ENDIF IF (by0 < 0) by0 = by0 + 256 ENDIF float bx1 = (bx0 + 1) % 256 float by1 = (by0 + 1) % 256 float rx0 = real(p) - floor(real(p)) float ry0 = imag(p) - floor(imag(p)) float rx1 = rx0 - 1 float ry1 = ry0 - 1 float b00 = (bx0^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b10 = (bx1^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b01 = (bx0^@fbmpower % 65536 + by1)^@fbmpower % 65536 float b11 = (bx1^@fbmpower % 65536 + by1)^@fbmpower % 65536 float g_b00_0 = (b00)^@fbmpower*0.25 % 512 - 256 float g_b10_0 = (b10)^@fbmpower*0.25 % 512 - 256 float g_b01_0 = (b01)^@fbmpower*0.25 % 512 - 256 float g_b11_0 = (b11)^@fbmpower*0.25 % 512 - 256 float g_b00_1 = (b00+1)^@fbmpower*0.25 % 512 - 256 float g_b10_1 = (b10+1)^@fbmpower*0.25 % 512 - 256 float g_b01_1 = (b01+1)^@fbmpower*0.25 % 512 - 256 float g_b11_1 = (b11+1)^@fbmpower*0.25 % 512 - 256 float d = 0.0; d = 1 / sqrt(sqr(g_b00_0) + sqr(g_b00_1)) g_b00_0 = g_b00_0 * d g_b00_1 = g_b00_1 * d d = 1 / sqrt(sqr(g_b10_0) + sqr(g_b10_1)) g_b10_0 = g_b10_0 * d g_b10_1 = g_b10_1 * d d = 1 / sqrt(sqr(g_b01_0) + sqr(g_b01_1)) g_b01_0 = g_b01_0 * d g_b01_1 = g_b01_1 * d d = 1 / sqrt(sqr(g_b11_0) + sqr(g_b11_1)) g_b11_0 = g_b11_0 * d g_b11_1 = g_b11_1 * d float u1 = rx0 * g_b00_0 + ry0 * g_b00_1 float v1 = rx1 * g_b10_0 + ry0 * g_b10_1 float u2 = rx0 * g_b01_0 + ry1 * g_b01_1 float v2 = rx1 * g_b11_0 + ry1 * g_b11_1 float sx = sqr(rx0) * (3 - rx0*2) float sy = sqr(ry0) * (3 - ry0*2) float a = u1 + sx*(v1-u1) float b = u2 + sx*(v2-u2) sum = sum + (a + sy*(b-a))*freq freq = freq * @fbmstep p = p * r2 / @fbmstep i = i - 1 endwhile texture_fbm = @fbmtxt * sum endif ;decimal if @dectxt > 0 if @dec_init == 0 pd = real(#z) elseif @dec_init == 1 pd = imag(#z) elseif @dec_init == 2 pd = r elseif @dec_init == 3 pd = phi elseif @dec_init == 4 pd = cabs(z) elseif @dec_init == 5 pd = path elseif @dec_init == 6 pd = real(trap_p) elseif @dec_init == 7 pd = imag(trap_p) elseif @dec_init == 8 pd = trap_dist elseif @dec_init == 9 pd = trap_a elseif @dec_init == 10 pd = trap_magn elseif @dec_init == 11 pd = trap_path elseif @dec_init == 12 pd = texture_rnd+texture_fbm endif if @dec_type == 0 pd = pd-ceil(pd*@dec_scale)/@dec_scale elseif @dec_type == 1 pd = pd-floor(pd*@dec_scale)/@dec_scale elseif @dec_type == 2 pd = pd-trunc(pd*@dec_scale)/@dec_scale elseif @dec_type == 3 pd = pd-round(pd*@dec_scale)/@dec_scale endif if @dec_size != 0 pd = pd/@dec_size endif texture_dec = @dectxt*pd if @dec_limit !=0 texture_dec= texture_dec%@dec_limit endif if @dec_sgn == true texture_dec = abs(texture_dec) endif endif if (@txtr_gnarl != 0) if @gnarl_init == 0 p = #pixel elseif @gnarl_init == 1 p = z elseif @gnarl_init == 2 p = r elseif @gnarl_init == 3 p = phi elseif @gnarl_init == 4 p = cabs(z) elseif @gnarl_init == 5 p = path elseif @gnarl_init == 6 p = trap_p elseif @gnarl_init == 7 p = trap_dist elseif @gnarl_init == 8 p = trap_a elseif @gnarl_init == 9 p = trap_magn elseif @gnarl_init == 10 p = trap_path elseif @gnarl_init == 11 p = #z elseif @gnarl_init == 12 p = texture_rnd+texture_fbm+texture_dec endif ; p = p-trunc(p*@gnarl_scale)/@gnarl_scale if @gnarl_scaling == 0 p = p-ceil(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 1 p = p-floor(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 2 p = p-trunc(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 3 p = p-round(p*@gnarl_scale)/@gnarl_scale endif if @gnarl_size != 0 p = p/@gnarl_size endif xx = real(p) yy = imag(p) float xOld = 0 int iter3 = @gnarl_octaves while (iter3 > 0) iter3 = iter3-1 xOld = xx if @gnarl_form == 0 xx = xx - sin(yy + sin(yy)) yy = yy - sin(xOld + sin(xOld)) elseif @gnarl_form == 1 xx = xx - sin(yy + log(yy + cos(yy))) yy = yy - sin(xOld + log(xOld + cos(xOld))) elseif @gnarl_form == 2 xx = xx - sin(yy + cos(yy)) yy = yy - sin(xOld + cos(xOld)) elseif @gnarl_form == 3 xx = xx - sin(yy + log(yy + tan(yy))) yy = yy - sin(xOld + log(xOld + tan(xOld))) elseif @gnarl_form == 4 xx = xx - sin(yy + log(yy + sin(yy))) yy = yy - sin(xOld + log(xOld + sin(xOld))) endif endwhile if (@gnarl_type == 0) texture_gna = abs(xx) elseif (@gnarl_type == 1) texture_gna = abs(yy) elseif (@gnarl_type == 2) texture_gna = abs(xx+yy) elseif (@gnarl_type == 3) texture_gna = abs(xx*yy) elseif (@gnarl_type == 4) texture_gna = abs(xx-yy) elseif (@gnarl_type == 5) texture_gna = abs(xx/yy) elseif (@gnarl_type == 6) texture_gna = abs(yy/xx) elseif (@gnarl_type == 7) texture_gna = abs(xx^yy) elseif (@gnarl_type == 8) texture_gna = abs(yy^xx) elseif (@gnarl_type == 9) texture_gna = abs(1/xx) elseif (@gnarl_type == 10) texture_gna = abs(1/yy) elseif (@gnarl_type == 11) texture_gna = atan2(xx+1i*yy)/(2*#pi) if (texture_gna < 0) texture_gna = texture_gna + 1 endif elseif (@gnarl_type == 12) texture_gna = |xx+1i*yy| elseif (@gnarl_type == 13) texture_gna = (xx+yy+|xx+1i*yy|)/3 elseif (@gnarl_type == 14) texture_gna = (xx*yy*|xx+1i*yy|)^(1/3) endif if @gnarl_limit !=0 texture_gna= texture_gna%@gnarl_limit endif endif endif texture = texture_rnd + texture_fbm + texture_dec + texture_gna if @colorfix ==0 if(@colorby==0) ; minimum distance _index=rmin elseif @colorby==1 ; iteration @ min _index=0.01*itermin elseif(@colorby==2) ; angle @ min t=atan2(zmin) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(zmin) ; magnitude @min elseif(@colorby==4) _index = pathmin ; path @min endif xx = real(zmin) yy = imag(zmin) endif if @colorfix == 1 if(@colorby==0) ; maximum distance _index=rmax elseif(@colorby==1) ; iteration @ max _index=0.01*itermax elseif(@colorby==2) ; angle @ max t=atan2(zmax) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(zmax) ; magnitude @max elseif(@colorby==4) _index = pathmax ; path @max endif xx = real(zmax) yy = imag(zmax) endif if @colorfix == 2 z = (zmin + zmax)/2 if(@colorby==0) ; average distance _index=path/iter elseif(@colorby==1) ; iteration @ average _index=0.01*iter/2 elseif(@colorby==2) ; angle @ average t=atan2(z) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(z) ; magnitude @average elseif(@colorby==4) _index = (pathmin + pathmax)/2 ; path @average endif xx = real(z) yy = imag(z) endif if @colorfix == 3 if(@colorby==0) ; last distance _index=r elseif(@colorby==1) ; iteration @ last _index=0.01*iter elseif(@colorby==2) ; angle @ last t=atan2(z) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(z) ; magnitude @last elseif(@colorby==4) _index = path ; path @last endif xx = real(z) yy = imag(z) endif if @colorfix == 4 if(@colorby==0) ; distance @trap _index=trap_dist elseif(@colorby==1) ; iteration @ trap _index=0.01*trap_iter elseif(@colorby==2) ; angle @ trap t=atan2(trap_p) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = trap_magn ; magnitude @trap elseif(@colorby==4) _index = trap_path ; path @trap endif xx = real(trap_p) yy = imag(trap_p) endif if @colorby == 5 _index = (xx+yy+|xx+1i*yy|)/3 ; arith.mean elseif @colorby == 6 _index = (xx*yy*|xx+1i*yy|)^(1/3) ; geom.mean elseif @colorby == 7 _index = xx ; réel elseif @colorby == 8 _index = yy ; imaginaire elseif @colorby == 9 _index = xx + yy ; real+imag elseif @colorby == 10 _index = xx * yy ; real*imag elseif @colorby == 11 _index = xx - yy ; real-imag elseif @colorby == 12 _index = yy - xx ; imag-real elseif @colorby == 13 _index = xx / yy ; real/imag elseif @colorby ==14 _index = yy / xx ; imag/real elseif @colorby == 15 _index = xx ^ yy ; real^imag elseif @colorby == 16 _index = yy ^ xx ; imag^real elseif @colorby == 17 _index = 1/xx ; 1/real elseif @colorby == 18 _index = 1/yy ; 1/imag endif #index = _index + texture default: title="Courbes ++" helpfile="mde-help\mde-courbes++.htm" param courbe caption = "Curve" enum="lissajou" "epicycloid" "companion" "cycloid" \ "ellipse" "evolute" "folium" "involute" \ "nephroid" "serpentine" "agnesi" "tractrix" \ "lissajou 2" "epicycloïde 2" "companion 2" "cycloid 2" \ "ellipse 2" "evolute 2" "folium 2" "involute 2" \ "nephroid 2" "serpentine 2" "agnesi 2" "tractrix 2" endparam param a caption = "a" default = 1.0 endparam param b caption = "b" default = 1.0 endparam param coord caption = "Coordinates" enum="cartesian" "polar" "hyperbolic" default = 0 endparam param colorby caption="Colouring Mode" default=0 enum="distance" "iteration" "angle" "magnitude" "path" \ "arith. mean" "geom. mean" \ "real" "imag" "real+imag" "real*imag" "real-imag" \ "imag-real" "real/imag" "imag/real" "real^imag" "imag^real" \ "1/real" "1/imag" endparam param colorfix caption ="Colouring Fix" enum = "@minimum" "@maximum" "average" "@last Z" "@trap" endparam param barn caption = "Barnsley type" enum = "none" "real" "imag" "real*imag" "real+imag" \ "distance" "angle" "magnitude" "path" "trap real" \ "trap imag" "trap r*i" "trap r+i" "trap distance" \ "trap angle" "trap magnitude" "trap path" "iteration" \ "trap iter" endparam param barn_offset caption = "Barnsley Offset" default = 0.0 endparam param pairimp caption = "Odd-even type" enum = "none" "real" "imag" "real*imag" "real+imag" \ "distance" "angle" "magnitude" "path" "trap real" \ "trap imag" "trap r*i" "trap r+i" "trap distance" \ "trap angle" "trap magnitude" "trap path" "iteration" \ "trap iter" endparam param sgn caption = "Apply Odd-even Sign?" default = false endparam param intf caption = "Odd-Even factor" enum = "ceil" "floor" "trunc" "round" endparam param rnd caption = "Random Texture Amount" default = 0.0 endparam param fbmtxt caption = "fBm Texture Amount" default = 0.0 endparam param fbminit caption = "fBm Initialization" enum = "pixel" "z" "distance" "angle" "magnitude" "path" "trap z" \ "trap distance" "trap angle" "trap magnitude" "trap path" \ "Z" "hand over" endparam param fbmscale caption = "fBm Scale" default = 1.0 endparam param fbmoffset caption = "fBm Offset" default = (0,0) endparam param fbmangle caption = "fBm Rotation" default = 0.0 endparam param fbmstep caption = "fBm Scale Step" default = 0.5 endparam param fbmastep caption = "fBm Rotation Step" default = 37.0 endparam param fbmoct caption = "fBm Octaves" default = 7 min = 1 endparam param fbmpower caption = "fBm Exponent" default = 2.0 endparam param dectxt caption = "Decimal Texture Amount" default = 0.0 endparam param dec_init caption = "Decimal Initialisation" enum = "real z" "imag z" "distance" "angle" "magnitude" "path" \ "real trap" "imag trap" "trap distance" "trap angle" \ "trap magnitude" "trap path" "hand over" endparam param dec_sgn caption = "Apply Decimal Sign?" default = true endparam param dec_type caption = "Decimal Type" enum = "Ceil" "Floor" "Trunc" "Round" endparam param dec_scale caption = "Decimal Scale" default = 1.0 endparam param dec_size caption = "Decimal Size" default = 1.0 endparam param dec_limit caption = "Decimal Limit" default = 1.0 min = 0.0 endparam param txtr_gnarl caption = "Popgnarl Texture Amount" default = 0.0 endparam param gnarl_init caption = "Popgnarl Initialization" enum = "pixel" "z" "distance" "angle" "magnitude" "path" "trap z" \ "trap distance" "trap angle" "trap magnitude" "trap path" \ "Z" "hand over" default = 1 endparam param gnarl_type caption = "Popgnarl Mode" enum = "real" "imag" "real+imag" "real*imag" "real-imag" \ "real/imag" "imag/real" "real^imag" "imag^real" \ "1/real" "1/imag" "angle" "magnitude" "arith. mean" \ "geom. mean" endparam param gnarl_form caption = "Popgnarl Formula" enum = "gnarl" "popcorn" "popsicle" "tannous" "narlog" endparam param gnarl_scale caption = "Popgnarl Scale" default = 1.0 endparam param gnarl_scaling caption = "Popgnarl Scaling" enum = "Ceil" "Floor" "trunc" "round" endparam param gnarl_size caption = "Popgnarl Size" default = 1.0 endparam param gnarl_limit caption = "Popgnarl Limit" default = 1.0 min = 0.0 endparam param gnarl_octaves caption = "Popgnarl Octaves" default = 5 min = 1 endparam param masking caption = "Masking" enum = "none" "lower" "upper" "between" "outside" default = 0 endparam param mask_type caption = "Mask Type" enum = "real pixel" "imag pixel" "real z" "imag z" "distance" \ "angle" "iteration" "magnitude" "path" "trap distance" \ "trap angle" "real trap" "imag trap" "trap magnitude" \ "trap iter" "trap path" "shape" "Barnsley" "odd-even" endparam param threshold_l caption = "Lower Mask Threshold" default = 0.5 endparam param threshold_u caption = "Upper Mask Threshold" default = 1.0 endparam param trapping caption = "Trapping" enum = "lower" "upper" endparam param trp caption = "Trap Type" enum = "iteration" "magnitude" "distance" "angle" "real" "imag" "path" endparam param trap_min caption = "Trap Threshold" default = 1.0 min = 0.0 endparam func fn1 caption = "First Function" default = cos() endfunc func fn2 caption = "Second Function" default = sin() endfunc func fnx caption = "Apply F(x)" default = ident() endfunc func fny caption = "Apply F(y)" default = ident() endfunc func fnb caption = "Barnsley Function" default = flip() endfunc func fnpi caption = "Odd-even Function" default = flip() endfunc func fm caption = "Masking Function" default = ident() endfunc } md-courbes-polaires-ea { ; Michèle Dessureault, 20 avril 2000 ; d'après les pages 390 des Standard Mathematical Tables ; 22ème édition ; Comme la méthode 'Courbes', mais celles en coordonnées ; polaires de ce manuel ; ; See also comments in the comments part of this file ; update october 2001 ; init: float r=0.0 float rmin=1.0e12 float rmax=0.0 float t=0.0 int iter=0 int itermin=0 int itermax=0 float mask = 0 bool is_masked = false zmin=(0.0,0.0) zmax=(0.0,0.0) z=(0.0,0.0) x=(0.0,0.0) y=(0.0,0.0) rho=(0.0,0.0) float texture=0.0 float phi=0.0 p=(0.0,0.0) float xx =0 float yy =0 float path = 0.0 float pathmin = 0.0 float pathmax = 0.0 float trap_path = 0.0 float trap_dist = 0.0 float trap_magn = 0.0 float trap_iter = 0.0 float _index = 0.0 float texture_rnd = 0.0 float texture_fbm = 0.0 float texture_dec = 0.0 float texture_gna = 0.0 trap_p = (0.0,0.0) temp2 = (0.0,0.0) temp3 = (0.0,0.0) float pd = 0.0 bool do_trap = true bool est_pair = true float trap_a = 0.0 float signe = 1.0 int temp1= 0 trp_iter = trunc(@trap_min) if trp_iter > #maxiter trp_iter = #maxiter elseif trp_iter < 1 trp_iter = 1 endif loop: if @courbe == 0 ;bifolium rho = @a*@fn2(#z)*@fn1(#z)*@fn1(#z) elseif @courbe == 1 ;limaçon de Pascal ; si a=b-> cardioïde rho = @a*@fn1(#z)+@b elseif @courbe == 2 ;cissoïde de Dioclès rho = @a*@fn2(#z)*@fn2(#z)/@fn1(#z) elseif @courbe == 3 ;cochléoïde rho = @a*@fn2(#z)/#z elseif @courbe == 4 ;conchoïde de Nicomède rho = @a/@fn2(#z)+@b elseif @courbe == 5 rho = (@a^2*@fn1(2*#z))^.5 ;lemniscate de Bernouilli elseif @courbe == 6 rho = (@a^2/#z)^.5 ;lituus elseif @courbe == 7 ;pétales rho = @a*@fn1(@b*#z) elseif @courbe == 8 ;parabole rho = 2*@a/(1-@fn1(#z)) elseif @courbe == 9 ;spirale d'Archimède rho = @a*#z elseif @courbe == 10 ;spirale hyperbolique rho = @a/#z elseif @courbe == 11 ;spirale logarithmique rho = exp(@a*#z) elseif @courbe == 12 ;strophoïde rho = @a*@fn1(2*#z)/@fn1(#z) endif x = real(rho) y = imag(rho) if @coord == 1 x = rho * cos(real(#z)) y = rho * sin(imag(#z)) elseif @coord ==2 x = rho * cosh(real(#z)) y = rho * sinh(imag(#z)) endif z= @fnx(x * (1.0,0.0)) + @fny(y * (0.0,1.0)) iter=iter+1 if @barn > 0 if @barn == 1 && real(z) >= @barn_offset z = @fnb(z) endif if @barn == 2 && imag(z) >= @barn_offset z = @fnb(z) endif if @barn == 3 && (real(z) * imag(z)) >= @barn_offset z = @fnb(z) endif if @barn == 4 && (real(z) + imag(z)) >= @barn_offset z = @fnb(z) endif if @barn == 5 && r >= @barn_offset z = @fnb(z) endif if @barn == 6 && phi >= @barn_offset z = @fnb(z) endif if @barn == 7 && cabs(z) >= @barn_offset z = @fnb(z) endif if @barn == 8 && path >= @barn_offset z = @fnb(z) endif if @barn == 9 && real(trap_p) >= @barn_offset z = @fnb(z) endif if @barn == 10 && imag(trap_p) >= @barn_offset z = @fnb(z) endif if @barn == 11 && (real(trap_p)*imag(trap_p)) >= @barn_offset z = @fnb(z) endif if @barn == 12 && (real(trap_p)+imag(trap_p)) >= @barn_offset z = @fnb(z) endif if @barn == 13 && trap_dist >= @barn_offset z = @fnb(z) endif if @barn == 14 && trap_a >= @barn_offset z = @fnb(z) endif if @barn == 15 && trap_magn >= @barn_offset z = @fnb(z) endif if @barn == 16 && trap_path >= @barn_offset z = @fnb(z) endif if @barn == 17 && iter >= @barn_offset z = @fnb(z) endif if @barn == 18 && trap_iter >= @barn_offset z = @fnb(z) endif if (@masking > 0) && @mask_type == 17 mask = real(@fm(z)) endif endif if @pairimp > 0 if @pairimp == 1 temp2 = real(z) elseif @pairimp == 2 temp2 = imag(z) elseif @pairimp == 3 temp2 = real(z) * imag(z) elseif @pairimp == 4 temp2 = real(z) + imag(z) elseif @pairimp == 5 temp2 = r elseif @pairimp == 6 temp2 = phi elseif @pairimp == 7 temp2 = cabs(z) elseif @pairimp == 8 temp2 = path elseif @pairimp == 9 temp2 = real(trap_p) elseif @pairimp == 10 temp2 = imag(trap_p) elseif @pairimp == 11 temp2 = real(trap_p)*imag(trap_p) elseif @pairimp == 12 temp2 = real(trap_p)+imag(trap_p) elseif @pairimp == 13 temp2 = trap_dist elseif @pairimp == 14 temp2 = trap_a elseif @pairimp == 15 temp2 = trap_magn elseif @pairimp == 16 temp2 = trap_path elseif @pairimp == 17 temp2 = iter elseif @pairimp == 18 temp2 = trap_iter endif if @sgn == true temp3 = real(z) * imag(z) if temp3 < 0 signe = -1.0 endif endif if @intf == 0 temp1 = ceil(signe*cabs(temp2)) elseif @intf == 1 temp1 = floor(signe*cabs(temp2)) elseif @intf == 2 temp1 = trunc(signe*cabs(temp2)) elseif @intf == 3 temp1 = round(signe*cabs(temp2)) endif if temp1 % 2 == 0 est_pair = true else est_pair = false endif IF est_pair z = @fnpi(z) endif if (@masking > 0) && @mask_type == 18 mask = real(@fm(z)) endif endif remain=#z-z r=cabs(remain) path = path + r phi = atan2(#z) phi = phi/#pi if phi < 0.0 phi = phi + 2.0 endif if(rrmax) rmax=r zmax=#z itermax=iter pathmax = path endif ; trappes if do_trap && \ ((@trp==0 && @trapping == 0 && iter<=trp_iter) || \ (@trp==0 && @trapping == 1 && iter>trp_iter) || \ (@trp==1 && @trapping == 0 && |z|<=@trap_min) || \ (@trp==1 && @trapping == 1 && |z|>@trap_min) || \ (@trp==2 && @trapping == 0 && r<=@trap_min) || \ (@trp==2 && @trapping == 1 && r>@trap_min) || \ (@trp==3 && @trapping == 0 && phi<=@trap_min) || \ (@trp==3 && @trapping == 1 && phi>@trap_min) || \ (@trp==4 && @trapping == 0 && real(z)<=@trap_min) || \ (@trp==4 && @trapping == 1 && real(z)>@trap_min) || \ (@trp==5 && @trapping == 0 && imag(z)<=@trap_min) || \ (@trp==5 && @trapping == 1 && imag(z)>@trap_min) || \ (@trp==6 && @trapping == 0 && path<=@trap_min) || \ (@trp==6 && @trapping == 1 && path>@trap_min)) do_trap = false trap_dist = r ; trap distance trap_p = z ;trap trap_a = phi ;trap angle trap_iter = iter trap_magn = cabs(z) trap_path = path endif final: ; masquage if (@masking > 0) if @mask_type == 0 mask = real(@fm(#pixel)) elseif @mask_type == 1 mask =imag(@fm(#pixel)) elseif @mask_type == 2 mask =real(@fm(#z)) elseif @mask_type == 3 mask =imag(@fm(#z)) elseif @mask_type == 4 mask =real(@fm(r+0i)) elseif @mask_type == 5 mask =real(@fm(phi+0i)) elseif @mask_type == 6 mask =real(@fm(iter+0i)) elseif @mask_type == 7 mask =cabs(@fm(z)) elseif @mask_type == 8 mask =real(@fm(path+0i)) elseif @mask_type == 9 mask =real(@fm(trap_dist+0i)) elseif @mask_type == 10 mask =real(@fm(trap_a+0i)) elseif @mask_type == 11 mask =real(@fm(trap_p+0i)) elseif @mask_type == 12 mask =imag(@fm(trap_p+0i)) elseif @mask_type == 13 mask =real(@fm(trap_magn+0i)) elseif @mask_type == 14 mask =real(@fm(trap_iter+0i)) elseif @mask_type == 15 mask =real(@fm(trap_path+0i)) elseif @mask_type == 16 mask =real(@fm(rmin+0i)) endif if (@masking == 1) ; Lower if (mask < @threshold_l) #solid = is_masked = true endif elseif (@masking == 2) ; Upper if (mask > @threshold_u) #solid = is_masked = true endif elseif (@masking == 3) ; Between if (mask > @threshold_l && mask < @threshold_u) #solid = is_masked = true endif elseif (@masking == 4) ; Outside if (mask < @threshold_l || mask > @threshold_u) #solid = is_masked = true endif endif endif if !is_masked ;Random complex hasard = #random texture_rnd = @rnd * (real(hasard)+ imag(hasard)) ; fBm if (@fbmtxt != 0) r1 = (0,1) ^ (@fbmangle / 90.0) r2 = (0,1) ^ (@fbmastep / 90.0) if @fbminit == 0 p = #pixel * @fbmscale * r1 + @fbmoffset elseif @fbminit == 1 p = z * @fbmscale * r1 + @fbmoffset elseif @fbminit == 2 p = r * @fbmscale * r1 + @fbmoffset elseif @fbminit == 3 p = phi * @fbmscale * r1 + @fbmoffset elseif @fbminit == 4 p = cabs(z) * @fbmscale * r1 + @fbmoffset elseif @fbminit == 5 p = path * @fbmscale * r1 + @fbmoffset elseif @fbminit == 6 p = trap_p * @fbmscale * r1 + @fbmoffset elseif @fbminit == 7 p = trap_dist * @fbmscale * r1 + @fbmoffset elseif @fbminit == 8 p = trap_a * @fbmscale * r1 + @fbmoffset elseif @fbminit == 9 p = trap_magn * @fbmscale * r1 + @fbmoffset elseif @fbminit == 10 p = trap_path * @fbmscale * r1 + @fbmoffset elseif @fbminit == 11 p = #z * @fbmscale * r1 + @fbmoffset elseif @fbminit == 12 p = texture_rnd * @fbmscale * r1 + @fbmoffset endif float sum = 0.0 float freq = 1.0 int i = @fbmoct while (i > 0) ; determine integer coordinate for corners of square ; surrounding p float bx0 = floor(real(p)) % 256 float by0 = floor(imag(p)) % 256 IF (bx0 < 0) bx0 = bx0 + 256 ENDIF IF (by0 < 0) by0 = by0 + 256 ENDIF float bx1 = (bx0 + 1) % 256 float by1 = (by0 + 1) % 256 float rx0 = real(p) - floor(real(p)) float ry0 = imag(p) - floor(imag(p)) float rx1 = rx0 - 1 float ry1 = ry0 - 1 float b00 = (bx0^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b10 = (bx1^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b01 = (bx0^@fbmpower % 65536 + by1)^@fbmpower % 65536 float b11 = (bx1^@fbmpower % 65536 + by1)^@fbmpower % 65536 float g_b00_0 = (b00)^@fbmpower*0.25 % 512 - 256 float g_b10_0 = (b10)^@fbmpower*0.25 % 512 - 256 float g_b01_0 = (b01)^@fbmpower*0.25 % 512 - 256 float g_b11_0 = (b11)^@fbmpower*0.25 % 512 - 256 float g_b00_1 = (b00+1)^@fbmpower*0.25 % 512 - 256 float g_b10_1 = (b10+1)^@fbmpower*0.25 % 512 - 256 float g_b01_1 = (b01+1)^@fbmpower*0.25 % 512 - 256 float g_b11_1 = (b11+1)^@fbmpower*0.25 % 512 - 256 float d = 0.0; d = 1 / sqrt(sqr(g_b00_0) + sqr(g_b00_1)) g_b00_0 = g_b00_0 * d g_b00_1 = g_b00_1 * d d = 1 / sqrt(sqr(g_b10_0) + sqr(g_b10_1)) g_b10_0 = g_b10_0 * d g_b10_1 = g_b10_1 * d d = 1 / sqrt(sqr(g_b01_0) + sqr(g_b01_1)) g_b01_0 = g_b01_0 * d g_b01_1 = g_b01_1 * d d = 1 / sqrt(sqr(g_b11_0) + sqr(g_b11_1)) g_b11_0 = g_b11_0 * d g_b11_1 = g_b11_1 * d float u1 = rx0 * g_b00_0 + ry0 * g_b00_1 float v1 = rx1 * g_b10_0 + ry0 * g_b10_1 float u2 = rx0 * g_b01_0 + ry1 * g_b01_1 float v2 = rx1 * g_b11_0 + ry1 * g_b11_1 float sx = sqr(rx0) * (3 - rx0*2) float sy = sqr(ry0) * (3 - ry0*2) float a = u1 + sx*(v1-u1) float b = u2 + sx*(v2-u2) sum = sum + (a + sy*(b-a))*freq freq = freq * @fbmstep p = p * r2 / @fbmstep i = i - 1 endwhile texture_fbm = @fbmtxt * sum endif ;decimal if @dectxt > 0 if @dec_init == 0 pd = real(#z) elseif @dec_init == 1 pd = imag(#z) elseif @dec_init == 2 pd = r elseif @dec_init == 3 pd = phi elseif @dec_init == 4 pd = cabs(z) elseif @dec_init == 5 pd = path elseif @dec_init == 6 pd = real(trap_p) elseif @dec_init == 7 pd = imag(trap_p) elseif @dec_init == 8 pd = trap_dist elseif @dec_init == 9 pd = trap_a elseif @dec_init == 10 pd = trap_magn elseif @dec_init == 11 pd = trap_path elseif @dec_init == 12 pd = texture_rnd+texture_fbm endif if @dec_type == 0 pd = pd-ceil(pd*@dec_scale)/@dec_scale elseif @dec_type == 1 pd = pd-floor(pd*@dec_scale)/@dec_scale elseif @dec_type == 2 pd = pd-trunc(pd*@dec_scale)/@dec_scale elseif @dec_type == 3 pd = pd-round(pd*@dec_scale)/@dec_scale endif if @dec_size != 0 pd = pd/@dec_size endif texture_dec = @dectxt*pd if @dec_limit !=0 texture_dec= texture_dec%@dec_limit endif if @dec_sgn == true texture_dec = abs(texture_dec) endif endif if (@txtr_gnarl != 0) if @gnarl_init == 0 p = #pixel elseif @gnarl_init == 1 p = z elseif @gnarl_init == 2 p = r elseif @gnarl_init == 3 p = phi elseif @gnarl_init == 4 p = cabs(z) elseif @gnarl_init == 5 p = path elseif @gnarl_init == 6 p = trap_p elseif @gnarl_init == 7 p = trap_dist elseif @gnarl_init == 8 p = trap_a elseif @gnarl_init == 9 p = trap_magn elseif @gnarl_init == 10 p = trap_path elseif @gnarl_init == 11 p = #z elseif @gnarl_init == 12 p = texture_rnd+texture_fbm+texture_dec endif ; p = p-trunc(p*@gnarl_scale)/@gnarl_scale if @gnarl_scaling == 0 p = p-ceil(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 1 p = p-floor(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 2 p = p-trunc(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 3 p = p-round(p*@gnarl_scale)/@gnarl_scale endif if @gnarl_size != 0 p = p/@gnarl_size endif xx = real(p) yy = imag(p) float xOld = 0 int iter3 = @gnarl_octaves while (iter3 > 0) iter3 = iter3-1 xOld = xx if @gnarl_form == 0 xx = xx - sin(yy + sin(yy)) yy = yy - sin(xOld + sin(xOld)) elseif @gnarl_form == 1 xx = xx - sin(yy + log(yy + cos(yy))) yy = yy - sin(xOld + log(xOld + cos(xOld))) elseif @gnarl_form == 2 xx = xx - sin(yy + cos(yy)) yy = yy - sin(xOld + cos(xOld)) elseif @gnarl_form == 3 xx = xx - sin(yy + log(yy + tan(yy))) yy = yy - sin(xOld + log(xOld + tan(xOld))) elseif @gnarl_form == 4 xx = xx - sin(yy + log(yy + sin(yy))) yy = yy - sin(xOld + log(xOld + sin(xOld))) endif endwhile if (@gnarl_type == 0) texture_gna = abs(xx) elseif (@gnarl_type == 1) texture_gna = abs(yy) elseif (@gnarl_type == 2) texture_gna = abs(xx+yy) elseif (@gnarl_type == 3) texture_gna = abs(xx*yy) elseif (@gnarl_type == 4) texture_gna = abs(xx-yy) elseif (@gnarl_type == 5) texture_gna = abs(xx/yy) elseif (@gnarl_type == 6) texture_gna = abs(yy/xx) elseif (@gnarl_type == 7) texture_gna = abs(xx^yy) elseif (@gnarl_type == 8) texture_gna = abs(yy^xx) elseif (@gnarl_type == 9) texture_gna = abs(1/xx) elseif (@gnarl_type == 10) texture_gna = abs(1/yy) elseif (@gnarl_type == 11) texture_gna = atan2(xx+1i*yy)/(2*#pi) if (texture_gna < 0) texture_gna = texture_gna + 1 endif elseif (@gnarl_type == 12) texture_gna = |xx+1i*yy| elseif (@gnarl_type == 13) texture_gna = (xx+yy+|xx+1i*yy|)/3 elseif (@gnarl_type == 14) texture_gna = (xx*yy*|xx+1i*yy|)^(1/3) endif if @gnarl_limit !=0 texture_gna= texture_gna%@gnarl_limit endif endif endif texture = texture_rnd + texture_fbm + texture_dec + texture_gna if @colorfix ==0 if(@colorby==0) ; minimum distance _index=rmin elseif @colorby==1 ; iteration @ min _index=0.01*itermin elseif(@colorby==2) ; angle @ min t=atan2(zmin) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(zmin) ; magnitude @min elseif(@colorby==4) _index = pathmin ; path @min endif xx = real(zmin) yy = imag(zmin) endif if @colorfix == 1 if(@colorby==0) ; maximum distance _index=rmax elseif(@colorby==1) ; iteration @ max _index=0.01*itermax elseif(@colorby==2) ; angle @ max t=atan2(zmax) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(zmax) ; magnitude @max elseif(@colorby==4) _index = pathmax ; path @max endif xx = real(zmax) yy = imag(zmax) endif if @colorfix == 2 z = (zmin + zmax)/2 if(@colorby==0) ; average distance _index=path/iter elseif(@colorby==1) ; iteration @ average _index=0.01*iter/2 elseif(@colorby==2) ; angle @ average t=atan2(z) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(z) ; magnitude @average elseif(@colorby==4) _index = (pathmin + pathmax)/2 ; path @average endif xx = real(z) yy = imag(z) endif if @colorfix == 3 if(@colorby==0) ; last distance _index=r elseif(@colorby==1) ; iteration @ last _index=0.01*iter elseif(@colorby==2) ; angle @ last t=atan2(z) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(z) ; magnitude @last elseif(@colorby==4) _index = path ; path @last endif xx = real(z) yy = imag(z) endif if @colorfix == 4 if(@colorby==0) ; distance @trap _index=trap_dist elseif(@colorby==1) ; iteration @ trap _index=0.01*trap_iter elseif(@colorby==2) ; angle @ trap t=atan2(trap_p) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = trap_magn ; magnitude @trap elseif(@colorby==4) _index = trap_path ; path @trap endif xx = real(trap_p) yy = imag(trap_p) endif if @colorby == 5 _index = (xx+yy+|xx+1i*yy|)/3 ; arith.mean elseif @colorby == 6 _index = (xx*yy*|xx+1i*yy|)^(1/3) ; geom.mean elseif @colorby == 7 _index = xx ; réel elseif @colorby == 8 _index = yy ; imaginaire elseif @colorby == 9 _index = xx + yy ; real+imag elseif @colorby == 10 _index = xx * yy ; real*imag elseif @colorby == 11 _index = xx - yy ; real-imag elseif @colorby == 12 _index = yy - xx ; imag-real elseif @colorby == 13 _index = xx / yy ; real/imag elseif @colorby ==14 _index = yy / xx ; imag/real elseif @colorby == 15 _index = xx ^ yy ; real^imag elseif @colorby == 16 _index = yy ^ xx ; imag^real elseif @colorby == 17 _index = 1/xx ; 1/real elseif @colorby == 18 _index = 1/yy ; 1/imag endif #index = _index + texture default: title="Courbes polaires ++" helpfile="mde-help\mde-courbes-polaires++.htm" param courbe caption = "Curve" enum="bifolium" "limacon" "cissoid" "cochleoid" \ "conchoid" "lemniscate" "lituus" "petals" "parabola" \ "Archimedes spir." "hyperbolic spir." \ "logarithmic spir." "strophoid" endparam param a caption = "a" default = 1.0 endparam param b caption = "b" default = 1.0 endparam param coord caption = "Coordinates" enum="polar" "cartesian" "hyperbolic" default = 0 endparam param colorby caption="Colouring Mode" default=0 enum="distance" "iteration" "angle" "magnitude" "path" \ "arith. mean" "geom. mean" \ "real" "imag" "real+imag" "real*imag" "real-imag" \ "imag-real" "real/imag" "imag/real" "real^imag" "imag^real" \ "1/real" "1/imag" endparam param colorfix caption ="Colouring Fix" enum = "@minimum" "@maximum" "average" "@last Z" "@trap" endparam param barn caption = "Barnsley type" enum = "none" "real" "imag" "real*imag" "real+imag" \ "distance" "angle" "magnitude" "path" "trap real" \ "trap imag" "trap r*i" "trap r+i" "trap distance" \ "trap angle" "trap magnitude" "trap path" "iteration" \ "trap iter" endparam param barn_offset caption = "Barnsley Offset" default = 0.0 endparam param pairimp caption = "Odd-even type" enum = "none" "real" "imag" "real*imag" "real+imag" \ "distance" "angle" "magnitude" "path" "trap real" \ "trap imag" "trap r*i" "trap r+i" "trap distance" \ "trap angle" "trap magnitude" "trap path" "iteration" \ "trap iter" endparam param sgn caption = "Apply Odd-even Sign?" default = false endparam param intf caption = "Odd-Even factor" enum = "ceil" "floor" "trunc" "round" endparam param rnd caption = "Random Texture Amount" default = 0.0 endparam param fbmtxt caption = "fBm Texture Amount" default = 0.0 endparam param fbminit caption = "fBm Initialization" enum = "pixel" "z" "distance" "angle" "magnitude" "path" "trap z" \ "trap distance" "trap angle" "trap magnitude" "trap path" "Z" \ "hand over" endparam param fbmscale caption = "fBm Scale" default = 1.0 endparam param fbmoffset caption = "fBm Offset" default = (0,0) endparam param fbmangle caption = "fBm Rotation" default = 0.0 endparam param fbmstep caption = "fBm Scale Step" default = 0.5 endparam param fbmastep caption = "fBm Rotation Step" default = 37.0 endparam param fbmoct caption = "fBm Octaves" default = 7 min = 1 endparam param fbmpower caption = "fBm Exponent" default = 2.0 endparam param dectxt caption = "Decimal Texture Amount" default = 0.0 endparam param dec_init caption = "Decimal Initialisation" enum = "real z" "imag z" "distance" "angle" "magnitude" "path" \ "real trap" "imag trap" "trap distance" "trap angle" \ "trap magnitude" "trap path" "hand over" endparam param dec_sgn caption = "Apply Decimal Sign?" default = true endparam param dec_type caption = "Decimal Type" enum = "Ceil" "Floor" "Trunc" "Round" endparam param dec_scale caption = "Decimal Scale" default = 1.0 endparam param dec_size caption = "Decimal Size" default = 1.0 endparam param dec_limit caption = "Decimal Limit" default = 1.0 min = 0.0 endparam param txtr_gnarl caption = "Popgnarl Texture Amount" default = 0.0 endparam param gnarl_init caption = "Popgnarl Initialization" enum = "pixel" "z" "distance" "angle" "magnitude" "path" "trap z" \ "trap distance" "trap angle" "trap magnitude" "trap path" \ "Z" "hand over" default = 1 endparam param gnarl_type caption = "Popgnarl Mode" enum = "real" "imag" "real+imag" "real*imag" "real-imag" \ "real/imag" "imag/real" "real^imag" "imag^real" \ "1/real" "1/imag" "angle" "magnitude" "arith. mean" \ "geom. mean" endparam param gnarl_form caption = "Popgnarl Formula" enum = "gnarl" "popcorn" "popsicle" "tannous" "narlog" endparam param gnarl_scale caption = "Popgnarl Scale" default = 1.0 endparam param gnarl_scaling caption = "Popgnarl Scaling" enum = "Ceil" "Floor" "trunc" "round" endparam param gnarl_size caption = "Popgnarl Size" default = 1.0 endparam param gnarl_limit caption = "Popgnarl Limit" default = 1.0 min = 0.0 endparam param gnarl_octaves caption = "Popgnarl Octaves" default = 5 min = 1 endparam param masking caption = "Masking" enum = "none" "lower" "upper" "between" "outside" default = 0 endparam param mask_type caption = "Mask Type" enum = "real pixel" "imag pixel" "real z" "imag z" "distance" \ "angle" "iteration" "magnitude" "path" "trap distance" \ "trap angle" "real trap" "imag trap" "trap magnitude" \ "trap iter" "trap path" "shape" "Barnsley" "odd-even" endparam param threshold_l caption = "Lower Mask Threshold" default = 0.5 endparam param threshold_u caption = "Upper Mask Threshold" default = 1.0 endparam param trapping caption = "Trapping" enum = "lower" "upper" endparam param trp caption = "Trap Type" enum = "iteration" "magnitude" "distance" "angle" "real" "imag" "path" endparam param trap_min caption = "Trap Threshold" default = 1.0 min = 0.0 endparam func fn1 caption = "First Function" default = cos() endfunc func fn2 caption = "Second Function" default = sin() endfunc func fnx caption = "Apply F(x)" default = ident() endfunc func fny caption = "Apply F(y)" default = ident() endfunc func fnb caption = "Barnsley Function" default = flip() endfunc func fnpi caption = "Odd-even Function" default = flip() endfunc func fm caption = "Masking Function" default = ident() endfunc } md-Fourier-edb { ; Michèle Dessureault, août 2000 ; update octobre 2001 ; ; - D'après les pages 474 & suivantes des Standard Mathematical Tables ; - From the Standard Mathematical Tables, 22nd edition, pp474- ; ; 4 premiers termes de l'équation générale des séries de Fourier ; 4 first terms of Fourier Series general equation: ; a0/2 + a1*cos(pi*#z/L)+ b1*sin(#pi*#z/L) + ; a2*cos(2*pi*#z/L)+ b2*sin(2*#pi*#z/L) + ; a3*cos(3*pi*#z/L)+ b3*sin(3*#pi*#z/L) + ; a4*cos(4*pi*#z/L)+ b4*sin(4*#pi*#z/L) ; init: float r=0.0 float path = 0.0 float pathmin = 0.0 float pathmax = 0.0 float trap_path = 0.0 float _index = 0.0 float rmin=1.0e12 float rmax=0.0 float t=0.0 float pd=0.0 int iter=0 int trp_iter = 0 int itermin=0 int itermax=0 zmin=(0.0,0.0) zmax=(0.0,0.0) z=(0.0,0.0) w=(0.0,0.0) float x=0.0 float y=0.0 float rho = 0.0 float theta = 0.0 float texture=0.0 float texture_rnd = 0.0 float texture_fbm = 0.0 float texture_dec = 0.0 float texture_gna = 0.0 float texture_pri = 0.0 float phi=0.0 r1 = (0.0,0.0) r2 = (0.0,0.0) p=(0.0,0.0) float trap_a=0.0 float trap_dist = 0.0 float trap_magn = 0.0 float trap_iter = 0.0 trap_p = 0 bool do_trap = true bool est_pair = true float mask = 0 bool is_masked = false float temp1 = 0 temp2 = (0.0,0.0) float signe = 1.0 temp3 = (0.0,0.0) trp_iter = trunc(@trap_min) if trp_iter > #maxiter trp_iter = #maxiter elseif trp_iter < 1 trp_iter = 1 endif loop: w= @a0/2 + @a1*@fn1(#pi*#z/@l)+ @b1*@fn2(#pi*#z/@L) w= w+@a2*@fn1(2*#pi*#z/@L)+ @b2*@fn2(2*#pi*#z/@L) w= w+@a3*@fn1(3*#pi*#z/@L)+ @b3*@fn2(3*#pi*#z/@L) w= w+@a4*@fn1(4*#pi*#z/@L)+ @b4*@fn2(4*#pi*#z/@L) x= real(w) y= imag(w) if @coord == 1 rho = sqrt(sqr(x)+sqr(y)) theta = atan2(y/x) if theta < 0 theta = theta + 2 * #pi endif x = rho y = theta elseif @coord ==2 rho = sqrt(sqr(x)+sqr(y)) x = rho * cosh(real(w)) y = rho * sinh(imag(w)) endif z= @fnx(((0.0,0.0)+ x) * (1.0,0.0)) + @fny(((0.0,0.0)+y) * (0.0,1.0)) iter=iter+1 if @barn > 0 if @barn == 1 && real(z) >= @barn_offset z = @fnb(z) endif if @barn == 2 && imag(z) >= @barn_offset z = @fnb(z) endif if @barn == 3 && (real(z) * imag(z)) >= @barn_offset z = @fnb(z) endif if @barn == 4 && (real(z) + imag(z)) >= @barn_offset z = @fnb(z) endif if @barn == 5 && r >= @barn_offset z = @fnb(z) endif if @barn == 6 && phi >= @barn_offset z = @fnb(z) endif if @barn == 7 && cabs(z) >= @barn_offset z = @fnb(z) endif if @barn == 8 && path >= @barn_offset z = @fnb(z) endif if @barn == 9 && real(trap_p) >= @barn_offset z = @fnb(z) endif if @barn == 10 && imag(trap_p) >= @barn_offset z = @fnb(z) endif if @barn == 11 && (real(trap_p)*imag(trap_p)) >= @barn_offset z = @fnb(z) endif if @barn == 12 && (real(trap_p)+imag(trap_p)) >= @barn_offset z = @fnb(z) endif if @barn == 13 && trap_dist >= @barn_offset z = @fnb(z) endif if @barn == 14 && trap_a >= @barn_offset z = @fnb(z) endif if @barn == 15 && trap_magn >= @barn_offset z = @fnb(z) endif if @barn == 16 && trap_path >= @barn_offset z = @fnb(z) endif if @barn == 17 && iter >= @barn_offset z = @fnb(z) endif if @barn == 18 && trap_iter >= @barn_offset z = @fnb(z) endif if (@masking > 0) && @mask_type == 17 mask = real(@fm(z)) endif endif if @pairimp > 0 if @pairimp == 1 temp2 = real(z) elseif @pairimp == 2 temp2 = imag(z) elseif @pairimp == 3 temp2 = real(z) * imag(z) elseif @pairimp == 4 temp2 = real(z) + imag(z) elseif @pairimp == 5 temp2 = r elseif @pairimp == 6 temp2 = phi elseif @pairimp == 7 temp2 = cabs(z) elseif @pairimp == 8 temp2 = path elseif @pairimp == 9 temp2 = real(trap_p) elseif @pairimp == 10 temp2 = imag(trap_p) elseif @pairimp == 11 temp2 = real(trap_p)*imag(trap_p) elseif @pairimp == 12 temp2 = real(trap_p)+imag(trap_p) elseif @pairimp == 13 temp2 = trap_dist elseif @pairimp == 14 temp2 = trap_a elseif @pairimp == 15 temp2 = trap_magn elseif @pairimp == 16 temp2 = trap_path elseif @pairimp == 17 temp2 = iter elseif @pairimp == 18 temp2 = trap_iter endif if @sgn == true temp3 = real(z) * imag(z) if temp3 < 0 signe = -1.0 endif endif if @intf == 0 temp1 = ceil(signe*cabs(temp2)) elseif @intf == 1 temp1 = floor(signe*cabs(temp2)) elseif @intf == 2 temp1 = trunc(signe*cabs(temp2)) elseif @intf == 3 temp1 = round(signe*cabs(temp2)) endif if temp1 % 2 == 0 est_pair = true else est_pair = false endif IF est_pair z = @fnpi(z) endif if (@masking > 0) && @mask_type == 18 mask = real(@fm(z)) endif endif remain=#z-z r=cabs(remain) path = path + r phi = atan2(#z) phi = phi/#pi if phi < 0.0 phi = phi + 2.0 endif if(rrmax) rmax=r zmax=#z itermax=iter pathmax = path endif ; trappes if do_trap && \ ((@trp==0 && @trapping == 0 && iter<=trp_iter) || \ (@trp==0 && @trapping == 1 && iter>trp_iter) || \ (@trp==1 && @trapping == 0 && |z|<=@trap_min) || \ (@trp==1 && @trapping == 1 && |z|>@trap_min) || \ (@trp==2 && @trapping == 0 && r<=@trap_min) || \ (@trp==2 && @trapping == 1 && r>@trap_min) || \ (@trp==3 && @trapping == 0 && phi<=@trap_min) || \ (@trp==3 && @trapping == 1 && phi>@trap_min) || \ (@trp==4 && @trapping == 0 && real(z)<=@trap_min) || \ (@trp==4 && @trapping == 1 && real(z)>@trap_min) || \ (@trp==5 && @trapping == 0 && imag(z)<=@trap_min) || \ (@trp==5 && @trapping == 1 && imag(z)>@trap_min) || \ (@trp==6 && @trapping == 0 && path<=@trap_min) || \ (@trp==6 && @trapping == 1 && path>@trap_min)) do_trap = false trap_dist = r ; trap distance trap_p = z ;trap trap_a = phi ;trap angle trap_iter = iter trap_magn = cabs(z) trap_path = path endif final: ; masquage if (@masking > 0) if @mask_type == 0 mask = real(@fm(#pixel)) elseif @mask_type == 1 mask =imag(@fm(#pixel)) elseif @mask_type == 2 mask =real(@fm(#z)) elseif @mask_type == 3 mask =imag(@fm(#z)) elseif @mask_type == 4 mask =real(@fm(r+0i)) elseif @mask_type == 5 mask =real(@fm(phi+0i)) elseif @mask_type == 6 mask =real(@fm(iter+0i)) elseif @mask_type == 7 mask =cabs(@fm(z)) elseif @mask_type == 8 mask =real(@fm(path+0i)) elseif @mask_type == 9 mask =real(@fm(trap_dist+0i)) elseif @mask_type == 10 mask =real(@fm(trap_a+0i)) elseif @mask_type == 11 mask =real(@fm(trap_p+0i)) elseif @mask_type == 12 mask =imag(@fm(trap_p+0i)) elseif @mask_type == 13 mask =real(@fm(trap_magn+0i)) elseif @mask_type == 14 mask =real(@fm(trap_iter+0i)) elseif @mask_type == 15 mask =real(@fm(trap_path+0i)) elseif @mask_type == 16 mask =real(@fm(rmin+0i)) endif if (@masking == 1) ; Lower if (mask < @threshold_l) #solid = is_masked = true endif elseif (@masking == 2) ; Upper if (mask > @threshold_u) #solid = is_masked = true endif elseif (@masking == 3) ; Between if (mask > @threshold_l && mask < @threshold_u) #solid = is_masked = true endif elseif (@masking == 4) ; Outside if (mask < @threshold_l || mask > @threshold_u) #solid = is_masked = true endif endif endif if !is_masked ;Random complex hasard = #random texture_rnd = @rnd * (real(hasard)+ imag(hasard)) ; fBm if (@fbmtxt != 0) r1 = (0,1) ^ (@fbmangle / 90.0) r2 = (0,1) ^ (@fbmastep / 90.0) if @fbminit == 0 p = #pixel * @fbmscale * r1 + @fbmoffset elseif @fbminit == 1 p = z * @fbmscale * r1 + @fbmoffset elseif @fbminit == 2 p = r * @fbmscale * r1 + @fbmoffset elseif @fbminit == 3 p = phi * @fbmscale * r1 + @fbmoffset elseif @fbminit == 4 p = cabs(z) * @fbmscale * r1 + @fbmoffset elseif @fbminit == 5 p = path * @fbmscale * r1 + @fbmoffset elseif @fbminit == 6 p = trap_p * @fbmscale * r1 + @fbmoffset elseif @fbminit == 7 p = trap_dist * @fbmscale * r1 + @fbmoffset elseif @fbminit == 8 p = trap_a * @fbmscale * r1 + @fbmoffset elseif @fbminit == 9 p = trap_magn * @fbmscale * r1 + @fbmoffset elseif @fbminit == 10 p = trap_path * @fbmscale * r1 + @fbmoffset elseif @fbminit == 11 p = #z * @fbmscale * r1 + @fbmoffset elseif @fbminit == 12 p = texture_rnd * @fbmscale * r1 + @fbmoffset endif float sum = 0.0 float freq = 1.0 int i = @fbmoct while (i > 0) ; determine integer coordinate for corners of square ; surrounding p float bx0 = floor(real(p)) % 256 float by0 = floor(imag(p)) % 256 IF (bx0 < 0) bx0 = bx0 + 256 ENDIF IF (by0 < 0) by0 = by0 + 256 ENDIF float bx1 = (bx0 + 1) % 256 float by1 = (by0 + 1) % 256 float rx0 = real(p) - floor(real(p)) float ry0 = imag(p) - floor(imag(p)) float rx1 = rx0 - 1 float ry1 = ry0 - 1 float b00 = (bx0^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b10 = (bx1^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b01 = (bx0^@fbmpower % 65536 + by1)^@fbmpower % 65536 float b11 = (bx1^@fbmpower % 65536 + by1)^@fbmpower % 65536 float g_b00_0 = (b00)^@fbmpower*0.25 % 512 - 256 float g_b10_0 = (b10)^@fbmpower*0.25 % 512 - 256 float g_b01_0 = (b01)^@fbmpower*0.25 % 512 - 256 float g_b11_0 = (b11)^@fbmpower*0.25 % 512 - 256 float g_b00_1 = (b00+1)^@fbmpower*0.25 % 512 - 256 float g_b10_1 = (b10+1)^@fbmpower*0.25 % 512 - 256 float g_b01_1 = (b01+1)^@fbmpower*0.25 % 512 - 256 float g_b11_1 = (b11+1)^@fbmpower*0.25 % 512 - 256 float d = 0.0; d = 1 / sqrt(sqr(g_b00_0) + sqr(g_b00_1)) g_b00_0 = g_b00_0 * d g_b00_1 = g_b00_1 * d d = 1 / sqrt(sqr(g_b10_0) + sqr(g_b10_1)) g_b10_0 = g_b10_0 * d g_b10_1 = g_b10_1 * d d = 1 / sqrt(sqr(g_b01_0) + sqr(g_b01_1)) g_b01_0 = g_b01_0 * d g_b01_1 = g_b01_1 * d d = 1 / sqrt(sqr(g_b11_0) + sqr(g_b11_1)) g_b11_0 = g_b11_0 * d g_b11_1 = g_b11_1 * d float u1 = rx0 * g_b00_0 + ry0 * g_b00_1 float v1 = rx1 * g_b10_0 + ry0 * g_b10_1 float u2 = rx0 * g_b01_0 + ry1 * g_b01_1 float v2 = rx1 * g_b11_0 + ry1 * g_b11_1 float sx = sqr(rx0) * (3 - rx0*2) float sy = sqr(ry0) * (3 - ry0*2) float a = u1 + sx*(v1-u1) float b = u2 + sx*(v2-u2) sum = sum + (a + sy*(b-a))*freq freq = freq * @fbmstep p = p * r2 / @fbmstep i = i - 1 endwhile texture_fbm = @fbmtxt * sum endif ;decimal if @dectxt > 0 if @dec_init == 0 pd = real(#z) elseif @dec_init == 1 pd = imag(#z) elseif @dec_init == 2 pd = r elseif @dec_init == 3 pd = phi elseif @dec_init == 4 pd = cabs(z) elseif @dec_init == 5 pd = path elseif @dec_init == 6 pd = real(trap_p) elseif @dec_init == 7 pd = imag(trap_p) elseif @dec_init == 8 pd = trap_dist elseif @dec_init == 9 pd = trap_a elseif @dec_init == 10 pd = trap_magn elseif @dec_init == 11 pd = trap_path elseif @dec_init == 12 pd = texture_rnd+texture_fbm endif if @dec_type == 0 pd = pd-ceil(pd*@dec_scale)/@dec_scale elseif @dec_type == 1 pd = pd-floor(pd*@dec_scale)/@dec_scale elseif @dec_type == 2 pd = pd-trunc(pd*@dec_scale)/@dec_scale elseif @dec_type == 3 pd = pd-round(pd*@dec_scale)/@dec_scale endif if @dec_size != 0 pd = pd/@dec_size endif texture_dec = @dectxt*pd if @dec_limit !=0 texture_dec= texture_dec%@dec_limit endif if @dec_sgn == true texture_dec = abs(texture_dec) endif endif if (@txtr_gnarl != 0) if @gnarl_init == 0 p = #pixel elseif @gnarl_init == 1 p = z elseif @gnarl_init == 2 p = r elseif @gnarl_init == 3 p = phi elseif @gnarl_init == 4 p = cabs(z) elseif @gnarl_init == 5 p = path elseif @gnarl_init == 6 p = trap_p elseif @gnarl_init == 7 p = trap_dist elseif @gnarl_init == 8 p = trap_a elseif @gnarl_init == 9 p = trap_magn elseif @gnarl_init == 10 p = trap_path elseif @gnarl_init == 11 p = #Z elseif @gnarl_init == 12 p = texture_rnd+texture_fbm+texture_dec endif ; p = p-trunc(p*@gnarl_scale)/@gnarl_scale if @gnarl_scaling == 0 p = p-ceil(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 1 p = p-floor(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 2 p = p-trunc(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 3 p = p-round(p*@gnarl_scale)/@gnarl_scale endif if @gnarl_size != 0 p = p/@gnarl_size endif x = real(p) y = imag(p) float xOld = 0 int iter3 = @gnarl_octaves while (iter3 > 0) iter3 = iter3-1 xOld = x if @gnarl_form == 0 x = x - sin(y + sin(y)) y = y - sin(xOld + sin(xOld)) elseif @gnarl_form == 1 x = x - sin(y + log(y + cos(y))) y = y - sin(xOld + log(xOld + cos(xOld))) elseif @gnarl_form == 2 x = x - sin(y + cos(y)) y = y - sin(xOld + cos(xOld)) elseif @gnarl_form == 3 x = x - sin(y + log(y + tan(y))) y = y - sin(xOld + log(xOld + tan(xOld))) elseif @gnarl_form == 4 x = x - sin(y + log(y + sin(y))) y = y - sin(xOld + log(xOld + sin(xOld))) endif endwhile if (@gnarl_type == 0) texture_gna = abs(x) elseif (@gnarl_type == 1) texture_gna = abs(y) elseif (@gnarl_type == 2) texture_gna = abs(x+y) elseif (@gnarl_type == 3) texture_gna = abs(x*y) elseif (@gnarl_type == 4) texture_gna = abs(x-y) elseif (@gnarl_type == 5) texture_gna = abs(x/y) elseif (@gnarl_type == 6) texture_gna = abs(y/x) elseif (@gnarl_type == 7) texture_gna = abs(x^y) elseif (@gnarl_type == 8) texture_gna = abs(y^x) elseif (@gnarl_type == 9) texture_gna = abs(1/x) elseif (@gnarl_type == 10) texture_gna = abs(1/y) elseif (@gnarl_type == 11) texture_gna = atan2(x+1i*y)/(2*#pi) if (texture_gna < 0) texture_gna = texture_gna + 1 endif elseif (@gnarl_type == 12) texture_gna = |x+1i*y| elseif (@gnarl_type == 13) texture_gna = (x+y+|x+1i*y|)/3 elseif (@gnarl_type == 14) texture_gna = (x*y*|x+1i*y|)^(1/3) endif if @gnarl_limit !=0 texture_gna= texture_gna%@gnarl_limit endif endif endif texture = texture_rnd + texture_fbm + texture_dec + texture_gna + \ texture_pri if @colorfix ==0 if(@colorby==0) ; minimum distance _index=rmin elseif @colorby==1 ; iteration @ min _index=0.01*itermin elseif(@colorby==2) ; angle @ min t=atan2(zmin) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(zmin) ; magnitude @min elseif(@colorby==4) _index = pathmin ; path @min endif x = real(zmin) y = imag(zmin) endif if @colorfix == 1 if(@colorby==0) ; maximum distance _index=rmax elseif(@colorby==1) ; iteration @ max _index=0.01*itermax elseif(@colorby==2) ; angle @ max t=atan2(zmax) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(zmax) ; magnitude @max elseif(@colorby==4) _index = pathmax ; path @max endif x = real(zmax) y = imag(zmax) endif if @colorfix == 2 z = (zmin + zmax)/2 if(@colorby==0) ; average distance _index=path/iter elseif(@colorby==1) ; iteration @ average _index=0.01*iter/2 elseif(@colorby==2) ; angle @ average t=atan2(z) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(z) ; magnitude @average elseif(@colorby==4) _index = (pathmin + pathmax)/2 ; path @average endif x = real(z) y = imag(z) endif if @colorfix == 3 if(@colorby==0) ; last distance _index=r elseif(@colorby==1) ; iteration @ last _index=0.01*iter elseif(@colorby==2) ; angle @ last t=atan2(z) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(z) ; magnitude @last elseif(@colorby==4) _index = path ; path @last endif x = real(z) y = imag(z) endif if @colorfix == 4 if(@colorby==0) ; distance @trap _index=trap_dist elseif(@colorby==1) ; iteration @ trap _index=0.01*trap_iter elseif(@colorby==2) ; angle @ trap t=atan2(trap_p) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = trap_magn ; magnitude @trap elseif(@colorby==4) _index = trap_path ; path @trap endif x = real(trap_p) y = imag(trap_p) endif if @colorby == 5 _index = (x+y+|x+1i*y|)/3 ; arith.mean elseif @colorby == 6 _index = (x*y*|x+1i*y|)^(1/3) ; geom.mean elseif @colorby == 7 _index = x ; réel elseif @colorby == 8 _index = y ; imaginaire elseif @colorby == 9 _index = x + y ; real+imag elseif @colorby == 10 _index = x * y ; real*imag elseif @colorby == 11 _index = x - y ; real-imag elseif @colorby == 12 _index = y - x ; imag-real elseif @colorby == 13 _index = x / y ; real/imag elseif @colorby ==14 _index = y / x ; imag/real elseif @colorby == 15 _index = x ^ y ; real^imag elseif @colorby == 16 _index = y ^ x ; imag^real elseif @colorby == 17 _index = 1/x ; 1/real elseif @colorby == 18 _index = 1/y ; 1/imag endif #index = _index + texture default: title="Fourier" helpfile="mde-help\mde-fourier-ucl.htm" param a0 caption = "A0" default = 1.0 endparam param a1 caption = "A1" default = 1.0 endparam param b1 caption = "B1" default = 1.0 endparam param a2 caption = "A2" default = 0.0 endparam param b2 caption = "B2" default = 0.0 endparam param a3 caption = "A3" default = 0.0 endparam param b3 caption = "B3" default = 0.0 endparam param a4 caption = "A4" default = 0.0 endparam param b4 caption = "B4" default = 0.0 endparam param l caption = "Wavelength" default = 1.0 endparam param coord caption = "Coordinates" enum="cartesian" "polar" "hyperbolic" default = 0 endparam param colorby caption="Colouring Mode" default=0 enum="distance" "iteration" "angle" "magnitude" "path" \ "arith. mean" "geom. mean" \ "real" "imag" "real+imag" "real*imag" "real-imag" \ "imag-real" "real/imag" "imag/real" "real^imag" "imag^real" \ "1/real" "1/imag" endparam param colorfix caption ="Colouring Fix" enum = "@minimum" "@maximum" "average" "@last Z" "@trap" endparam param barn caption = "Barnsley type" enum = "none" "real" "imag" "real*imag" "real+imag" \ "distance" "angle" "magnitude" "path" "trap real" \ "trap imag" "trap r*i" "trap r+i" "trap distance" \ "trap angle" "trap magnitude" "trap path" "iteration" \ "trap iter" endparam param barn_offset caption = "Barnsley Offset" default = 0.0 endparam param pairimp caption = "Odd-even type" enum = "none" "real" "imag" "real*imag" "real+imag" \ "distance" "angle" "magnitude" "path" "trap real" \ "trap imag" "trap r*i" "trap r+i" "trap distance" \ "trap angle" "trap magnitude" "trap path" "iteration" \ "trap iter" endparam param sgn caption = "Apply Odd-even Sign?" default = false endparam param intf caption = "Odd-Even factor" enum = "ceil" "floor" "trunc" "round" endparam param rnd caption = "Random Texture Amount" default = 0.0 endparam param fbmtxt caption = "fBm Texture Amount" default = 0.0 endparam param fbminit caption = "fBm Initialization" enum = "pixel" "z" "distance" "angle" "magnitude" "path" "trap z" \ "trap distance" "trap angle" "trap magnitude" "trap path" "Z" \ "hand over" endparam param fbmscale caption = "fBm Scale" default = 1.0 endparam param fbmoffset caption = "fBm Offset" default = (0,0) endparam param fbmangle caption = "fBm Rotation" default = 0.0 endparam param fbmstep caption = "fBm Scale Step" default = 0.5 endparam param fbmastep caption = "fBm Rotation Step" default = 37.0 endparam param fbmoct caption = "fBm Octaves" default = 7 min = 1 endparam param fbmpower caption = "fBm Exponent" default = 2.0 endparam param dectxt caption = "Decimal Texture Amount" default = 0.0 endparam param dec_init caption = "Decimal Initialisation" enum = "real z" "imag z" "distance" "angle" "magnitude" "path" \ "real trap" "imag trap" "trap distance" "trap angle" \ "trap magnitude" "trap path" "hand over" endparam param dec_sgn caption = "Apply Decimal Sign?" default = true endparam param dec_type caption = "Decimal Type" enum = "Ceil" "Floor" "Trunc" "Round" endparam param dec_scale caption = "Decimal Scale" default = 1.0 endparam param dec_size caption = "Decimal Size" default = 1.0 endparam param dec_limit caption = "Decimal Limit" default = 1.0 min = 0.0 endparam param txtr_gnarl caption = "Popgnarl Texture Amount" default = 0.0 endparam param gnarl_init caption = "Popgnarl Initialization" enum = "pixel" "z" "distance" "angle" "magnitude" "path" "trap z" \ "trap distance" "trap angle" "trap magnitude" "trap path" \ "Z" "hand over" default = 1 endparam param gnarl_type caption = "Popgnarl Mode" enum = "real" "imag" "real+imag" "real*imag" "real-imag" \ "real/imag" "imag/real" "real^imag" "imag^real" \ "1/real" "1/imag" "angle" "magnitude" "arith. mean" \ "geom. mean" endparam param gnarl_form caption = "Popgnarl Formula" enum = "gnarl" "popcorn" "popsicle" "tannous" "narlog" endparam param gnarl_scale caption = "Popgnarl Scale" default = 1.0 endparam param gnarl_scaling caption = "Popgnarl Scaling" enum = "Ceil" "Floor" "trunc" "round" endparam param gnarl_size caption = "Popgnarl Size" default = 1.0 endparam param gnarl_limit caption = "Popgnarl Limit" default = 1.0 min = 0.0 endparam param gnarl_octaves caption = "Popgnarl Octaves" default = 5 min = 1 endparam param masking caption = "Masking" enum = "none" "lower" "upper" "between" "outside" default = 0 endparam param mask_type caption = "Mask Type" enum = "real pixel" "imag pixel" "real z" "imag z" "distance" \ "angle" "iteration" "magnitude" "path" "trap distance" \ "trap angle" "real trap" "imag trap" "trap magnitude" \ "trap iter" "trap path" "shape" "Barnsley" "odd-even" endparam param threshold_l caption = "Lower Mask Threshold" default = 0.5 endparam param threshold_u caption = "Upper Mask Threshold" default = 1.0 endparam param trapping caption = "Trapping" enum = "lower" "upper" endparam param trp caption = "Trap Type" enum = "iteration" "magnitude" "distance" "angle" "real" "imag" "path" endparam param trap_min caption = "Trap Threshold" default = 1.0 min = 0.0 endparam func fn1 caption = "First Function" default = cos() endfunc func fn2 caption = "Second Function" default = sin() endfunc func fnx caption = "Apply F(x)" default = ident() endfunc func fny caption = "Apply F(y)" default = ident() endfunc func fnb caption = "Barnsley Function" default = flip() endfunc func fnpi caption = "Odd-even Function" default = flip() endfunc func fm caption = "Masking Function" default = ident() endfunc } md-ifs-a { ; Michèle Dessureault, octobre 2001 ; ; D'après Roger Stevens, "Fractal programming in C", ; p.394 à 397 ; ; Mark Townsend m'a inspiré pour les modes de coloration ; Le code de masquage vient de Andreas Lober, 11 juin 2000 ; Merci pour la permission de publier ; init: float r=0.0 float rmin=1.0e12 float rmax=0.0 float t=0.0 int iter=0 int itermin=0 int itermax=0 zmin=(0.0,0.0) zmax=(0.0,0.0) float mask = 0 bool is_masked = false z=(0.0,0.0) x =(0.0,0.0) y =(0.0,0.0) w =(0.0,0.0) p =(0.0,0.0) trap_p =(0.0,0.0) float xx =0 float yy =0 float path = 0.0 float pathmin = 0.0 float pathmax = 0.0 float trap_path = 0.0 float trap_dist = 0.0 float trap_magn = 0.0 float trap_iter = 0.0 float _index = 0.0 float texture=0.0 float texture_rnd = 0.0 float texture_fbm = 0.0 float texture_dec = 0.0 float texture_gna = 0.0 float phi=0.0 float trap_a=0.0 float pd=0.0 bool do_trap = true bool est_pair = true int temp1 = 0 temp2 = (0.0,0.0) float signe = 1.0 temp3 = (0.0,0.0) trp_iter = trunc(@trap_min) if trp_iter > #maxiter trp_iter = #maxiter elseif trp_iter < 1 trp_iter = 1 endif float a1=0 float a2=0 float a3=0 float a4=0 float b1=0 float b2=0 float b3=0 float b4=0 float c1=0 float c2=0 float c3=0 float c4=0 float d1=0 float d2=0 float d3=0 float d4=0 float e1=0 float e2=0 float e3=0 float e4=0 float f1=0 float f2=0 float f3=0 float f4=0 float a=0 float b=0 float c=0 float d=0 float e0=0 float f=0 float pr=0 float r1=0 float r2=0 float r3=0 float r4=0 if @figure == 0 ;Sierpinsky a1=a2=a3=d1=d2=d3=e3=f3=0.5 e2=1.0 r1=10813.0 r2=21626.0 r3=32767.0 endif if @figure == 1 ;fougère a2=f2=f3=f4=0.2 a3=-0.15 a4=d4=0.85 b2=-0.26 b3=0.28 b4=0.04 c2=0.23 c3=0.26 c4=-0.04 d1=0.16 d2=0.22 d3=0.24 r1=328.0 r2=2621.0 r3=4915.0 r4=32767.0 endif if @figure == 2 ; arbre a2=d2=0.1 a3=b4=c3=d3=d4=0.42 a4=b3=c4=-0.42 d1=0.5 f2=f3=f4=0.2 r1=1638.0 r2=6553.0 r3=19660.0 r4=32767.0 endif if @figure == 3 ; arbre de Cantor a1=a2=d1=d2=0.333 a3=d3=0.667 e2=1.0 e3=f3=0.5 r1=10813.0 r2=21626.0 r3=32767.0 endif loop: if @hasard == 1 pr = real(#random*#z)*32767.0 elseif @hasard == 2 pr = imag(#random*#z)*32767.0 elseif @hasard == 0 ; pas de hasard pr = (real(#z)+imag(#z)) % 32767 elseif @hasard == 3 pr = (real(#random*#z)+imag(#random*#z)) *32767.0 elseif @hasard == 4 pr = (real(#random*#z)-imag(#random*#z)) *32767.0 elseif @hasard == 5 pr = (real(#random*#z)*imag(#random*#z)) *32767.0 elseif @hasard == 6 pr = (real(#random*#z)/imag(#random*#z)) *32767.0 elseif @hasard == 7 pr = (imag(#random*#z)/real(#random*#z)) *32767.0 elseif @hasard == 8 pr = (real(#random*#z)^imag(#random*#z)) *32767.0 elseif @hasard == 9 pr = (imag(#random*#z)^real(#random*#z)) *32767.0 elseif @hasard == 10 ; multi pr = (real(z)+imag(z)) * 32767 endif if @wrp == true && pr > 32767 pr = pr % 32767 endif if pr <= r1 a = a1 b = b1 c = c1 d = d1 e0 = e1 f = f1 endif if pr > r1 && pr <= r2 a = a2 b = b2 c = c2 d = d2 e0 = e2 f = f2 endif if pr > r2 && pr <= r3 a = a3 b = b3 c = c3 d = d3 e0 = e3 f = f3 endif if pr > r3 && pr <= r4 && (@figure == 1 || @figure == 2) a = a4 b = b4 c = c4 d = d4 e0 = e4 f = f4 endif x = real(a*real(#z) + b*imag(#z) + e0) y = imag(c*real(#z) + d*imag(#z) + f) w = x + flip(y) if @coord == 1 rho = sqrt(sqr(x)+sqr(y)) theta = atan2(y/x) if theta < 0 theta = theta + 2 * #pi endif x = rho y = theta elseif @coord ==2 rho = sqrt(sqr(x)+sqr(y)) x = rho * cosh(real(w)) y = rho * sinh(imag(w)) endif z= @fnx(x * (1.0,0.0)) + @fny(y * (0.0,1.0)) iter=iter+1 if @barn > 0 if @barn == 1 && real(z) >= @barn_offset z = @fnb(z) endif if @barn == 2 && imag(z) >= @barn_offset z = @fnb(z) endif if @barn == 3 && (real(z) * imag(z)) >= @barn_offset z = @fnb(z) endif if @barn == 4 && (real(z) + imag(z)) >= @barn_offset z = @fnb(z) endif if @barn == 5 && r >= @barn_offset z = @fnb(z) endif if @barn == 6 && phi >= @barn_offset z = @fnb(z) endif if @barn == 7 && cabs(z) >= @barn_offset z = @fnb(z) endif if @barn == 8 && path >= @barn_offset z = @fnb(z) endif if @barn == 9 && real(trap_p) >= @barn_offset z = @fnb(z) endif if @barn == 10 && imag(trap_p) >= @barn_offset z = @fnb(z) endif if @barn == 11 && (real(trap_p)*imag(trap_p)) >= @barn_offset z = @fnb(z) endif if @barn == 12 && (real(trap_p)+imag(trap_p)) >= @barn_offset z = @fnb(z) endif if @barn == 13 && trap_dist >= @barn_offset z = @fnb(z) endif if @barn == 14 && trap_a >= @barn_offset z = @fnb(z) endif if @barn == 15 && trap_magn >= @barn_offset z = @fnb(z) endif if @barn == 16 && trap_path >= @barn_offset z = @fnb(z) endif if @barn == 17 && iter >= @barn_offset z = @fnb(z) endif if @barn == 18 && trap_iter >= @barn_offset z = @fnb(z) endif if (@masking > 0) && @mask_type == 17 mask = real(@fm(z)) endif endif if @pairimp > 0 if @pairimp == 1 temp2 = real(z) elseif @pairimp == 2 temp2 = imag(z) elseif @pairimp == 3 temp2 = real(z) * imag(z) elseif @pairimp == 4 temp2 = real(z) + imag(z) elseif @pairimp == 5 temp2 = r elseif @pairimp == 6 temp2 = phi elseif @pairimp == 7 temp2 = cabs(z) elseif @pairimp == 8 temp2 = path elseif @pairimp == 9 temp2 = real(trap_p) elseif @pairimp == 10 temp2 = imag(trap_p) elseif @pairimp == 11 temp2 = real(trap_p)*imag(trap_p) elseif @pairimp == 12 temp2 = real(trap_p)+imag(trap_p) elseif @pairimp == 13 temp2 = trap_dist elseif @pairimp == 14 temp2 = trap_a elseif @pairimp == 15 temp2 = trap_magn elseif @pairimp == 16 temp2 = trap_path elseif @pairimp == 17 temp2 = iter elseif @pairimp == 18 temp2 = trap_iter endif if @sgn == true temp3 = real(z) * imag(z) if temp3 < 0 signe = -1.0 endif endif if @intf == 0 temp1 = ceil(signe*cabs(temp2)) elseif @intf == 1 temp1 = floor(signe*cabs(temp2)) elseif @intf == 2 temp1 = trunc(signe*cabs(temp2)) elseif @intf == 3 temp1 = round(signe*cabs(temp2)) endif if temp1 % 2 == 0 est_pair = true else est_pair = false endif IF est_pair z = @fnpi(z) endif if (@masking > 0) && @mask_type == 18 mask = real(@fm(z)) endif endif remain=#z-z r=cabs(remain) path = path + r phi = atan2(#z) phi = phi/#pi if phi < 0.0 phi = phi + 2.0 endif if(rrmax) rmax=r zmax=#z itermax=iter pathmax = path endif ; trappes if do_trap && \ ((@trp==0 && @trapping == 0 && iter<=trp_iter) || \ (@trp==0 && @trapping == 1 && iter>trp_iter) || \ (@trp==1 && @trapping == 0 && |z|<=@trap_min) || \ (@trp==1 && @trapping == 1 && |z|>@trap_min) || \ (@trp==2 && @trapping == 0 && r<=@trap_min) || \ (@trp==2 && @trapping == 1 && r>@trap_min) || \ (@trp==3 && @trapping == 0 && phi<=@trap_min) || \ (@trp==3 && @trapping == 1 && phi>@trap_min) || \ (@trp==4 && @trapping == 0 && real(z)<=@trap_min) || \ (@trp==4 && @trapping == 1 && real(z)>@trap_min) || \ (@trp==5 && @trapping == 0 && imag(z)<=@trap_min) || \ (@trp==5 && @trapping == 1 && imag(z)>@trap_min) || \ (@trp==6 && @trapping == 0 && path<=@trap_min) || \ (@trp==6 && @trapping == 1 && path>@trap_min)) do_trap = false trap_dist = r ; trap distance trap_p = z ;trap trap_a = phi ;trap angle trap_iter = iter trap_magn = cabs(z) trap_path = path endif final: ; masquage if (@masking > 0) if @mask_type == 0 mask = real(@fm(#pixel)) elseif @mask_type == 1 mask =imag(@fm(#pixel)) elseif @mask_type == 2 mask =real(@fm(#z)) elseif @mask_type == 3 mask =imag(@fm(#z)) elseif @mask_type == 4 mask =real(@fm(r+0i)) elseif @mask_type == 5 mask =real(@fm(phi+0i)) elseif @mask_type == 6 mask =real(@fm(iter+0i)) elseif @mask_type == 7 mask =cabs(@fm(z)) elseif @mask_type == 8 mask =real(@fm(path+0i)) elseif @mask_type == 9 mask =real(@fm(trap_dist+0i)) elseif @mask_type == 10 mask =real(@fm(trap_a+0i)) elseif @mask_type == 11 mask =real(@fm(trap_p+0i)) elseif @mask_type == 12 mask =imag(@fm(trap_p+0i)) elseif @mask_type == 13 mask =real(@fm(trap_magn+0i)) elseif @mask_type == 14 mask =real(@fm(trap_iter+0i)) elseif @mask_type == 15 mask =real(@fm(trap_path+0i)) elseif @mask_type == 16 mask =real(@fm(rmin+0i)) endif if (@masking == 1) ; Lower if (mask < @threshold_l) #solid = is_masked = true endif elseif (@masking == 2) ; Upper if (mask > @threshold_u) #solid = is_masked = true endif elseif (@masking == 3) ; Between if (mask > @threshold_l && mask < @threshold_u) #solid = is_masked = true endif elseif (@masking == 4) ; Outside if (mask < @threshold_l || mask > @threshold_u) #solid = is_masked = true endif endif endif if !is_masked ;Random complex hasard = #random texture_rnd = @rnd * (real(hasard)+ imag(hasard)) ; fBm if (@fbmtxt != 0) r11 = (0,1) ^ (@fbmangle / 90.0) r22 = (0,1) ^ (@fbmastep / 90.0) if @fbminit == 0 p = #pixel * @fbmscale * r11 + @fbmoffset elseif @fbminit == 1 p = z * @fbmscale * r11 + @fbmoffset elseif @fbminit == 2 p = r * @fbmscale * r11 + @fbmoffset elseif @fbminit == 3 p = phi * @fbmscale * r11 + @fbmoffset elseif @fbminit == 4 p = cabs(z) * @fbmscale * r11 + @fbmoffset elseif @fbminit == 5 p = path * @fbmscale * r11 + @fbmoffset elseif @fbminit == 6 p = trap_p * @fbmscale * r11 + @fbmoffset elseif @fbminit == 7 p = trap_dist * @fbmscale * r11 + @fbmoffset elseif @fbminit == 8 p = trap_a * @fbmscale * r11 + @fbmoffset elseif @fbminit == 9 p = trap_magn * @fbmscale * r11 + @fbmoffset elseif @fbminit == 10 p = trap_path * @fbmscale * r11 + @fbmoffset elseif @fbminit == 11 p = #z * @fbmscale * r1 + @fbmoffset elseif @fbminit == 12 p = texture_rnd * @fbmscale * r11 + @fbmoffset endif float sum = 0.0 float freq = 1.0 int i = @fbmoct while (i > 0) ; determine integer coordinate for corners of square ; surrounding p float bx0 = floor(real(p)) % 256 float by0 = floor(imag(p)) % 256 IF (bx0 < 0) bx0 = bx0 + 256 ENDIF IF (by0 < 0) by0 = by0 + 256 ENDIF float bx1 = (bx0 + 1) % 256 float by1 = (by0 + 1) % 256 float rx0 = real(p) - floor(real(p)) float ry0 = imag(p) - floor(imag(p)) float rx1 = rx0 - 1 float ry1 = ry0 - 1 float b00 = (bx0^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b10 = (bx1^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b01 = (bx0^@fbmpower % 65536 + by1)^@fbmpower % 65536 float b11 = (bx1^@fbmpower % 65536 + by1)^@fbmpower % 65536 float g_b00_0 = (b00)^@fbmpower*0.25 % 512 - 256 float g_b10_0 = (b10)^@fbmpower*0.25 % 512 - 256 float g_b01_0 = (b01)^@fbmpower*0.25 % 512 - 256 float g_b11_0 = (b11)^@fbmpower*0.25 % 512 - 256 float g_b00_1 = (b00+1)^@fbmpower*0.25 % 512 - 256 float g_b10_1 = (b10+1)^@fbmpower*0.25 % 512 - 256 float g_b01_1 = (b01+1)^@fbmpower*0.25 % 512 - 256 float g_b11_1 = (b11+1)^@fbmpower*0.25 % 512 - 256 float d = 0.0; d = 1 / sqrt(sqr(g_b00_0) + sqr(g_b00_1)) g_b00_0 = g_b00_0 * d g_b00_1 = g_b00_1 * d d = 1 / sqrt(sqr(g_b10_0) + sqr(g_b10_1)) g_b10_0 = g_b10_0 * d g_b10_1 = g_b10_1 * d d = 1 / sqrt(sqr(g_b01_0) + sqr(g_b01_1)) g_b01_0 = g_b01_0 * d g_b01_1 = g_b01_1 * d d = 1 / sqrt(sqr(g_b11_0) + sqr(g_b11_1)) g_b11_0 = g_b11_0 * d g_b11_1 = g_b11_1 * d float u1 = rx0 * g_b00_0 + ry0 * g_b00_1 float v1 = rx1 * g_b10_0 + ry0 * g_b10_1 float u2 = rx0 * g_b01_0 + ry1 * g_b01_1 float v2 = rx1 * g_b11_0 + ry1 * g_b11_1 float sx = sqr(rx0) * (3 - rx0*2) float sy = sqr(ry0) * (3 - ry0*2) float a = u1 + sx*(v1-u1) float b = u2 + sx*(v2-u2) sum = sum + (a + sy*(b-a))*freq freq = freq * @fbmstep p = p * r22 / @fbmstep i = i - 1 endwhile texture_fbm = @fbmtxt * sum endif ;decimal if @dectxt > 0 if @dec_init == 0 pd = real(#z) elseif @dec_init == 1 pd = imag(#z) elseif @dec_init == 2 pd = r elseif @dec_init == 3 pd = phi elseif @dec_init == 4 pd = cabs(z) elseif @dec_init == 5 pd = path elseif @dec_init == 6 pd = real(trap_p) elseif @dec_init == 7 pd = imag(trap_p) elseif @dec_init == 8 pd = trap_dist elseif @dec_init == 9 pd = trap_a elseif @dec_init == 10 pd = trap_magn elseif @dec_init == 11 pd = trap_path elseif @dec_init == 12 pd = texture_rnd+texture_fbm endif if @dec_type == 0 pd = pd-ceil(pd*@dec_scale)/@dec_scale elseif @dec_type == 1 pd = pd-floor(pd*@dec_scale)/@dec_scale elseif @dec_type == 2 pd = pd-trunc(pd*@dec_scale)/@dec_scale elseif @dec_type == 3 pd = pd-round(pd*@dec_scale)/@dec_scale endif if @dec_size != 0 pd = pd/@dec_size endif texture_dec = @dectxt*pd if @dec_limit !=0 texture_dec= texture_dec%@dec_limit endif if @dec_sgn == true texture_dec = abs(texture_dec) endif endif if (@txtr_gnarl != 0) if @gnarl_init == 0 p = #pixel elseif @gnarl_init == 1 p = z elseif @gnarl_init == 2 p = r elseif @gnarl_init == 3 p = phi elseif @gnarl_init == 4 p = cabs(z) elseif @gnarl_init == 5 p = path elseif @gnarl_init == 6 p = trap_p elseif @gnarl_init == 7 p = trap_dist elseif @gnarl_init == 8 p = trap_a elseif @gnarl_init == 9 p = trap_magn elseif @gnarl_init == 10 p = trap_path elseif @gnarl_init == 11 p = #z elseif @gnarl_init == 12 p = texture_rnd+texture_fbm+texture_dec endif ; p = p-trunc(p*@gnarl_scale)/@gnarl_scale if @gnarl_scaling == 0 p = p-ceil(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 1 p = p-floor(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 2 p = p-trunc(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 3 p = p-round(p*@gnarl_scale)/@gnarl_scale endif if @gnarl_size != 0 p = p/@gnarl_size endif xx = real(p) yy = imag(p) float xOld = 0 int iter3 = @gnarl_octaves while (iter3 > 0) iter3 = iter3-1 xOld = xx if @gnarl_form == 0 xx = xx - sin(yy + sin(yy)) yy = yy - sin(xOld + sin(xOld)) elseif @gnarl_form == 1 xx = xx - sin(yy + log(yy + cos(yy))) yy = yy - sin(xOld + log(xOld + cos(xOld))) elseif @gnarl_form == 2 xx = xx - sin(yy + cos(yy)) yy = yy - sin(xOld + cos(xOld)) elseif @gnarl_form == 3 xx = xx - sin(yy + log(yy + tan(yy))) yy = yy - sin(xOld + log(xOld + tan(xOld))) elseif @gnarl_form == 4 xx = xx - sin(yy + log(yy + sin(yy))) yy = yy - sin(xOld + log(xOld + sin(xOld))) endif endwhile if (@gnarl_type == 0) texture_gna = abs(xx) elseif (@gnarl_type == 1) texture_gna = abs(yy) elseif (@gnarl_type == 2) texture_gna = abs(xx+yy) elseif (@gnarl_type == 3) texture_gna = abs(xx*yy) elseif (@gnarl_type == 4) texture_gna = abs(xx-yy) elseif (@gnarl_type == 5) texture_gna = abs(xx/yy) elseif (@gnarl_type == 6) texture_gna = abs(yy/xx) elseif (@gnarl_type == 7) texture_gna = abs(xx^yy) elseif (@gnarl_type == 8) texture_gna = abs(yy^xx) elseif (@gnarl_type == 9) texture_gna = abs(1/xx) elseif (@gnarl_type == 10) texture_gna = abs(1/yy) elseif (@gnarl_type == 11) texture_gna = atan2(xx+1i*yy)/(2*#pi) if (texture_gna < 0) texture_gna = texture_gna + 1 endif elseif (@gnarl_type == 12) texture_gna = |xx+1i*yy| elseif (@gnarl_type == 13) texture_gna = (xx+yy+|xx+1i*yy|)/3 elseif (@gnarl_type == 14) texture_gna = (xx*yy*|xx+1i*yy|)^(1/3) endif if @gnarl_limit !=0 texture_gna= texture_gna%@gnarl_limit endif endif endif texture = texture_rnd + texture_fbm + texture_dec + texture_gna if @colorfix ==0 if(@colorby==0) ; minimum distance _index=rmin elseif @colorby==1 ; iteration @ min _index=0.01*itermin elseif(@colorby==2) ; angle @ min t=atan2(zmin) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(zmin) ; magnitude @min elseif(@colorby==4) _index = pathmin ; path @min endif xx = real(zmin) yy = imag(zmin) endif if @colorfix == 1 if(@colorby==0) ; maximum distance _index=rmax elseif(@colorby==1) ; iteration @ max _index=0.01*itermax elseif(@colorby==2) ; angle @ max t=atan2(zmax) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(zmax) ; magnitude @max elseif(@colorby==4) _index = pathmax ; path @max endif xx = real(zmax) yy = imag(zmax) endif if @colorfix == 2 z = (zmin + zmax)/2 if(@colorby==0) ; average distance _index=path/iter elseif(@colorby==1) ; iteration @ average _index=0.01*iter/2 elseif(@colorby==2) ; angle @ average t=atan2(z) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(z) ; magnitude @average elseif(@colorby==4) _index = (pathmin + pathmax)/2 ; path @average endif xx = real(z) yy = imag(z) endif if @colorfix == 3 if(@colorby==0) ; last distance _index=r elseif(@colorby==1) ; iteration @ last _index=0.01*iter elseif(@colorby==2) ; angle @ last t=atan2(z) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(z) ; magnitude @last elseif(@colorby==4) _index = path ; path @last endif xx = real(z) yy = imag(z) endif if @colorfix == 4 if(@colorby==0) ; distance @trap _index=trap_dist elseif(@colorby==1) ; iteration @ trap _index=0.01*trap_iter elseif(@colorby==2) ; angle @ trap t=atan2(trap_p) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = trap_magn ; magnitude @trap elseif(@colorby==4) _index = trap_path ; path @trap endif xx = real(trap_p) yy = imag(trap_p) endif if @colorby == 5 _index = (xx+yy+|xx+1i*yy|)/3 ; arith.mean elseif @colorby == 6 _index = (xx*yy*|xx+1i*yy|)^(1/3) ; geom.mean elseif @colorby == 7 _index = xx ; réel elseif @colorby == 8 _index = yy ; imaginaire elseif @colorby == 9 _index = xx + yy ; real+imag elseif @colorby == 10 _index = xx * yy ; real*imag elseif @colorby == 11 _index = xx - yy ; real-imag elseif @colorby == 12 _index = yy - xx ; imag-real elseif @colorby == 13 _index = xx / yy ; real/imag elseif @colorby ==14 _index = yy / xx ; imag/real elseif @colorby == 15 _index = xx ^ yy ; real^imag elseif @colorby == 16 _index = yy ^ xx ; imag^real elseif @colorby == 17 _index = 1/xx ; 1/real elseif @colorby == 18 _index = 1/yy ; 1/imag endif #index = _index + texture default: title = "Ifs ++" helpfile="mde-help\mde-IFS++.htm" param figure caption = "Figure" enum = "Sierpinsky" "fern" "tree" "Cantor tree" endparam param hasard caption ="Chaos" enum="no" "real" "imaginary" "real+imag" "real-imag" "real*imag" \ "real/imag" "imag/real" "real^imag" "imag^real" "multi" endparam param wrp caption = "Apply wrap around?" default = false endparam param coord caption = "Coordinates" enum="cartesian" "polar" "hyperbolic" default = 0 endparam param colorby caption="Colouring Mode" default=0 enum="distance" "iteration" "angle" "magnitude" "path" \ "arith. mean" "geom. mean" \ "real" "imag" "real+imag" "real*imag" "real-imag" \ "imag-real" "real/imag" "imag/real" "real^imag" "imag^real" \ "1/real" "1/imag" endparam param colorfix caption ="Colouring Fix" enum = "@minimum" "@maximum" "average" "@last Z" "@trap" endparam param barn caption = "Barnsley type" enum = "none" "real" "imag" "real*imag" "real+imag" \ "distance" "angle" "magnitude" "path" "trap real" \ "trap imag" "trap r*i" "trap r+i" "trap distance" \ "trap angle" "trap magnitude" "trap path" "iteration" \ "trap iter" endparam param barn_offset caption = "Barnsley Offset" default = 0.0 endparam param pairimp caption = "Odd-even type" enum = "none" "real" "imag" "real*imag" "real+imag" \ "distance" "angle" "magnitude" "path" "trap real" \ "trap imag" "trap r*i" "trap r+i" "trap distance" \ "trap angle" "trap magnitude" "trap path" "iteration" \ "trap iter" endparam param sgn caption = "Apply Odd-even Sign?" default = false endparam param intf caption = "Odd-Even factor" enum = "ceil" "floor" "trunc" "round" endparam param rnd caption = "Random Texture Amount" default = 0.0 endparam param fbmtxt caption = "fBm Texture Amount" default = 0.0 endparam param fbminit caption = "fBm Initialization" enum = "pixel" "z" "distance" "angle" "magnitude" "path" "trap z" \ "trap distance" "trap angle" "trap magnitude" "trap path" \ "Z" "hand over" endparam param fbmscale caption = "fBm Scale" default = 1.0 endparam param fbmoffset caption = "fBm Offset" default = (0,0) endparam param fbmangle caption = "fBm Rotation" default = 0.0 endparam param fbmstep caption = "fBm Scale Step" default = 0.5 endparam param fbmastep caption = "fBm Rotation Step" default = 37.0 endparam param fbmoct caption = "fBm Octaves" default = 7 min = 1 endparam param fbmpower caption = "fBm Exponent" default = 2.0 endparam param dectxt caption = "Decimal Texture Amount" default = 0.0 endparam param dec_init caption = "Decimal Initialisation" enum = "real z" "imag z" "distance" "angle" "magnitude" "path" \ "real trap" "imag trap" "trap distance" "trap angle" \ "trap magnitude" "trap path" "hand over" endparam param dec_sgn caption = "Apply Decimal Sign?" default = true endparam param dec_type caption = "Decimal Type" enum = "Ceil" "Floor" "Trunc" "Round" endparam param dec_scale caption = "Decimal Scale" default = 1.0 endparam param dec_size caption = "Decimal Size" default = 1.0 endparam param dec_limit caption = "Decimal Limit" default = 1.0 min = 0.0 endparam param txtr_gnarl caption = "Popgnarl Texture Amount" default = 0.0 endparam param gnarl_init caption = "Popgnarl Initialization" enum = "pixel" "z" "distance" "angle" "magnitude" "path" "trap z" \ "trap distance" "trap angle" "trap magnitude" "trap path" \ "Z" "hand over" default = 1 endparam param gnarl_type caption = "Popgnarl Mode" enum = "real" "imag" "real+imag" "real*imag" "real-imag" \ "real/imag" "imag/real" "real^imag" "imag^real" \ "1/real" "1/imag" "angle" "magnitude" "arith. mean" \ "geom. mean" endparam param gnarl_form caption = "Popgnarl Formula" enum = "gnarl" "popcorn" "popsicle" "tannous" "narlog" endparam param gnarl_scale caption = "Popgnarl Scale" default = 1.0 endparam param gnarl_scaling caption = "Popgnarl Scaling" enum = "Ceil" "Floor" "trunc" "round" endparam param gnarl_size caption = "Popgnarl Size" default = 1.0 endparam param gnarl_limit caption = "Popgnarl Limit" default = 1.0 min = 0.0 endparam param gnarl_octaves caption = "Popgnarl Octaves" default = 5 min = 1 endparam param masking caption = "Masking" enum = "none" "lower" "upper" "between" "outside" default = 0 endparam param mask_type caption = "Mask Type" enum = "real pixel" "imag pixel" "real z" "imag z" "distance" \ "angle" "iteration" "magnitude" "path" "trap distance" \ "trap angle" "real trap" "imag trap" "trap magnitude" \ "trap iter" "trap path" "shape" "Barnsley" "odd-even" endparam param threshold_l caption = "Lower Mask Threshold" default = 0.5 endparam param threshold_u caption = "Upper Mask Threshold" default = 1.0 endparam param trapping caption = "Trapping" enum = "lower" "upper" endparam param trp caption = "Trap Type" enum = "iteration" "magnitude" "distance" "angle" "real" "imag" "path" endparam param trap_min caption = "Trap Threshold" default = 1.0 min = 0.0 endparam func fnx caption = "Apply F(x)" default = ident() endfunc func fny caption = "Apply F(y)" default = ident() endfunc func fnb caption = "Barnsley Function" default = flip() endfunc func fnpi caption = "Odd-even Function" default = flip() endfunc func fm caption = "Masking Function" default = ident() endfunc }