comment { dmj-pub.ufm 2.1 Fractal types for Ultra Fractal 2 by Damien M. Jones April 2, 2000 For more information about this formula collection, please visit its home page: http://www.fractalus.com/ultrafractal/dmj-pub-uf.htm Many of these are based on traditional fractal types. They have been included here with my own peculiar "twists". } dmj-Bifurcation { ; ; This is a bifurcation rendering engine. You can use this ; to produce bifurcation diagrams similar to FractInt's. ; For best results, use the bifurcation coloring. It's ; specifically tuned to work with this formula. ; ; Note: Because this is pixel-oriented instead of column- ; oriented, this renders much slower than FractInt. Also, ; plots are resolution-dependent. They are suitable for ; exploration of formulas, but you may have difficulty ; rendering them at large sizes. Don't say I didn't warn you. ; init: float z1 = @start float r = real(#pixel) float zmin = imag(#pixel) float zmax = imag(#pixel) + 4/#magn/#height int inside = 0 int counter = 0 z = 0 loop: IF (@type == 0); bif+sinpi z1 = z1 + r * real(@f(#pi*z1)) ELSEIF (@type == 1); bif=sinpi z1 = r * real(@f(#pi*z1)) ELSEIF (@type == 2); biflambda z1 = r * real(@f(z1)) * (1-real(@f(z1))) ELSEIF (@type == 3); bifmay z1 = (r * z1) / (1 + z1)^@power ELSEIF (@type == 4); bifstewart z1 = r * sqr(real(@f(z1))) - 1 ELSEIF (@type == 5); bifurcation z1 = z1 + r * real(@f(z1)) * (1-real(@f(z1))) ENDIF IF (z1 >= zmin && z1 < zmax && counter > @filter) inside = inside + 1 ENDIF counter = counter + 1 IF (counter == #maxit) z = inside ENDIF bailout: true default: title = "Bifurcation" helpfile = "dmj-pub\dmj-pub-uf-bifurcation.htm" maxiter = 400 periodicity = 0 center = (2,0.5) magn = 2 param type caption = "Function Type" default = 5 enum = "bif+sinpi" "bif=sinpi" "biflambda" "bifmay" "bifstewart" \ "bifurcation" endparam param start caption = "Start Value" default = 0.66 hint = "Starting value for all points." endparam param filter caption = "Filter Iterations" default = 200 hint = "Specifies the number of iterations to skip before \ plotting orbit points." endparam param power caption = "Exponent" default = 5.0 hint = "Specifies the exponent for the bifmay type." endparam func f caption = "Extra Function" default = ident() hint = "Specifies the extra function. Use sin() to reproduce \ the default FractInt behavior for sinpi types." endfunc } dmj-BoostMandel { ; ; This formula is an implementation of Orbit Boosting, ; an idea by Earl Hinrichs. ; ; The basic idea is that we perform a normal Mandelbrot ; iteration, but if the orbit enters a specified region ; of the complex plane (much like an orbit trap) we ; "boost" it in some fashion. A variety of boosting modes ; are included. Boost regions are ALWAYS circular in this ; implementation. ; init: float d = 0; distance to boost area float radius2 = sqr(@boostradius); pre-calc this float iradius = 1/@boostradius; pre-calc this ; complex c = 0 z = @start loop: z = z^@power + #pixel; calculate the M-set d = |z - @boostcenter|; distance to boost area IF (d < radius2); within threshold IF (@boostmode == 0); displace (addition) z = z + @boostamount ELSEIF (@boostmode == 1); orbit origin (multiply) z = z * @boostamount ELSEIF (@boostmode == 2); orbit boost (multiply) z = (z-@boostcenter) * @boostamount + @boostcenter ELSEIF (@boostmode == 3); flip out (reverse distance) d = 2*@boostradius/sqrt(d)-1 z = @boostcenter + (z-@boostcenter)*d*@boostamount ELSEIF (@boostmode == 4); repel (reverse distance squared) d = 1-sqr(1-@boostradius/sqrt(d)) z = @boostcenter + (z-@boostcenter)*d*@boostamount ELSEIF (@boostmode == 5); exponentiate origin (exponent) z = z ^ @boostamount ELSEIF (@boostmode == 6); exponentiate boost (exponent) z = (z-@boostcenter) ^ @boostamount + @boostcenter ELSEIF (@boostmode == 7); invert z = conj(iradius/(z-@boostcenter)) + @boostcenter ELSEIF (@boostmode == 8); pass through z = z + 2*(z-@boostcenter)*@boostamount ELSEIF (@boostmode == 9); pass through 2 z = z + 2*(@boostcenter-z)/cabs(@boostcenter-z)*@boostradius*@boostamount ENDIF ENDIF bailout: |z| < @bailout default: title = "Orbit Boost (Mandelbrot)" helpfile = "dmj-pub\dmj-pub-uf-ob.htm" center = (-0.5, 0.0) maxiter = 1000 param start caption = "Starting Point" default = (0,0) hint = "Starting value for each point. You can use this to \ 'perturb' the fractal." endparam param power caption = "Exponent" default = (2,0) hint = "Overall exponent for the equation. (2,0) gives \ the classic Julia type." endparam param bailout caption = "Bail-out Value" default = 1.0e20 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Julia set anymore." endparam param boostcenter caption = "Boost Center" default = (0,0) hint = "This is the location of the boost area in the complex plane." endparam param boostradius caption = "Boost Radius" default = 0.5 hint = "This is the size of the boost area." endparam param boostmode caption = "Boost Mode" default = 0 enum = "displace" "orbit origin" "orbit boost" "flip out" "repel" \ "exponentiate origin" "exponentiate boost" "invert" "pass through" \ "pass through 2" hint = "Sets the type of effect when the orbit enters the boost area." endparam param boostamount caption = "Boost Amount" default = (1,0) hint = "This is the amount to boost." endparam switch: type = "dmj-BoostJulia" seed = #pixel power = @power bailout = @bailout boostcenter = @boostcenter boostradius = @boostradius boostmode = @boostmode boostamount = @boostamount } dmj-BoostJulia { ; ; This formula is an implementation of Orbit Boosting, ; an idea by Earl Hinrichs. ; ; The basic idea is that we perform a normal Julia ; iteration, but if the orbit enters a specified region ; of the complex plane (much like an orbit trap) we ; "boost" it in some fashion. A variety of boosting modes ; are included. Boost regions are ALWAYS circular in this ; implementation. ; init: float d = 0; distance to boost area float radius2 = sqr(@boostradius); pre-calc this float iradius = 1/@boostradius; pre-calc this z = #pixel loop: z = z^@power + @seed; calculate the J-set d = |z - @boostcenter|; distance to boost area IF (d < radius2); within threshold IF (@boostmode == 0); displace (addition) z = z + @boostamount ELSEIF (@boostmode == 1); orbit origin (multiply) z = z * @boostamount ELSEIF (@boostmode == 2); orbit boost (multiply) z = (z-@boostcenter) * @boostamount + @boostcenter ELSEIF (@boostmode == 3); flip out (reverse distance) d = 2*@boostradius/sqrt(d)-1 z = @boostcenter + (z-@boostcenter)*d*@boostamount ELSEIF (@boostmode == 4); repel (reverse distance squared) d = 1-sqr(1-@boostradius/sqrt(d)) z = @boostcenter + (z-@boostcenter)*d*@boostamount ELSEIF (@boostmode == 5); exponentiate origin (exponent) z = z ^ @boostamount ELSEIF (@boostmode == 6); exponentiate boost (exponent) z = (z-@boostcenter) ^ @boostamount + @boostcenter ELSEIF (@boostmode == 7); invert z = conj(iradius/(z-@boostcenter)) + @boostcenter ELSEIF (@boostmode == 8); pass through z = z + 2*(z-@boostcenter)*@boostamount ELSEIF (@boostmode == 9); pass through 2 z = z + 2*(@boostcenter-z)/cabs(@boostcenter-z)*@boostradius*@boostamount ENDIF ENDIF bailout: |z| < @bailout default: title = "Orbit Boost (Julia)" helpfile = "dmj-pub\dmj-pub-uf-ob.htm" center = (0.0, 0.0) maxiter = 1000 param seed caption = "Julia Seed" default = (0,0) hint = "This is the Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param power caption = "Exponent" default = (2,0) hint = "Overall exponent for the equation. (2,0) gives \ the classic Julia type." endparam param bailout caption = "Bail-out Value" default = 1.0e20 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Julia set anymore." endparam param boostcenter caption = "Boost Center" default = (0,0) hint = "This is the location of the boost area in the complex plane." endparam param boostradius caption = "Boost Radius" default = 0.5 hint = "This is the size of the boost area." endparam param boostmode caption = "Boost Mode" default = 0 enum = "displace" "orbit origin" "orbit boost" "flip out" "repel" \ "exponentiate origin" "exponentiate boost" "invert" "pass through" \ "pass through 2" hint = "Sets the type of effect when the orbit enters the boost area." endparam param boostamount caption = "Boost Amount" default = (1,0) hint = "This is the amount to boost." endparam switch: type = "dmj-BoostMandel" power = @power bailout = @bailout boostcenter = @boostcenter boostradius = @boostradius boostmode = @boostmode boostamount = @boostamount } dmj-BoostNovaMandel { ; ; This formula is an implementation of Orbit Boosting, ; an idea by Earl Hinrichs. ; ; The basic idea is that we perform a normal Nova Mandelbrot ; iteration, but if the orbit enters a specified region ; of the complex plane (much like an orbit trap) we ; "boost" it in some fashion. A variety of boosting modes ; are included. Boost regions are ALWAYS circular in this ; implementation. ; init: float d = 0; distance to boost area float radius2 = sqr(@boostradius); pre-calc this float iradius = 1/@boostradius; pre-calc this ; complex c = 0 complex zsquared = (0,0) complex zcubed = (0,0) complex zold = (0,0) z = @start loop: IF (@power == (3,0)); special optimized routine for power 3 zsquared = sqr(z) zcubed = zsquared * z zold = z z = z - @relax * (zcubed-1) / (3*zsquared) + #pixel ELSE zold = z z = z - @relax * (z^@power-1) / (@power * z^(@power-1)) + #pixel ENDIF d = |z - @boostcenter|; distance to boost area IF (d < radius2); within threshold IF (@boostmode == 0); displace (addition) z = z + @boostamount ELSEIF (@boostmode == 1); orbit origin (multiply) z = z * @boostamount ELSEIF (@boostmode == 2); orbit boost (multiply) z = (z-@boostcenter) * @boostamount + @boostcenter ELSEIF (@boostmode == 3); flip out (reverse distance) d = 2*@boostradius/sqrt(d)-1 z = @boostcenter + (z-@boostcenter)*d*@boostamount ELSEIF (@boostmode == 4); repel (reverse distance squared) d = 1-sqr(1-@boostradius/sqrt(d)) z = @boostcenter + (z-@boostcenter)*d*@boostamount ELSEIF (@boostmode == 5); exponentiate origin (exponent) z = z ^ @boostamount ELSEIF (@boostmode == 6); exponentiate boost (exponent) z = (z-@boostcenter) ^ @boostamount + @boostcenter ELSEIF (@boostmode == 7); invert z = conj(iradius/(z-@boostcenter)) + @boostcenter ELSEIF (@boostmode == 8); pass through z = z + 2*(z-@boostcenter)*@boostamount ELSEIF (@boostmode == 9); pass through 2 z = z + 2*(@boostcenter-z)/cabs(@boostcenter-z)*@boostradius*@boostamount ENDIF ENDIF bailout: |z - zold| > @bailout default: title = "Orbit Boost (Nova Mandelbrot)" helpfile = "dmj-pub\dmj-pub-uf-nob.htm" center = (-0.5, 0.0) maxiter = 1000 periodicity = 0 magn = 1.5 param start caption = "Start Value" default = (1,0) hint = "Starting value for each point. You can use this to \ 'perturb' the fractal." endparam param power caption = "Exponent" default = (3,0) hint = "Overall exponent for the equation. (3,0) gives \ the classic NovaM type." endparam param bailout caption = "Bailout" default = 0.00001 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam param boostcenter caption = "Boost Center" default = (0,0) hint = "This is the location of the boost area in the complex plane." endparam param boostradius caption = "Boost Radius" default = 0.5 hint = "This is the size of the boost area." endparam param boostmode caption = "Boost Mode" default = 0 enum = "displace" "orbit origin" "orbit boost" "flip out" "repel" \ "exponentiate origin" "exponentiate boost" "invert" "pass through" \ "pass through 2" hint = "Sets the type of effect when the orbit enters the boost area." endparam param boostamount caption = "Boost Amount" default = (1,0) hint = "This is the amount to boost." endparam switch: type = "dmj-BoostNovaJulia" seed = #pixel power = @power bailout = @bailout relax = @relax boostcenter = @boostcenter boostradius = @boostradius boostmode = @boostmode boostamount = @boostamount } dmj-BoostNovaJulia { ; ; This formula is an implementation of Orbit Boosting, ; an idea by Earl Hinrichs. ; ; The basic idea is that we perform a normal Nova Julia ; iteration, but if the orbit enters a specified region ; of the complex plane (much like an orbit trap) we ; "boost" it in some fashion. A variety of boosting modes ; are included. Boost regions are ALWAYS circular in this ; implementation. ; init: float d = 0; distance to boost area float radius2 = sqr(@boostradius); pre-calc this float iradius = 1/@boostradius; pre-calc this complex zsquared = (0,0) complex zcubed = (0,0) complex zold = (0,0) z = #pixel loop: IF (@power == (3,0)); special optimized routine for power 3 zsquared = sqr(z) zcubed = zsquared * z zold = z z = z - @relax * (zcubed-1) / (3*zsquared) + @seed ELSE zold = z z = z - @relax * (z^@power-1) / (@power * z^(@power-1)) + @seed ENDIF d = |z - @boostcenter|; distance to boost area IF (d < radius2); within threshold IF (@boostmode == 0); displace (addition) z = z + @boostamount ELSEIF (@boostmode == 1); orbit origin (multiply) z = z * @boostamount ELSEIF (@boostmode == 2); orbit boost (multiply) z = (z-@boostcenter) * @boostamount + @boostcenter ELSEIF (@boostmode == 3); flip out (reverse distance) d = 2*@boostradius/sqrt(d)-1 z = @boostcenter + (z-@boostcenter)*d*@boostamount ELSEIF (@boostmode == 4); repel (reverse distance squared) d = 1-sqr(1-@boostradius/sqrt(d)) z = @boostcenter + (z-@boostcenter)*d*@boostamount ELSEIF (@boostmode == 5); exponentiate origin (exponent) z = z ^ @boostamount ELSEIF (@boostmode == 6); exponentiate boost (exponent) z = (z-@boostcenter) ^ @boostamount + @boostcenter ELSEIF (@boostmode == 7); invert z = conj(iradius/(z-@boostcenter)) + @boostcenter ELSEIF (@boostmode == 8); pass through z = z + 2*(z-@boostcenter)*@boostamount ELSEIF (@boostmode == 9); pass through 2 z = z + 2*(@boostcenter-z)/cabs(@boostcenter-z)*@boostradius*@boostamount ENDIF ENDIF bailout: |z - zold| > @bailout default: title = "Orbit Boost (Nova Julia)" helpfile = "dmj-pub\dmj-pub-uf-nob.htm" center = (0.0, 0.0) maxiter = 1000 periodicity = 0 magn = 1.5 param seed caption = "Julia Seed" default = (0,0) hint = "This is the Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param power caption = "Exponent" default = (3,0) hint = "Overall exponent for the equation. (3,0) gives \ the classic Nova type." endparam param bailout caption = "Bailout" default = 0.00001 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam param boostcenter caption = "Boost Center" default = (0,0) hint = "This is the location of the boost area in the complex plane." endparam param boostradius caption = "Boost Radius" default = 0.5 hint = "This is the size of the boost area." endparam param boostmode caption = "Boost Mode" default = 0 enum = "displace" "orbit origin" "orbit boost" "flip out" "repel" \ "exponentiate origin" "exponentiate boost" "invert" "pass through" \ "pass through 2" hint = "Sets the type of effect when the orbit enters the boost area." endparam param boostamount caption = "Boost Amount" default = (1,0) hint = "This is the amount to boost." endparam switch: type = "dmj-BoostNovaMandel" power = @power bailout = @bailout relax = @relax boostcenter = @boostcenter boostradius = @boostradius boostmode = @boostmode boostamount = @boostamount } dmj-DoubleMandel { ; ; This is based on an idea by Jim Muth. It is the ; classical Mandelbrot equation, but with two terms ; of user-specified power and weight. ; init: z = @start loop: z = @coeff1*z^@power1 + @coeff2*z^@power2 + #pixel bailout: |z| < @bailout default: title = "DoubleMandel" helpfile = "dmj-pub\dmj-pub-uf-dmj.htm" param start caption = "Start Value" default = (0,0) hint = "Starting value for each point. You can use this to \ 'perturb' the fractal." endparam param power1 caption = "Primary Exponent" default = (2,0) hint = "Defines the primary exponent for the equation." endparam param power2 caption = "Secondary Exponent" default = (-1,0) hint = "Defines the secondary exponent for the equation." endparam param coeff1 caption = "Primary Scale" default = (1,0) hint = "Defines the coefficient (multiplier) for the \ primary exponent term." endparam param coeff2 caption = "Secondary Scale" default = (1,0) hint = "Defines the coefficient (multiplier) for the \ secondary exponent term." endparam param bailout caption = "Bailout" default = 1e20 hint = "Bailout value; larger values will cause more \ iterations to be done for each point." endparam switch: type = "dmj-DoubleJulia" seed = #pixel power1 = @power1 power2 = @power2 coeff1 = @coeff1 coeff2 = @coeff2 } dmj-DoubleJulia { ; ; This is based on an idea by Jim Muth. It is the ; classical Julia equation, but with two terms of ; user-specified power and weight. ; init: z = #pixel loop: z = @coeff1*z^@power1 + @coeff2*z^@power2 + @seed bailout: |z| < @bailout default: title = "DoubleJulia" helpfile = "dmj-pub\dmj-pub-uf-dmj.htm" param seed caption = "Julia Seed" default = (0,0) hint = "This is the Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param power1 caption = "Primary Exponent" default = (2,0) hint = "Defines the primary exponent for the equation." endparam param power2 caption = "Secondary Exponent" default = (-1,0) hint = "Defines the secondary exponent for the equation." endparam param coeff1 caption = "Primary Scale" default = (1,0) hint = "Defines the coefficient (multiplier) for the \ primary exponent term." endparam param coeff2 caption = "Secondary Scale" default = (1,0) hint = "Defines the coefficient (multiplier) for the \ secondary exponent term." endparam param bailout caption = "Bailout" default = 1e20 hint = "Bailout value; larger values will cause more \ iterations to be done for each point." endparam switch: type = "dmj-DoubleMandel" power1 = @power1 power2 = @power2 coeff1 = @coeff1 coeff2 = @coeff2 } dmj-DNovaMandel { ; ; This is the DoubleNova fractal (Mandelbrot form), ; a modified Newtonian-style fractal. DoubleNova is ; like Nova, but with two terms instead of one. ; init: complex zold = (0,0) z = @start IF (@usecritical) z = ( -((@power2-1)*@power2*@coeff2) / \ ((@power1-1)*@power1*@coeff1) ) ^ (1/(@power1-@power2)) ENDIF loop: zold = z z = z - (@coeff1*z^@power1 + @coeff2*z^@power2 - 1) * @relax / \ (@coeff1*@power1*z^(@power1-1) + @coeff2*@power2*z^(@power2-1)) + #pixel bailout: |z - zold| > @bailout default: title = "DoubleNova (Mandelbrot)" helpfile = "dmj-pub\dmj-pub-uf-dn.htm" maxiter = 1000 periodicity = 0 center = (-0.5,0) magn = 1.5 param start caption = "Start Value" default = (1,0) hint = "Starting value for each point. You can use this to \ 'perturb' the fractal." endparam param power1 caption = "Primary Exponent" default = (4,0) hint = "Defines the primary exponent for the equation." endparam param power2 caption = "Secondary Exponent" default = (2,0) hint = "Defines the secondary exponent for the equation." endparam param coeff1 caption = "Primary Scale" default = (1,0) hint = "Defines the coefficient (multiplier) for the \ primary exponent term." endparam param coeff2 caption = "Secondary Scale" default = (-3,0) hint = "Defines the coefficient (multiplier) for the \ secondary exponent term." endparam param bailout caption = "Bailout" default = 0.00001 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam param usecritical caption = "Use Critical Point" default = false hint = "If set, a critical point for the function will \ be used in place of the Start Value." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam switch: type = "dmj-DNovaJulia" seed = #pixel power1 = @power1 power2 = @power2 coeff1 = @coeff1 coeff2 = @coeff2 bailout = @bailout relax = @relax } dmj-DNovaJulia { ; ; This is the DoubleNova fractal (Julia form), a ; modified Newtonian-style fractal. DoubleNova is ; like Nova, but with two terms instead of one. ; init: complex zold = (0,0) z = #pixel loop: zold = z z = z - (@coeff1*z^@power1 + @coeff2*z^@power2 - 1) * @relax / \ (@coeff1*@power1*z^(@power1-1) + @coeff2*@power2*z^(@power2-1)) + @seed bailout: |z - zold| > @bailout default: title = "DoubleNova (Julia)" helpfile = "dmj-pub\dmj-pub-uf-dn.htm" maxiter = 1000 periodicity = 0 center = (0,0) magn = 1.5 param seed caption = "Julia Seed" default = (0,0) hint = "This is the Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param power1 caption = "Primary Exponent" default = (4,0) hint = "Defines the primary exponent for the equation." endparam param power2 caption = "Secondary Exponent" default = (2,0) hint = "Defines the secondary exponent for the equation." endparam param coeff1 caption = "Primary Scale" default = (1,0) hint = "Defines the coefficient (multiplier) for the \ primary exponent term." endparam param coeff2 caption = "Secondary Scale" default = (-2,0) hint = "Defines the coefficient (multiplier) for the \ secondary exponent term." endparam param bailout caption = "Bailout" default = 0.00001 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam switch: type = "dmj-DNovaMandel" power1 = @power1 power2 = @power2 coeff1 = @coeff1 coeff2 = @coeff2 bailout = @bailout relax = @relax } dmj-DHNovaMandel { ; ; This is the DoubleHalleyNova fractal (Mandelbrot form), ; a modified Newtonian-style fractal. DoubleHalleyNova is ; like HalleyNova, but with two terms instead of one. ; init: complex zold = (0,0) complex fz = (0,0) complex f1z = (0,0) complex f2z = (0,0) z = @start ; IF (@usecritical) ; ENDIF loop: zold = z fz = @coeff1*z^@power1 + @coeff2*z^@power2 - 1 f1z = @coeff1*@power1*z^(@power1-1) + @coeff2*@power2*z^(@power2-1) f2z = @coeff1*@power1*(@power1-1)*z^(@power1-2) + @coeff2*@power2*(@power2-1)*z^(@power2-2) z = z - @relax * (2*fz*f1z) / (2*f1z^2 - fz*f2z) + #pixel bailout: |z - zold| > @bailout default: title = "DoubleHalleyNova (Mandelbrot)" helpfile = "dmj-pub\dmj-pub-uf-dhn.htm" maxiter = 1000 periodicity = 0 center = (-0.5,0) magn = 1.5 param start caption = "Start Value" default = (1,0) hint = "Starting value for each point. You can use this to \ 'perturb' the fractal." endparam param power1 caption = "Primary Exponent" default = (4,0) hint = "Defines the primary exponent for the equation." endparam param power2 caption = "Secondary Exponent" default = (2,0) hint = "Defines the secondary exponent for the equation." endparam param coeff1 caption = "Primary Scale" default = (1,0) hint = "Defines the coefficient (multiplier) for the \ primary exponent term." endparam param coeff2 caption = "Secondary Scale" default = (-3,0) hint = "Defines the coefficient (multiplier) for the \ secondary exponent term." endparam param bailout caption = "Bailout" default = 0.00001 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam ; param usecritical ; caption = "Use Critical Point" ; default = false ; hint = "If set, a critical point for the function will \ ; be used in place of the Start Value." ; endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam switch: type = "dmj-DHNovaJulia" seed = #pixel power1 = @power1 power2 = @power2 coeff1 = @coeff1 coeff2 = @coeff2 bailout = @bailout relax = @relax } dmj-DHNovaJulia { ; ; This is the DoubleHalleyNova fractal (Julia form), a ; modified Newtonian-style fractal. DoubleHalleyNova is ; like HalleyNova, but with two terms instead of one. ; init: complex zold = (0,0) complex fz = (0,0) complex f1z = (0,0) complex f2z = (0,0) z = #pixel loop: zold = z fz = @coeff1*z^@power1 + @coeff2*z^@power2 - 1 f1z = @coeff1*@power1*z^(@power1-1) + @coeff2*@power2*z^(@power2-1) f2z = @coeff1*@power1*(@power1-1)*z^(@power1-2) + @coeff2*@power2*(@power2-1)*z^(@power2-2) z = z - @relax * (2*fz*f1z) / (2*f1z^2 - fz*f2z) + @seed bailout: |z - zold| > @bailout default: title = "DoubleHalleyNova (Julia)" helpfile = "dmj-pub\dmj-pub-uf-dhn.htm" maxiter = 1000 periodicity = 0 center = (0,0) magn = 1.5 param seed caption = "Julia Seed" default = (0,0) hint = "This is the Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param power1 caption = "Primary Exponent" default = (4,0) hint = "Defines the primary exponent for the equation." endparam param power2 caption = "Secondary Exponent" default = (2,0) hint = "Defines the secondary exponent for the equation." endparam param coeff1 caption = "Primary Scale" default = (1,0) hint = "Defines the coefficient (multiplier) for the \ primary exponent term." endparam param coeff2 caption = "Secondary Scale" default = (-2,0) hint = "Defines the coefficient (multiplier) for the \ secondary exponent term." endparam param bailout caption = "Bailout" default = 0.00001 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam switch: type = "dmj-DHNovaMandel" power1 = @power1 power2 = @power2 coeff1 = @coeff1 coeff2 = @coeff2 bailout = @bailout relax = @relax } dmj-fBmMandel { ; ; This is the basic Mandelbrot type, but with a ; bit of fBm noise added at each iteration. This ; tends to distort the fractal beyond all recognition ; after just a few iterations, which may or may not ; be what you're looking for. ; ; You can also use the "Coloring Only" option to ; restrict the fBm distortion to the value passed ; to the coloring algorithm; the distortion will be ; removed before the next iteration is calculated. ; init: z = @start complex oz = z complex c = @distcenter IF (@centermove) c = #center ENDIF complex r = (0,1) ^ (@angle / 90.0) complex r2 = (0,1) ^ (@anglestep / 90.0) complex r3 = (0,1) ^ (@distangle / 90.0) float fiter = @noisestart BOOL noise = false loop: IF (@noiseskip != 0); we are skipping some iterations fiter = fiter - 1; one less to go before we add noise WHILE (fiter < 0.0); iterations all used up IF (noise); we are currently adding noise noise = false; so stop fiter = fiter + @noiseskip; skip this many iterations ELSE; we aren't currently adding noise noise = true; so start fiter = fiter + @noiseiter; do this many iterations ENDIF ENDWHILE ENDIF IF (@coloronly); only using fBm on coloring z = oz; restore z from un-fBm'ed copy ENDIF z = z^@power + #pixel; do Mandelbrot iteration IF (@coloronly); only using fBm on coloring oz = z ENDIF IF (@noiseskip == 0.0 || noise); adding noise this iteration complex p = z * @scale * r + @offset float sum = 0.0 float freq = 1.0 complex v = (0,0) int i = @octaves 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 ; create a "random" index for each corner ; (this is where Intel's version differs from Perlin's; ; I used Intel's version because it doesn't require a ; pre-computed random table, which is difficult to manage ; in UF.) float b00 = (bx0^@npower % 65536 + by0)^@npower % 65536 float b10 = (bx1^@npower % 65536 + by0)^@npower % 65536 float b01 = (bx0^@npower % 65536 + by1)^@npower % 65536 float b11 = (bx1^@npower % 65536 + by1)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0 = (b00)^@npower*0.25 % 512 - 256 float g_b10_0 = (b10)^@npower*0.25 % 512 - 256 float g_b01_0 = (b01)^@npower*0.25 % 512 - 256 float g_b11_0 = (b11)^@npower*0.25 % 512 - 256 float g_b00_1 = (b00+1)^@npower*0.25 % 512 - 256 float g_b10_1 = (b10+1)^@npower*0.25 % 512 - 256 float g_b01_1 = (b01+1)^@npower*0.25 % 512 - 256 float g_b11_1 = (b11+1)^@npower*0.25 % 512 - 256 ; normalize each vector 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 ; produce colors for each corner 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 ; interpolate between corners using ; bilinear filtering 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 * @step p = p * r2 / @step i = i - 1 ENDWHILE IF (@style == 0); radial distortion v = (z-c)/cabs(z-c) * r3; use vector based on angle to distortion center ELSEIF (@style == 1); linear distortion v = r3; just use rotation vector ENDIF z = z + v * sum*0.5*@distortion ENDIF IF (@coloronly == false); not just using fBm on coloring oz = z; value for bailout is fBm'ed z ENDIF bailout: |oz| < @bailout default: title = "Mandelbrot + fBm" helpfile = "dmj-pub\dmj-pub-uf-mjf.htm" center = (-0.5,0) magn = 1.0 param start caption = "Start Value" default = (0,0) hint = "Starting value for each point. You can use this to \ 'perturb' the fractal." endparam param power caption = "Exponent" default = (2,0) hint = "Overall exponent for the equation. (2,0) gives \ the classic Mandelbrot type." endparam param bailout caption = "Bailout" default = 1.0e20 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Mandelbrot set anymore." endparam param distortion caption = "Distortion Strength" default = 1.0 hint = "This is the amount the noise distorts the image." endparam param style caption = "Distortion Style" default = 0 enum = "radial" "linear" hint = "This selects whether the distortion will be focused \ around a single point, or directed along a line." endparam param distangle caption = "Distortion Angle" default = 0.0 hint = "This is the angle to rotate the distortion." endparam param distcenter caption = "Distortion Center" default = (0,0) hint = "Sets the center of distortion. If Use Screen \ Center is set, this item is ignored." endparam param centermove caption = "Use Screen Center" default = FALSE hint = "If set, distortion will be around the center of \ the window, regardless of the Distortion Center \ setting." endparam param offset caption = "Noise Offset" default = (0,0) hint = "This is the offset of the pattern. You can use this to shift \ the pattern around on the complex plane." endparam param scale caption = "Noise Scale" default = 1.0 hint = "This is the overall scale of the noise." endparam param angle caption = "Noise Rotation" default = 0.0 hint = "This is the angle, in degrees, of the noise." endparam param step caption = "Noise Scale Step" default = 0.5 hint = "This is the step in scale between noise iterations." endparam param anglestep caption = "Noise Rotation Step" default = 37.0 hint = "This is the angle, in degrees, to rotate between noise \ iterations." endparam param octaves caption = "Noise Octaves" default = 7 min = 1 hint = "This is the number of iterations of the noise formula." endparam param npower caption = "Noise Exponent" default = 2.0 hint = "This is the exponent used to scramble numbers." endparam param noisestart caption = "Start Iteration" default = 0.0 hint = "This is the iteration at which to start adding noise." endparam param noiseiter caption = "Noise Iterations" default = 10000.0 hint = "This is the number of iterations to add noise to." endparam param noiseskip caption = "Skip Iterations" default = 0.0 hint = "This is the number of iterations to skip adding noise \ before starting again." endparam param coloronly caption = "Coloring Only" default = false hint = "If set, noise will only apply to pixel values passed \ to the coloring algorithm; it will not be included in \ the fractal calculation between iterations." endparam switch: type = "dmj-fBmJulia" seed = #pixel power = @power bailout = @bailout distortion = @distortion style = @style distangle = @distangle distcenter = @distcenter centermove = @centermove offset = @offset scale = @scale angle = @angle step = @step anglestep = @anglestep octaves = @octaves npower = @npower noisestart = @noisestart noiseiter = @noiseiter noiseskip = @noiseskip coloronly = @coloronly } dmj-fBmJulia { ; ; This is the basic Julia type, but with a ; bit of fBm noise added at each iteration. This ; tends to distort the fractal beyond all recognition ; after just a few iterations, which may or may not ; be what you're looking for. ; ; You can also use the "Coloring Only" option to ; restrict the fBm distortion to the value passed ; to the coloring algorithm; the distortion will be ; removed before the next iteration is calculated. ; init: z = #pixel complex oz = z complex c = @distcenter IF (@centermove) c = #center ENDIF complex r = (0,1) ^ (@angle / 90.0) complex r2 = (0,1) ^ (@anglestep / 90.0) complex r3 = (0,1) ^ (@distangle / 90.0) float fiter = @noisestart BOOL noise = false loop: IF (@noiseskip != 0); we are skipping some iterations fiter = fiter - 1; one less to go before we add noise WHILE (fiter < 0.0); iterations all used up IF (noise); we are currently adding noise noise = false; so stop fiter = fiter + @noiseskip; skip this many iterations ELSE; we aren't currently adding noise noise = true; so start fiter = fiter + @noiseiter; do this many iterations ENDIF ENDWHILE ENDIF IF (@coloronly); only using fBm on coloring z = oz; restore z from un-fBm'ed copy ENDIF z = z^@power + @seed; do Julia iteration IF (@coloronly); only using fBm on coloring oz = z ENDIF IF (@noiseskip == 0.0 || noise); adding noise this iteration complex p = z * @scale * r + @offset float sum = 0.0 float freq = 1.0 complex v = (0,0) int i = @octaves 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 ; create a "random" index for each corner ; (this is where Intel's version differs from Perlin's; ; I used Intel's version because it doesn't require a ; pre-computed random table, which is difficult to manage ; in UF.) float b00 = (bx0^@npower % 65536 + by0)^@npower % 65536 float b10 = (bx1^@npower % 65536 + by0)^@npower % 65536 float b01 = (bx0^@npower % 65536 + by1)^@npower % 65536 float b11 = (bx1^@npower % 65536 + by1)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0 = (b00)^@npower*0.25 % 512 - 256 float g_b10_0 = (b10)^@npower*0.25 % 512 - 256 float g_b01_0 = (b01)^@npower*0.25 % 512 - 256 float g_b11_0 = (b11)^@npower*0.25 % 512 - 256 float g_b00_1 = (b00+1)^@npower*0.25 % 512 - 256 float g_b10_1 = (b10+1)^@npower*0.25 % 512 - 256 float g_b01_1 = (b01+1)^@npower*0.25 % 512 - 256 float g_b11_1 = (b11+1)^@npower*0.25 % 512 - 256 ; normalize each vector 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 ; produce colors for each corner 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 ; interpolate between corners using ; bilinear filtering 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 * @step p = p * r2 / @step i = i - 1 ENDWHILE IF (@style == 0); radial distortion v = (z-c)/cabs(z-c) * r3; use vector based on angle to distortion center ELSEIF (@style == 1); linear distortion v = r3; just use rotation vector ENDIF z = z + v * sum*0.5*@distortion ENDIF IF (@coloronly == false); not just using fBm on coloring oz = z; value for bailout is fBm'ed z ENDIF bailout: |oz| < @bailout default: title = "Julia + fBm" helpfile = "dmj-pub\dmj-pub-uf-mjf.htm" center = (-0.5,0) magn = 1.0 param seed caption = "Julia Seed" default = (0,0) hint = "This is the Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param power caption = "Exponent" default = (2,0) hint = "Overall exponent for the equation. (2,0) gives \ the classic Julia type." endparam param bailout caption = "Bailout" default = 1.0e20 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Julia set anymore." endparam param distortion caption = "Distortion Strength" default = 1.0 hint = "This is the amount the noise distorts the image." endparam param style caption = "Distortion Style" default = 0 enum = "radial" "linear" hint = "This selects whether the distortion will be focused \ around a single point, or directed along a line." endparam param distangle caption = "Distortion Angle" default = 0.0 hint = "This is the angle to rotate the distortion." endparam param distcenter caption = "Distortion Center" default = (0,0) hint = "Sets the center of distortion. If Use Screen \ Center is set, this item is ignored." endparam param centermove caption = "Use Screen Center" default = FALSE hint = "If set, distortion will be around the center of \ the window, regardless of the Distortion Center \ setting." endparam param offset caption = "Noise Offset" default = (0,0) hint = "This is the offset of the pattern. You can use this to shift \ the pattern around on the complex plane." endparam param scale caption = "Noise Scale" default = 1.0 hint = "This is the overall scale of the noise." endparam param angle caption = "Noise Rotation" default = 0.0 hint = "This is the angle, in degrees, of the noise." endparam param step caption = "Noise Scale Step" default = 0.5 hint = "This is the step in scale between noise iterations." endparam param anglestep caption = "Noise Rotation Step" default = 37.0 hint = "This is the angle, in degrees, to rotate between noise \ iterations." endparam param octaves caption = "Noise Octaves" default = 7 min = 1 hint = "This is the number of iterations of the noise formula." endparam param npower caption = "Noise Exponent" default = 2.0 hint = "This is the exponent used to scramble numbers." endparam param noisestart caption = "Start Iteration" default = 0.0 hint = "This is the iteration at which to start adding noise." endparam param noiseiter caption = "Noise Iterations" default = 10000.0 hint = "This is the number of iterations to add noise to." endparam param noiseskip caption = "Skip Iterations" default = 0.0 hint = "This is the number of iterations to skip adding noise \ before starting again." endparam param coloronly caption = "Coloring Only" default = false hint = "If set, noise will only apply to pixel values passed \ to the coloring algorithm; it will not be included in \ the fractal calculation between iterations." endparam switch: type = "dmj-fBmMandel" power = @power bailout = @bailout distortion = @distortion style = @style distangle = @distangle distcenter = @distcenter centermove = @centermove offset = @offset scale = @scale angle = @angle step = @step anglestep = @anglestep octaves = @octaves npower = @npower noisestart = @noisestart noiseiter = @noiseiter noiseskip = @noiseskip coloronly = @coloronly } dmj-fBmNovaMandel { ; ; This is the basic Nova (Mandelbrot) type, but with a ; bit of fBm noise added at each iteration. This ; tends to distort the fractal beyond all recognition ; after just a few iterations, which may or may not ; be what you're looking for. ; ; You can also use the "Coloring Only" option to ; restrict the fBm distortion to the value passed ; to the coloring algorithm; the distortion will be ; removed before the next iteration is calculated. ; init: complex zsquared = (0,0) complex zcubed = (0,0) complex zold = (0,0) z = @start complex oz = z complex c = @distcenter IF (@centermove) c = #center ENDIF complex r = (0,1) ^ (@angle / 90.0) complex r2 = (0,1) ^ (@anglestep / 90.0) complex r3 = (0,1) ^ (@distangle / 90.0) float fiter = @noisestart BOOL noise = false loop: IF (@noiseskip != 0); we are skipping some iterations fiter = fiter - 1; one less to go before we add noise WHILE (fiter < 0.0); iterations all used up IF (noise); we are currently adding noise noise = false; so stop fiter = fiter + @noiseskip; skip this many iterations ELSE; we aren't currently adding noise noise = true; so start fiter = fiter + @noiseiter; do this many iterations ENDIF ENDWHILE ENDIF IF (@coloronly); only using fBm on coloring z = oz; restore z from un-fBm'ed copy ENDIF IF (@power == (3,0)); special optimized routine for power 3 zsquared = sqr(z) zcubed = zsquared * z zold = z z = z - @relax * (zcubed-1) / (3*zsquared) + #pixel ELSE zold = z z = z - @relax * (z^@power-1) / (@power * z^(@power-1)) + #pixel ENDIF IF (@coloronly); only using fBm on coloring oz = z ENDIF IF (@noiseskip == 0.0 || noise); adding noise this iteration complex p = z * @scale * r ;+ @offset float sum = 0.0 float freq = 1.0 complex v = (0,0) int i = @octaves 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 ; create a "random" index for each corner ; (this is where Intel's version differs from Perlin's; ; I used Intel's version because it doesn't require a ; pre-computed random table, which is difficult to manage ; in UF.) float b00 = (bx0^@npower % 65536 + by0)^@npower % 65536 float b10 = (bx1^@npower % 65536 + by0)^@npower % 65536 float b01 = (bx0^@npower % 65536 + by1)^@npower % 65536 float b11 = (bx1^@npower % 65536 + by1)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0 = (b00)^@npower*0.25 % 512 - 256 float g_b10_0 = (b10)^@npower*0.25 % 512 - 256 float g_b01_0 = (b01)^@npower*0.25 % 512 - 256 float g_b11_0 = (b11)^@npower*0.25 % 512 - 256 float g_b00_1 = (b00+1)^@npower*0.25 % 512 - 256 float g_b10_1 = (b10+1)^@npower*0.25 % 512 - 256 float g_b01_1 = (b01+1)^@npower*0.25 % 512 - 256 float g_b11_1 = (b11+1)^@npower*0.25 % 512 - 256 ; normalize each vector 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 ; produce colors for each corner 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 ; interpolate between corners using ; bilinear filtering 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 * @step p = p * r2 / @step i = i - 1 ENDWHILE IF (@style == 0); radial distortion v = (z-c)/cabs(z-c) * r3; use vector based on angle to distortion center ELSEIF (@style == 1); linear distortion v = r3; just use rotation vector ENDIF z = z + v * sum*0.5*@distortion ENDIF IF (@coloronly == false); not just using fBm on coloring oz = z; value for bailout is fBm'ed z ENDIF bailout: |oz - zold| > @bailout default: title = "Nova (Mandelbrot) + fBm" helpfile = "dmj-pub\dmj-pub-uf-nf.htm" maxiter = 1000 periodicity = 0 center = (-0.5,0) magn = 1.5 param start caption = "Start Value" default = (1,0) hint = "Starting value for each point. You can use this to \ 'perturb' the fractal." endparam param power caption = "Exponent" default = (3,0) hint = "Overall exponent for the equation. (3,0) gives \ the classic NovaM type." endparam param bailout caption = "Bailout" default = 0.00001 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam param distortion caption = "Distortion Strength" default = 1.0 hint = "This is the amount the noise distorts the image." endparam param style caption = "Distortion Style" default = 0 enum = "radial" "linear" hint = "This selects whether the distortion will be focused \ around a single point, or directed along a line." endparam param distangle caption = "Distortion Angle" default = 0.0 hint = "This is the angle to rotate the distortion." endparam param distcenter caption = "Distortion Center" default = (0,0) hint = "Sets the center of distortion. If Use Screen \ Center is set, this item is ignored." endparam param centermove caption = "Use Screen Center" default = FALSE hint = "If set, distortion will be around the center of \ the window, regardless of the Distortion Center \ setting." endparam param offset caption = "Noise Offset" default = (0,0) hint = "This is the offset of the pattern. You can use this to shift \ the pattern around on the complex plane." endparam param scale caption = "Noise Scale" default = 1.0 hint = "This is the overall scale of the noise." endparam param angle caption = "Noise Rotation" default = 0.0 hint = "This is the angle, in degrees, of the noise." endparam param step caption = "Noise Scale Step" default = 0.5 hint = "This is the step in scale between noise iterations." endparam param anglestep caption = "Noise Rotation Step" default = 37.0 hint = "This is the angle, in degrees, to rotate between noise \ iterations." endparam param octaves caption = "Noise Octaves" default = 7 min = 1 hint = "This is the number of iterations of the noise formula." endparam param npower caption = "Noise Exponent" default = 2.0 hint = "This is the exponent used to scramble numbers." endparam param noisestart caption = "Start Iteration" default = 0.0 hint = "This is the iteration at which to start adding noise." endparam param noiseiter caption = "Noise Iterations" default = 10000.0 hint = "This is the number of iterations to add noise to." endparam param noiseskip caption = "Skip Iterations" default = 0.0 hint = "This is the number of iterations to skip adding noise \ before starting again." endparam param coloronly caption = "Coloring Only" default = false hint = "If set, noise will only apply to pixel values passed \ to the coloring algorithm; it will not be included in \ the fractal calculation between iterations." endparam switch: type = "dmj-fBmNovaJulia" seed = #pixel power = @power bailout = @bailout relax = @relax distortion = @distortion style = @style distangle = @distangle distcenter = @distcenter centermove = @centermove offset = @offset scale = @scale angle = @angle step = @step anglestep = @anglestep octaves = @octaves npower = @npower noisestart = @noisestart noiseiter = @noiseiter noiseskip = @noiseskip coloronly = @coloronly } dmj-fBmNovaJulia { ; ; This is the basic Nova (Mandelbrot) type, but with a ; bit of fBm noise added at each iteration. This ; tends to distort the fractal beyond all recognition ; after just a few iterations, which may or may not ; be what you're looking for. ; ; You can also use the "Coloring Only" option to ; restrict the fBm distortion to the value passed ; to the coloring algorithm; the distortion will be ; removed before the next iteration is calculated. ; init: complex zsquared = (0,0) complex zcubed = (0,0) complex zold = (0,0) z = #pixel complex oz = z complex c = @distcenter IF (@centermove) c = #center ENDIF complex r = (0,1) ^ (@angle / 90.0) complex r2 = (0,1) ^ (@anglestep / 90.0) complex r3 = (0,1) ^ (@distangle / 90.0) float fiter = @noisestart BOOL noise = false loop: IF (@noiseskip != 0); we are skipping some iterations fiter = fiter - 1; one less to go before we add noise WHILE (fiter < 0.0); iterations all used up IF (noise); we are currently adding noise noise = false; so stop fiter = fiter + @noiseskip; skip this many iterations ELSE; we aren't currently adding noise noise = true; so start fiter = fiter + @noiseiter; do this many iterations ENDIF ENDWHILE ENDIF IF (@coloronly); only using fBm on coloring z = oz; restore z from un-fBm'ed copy ENDIF IF (@power == (3,0)); special optimized routine for power 3 zsquared = sqr(z) zcubed = zsquared * z zold = z z = z - @relax * (zcubed-1) / (3*zsquared) + @seed ELSE zold = z z = z - @relax * (z^@power-1) / (@power * z^(@power-1)) + @seed ENDIF IF (@coloronly); only using fBm on coloring oz = z ENDIF IF (@noiseskip == 0.0 || noise); adding noise this iteration complex p = z * @scale * r + @offset float sum = 0.0 float freq = 1.0 complex v = (0,0) int i = @octaves 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 ; create a "random" index for each corner ; (this is where Intel's version differs from Perlin's; ; I used Intel's version because it doesn't require a ; pre-computed random table, which is difficult to manage ; in UF.) float b00 = (bx0^@npower % 65536 + by0)^@npower % 65536 float b10 = (bx1^@npower % 65536 + by0)^@npower % 65536 float b01 = (bx0^@npower % 65536 + by1)^@npower % 65536 float b11 = (bx1^@npower % 65536 + by1)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0 = (b00)^@npower*0.25 % 512 - 256 float g_b10_0 = (b10)^@npower*0.25 % 512 - 256 float g_b01_0 = (b01)^@npower*0.25 % 512 - 256 float g_b11_0 = (b11)^@npower*0.25 % 512 - 256 float g_b00_1 = (b00+1)^@npower*0.25 % 512 - 256 float g_b10_1 = (b10+1)^@npower*0.25 % 512 - 256 float g_b01_1 = (b01+1)^@npower*0.25 % 512 - 256 float g_b11_1 = (b11+1)^@npower*0.25 % 512 - 256 ; normalize each vector 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 ; produce colors for each corner 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 ; interpolate between corners using ; bilinear filtering 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 * @step p = p * r2 / @step i = i - 1 ENDWHILE IF (@style == 0); radial distortion v = (z-c)/cabs(z-c) * r3; use vector based on angle to distortion center ELSEIF (@style == 1); linear distortion v = r3; just use rotation vector ENDIF z = z + v * sum*0.5*@distortion ENDIF IF (@coloronly == false); not just using fBm on coloring oz = z; value for bailout is fBm'ed z ENDIF bailout: |oz - zold| > @bailout default: title = "Nova (Julia) + fBm" helpfile = "dmj-pub\dmj-pub-uf-nf.htm" maxiter = 1000 periodicity = 0 center = (0,0) magn = 1.5 param seed caption = "Julia Seed" default = (0,0) hint = "This is the Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param power caption = "Exponent" default = (3,0) hint = "Overall exponent for the equation. (3,0) gives \ the classic Nova type." endparam param bailout caption = "Bailout" default = 0.00001 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam param distortion caption = "Distortion Strength" default = 1.0 hint = "This is the amount the noise distorts the image." endparam param style caption = "Distortion Style" default = 0 enum = "radial" "linear" hint = "This selects whether the distortion will be focused \ around a single point, or directed along a line." endparam param distangle caption = "Distortion Angle" default = 0.0 hint = "This is the angle to rotate the distortion." endparam param distcenter caption = "Distortion Center" default = (0,0) hint = "Sets the center of distortion. If Use Screen \ Center is set, this item is ignored." endparam param centermove caption = "Use Screen Center" default = FALSE hint = "If set, distortion will be around the center of \ the window, regardless of the Distortion Center \ setting." endparam param offset caption = "Noise Offset" default = (0,0) hint = "This is the offset of the pattern. You can use this to shift \ the pattern around on the complex plane." endparam param scale caption = "Noise Scale" default = 1.0 hint = "This is the overall scale of the noise." endparam param angle caption = "Noise Rotation" default = 0.0 hint = "This is the angle, in degrees, of the noise." endparam param step caption = "Noise Scale Step" default = 0.5 hint = "This is the step in scale between noise iterations." endparam param anglestep caption = "Noise Rotation Step" default = 37.0 hint = "This is the angle, in degrees, to rotate between noise \ iterations." endparam param octaves caption = "Noise Octaves" default = 7 min = 1 hint = "This is the number of iterations of the noise formula." endparam param npower caption = "Noise Exponent" default = 2.0 hint = "This is the exponent used to scramble numbers." endparam param noisestart caption = "Start Iteration" default = 0.0 hint = "This is the iteration at which to start adding noise." endparam param noiseiter caption = "Noise Iterations" default = 10000.0 hint = "This is the number of iterations to add noise to." endparam param noiseskip caption = "Skip Iterations" default = 0.0 hint = "This is the number of iterations to skip adding noise \ before starting again." endparam param coloronly caption = "Coloring Only" default = false hint = "If set, noise will only apply to pixel values passed \ to the coloring algorithm; it will not be included in \ the fractal calculation between iterations." endparam switch: type = "dmj-fBmNovaMandel" power = @power bailout = @bailout relax = @relax distortion = @distortion style = @style distangle = @distangle distcenter = @distcenter centermove = @centermove offset = @offset scale = @scale angle = @angle step = @step anglestep = @anglestep octaves = @octaves npower = @npower noisestart = @noisestart noiseiter = @noiseiter noiseskip = @noiseskip coloronly = @coloronly } dmj-HNovaIMandel { ; ; This is the Halley Nova fractal (Mandelbrot ; form), a modified Halley-style fractal. This ; is an adaptation of Paul Derbyshire's Halley ; Nova formulas for FractInt, which are based ; on his "Nova" formulas derived from classical ; Newton's Method fractals. ; ; This variant uses Kerry Mitchell's inverted ; computation so that it works with coloring ; methods expecting divergent z. ; init: complex nsquaredplusn = sqr(@power) + @power complex nsquaredminusn = sqr(@power) - @power complex zton = (0,0) complex zcurrent = @start z = (0,0) loop: zton = zcurrent^@power z = (2*@power*zcurrent * (zton-1)) * @relax /\ (nsquaredplusn*zton + nsquaredminusn) - #pixel zcurrent = zcurrent - z z = 1/z IF (@fudge == true &&\ |z| > 4); fudging angle z = z * zcurrent/cabs(zcurrent) ENDIF bailout: |z| < @bailout default: title = "HalleyNova-I (Mandelbrot)" helpfile = "dmj-pub\dmj-pub-uf-hni.htm" maxiter = 1000 periodicity = 0 center = (0,0) magn = 1.5 param start caption = "Start Value" default = (1,0) hint = "Starting value for each point. You can use this to \ 'perturb' the fractal." endparam param power caption = "Exponent" default = (3,0) hint = "Overall exponent for the equation. (3,0) gives \ the classic NovaM type." endparam param bailout caption = "Bailout" default = 10000.0 hint = "Bailout value; larger values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam param fudge caption = "Fudge z Angle" default = false hint = "Modifies angle of z based on starting point. \ Turning this on will make decomposition more \ consistent between iterations, regardless of \ the root converged on." endparam switch: type = "dmj-HNovaIJulia" seed = #pixel power = @power bailout = @bailout relax = @relax fudge = @fudge } dmj-HNovaIJulia { ; ; This is the Halley Nova fractal (Julia form), ; a modified Halley-style fractal. This is an ; adaptation of Paul Derbyshire's Halley Nova ; formulas for FractInt, which are based on his ; "Nova" formulas derived from classical ; Newton's Method fractals. ; ; This variant uses Kerry Mitchell's inverted ; computation so that it works with coloring ; methods expecting divergent z. ; init: complex nsquaredplusn = sqr(@power) + @power complex nsquaredminusn = sqr(@power) - @power complex zton = (0,0) complex zcurrent = #pixel z = (0,0) loop: zton = zcurrent^@power z = (2*@power*zcurrent * (zton-1)) * @relax /\ (nsquaredplusn*zton + nsquaredminusn) - @seed zcurrent = zcurrent - z z = 1/z IF (@fudge == true &&\ |z| > 4); fudging angle z = z * zcurrent/cabs(zcurrent) ENDIF bailout: |z| < @bailout default: title = "HalleyNova-I (Julia)" helpfile = "dmj-pub\dmj-pub-uf-hni.htm" maxiter = 1000 periodicity = 0 center = (0,0) magn = 1.5 param seed caption = "Julia Seed" default = (0,0) hint = "This is the Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param power caption = "Exponent" default = (3,0) hint = "Overall exponent for the equation. (3,0) gives \ the classic NovaM type." endparam param bailout caption = "Bailout" default = 10000.0 hint = "Bailout value; larger values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam param fudge caption = "Fudge z Angle" default = false hint = "Modifies angle of z based on starting point. \ Turning this on will make decomposition more \ consistent between iterations, regardless of \ the root converged on." endparam switch: type = "dmj-HNovaIMandel" power = @power bailout = @bailout relax = @relax fudge = @fudge } dmj-HNovaMandel { ; ; This is the Halley Nova fractal (Mandelbrot ; form), a modified Halley-style fractal. This ; is an adaptation of Paul Derbyshire's Halley ; Nova formulas for FractInt, which are based ; on his "Nova" formulas derived from classical ; Newton's Method fractals. ; init: complex nsquaredplusn = sqr(@power) + @power complex nsquaredminusn = sqr(@power) - @power complex zton = (0,0) complex zold = (0,0) z = @start loop: zold = z zton = z^@power z = z - (2*@power*z * (zton-1)) * @relax / \ (nsquaredplusn*zton + nsquaredminusn) + #pixel bailout: |z - zold| > @bailout default: title = "HalleyNova (Mandelbrot)" helpfile = "dmj-pub\dmj-pub-uf-hn.htm" maxiter = 1000 periodicity = 0 center = (-0.5,0) magn = 1.0 param start caption = "Start Value" default = (1,0) hint = "Starting value for each point. You can use this to \ 'perturb' the fractal." endparam param power caption = "Exponent" default = (3,0) hint = "Overall exponent for the equation. (3,0) gives \ the classic HalleyNovaM type." endparam param bailout caption = "Bailout" default = 0.00001 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam switch: type = "dmj-HNovaJulia" seed = #pixel power = @power bailout = @bailout relax = @relax } dmj-HNovaJulia { ; ; This is the Halley Nova fractal (Julia form), ; a modified Halley-style fractal. This is an ; adaptation of Paul Derbyshire's Halley Nova ; formulas for FractInt, which are based on his ; "Nova" formulas derived from classical ; Newton's Method fractals. ; init: complex nsquaredplusn = sqr(@power) + @power complex nsquaredminusn = sqr(@power) - @power complex zton = (0,0) complex zold = (0,0) z = #pixel loop: zold = z zton = z^@power z = z - (2*@power*z * (zton-1)) * @relax /\ (nsquaredplusn*zton + nsquaredminusn) + @seed bailout: |z - zold| > @bailout default: title = "HalleyNova (Julia)" helpfile = "dmj-pub\dmj-pub-uf-hn.htm" maxiter = 1000 periodicity = 0 center = (0,0) magn = 0.5 param seed caption = "Julia Seed" default = (0,0) hint = "This is the Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param power caption = "Exponent" default = (3,0) hint = "Overall exponent for the equation. (3,0) gives \ the classic HalleyNovaJ type." endparam param bailout caption = "Bailout" default = 0.00001 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam switch: type = "dmj-HNovaMandel" power = @power bailout = @bailout relax = @relax } dmj-IMandel { ; ; This is a modified Mandelbrot formula which ; returns 1/z in z. This is useful for coloring ; algorithms which expect convergent orbits. ; init: IF (@start == (0,0)) #z = 1 / (#pixel-@invcenter) ELSE #z = 1 / (@start-@invcenter) ENDIF complex z2 = (0,0) complex z3 = (0,0) loop: #z = 1/#z + @invcenter IF (@invdelta == TRUE) #z = #z + z2 z2 = #z ENDIF #z = #z^@power + #pixel IF (@invdelta == TRUE) #z = #z - z2 ENDIF #z = 1 / (#z-@invcenter) bailout: |#z| > @bailout default: title = "Mandelbrot (Inverted)" helpfile = "dmj-pub\dmj-pub-uf-mji.htm" maxiter = 1000 center = (-0.5,0) param start caption = "Start Value" default = (0,0) hint = "Starting value for each point. You can use this to \ 'perturb' the fractal." endparam param power caption = "Exponent" default = (2,0) hint = "Overall exponent for the equation. (2,0) gives \ the classic Mandelbrot type." endparam param bailout caption = "Bailout" default = 1.0e-9 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Mandelbrot set anymore. Note that this is an \ inverse bailout; larger values make points bail out sooner." endparam param invcenter caption = "Inversion Center" default = (0,0) hint = "Center of inversion for calculation." endparam param invdelta caption = "Use Change in z" default = FALSE hint = "If set, z will be the inverted change in orbit values, \ rather than the inverted orbit value itself." endparam switch: type = "dmj-IJulia" seed = #pixel power = @power bailout = @bailout invcenter = @invcenter invdelta = @invdelta } dmj-IJulia { ; ; This is a modified Julia formula which ; returns 1/z in z. This is useful for coloring ; algorithms which expect convergent orbits. ; init: #z = 1 / (#pixel-@invcenter) complex z2 = (0,0) complex z3 = (0,0) loop: #z = 1/#z + @invcenter IF (@invdelta == TRUE) #z = #z + z2 z2 = #z ENDIF #z = #z^@power + @seed IF (@invdelta == TRUE) #z = #z - z2 ENDIF #z = 1 / (#z-@invcenter) bailout: |#z| > @bailout default: title = "Julia (Inverted)" helpfile = "dmj-pub\dmj-pub-uf-mji.htm" maxiter = 1000 center = (0,0) param seed caption = "Julia Seed" default = (0,0) hint = "This is the Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param power caption = "Exponent" default = (2,0) hint = "Overall exponent for the equation. (2,0) gives \ the classic Julia type." endparam param bailout caption = "Bailout" default = 1.0e-9 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Julia set anymore. Note that this is an \ inverse bailout; larger values make points bail out sooner." endparam param invcenter caption = "Inversion Center" default = (0,0) hint = "Center of inversion for calculation." endparam param invdelta caption = "Use Change in z" default = FALSE hint = "If set, z will be the inverted change in orbit values, \ rather than the inverted orbit value itself." endparam switch: type = "dmj-IMandel" power = @power bailout = @bailout invcenter = @invcenter invdelta = @invdelta } dmj-Julia2-Start { ; ; This is the starting point for Julia2, the periodic-c ; Julia variant. Because this is derived from the basic ; Julia equation, z^2+c, the dmj-Smooth and dmj-Triangle ; coloring algorithms will work with it. Use UF2's ; Switch feature to select the first Julia point. ; init: z = 0 loop: z = z^@power + #pixel bailout: |z| < @bailout default: title = "Julia2 Start" helpfile = "dmj-pub\dmj-pub-uf-j2.htm" maxiter = 1000 center = (-0.5,0) param switchseeds caption = "Switch Seeds" default = FALSE hint = "If this is enabled, the Julia seeds will be swapped. \ NOTE: the effects will not be visible at this stage." endparam param pattern caption = "Seed Pattern" default = 21 min = 12 hint = "Defines the pattern in which the two seeds will be used. \ NOTE: the effects will not be visible at this stage." endparam param power caption = "Exponent" default = (2,0) hint = "Overall exponent for the equation. (2,0) gives \ the classic Julia type." endparam param bailout caption = "Bailout" default = 1.0e20 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Julia2 set anymore." endparam switch: type = "dmj-Julia2-Step1" seed1 = #pixel switchseeds = @switchseeds pattern = @pattern power = @power bailout = @bailout } dmj-Julia2-Step1 { ; ; This is the first step in selecting a Julia2 fractal. From ; here, use the Switch feature again to select the second Julia ; point. ; init: z = 0 int p = @pattern; Starting pattern int plength = floor(log(p)/log(10)); number of digits in the pattern, - 1 int pmul = floor(10^plength); multiplier to get leftmost digit int pdigit = 0; used for extracted digit BOOL t = FALSE IF (p == 21 && @switchseeds); special optimized pattern t = TRUE; start with the other seed ENDIF loop: IF (p == 21); special optimized pattern t = !t; rotate pattern one step IF (t); using second seed z = z^@power + #pixel ELSE; using first seed z = z^@power + @seed1 ENDIF ELSE pdigit = floor(p / pmul); rotate pattern one step p = (p-pdigit*pmul)*10 + pdigit IF (@switchseeds); seeds should be swapped pdigit = 3 - pdigit; use the other seed ENDIF IF (pdigit == 1); using first seed z = z^@power + @seed1 ELSE; using second seed z = z^@power + #pixel ENDIF ENDIF bailout: |z| < @bailout default: title = "Julia2 Step 1" helpfile = "dmj-pub\dmj-pub-uf-j2.htm" maxiter = 1000 center = (-0.5,0) param seed1 caption = "Julia Seed 1" default = (0,0) hint = "This is the first Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param switchseeds caption = "Switch Seeds" default = FALSE hint = "If this is enabled, the Julia seeds will be swapped. This \ lets you try the alternate 'flavor' Julia2 without manually \ swapping the parameters." endparam param pattern caption = "Seed Pattern" default = 21 min = 12 hint = "Defines the pattern in which the two seeds will be used. \ Each digit indicates the seed to use, 1 or 2; when all \ digits have been used, the pattern repeats. The default \ of 21 gives the original Julia2 behavior." endparam param power caption = "Exponent" default = (2,0) hint = "Overall exponent for the equation. (2,0) gives \ the classic Julia type." endparam param bailout caption = "Bailout" default = 1.0e20 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Julia2 set anymore." endparam switch: type = "dmj-Julia2-Step2" seed1 = @seed1 seed2 = #pixel switchseeds = @switchseeds pattern = @pattern power = @power bailout = @bailout } dmj-Julia2-Step2 { ; ; This is the final alternating-c Julia2 fractal. ; Once both seeds have been selected, you can use ; the Switch feature again to open up a window ; which will let you select the first Julia seed ; again, leaving the second one unchanged. ; init: z = #pixel int p = @pattern; Starting pattern int plength = floor(log(p)/log(10)); number of digits in the pattern, - 1 int pmul = floor(10^plength); multiplier to get leftmost digit int pdigit = 0; used for extracted digit BOOL t = FALSE IF (p == 21 && @switchseeds); special optimized pattern t = TRUE; start with the other seed ENDIF loop: IF (p == 21); special optimized pattern t = !t; rotate pattern one step IF (t); using second seed z = z^@power + @seed2 ELSE; using first seed z = z^@power + @seed1 ENDIF ELSE pdigit = floor(p / pmul); rotate pattern one step p = (p-pdigit*pmul)*10 + pdigit IF (@switchseeds); seeds should be swapped pdigit = 3 - pdigit; use the other seed ENDIF IF (pdigit == 1); using first seed z = z^@power + @seed1 ELSE; using second seed z = z^@power + @seed2 ENDIF ENDIF bailout: |z| < @bailout default: title = "Julia2 Step 2" helpfile = "dmj-pub\dmj-pub-uf-j2.htm" maxiter = 1000 param seed1 caption = "Julia Seed 1" default = (0,0) hint = "This is the first Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param seed2 caption = "Julia Seed 2" default = (0,0) hint = "This is the second Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param switchseeds caption = "Switch Seeds" default = FALSE hint = "If this is enabled, the Julia seeds will be swapped. This \ lets you try the alternate 'flavor' Julia2 without manually \ swapping the parameters." endparam param pattern caption = "Seed Pattern" default = 21 min = 12 hint = "Defines the pattern in which the two seeds will be used. \ Each digit indicates the seed to use, 1 or 2; when all \ digits have been used, the pattern repeats. The default \ of 21 gives the original Julia2 behavior." endparam param power caption = "Exponent" default = (2,0) hint = "Overall exponent for the equation. (2,0) gives \ the classic Julia type." endparam param bailout caption = "Bailout" default = 1.0e20 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Julia2 set anymore." endparam switch: type = "dmj-Julia2-Step1a" seed2 = @seed2 switchseeds = @switchseeds pattern = @pattern power = @power bailout = @bailout } dmj-Julia2-Step1a { ; ; This is the first step in selecting a Julia2 fractal. From ; here, use the Switch feature again to select the second Julia ; point. ; init: z = 0 int p = @pattern; Starting pattern int plength = floor(log(p)/log(10)); number of digits in the pattern, - 1 int pmul = floor(10^plength); multiplier to get leftmost digit int pdigit = 0; used for extracted digit BOOL t = FALSE IF (p == 21 && @switchseeds); special optimized pattern t = TRUE; start with the other seed ENDIF loop: IF (p == 21); special optimized pattern t = !t; rotate pattern one step IF (t); using second seed z = z^@power + @seed2 ELSE; using first seed z = z^@power + #pixel ENDIF ELSE pdigit = floor(p / pmul); rotate pattern one step p = (p-pdigit*pmul)*10 + pdigit IF (@switchseeds); seeds should be swapped pdigit = 3 - pdigit; use the other seed ENDIF IF (pdigit == 1); using first seed z = z^@power + #pixel ELSE; using second seed z = z^@power + @seed2 ENDIF ENDIF bailout: |z| < @bailout default: title = "Julia2 Step 1a" helpfile = "dmj-pub\dmj-pub-uf-j2.htm" maxiter = 1000 center = (-0.5,0) periodicity = 0 param seed2 caption = "Julia Seed 2" default = (0,0) hint = "This is the second Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param switchseeds caption = "Switch Seeds" default = FALSE hint = "If this is enabled, the Julia seeds will be swapped. This \ lets you try the alternate 'flavor' Julia2 without manually \ swapping the parameters." endparam param pattern caption = "Seed Pattern" default = 21 min = 12 hint = "Defines the pattern in which the two seeds will be used. \ Each digit indicates the seed to use, 1 or 2; when all \ digits have been used, the pattern repeats. The default \ of 21 gives the original Julia2 behavior." endparam param power caption = "Exponent" default = (2,0) hint = "Overall exponent for the equation. (2,0) gives \ the classic Julia type." endparam param bailout caption = "Bailout" default = 1.0e20 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Julia2 set anymore." endparam switch: type = "dmj-Julia2-Step2" seed1 = #pixel seed2 = @seed2 switchseeds = @switchseeds pattern = @pattern power = @power bailout = @bailout } dmj-Julia3-Start { ; ; This is the starting point for Julia3, the periodic-c ; Julia variant. Because this is derived from the basic ; Julia equation, z^2+c, the dmj-Smooth and dmj-Triangle ; coloring algorithms will work with it. Use UF2's ; Switch feature to select the first Julia point. ; init: z = 0 loop: z = z^@power + #pixel bailout: |z| < @bailout default: title = "Julia3 Start" helpfile = "dmj-pub\dmj-pub-uf-j2.htm" maxiter = 1000 center = (-0.5,0) param seedorder caption = "Seed Order" default = 6 enum = "1, 2, 3" "2, 3, 1" "3, 1, 2" "3, 2, 1" "2, 1, 3" "1, 3, 2" "custom" hint = "Selects the order in which the Julia seeds are used. \ This parameter is retained for compatibility purposes; \ new fractals should use 'Custom' and set the order explicitly." endparam param pattern caption = "Seed Pattern" default = 123 min = 12 hint = "Defines the pattern in which the two seeds will be used. \ Each digit indicates the seed to use, 1, 2, or 3; when all \ digits have been used, the pattern repeats. The default \ of 123 gives the original Julia3 behavior." endparam param power caption = "Exponent" default = (2,0) hint = "Overall exponent for the equation. (2,0) gives \ the classic Julia type." endparam param bailout caption = "Bailout" default = 1.0e20 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Julia3 set anymore." endparam switch: type = "dmj-Julia3-Step1" seed1 = #pixel seedorder = @seedorder pattern = @pattern power = @power bailout = @bailout } dmj-Julia3-Step1 { ; ; This is the first step in selecting a Julia3 fractal. From ; here, use the Switch feature again to select the second Julia ; point. ; init: z = 0 int p = @pattern; Starting pattern IF (@seedorder == 0); Preset pattern p = 123 ELSEIF (@seedorder == 1) p = 231 ELSEIF (@seedorder == 2) p = 312 ELSEIF (@seedorder == 3) p = 321 ELSEIF (@seedorder == 4) p = 213 ELSEIF (@seedorder == 5) p = 132 ENDIF int plength = floor(log(p)/log(10)); number of digits in the pattern, - 1 int pmul = floor(10^plength); multiplier to get leftmost digit int pdigit = 0; used for extracted digit loop: pdigit = floor(p / pmul); rotate pattern one step p = (p-pdigit*pmul)*10 + pdigit IF (pdigit == 1); using first seed z = z^@power + @seed1 ELSEIF (pdigit == 2); using second seed z = z^@power + #pixel ELSE; using third seed z = z^@power + #pixel ENDIF bailout: |z| < @bailout default: title = "Julia3 Step 1" helpfile = "dmj-pub\dmj-pub-uf-j2.htm" maxiter = 1000 center = (-0.5,0) param seed1 caption = "Julia Seed 1" default = (0,0) hint = "This is the first Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param seedorder caption = "Seed Order" default = 6 enum = "1, 2, 3" "2, 3, 1" "3, 1, 2" "3, 2, 1" "2, 1, 3" "1, 3, 2" "custom" hint = "Selects the order in which the Julia seeds are used. \ This parameter is retained for compatibility purposes; \ new fractals should use 'Custom' and set the order explicitly." endparam param pattern caption = "Seed Pattern" default = 123 min = 12 hint = "Defines the pattern in which the two seeds will be used. \ Each digit indicates the seed to use, 1, 2, or 3; when all \ digits have been used, the pattern repeats. The default \ of 123 gives the original Julia3 behavior." endparam param power caption = "Exponent" default = (2,0) hint = "Overall exponent for the equation. (2,0) gives \ the classic Julia type." endparam param bailout caption = "Bailout" default = 1.0e20 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Julia3 set anymore." endparam switch: type = "dmj-Julia3-Step2" seed1 = @seed1 seed2 = #pixel seedorder = @seedorder pattern = @pattern power = @power bailout = @bailout } dmj-Julia3-Step2 { ; ; This is the second step in selecting a Julia3 fractal. From ; here, use the Switch feature again to select the third Julia ; point. ; init: z = 0 int p = @pattern; Starting pattern IF (@seedorder == 0); Preset pattern p = 123 ELSEIF (@seedorder == 1) p = 231 ELSEIF (@seedorder == 2) p = 312 ELSEIF (@seedorder == 3) p = 321 ELSEIF (@seedorder == 4) p = 213 ELSEIF (@seedorder == 5) p = 132 ENDIF int plength = floor(log(p)/log(10)); number of digits in the pattern, - 1 int pmul = floor(10^plength); multiplier to get leftmost digit int pdigit = 0; used for extracted digit loop: pdigit = floor(p / pmul); rotate pattern one step p = (p-pdigit*pmul)*10 + pdigit IF (pdigit == 1); using first seed z = z^@power + @seed1 ELSEIF (pdigit == 2); using second seed z = z^@power + @seed2 ELSE; using third seed z = z^@power + #pixel ENDIF bailout: |z| < @bailout default: title = "Julia3 Step 2" helpfile = "dmj-pub\dmj-pub-uf-j2.htm" maxiter = 1000 center = (-0.5,0) param seed1 caption = "Julia Seed 1" default = (0,0) hint = "This is the first Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param seed2 caption = "Julia Seed 2" default = (0,0) hint = "This is the second Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param seedorder caption = "Seed Order" default = 6 enum = "1, 2, 3" "2, 3, 1" "3, 1, 2" "3, 2, 1" "2, 1, 3" "1, 3, 2" "custom" hint = "Selects the order in which the Julia seeds are used. \ This parameter is retained for compatibility purposes; \ new fractals should use 'Custom' and set the order explicitly." endparam param pattern caption = "Seed Pattern" default = 123 min = 12 hint = "Defines the pattern in which the two seeds will be used. \ Each digit indicates the seed to use, 1, 2, or 3; when all \ digits have been used, the pattern repeats. The default \ of 123 gives the original Julia3 behavior." endparam param power caption = "Exponent" default = (2,0) hint = "Overall exponent for the equation. (2,0) gives \ the classic Julia type." endparam param bailout caption = "Bailout" default = 1.0e20 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Julia3 set anymore." endparam switch: type = "dmj-Julia3-Step3" seed1 = @seed1 seed2 = @seed2 seed3 = #pixel seedorder = @seedorder pattern = @pattern power = @power bailout = @bailout } dmj-Julia3-Step3 { ; ; This is the final alternating-c Julia3 fractal. ; init: z = #pixel int p = @pattern; Starting pattern IF (@seedorder == 0); Preset pattern p = 123 ELSEIF (@seedorder == 1) p = 231 ELSEIF (@seedorder == 2) p = 312 ELSEIF (@seedorder == 3) p = 321 ELSEIF (@seedorder == 4) p = 213 ELSEIF (@seedorder == 5) p = 132 ENDIF int plength = floor(log(p)/log(10)); number of digits in the pattern, - 1 int pmul = floor(10^plength); multiplier to get leftmost digit int pdigit = 0; used for extracted digit loop: pdigit = floor(p / pmul); rotate pattern one step p = (p-pdigit*pmul)*10 + pdigit IF (pdigit == 1); using first seed z = z^@power + @seed1 ELSEIF (pdigit == 2); using second seed z = z^@power + @seed2 ELSE; using third seed z = z^@power + @seed3 ENDIF bailout: |z| < @bailout default: title = "Julia3 Step 3" helpfile = "dmj-pub\dmj-pub-uf-j2.htm" maxiter = 1000 center = (0,0) param seed1 caption = "Julia Seed 1" default = (0,0) hint = "This is the first Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param seed2 caption = "Julia Seed 2" default = (0,0) hint = "This is the second Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param seed3 caption = "Julia Seed 3" default = (0,0) hint = "This is the third Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param seedorder caption = "Seed Order" default = 6 enum = "1, 2, 3" "2, 3, 1" "3, 1, 2" "3, 2, 1" "2, 1, 3" "1, 3, 2" "custom" hint = "Selects the order in which the Julia seeds are used. \ This parameter is retained for compatibility purposes; \ new fractals should use 'Custom' and set the order explicitly." endparam param pattern caption = "Seed Pattern" default = 123 min = 12 hint = "Defines the pattern in which the two seeds will be used. \ Each digit indicates the seed to use, 1, 2, or 3; when all \ digits have been used, the pattern repeats. The default \ of 123 gives the original Julia3 behavior." endparam param power caption = "Exponent" default = (2,0) hint = "Overall exponent for the equation. (2,0) gives \ the classic Julia type." endparam param bailout caption = "Bailout" default = 1.0e20 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Julia3 set anymore." endparam switch: type = "dmj-Julia3-Start" seedorder = @seedorder pattern = @pattern power = @power bailout = @bailout } dmj-LyapMandel { ; ; This fractal iterates the classical Logistics equation, ; but using complex numbers. It is similar to the ; MandelLambda type in FractInt, which is the Mandelbrot ; form of the classic Lambda fractal. ; init: z = @start loop: z = #pixel*z*(1-z)^(@power-1) bailout: |z| < @bailout default: title = "Lambda (Mandelbrot)" helpfile = "dmj-pub\dmj-pub-uf-lambda.htm" center = (1,0) magn = 0.5 param start caption = "Start Value" default = (0.5,0) hint = "Starting value for each point. You can use this to \ 'perturb' the fractal." endparam param power caption = "Exponent" default = (2,0) hint = "Overall exponent for the equation. (2,0) gives \ the classic Lambda type." endparam param bailout caption = "Bailout" default = 1.0e20 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Lambda set anymore." endparam switch: type = "dmj-LyapJulia" seed = #pixel power = @power bailout = @bailout } dmj-LyapJulia { ; ; This fractal iterates the classical Logistics equation, ; but using complex numbers. It is similar to the Lambda ; type in FractInt. Note that all the Julia sets created ; with this formula can be recreated with the classical ; Julia type; however, coloring formulas based on #pixel ; will produce slightly different results, so it is not ; completely redundant. ; init: z = #pixel loop: z = @seed*z*(1-z)^(@power-1) bailout: |z| < @bailout default: title = "Lambda (Julia)" helpfile = "dmj-pub\dmj-pub-uf-lambda.htm" center = (0.5,0) param seed caption = "Julia Seed" default = (1,0) hint = "This is the Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param power caption = "Exponent" default = (2,0) hint = "Overall exponent for the equation. (2,0) gives \ the classic Julia type." endparam param bailout caption = "Bailout" default = 1.0e20 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Julia set anymore." endparam switch: type = "dmj-LyapMandel" power = @power bailout = @bailout } dmj-Lyapunov { ; ; This is an implementation of Markus-Lyapunov ; fractals, which iterates the classical Logistics ; equation, but varying the (normally constant) r ; value with each iteration, flipping it between ; two values according to a pattern. ; ; This variation allows you to introduce complex ; elements into r, but doing so substantially slows ; down the formula (and it is already slow). So far ; I've not produced any interesting results this way. ; ; This formula is designed to work with the Markus- ; Lyapunov coloring. It also produces only "inside" ; points, so the Outside coloring settings will have ; no effect. ; init: complex s1 = real(#pixel)*exp(flip(real(@rotation)*#pi/180)) + @seed1 complex s2 = imag(#pixel)*exp(flip(imag(@rotation)*#pi/180)) + @seed2 ; float le = 0.0 float le = 1.0 complex z1 = (0,0) IF (@starttype == 0) z1 = @start ELSEIF (@starttype == 1) z1 = @seed1 ELSEIF (@starttype == 2) z1 = @seed2 ELSEIF (@starttype == 3) z1 = #random ELSEIF (@starttype == 4) z1 = #pixel ENDIF float f1 = 0.0 float f2 = 0.0 float z2 = 0.0 IF (@rotation == (0,0) && imag(@seed1) == 0 && imag(@seed2) == 0 && imag(@power) == 0) f1 = real(#pixel) + real(@seed1) f2 = imag(#pixel) + real(@seed2) z2 = real(z1) ENDIF float p = @pattern; Starting pattern IF (@patterntype == 0); decimal pattern int plength = floor(log(p)/log(10)); number of digits in the pattern, - 1 float pmul = floor(10^plength); multiplier to get leftmost digit float imul = 1/pmul ELSE int plength = floor(log(p)/log(2)); number of digits in the pattern, - 1 float pmul = floor(2^plength); multiplier to get leftmost digit float imul = 1/pmul ENDIF int pdigit = 0 ; used for extracted digit int counter = 0 loop: IF (@patterntype == 0); decimal pattern pdigit = floor(p * imul); extract digit p = (p-pdigit*pmul)*10 + pdigit; rotate pattern one step ELSE; binary pattern IF (p >= pmul); this bit is 1 pdigit = 2; extract digit p = (p-pmul)*2 + 1; rotate pattern one step ELSE; this bit is 0 pdigit = 1; extract digit p = p * 2; rotate pattern one step ENDIF ENDIF IF (pdigit == 1); using first seed IF (@rotation == (0,0) && @seed1 == (0,0) && @seed2 == (0,0) && imag(@power) == 0) z2 = f1*z2*(1-z2)^(real(@power)-1) IF (counter >= @filter) ; le = le + log(abs(f1-2*f1*z2)) - @offset le = le * (abs(f1-2*f1*z2)) ENDIF ELSE z1 = s1*z1*(1-z1)^(@power-1) IF (counter >= @filter) ; le = le + log(cabs(s1-2*s1*z1)) - @offset le = le * (cabs(s1-2*s1*z1)) ENDIF ENDIF ELSE ; using second seed IF (@rotation == (0,0) && @seed1 == (0,0) && @seed2 == (0,0) && imag(@power) == 0) z2 = f2*z2*(1-z2)^(real(@power)-1) IF (counter >= @filter) ; le = le + log(abs(f2-2*f2*z2)) - @offset le = le * (abs(f2-2*f2*z2)) ENDIF ELSE z1 = s2*z1*(1-z1)^(@power-1) IF (counter >= @filter) ; le = le + log(cabs(s2-2*s2*z1)) - @offset le = le * (cabs(s2-2*s2*z1)) ENDIF ENDIF ENDIF counter = counter + 1 IF (@ztype == 0) ; z = le z = log(le) - counter*@offset ELSEIF (@ztype == 1) IF (counter == #maxit) z = log(le) - counter*@offset ENDIF ELSEIF (@ztype == 2) z = z1 ENDIF bailout: true default: title = "Markus-Lyapunov" helpfile = "dmj-pub\dmj-pub-uf-ml.htm" periodicity = 0 magn = 0.25 maxiter = 1000 param starttype caption = "Start Type" default = 0 enum = "fixed" "first seed" "second seed" "random" "pixel" endparam param start caption = "Start Value" default = (0.5,0) hint = "Starting value for each point. You can use this to \ 'perturb' the fractal." endparam param seed1 caption = "X Seed" default = (0,0) endparam param seed2 caption = "Y Seed" default = (0,0) endparam param rotation caption = "Rotation" default = (0,0) endparam param pattern caption = "Seed Pattern" default = 21.0 min = 1 hint = "Defines the pattern in which the two seeds will be used. \ Each digit indicates the seed to use, 1 or 2; when all \ digits have been used, the pattern repeats." endparam param patterntype caption = "Seed Pattern Type" default = 0 enum = "decimal" "binary" hint = "Specifies whether the pattern is expressed in decimals \ (limited to ten digits) or binary (up to 64 digits)." endparam param offset caption = "Coloring Offset" default = 0.0 hint = "Offsets the coloring value, positive values will cause \ more areas to be colored." endparam param power caption = "Exponent" default = (2,0) hint = "Overall exponent for the equation. (2,0) gives \ the classic Markus-Lyapunov type." endparam param filter caption = "Filter Iterations" default = 0 hint = "Specifies the number of iterations to skip before \ calculating the Markus-Lyapunov exponent." endparam param ztype caption = "Iteration Value" default = 1 enum = "Lyapunov exponent" "Lyapunov exp (fast)" "function value" hint = "Specifies the value to be given to the coloring algorithm." endparam } dmj-Magnet1Mandel { ; ; This is the Type 1 Magnetic fractal as found in ; FractInt (Mandelbrot form). You can use the ; Switch feature to select a Magnet1Julia fractal. ; init: z = @start loop: z = ( (z^2 + #pixel-1) / (2*z + #pixel-2) ) ^2 bailout: |z| < @bailout && |z - 1| > @bailout2 default: title = "Magnet 1 (Mandelbrot)" helpfile = "dmj-pub\dmj-pub-uf-magnet.htm" maxiter = 1000 periodicity = 0 center = (1,0) magn = 0.5 param start caption = "Start Value" default = (0,0) hint = "Starting value for each point. You can use this to \ 'perturb' the fractal." endparam param bailout caption = "Bailout 1" default = 128.0 hint = "Divergent bailout value; larger values will cause more \ iterations to be done for each point." endparam param bailout2 caption = "Bailout 2" default = 0.00001 hint = "Convergent bailout value; smaller values will cause more \ iterations to be done for each point." endparam switch: type = "dmj-Magnet1Julia" seed = #pixel bailout = @bailout bailout2 = @bailout2 } dmj-Magnet1Julia { ; ; This is the Type 1 Magnetic fractal as found in ; FractInt (Julia form). Use the Magnet1Mandel type ; to select a Julia seed. ; init: complex zold = (0,0) z = #pixel loop: zold = z z = ( (z^2 + @seed-1) / (2*z + @seed-2) ) ^2 bailout: |z| < @bailout && |z - zold| > @bailout2 default: title = "Magnet 1 (Julia)" helpfile = "dmj-pub\dmj-pub-uf-magnet.htm" maxiter = 1000 periodicity = 0 center = (-1,0) magn = 0.25 param seed caption = "Julia Seed" default = (0,0) hint = "This is the Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param bailout caption = "Bailout 1" default = 128.0 hint = "Divergent bailout value; larger values will cause more \ iterations to be done for each point." endparam param bailout2 caption = "Bailout 2" default = 0.00001 hint = "Convergent bailout value; smaller values will cause more \ iterations to be done for each point." endparam switch: type = "dmj-Magnet1Mandel" bailout = @bailout bailout2 = @bailout2 } dmj-Magnet2Mandel { ; ; This is the Type 2 Magnetic fractal as found in ; FractInt (Mandelbrot form). You can use the ; Switch feature to select a Magnet2Julia fractal. ; init: z = @start loop: z = ( (z^3 + 3*(#pixel-1)*z + (#pixel-1)*(#pixel-2)) / (3*z^2 + 3*(#pixel-2)*z + (#pixel-1)*(#pixel-2) + 1) ) ^2 bailout: |z| < @bailout && |z - 1| > @bailout2 default: title = "Magnet 2 (Mandelbrot)" helpfile = "dmj-pub\dmj-pub-uf-magnet.htm" maxiter = 1000 periodicity = 0 center = (1,0) magn = 0.75 param start caption = "Start Value" default = (0,0) hint = "Starting value for each point. You can use this to \ 'perturb' the fractal." endparam param bailout caption = "Bailout 1" default = 128.0 hint = "Divergent bailout value; larger values will cause more \ iterations to be done for each point." endparam param bailout2 caption = "Bailout 2" default = 0.00001 hint = "Convergent bailout value; smaller values will cause more \ iterations to be done for each point." endparam switch: type = "dmj-Magnet2Julia" seed = #pixel bailout = @bailout bailout2 = @bailout2 } dmj-Magnet2Julia { ; ; This is the Type 2 Magnetic fractal as found in ; FractInt (Julia form). Use the Magnet2Mandel type ; to select a Julia seed. ; init: complex zold = (0,0) z = #pixel loop: zold = z z = ( (z^3 + 3*(@seed-1)*z + (@seed-1)*(@seed-2)) / (3*z^2 + 3*(@seed-2)*z + (@seed-1)*(@seed-2) + 1) ) ^2 bailout: |z| < @bailout && |z - zold| > @bailout2 default: title = "Magnet 2 (Julia)" helpfile = "dmj-pub\dmj-pub-uf-magnet.htm" maxiter = 1000 periodicity = 0 center = (-1,0) magn = 0.125 param seed caption = "Julia Seed" default = (0,0) hint = "This is the Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param bailout caption = "Bailout 1" default = 128.0 hint = "Divergent bailout value; larger values will cause more \ iterations to be done for each point." endparam param bailout2 caption = "Bailout 2" default = 0.00001 hint = "Convergent bailout value; smaller values will cause more \ iterations to be done for each point." endparam switch: type = "dmj-Magnet2Mandel" bailout = @bailout bailout2 = @bailout2 } dmj-Mandel-Nova { ; ; Mandelbrot-Nova alternator. ; This fractal switches between the Mandelbrot ; and Nova formulas with each iteration. ; ; Note: there is a slight logic error in dealing ; with iteration counts less than 1. The results ; may not be exactly what you expect. Because ; I have some images which rely on this behavior, ; I have not fixed it. ; init: #z = @start BOOL bail = FALSE BOOL mset = TRUE float switch = @mswitch complex zold = (0,0) complex nseed1 = @nseed IF (@ntype == 0) nseed1 = #pixel ENDIF loop: IF (mset == TRUE); do M-set equation this time #z = #z^@mpower + #pixel IF (|#z| > @mbailout); this point has bailed out bail = TRUE ENDIF ELSE; do Nova equation this time IF (@npower == (3,0)); special optimized routine for power 3 zsquared = sqr(#z) zcubed = zsquared * #z zold = #z #z = #z - @relax * (zcubed-1) / (3*zsquared) + nseed1 ELSE zold = #z #z = #z - @relax * (#z^@npower-1) / (@npower * #z^(@npower-1)) + nseed1 ENDIF IF (|#z-zold| < @nbailout); this point has bailed out bail = TRUE ENDIF ENDIF switch = switch - 1 IF (switch < 0) IF (mset == TRUE) mset = FALSE switch = switch + @nswitch ELSE mset = TRUE switch = switch + @mswitch ENDIF ENDIF bailout: bail == FALSE default: title = "Mandelbrot-Nova" helpfile = "dmj-pub\dmj-pub-uf-mn.htm" maxiter = 1000 param start caption = "Start Value" default = (0,0) hint = "Starting value for each point. You can use this to \ 'perturb' the fractal." endparam param mpower caption = "M-Set Exponent" default = (2,0) hint = "Overall exponent for the equation. (2,0) gives \ the classic Mandelbrot type." endparam param mbailout caption = "M-Set Bailout" default = 1.0e20 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Mandelbrot set anymore." endparam param nseed caption = "Nova Julia Seed" default = (0,0) hint = "This is the Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param npower caption = "Nova Exponent" default = (3,0) hint = "Overall exponent for the equation. (3,0) gives \ the classic NovaM type." endparam param nbailout caption = "Nova Bailout" default = 1.0e-9 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = 1.0 hint = "This can be used to slow down the convergence of \ the formula." endparam param ntype caption = "Nova Type" default = 0 enum = "Mandelbrot" "Julia" hint = "Type of Nova fractal to use." endparam param mswitch caption = "M-set Iterations" default = 1.0 hint = "Do this many iterations using the M-set equation \ before switching to the Nova equation." endparam param nswitch caption = "Nova Iterations" default = 1.0 hint = "Do this many iterations using the Nova equation \ before switching to the M-set equation." endparam } dmj-ManyJulia { ; ; This formula breaks the image up into a grid of ; squares, each square containing a small Julia set ; using the c value from the center of the square. ; As the size of the grid is reduced, the image will ; approach that of the Mandelbrot set. ; init: float iscale = 1 / @scale c = round(#pixel * @scale) * iscale z = (#pixel - c) * @scale * @jscale loop: z = z^@power + c bailout: |z| < @bailout default: title = "ManyJulia" helpfile = "dmj-pub\dmj-pub-uf-manyjulia.htm" maxiter = 1000 center = (-0.5,0) magn = 1.0 param power caption = "Exponent" default = (2,0) hint = "Overall exponent for the equation. (2,0) gives \ the classic Mandelbrot type." endparam param bailout caption = "Bailout" default = 1.0e20 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Mandelbrot set anymore." endparam param scale caption = "Julia Density" default = 2.0 hint = "Specifies the density of separate Julia sets; higher \ numbers will produce more divisions." endparam param jscale caption = "Julia Zoom" default = 3.0 hint = "Specifies the zoom level of Julia sets within each division." endparam } dmj-ManyNova { ; ; This formula breaks the image up into a grid of ; squares, each square containing a small Nova Julia set ; using the c value from the center of the square. ; init: float iscale = 1 / @scale c = round(#pixel * @scale) * iscale z = (#pixel - c) * @scale * @jscale complex zsquared = (0,0) complex zcubed = (0,0) complex zold = (0,0) loop: IF (@power == (3,0)); special optimized routine for power 3 zsquared = sqr(z) zcubed = zsquared * z zold = z z = z - @relax * (zcubed-1) / (3*zsquared) + c ELSE zold = z z = z - @relax * (z^@power-1) / (@power * z^(@power-1)) + c ENDIF bailout: |z-zold| > @bailout default: title = "ManyNova" helpfile = "dmj-pub\dmj-pub-uf-manynova.htm" maxiter = 1000 periodicity = 0 center = (0,0) magn = 1.0 param power caption = "Exponent" default = (3,0) hint = "Overall exponent for the equation. (3,0) gives \ the classic NovaM type." endparam param bailout caption = "Bailout" default = 0.00001 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam param scale caption = "Julia Density" default = 2.0 hint = "Specifies the density of separate Julia sets; higher \ numbers will produce more divisions." endparam param jscale caption = "Julia Zoom" default = 3.0 hint = "Specifies the zoom level of Julia sets within each division." endparam } dmj-NovaIMandel { ; ; This is the Nova fractal (Mandelbrot form), a ; modified Newtonian-style fractal. The formula ; was first shown to me by Paul Derbyshire (who ; named it Nova). It has also appeared elsewhere ; under other names. Use this formula and the ; Switch feature to select a Nova Julia. ; ; This variant uses Kerry Mitchell's inverted ; computation so that it works with coloring ; methods expecting divergent z. ; init: complex zsquared = (0,0) complex zcubed = (0,0) complex zcurrent = @start z = (0,0) loop: IF (@power == (3,0)); special optimized routine for power 3 zsquared = sqr(zcurrent) zcubed = zsquared * zcurrent z = @relax * (zcubed-1) / (3*zsquared) - #pixel zcurrent = zcurrent - z z = 1/z ELSE z = @relax * (zcurrent^@power-1) / (@power * zcurrent^(@power-1)) - #pixel zcurrent = zcurrent - z z = 1/z ENDIF IF (@fudge == true &&\ |z| > 4); fudging angle z = z * zcurrent/cabs(zcurrent) ENDIF bailout: |z| < @bailout default: title = "Nova-I (Mandelbrot)" helpfile = "dmj-pub\dmj-pub-uf-ni.htm" maxiter = 1000 periodicity = 0 center = (-0.5,0) magn = 1.5 param start caption = "Start Value" default = (1,0) hint = "Starting value for each point. You can use this to \ 'perturb' the fractal." endparam param power caption = "Exponent" default = (3,0) hint = "Overall exponent for the equation. (3,0) gives \ the classic NovaM type." endparam param bailout caption = "Bailout" default = 10000.0 hint = "Bailout value; larger values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam param fudge caption = "Fudge z Angle" default = false hint = "Modifies angle of z based on starting point. \ Turning this on will make decomposition more \ consistent between iterations, regardless of \ the root converged on." endparam switch: type = "dmj-NovaIJulia" seed = #pixel power = @power bailout = @bailout relax = @relax fudge = @fudge } dmj-NovaIJulia { ; ; This is the Nova fractal (Julia form), a ; modified Newtonian-style fractal. The formula ; was first shown to me by Paul Derbyshire (who ; named it Nova). It has also appeared elsewhere ; under other names. If you leave the Julia ; seed at the default (0,0), you can use this as ; a general Newton-style fractal as in FractInt. ; ; This variant uses Kerry Mitchell's inverted ; computation so that it works with coloring ; methods expecting divergent z. ; init: complex zsquared = (0,0) complex zcubed = (0,0) complex zcurrent = #pixel z = (0,0) loop: IF (@power == (3,0)); special optimized routine for power 3 zsquared = sqr(zcurrent) zcubed = zsquared * zcurrent z = @relax * (zcubed-1) / (3*zsquared) - @seed zcurrent = zcurrent - z z = 1/z ELSE z = @relax * (zcurrent^@power-1) / (@power * zcurrent^(@power-1)) - @seed zcurrent = zcurrent - z z = 1/z ENDIF IF (@fudge == true &&\ |z| > 4); fudging angle z = z * zcurrent/cabs(zcurrent) ENDIF bailout: |z| < @bailout default: title = "Nova-I (Julia)" helpfile = "dmj-pub\dmj-pub-uf-ni.htm" maxiter = 1000 periodicity = 0 center = (0,0) magn = 1.5 param seed caption = "Julia Seed" default = (0,0) hint = "This is the Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param power caption = "Exponent" default = (3,0) hint = "Overall exponent for the equation. (3,0) gives \ the classic NovaM type." endparam param bailout caption = "Bailout" default = 10000.0 hint = "Bailout value; larger values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam param fudge caption = "Fudge z Angle" default = false hint = "Modifies angle of z based on starting point. \ Turning this on will make decomposition more \ consistent between iterations, regardless of \ the root converged on." endparam switch: type = "dmj-NovaIMandel" power = @power bailout = @bailout relax = @relax fudge = @fudge } dmj-NovaMandel { ; ; This is the Nova fractal (Mandelbrot form), a ; modified Newtonian-style fractal. The formula ; was first shown to me by Paul Derbyshire (who ; named it Nova). It has also appeared elsewhere ; under other names. Use this formula and the ; Switch feature to select a NovaJulia. ; init: complex zsquared = (0,0) complex zcubed = (0,0) complex zold = (0,0) z = @start loop: IF (@power == (3,0)); special optimized routine for power 3 zsquared = sqr(z) zcubed = zsquared * z zold = z z = z - @relax * (zcubed-1) / (3*zsquared) + #pixel ELSE zold = z z = z - @relax * (z^@power-1) / (@power * z^(@power-1)) + #pixel ENDIF bailout: |z - zold| > @bailout default: title = "Nova (Mandelbrot)" helpfile = "dmj-pub\dmj-pub-uf-nova.htm" maxiter = 1000 periodicity = 0 center = (-0.5,0) magn = 1.5 param start caption = "Start Value" default = (1,0) hint = "Starting value for each point. You can use this to \ 'perturb' the fractal." endparam param power caption = "Exponent" default = (3,0) hint = "Overall exponent for the equation. (3,0) gives \ the classic NovaM type." endparam param bailout caption = "Bailout" default = 0.00001 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam switch: type = "dmj-NovaJulia" seed = #pixel power = @power bailout = @bailout relax = @relax } dmj-NovaJulia { ; ; This is the Nova fractal (Julia form), a ; modified Newtonian-style fractal. The formula ; was first shown to me by Paul Derbyshire (who ; named it Nova). It has also appeared elsewhere ; under other names. If you leave the Julia ; seed at the default (0,0), you can use this as ; a general Newton-style fractal as in FractInt. ; init: complex zsquared = (0,0) complex zcubed = (0,0) complex zold = (0,0) z = #pixel loop: IF (@power == (3,0)); special optimized routine for power 3 zsquared = sqr(z) zcubed = zsquared * z zold = z z = z - @relax * (zcubed-1) / (3*zsquared) + @seed ELSE zold = z z = z - @relax * (z^@power-1) / (@power * z^(@power-1)) + @seed ENDIF bailout: |z - zold| > @bailout default: title = "Nova (Julia)" helpfile = "dmj-pub\dmj-pub-uf-nova.htm" maxiter = 1000 periodicity = 0 center = (0,0) magn = 1.5 param seed caption = "Julia Seed" default = (0,0) hint = "This is the Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param power caption = "Exponent" default = (3,0) hint = "Overall exponent for the equation. (3,0) gives \ the classic Nova type." endparam param bailout caption = "Bailout" default = 0.00001 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam switch: type = "dmj-NovaMandel" power = @power bailout = @bailout relax = @relax } dmj-NovaJulia2-Start { ; ; This is the starting point for Nova Julia2, the ; periodic-c Nova Julia variant. Use UF2's ; Switch feature to select the first Julia point. ; init: complex zsquared = (0,0) complex zcubed = (0,0) complex zold = (0,0) z = (1,0) loop: IF (@power == (3,0)); special optimized routine for power 3 zsquared = sqr(z) zcubed = zsquared * z zold = z z = z - @relax * (zcubed-1) / (3*zsquared) + #pixel ELSE zold = z z = z - @relax * (z^@power-1) / (@power * z^(@power-1)) + #pixel ENDIF bailout: |z - zold| > @bailout default: title = "Nova Julia2 Start" helpfile = "dmj-pub\dmj-pub-uf-nj2.htm" maxiter = 1000 periodicity = 0 center = (-0.5,0) magn = 1.5 param switchseeds caption = "Switch Seeds" default = FALSE hint = "If this is enabled, the Julia seeds will be swapped. \ NOTE: the effects will not be visible at this stage." endparam ; param pattern ; caption = "Seed Pattern" ; default = 21 ; min = 12 ; hint = "Defines the pattern in which the two seeds will be used. \ ; NOTE: the effects will not be visible at this stage." ; endparam param power caption = "Exponent" default = (3,0) hint = "Overall exponent for the equation. (3,0) gives \ the classic NovaM type." endparam param bailout caption = "Bailout" default = 0.00001 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam switch: type = "dmj-NovaJulia2-Step1" seed1 = #pixel switchseeds = @switchseeds ; pattern = @pattern power = @power bailout = @bailout relax = @relax } dmj-NovaJulia2-Step1 { ; ; This is the first step in selecting a Nova Julia2 ; fractal. From here, use the Switch feature again ; to select the second Julia ; point. ; init: int count = 0 complex zold = (0,0) complex zold2 = (0,0) z = (1,0) int p = 21;@pattern; Starting pattern int plength = floor(log(p)/log(10)); number of digits in the pattern, - 1 int pmul = floor(10^plength); multiplier to get leftmost digit int pdigit = 0; used for extracted digit loop: pdigit = floor(p / pmul); rotate pattern one step p = (p-pdigit*pmul)*10 + pdigit IF (@switchseeds); seeds should be swapped pdigit = 3 - pdigit; use the other seed ENDIF IF (pdigit == 1); using first seed IF (@power == (3,0)) zsquared = sqr(z) zcubed = zsquared * z z = z - @relax * (zcubed-1) / (3*zsquared) + @seed1 ELSE z = z - @relax * (z^@power-1) / (@power * z^(@power-1)) + @seed1 ENDIF IF (|z - zold| < @bailout) count = count + 1 ELSE count = 0 ENDIF zold = z ELSE; using second seed IF (@power == (3,0)) zsquared = sqr(z) zcubed = zsquared * z z = z - @relax * (zcubed-1) / (3*zsquared) + #pixel ELSE z = z - @relax * (z^@power-1) / (@power * z^(@power-1)) + #pixel ENDIF IF (|z - zold2| < @bailout) count = count + 1 ELSE count = 0 ENDIF zold2 = z ENDIF bailout: count < plength default: title = "Nova Julia2 Step 1" helpfile = "dmj-pub\dmj-pub-uf-nj2.htm" maxiter = 1000 periodicity = 0 center = (-0.5,0) magn = 1.5 param seed1 caption = "Julia Seed 1" default = (0,0) hint = "This is the first Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param switchseeds caption = "Switch Seeds" default = FALSE hint = "If this is enabled, the Julia seeds will be swapped. This \ lets you try the alternate 'flavor' Julia2 without manually \ swapping the parameters." endparam ; param pattern ; caption = "Seed Pattern" ; default = 21 ; min = 12 ; hint = "Defines the pattern in which the two seeds will be used. \ ; Each digit indicates the seed to use, 1 or 2; when all \ ; digits have been used, the pattern repeats. The default \ ; of 21 gives the original Julia2 behavior." ; endparam param power caption = "Exponent" default = (3,0) hint = "Overall exponent for the equation. (3,0) gives \ the classic NovaM type." endparam param bailout caption = "Bailout" default = 0.00001 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam switch: type = "dmj-NovaJulia2-Step2" seed1 = @seed1 seed2 = #pixel switchseeds = @switchseeds ; pattern = @pattern power = @power bailout = @bailout relax = @relax } dmj-NovaJulia2-Step2 { ; ; This is the final alternating-c Nova Julia2 fractal. ; Once both seeds have been selected, you can use ; the Switch feature again to open up a window ; which will let you select the first Julia seed ; again, leaving the second one unchanged. ; init: int count = 0 complex zold = (0,0) complex zold2 = (0,0) z = #pixel int p = 21;@pattern; Starting pattern int plength = floor(log(p)/log(10)); number of digits in the pattern, - 1 int pmul = floor(10^plength); multiplier to get leftmost digit int pdigit = 0; used for extracted digit loop: pdigit = floor(p / pmul); rotate pattern one step p = (p-pdigit*pmul)*10 + pdigit IF (@switchseeds); seeds should be swapped pdigit = 3 - pdigit; use the other seed ENDIF IF (pdigit == 1); using first seed IF (@power == (3,0)) zsquared = sqr(z) zcubed = zsquared * z z = z - @relax * (zcubed-1) / (3*zsquared) + @seed1 ELSE z = z - @relax * (z^@power-1) / (@power * z^(@power-1)) + @seed1 ENDIF IF (|z - zold| < @bailout) count = count + 1 ELSE count = 0 ENDIF zold = z ELSE; using second seed IF (@power == (3,0)) zsquared = sqr(z) zcubed = zsquared * z z = z - @relax * (zcubed-1) / (3*zsquared) + @seed2 ELSE z = z - @relax * (z^@power-1) / (@power * z^(@power-1)) + @seed2 ENDIF IF (|z - zold2| < @bailout) count = count + 1 ELSEIF (count > 0) count = count - 1 ENDIF zold2 = z ENDIF bailout: count < plength default: title = "Nova Julia2 Step 2" helpfile = "dmj-pub\dmj-pub-uf-nj2.htm" maxiter = 1000 periodicity = 0 center = (0,0) magn = 1.5 param seed1 caption = "Julia Seed 1" default = (0,0) hint = "This is the first Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param seed2 caption = "Julia Seed 2" default = (0,0) hint = "This is the second Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param switchseeds caption = "Switch Seeds" default = FALSE hint = "If this is enabled, the Julia seeds will be swapped. This \ lets you try the alternate 'flavor' Julia2 without manually \ swapping the parameters." endparam ; param pattern ; caption = "Seed Pattern" ; default = 21 ; min = 12 ; hint = "Defines the pattern in which the two seeds will be used. \ ; Each digit indicates the seed to use, 1 or 2; when all \ ; digits have been used, the pattern repeats. The default \ ; of 21 gives the original Julia2 behavior." ; endparam param power caption = "Exponent" default = (3,0) hint = "Overall exponent for the equation. (3,0) gives \ the classic Nova type." endparam param bailout caption = "Bailout" default = 0.00001 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam switch: type = "dmj-NovaJulia2-Step1a" seed2 = @seed2 switchseeds = @switchseeds ; pattern = @pattern power = @power bailout = @bailout relax = @relax } dmj-NovaJulia2-Step1a { ; ; This is the first step in selecting a Julia2 fractal. From ; here, use the Switch feature again to select the second Julia ; point. ; ; Note: an early bug in this formula produced erroneous results. ; If you have a parameter set which relied on this behavior, ; please see the obsolete.ufm file. ; init: int count = 0 complex zold = (0,0) complex zold2 = (0,0) z = (1,0) int p = 21;@pattern; Starting pattern int plength = floor(log(p)/log(10)); number of digits in the pattern, - 1 int pmul = floor(10^plength); multiplier to get leftmost digit int pdigit = 0; used for extracted digit loop: pdigit = floor(p / pmul); rotate pattern one step p = (p-pdigit*pmul)*10 + pdigit IF (@switchseeds); seeds should be swapped pdigit = 3 - pdigit; use the other seed ENDIF IF (pdigit == 1); using first seed IF (@power == (3,0)) zsquared = sqr(z) zcubed = zsquared * z z = z - @relax * (zcubed-1) / (3*zsquared) + #pixel ELSE z = z - @relax * (z^@power-1) / (@power * z^(@power-1)) + #pixel ENDIF IF (|z - zold| < @bailout) count = count + 1 ELSE count = 0 ENDIF zold = z ELSE; using second seed IF (@power == (3,0)) zsquared = sqr(z) zcubed = zsquared * z z = z - @relax * (zcubed-1) / (3*zsquared) + @seed2 ELSE z = z - @relax * (z^@power-1) / (@power * z^(@power-1)) + @seed2 ENDIF IF (|z - zold2| < @bailout) count = count + 1 ELSE count = 0 ENDIF zold2 = z ENDIF bailout: count < plength default: title = "Nova Julia2 Step 1a" helpfile = "dmj-pub\dmj-pub-uf-nj2.htm" maxiter = 1000 periodicity = 0 center = (-0.5,0) magn = 1.5 param seed2 caption = "Julia Seed 2" default = (0,0) hint = "This is the second Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param switchseeds caption = "Switch Seeds" default = FALSE hint = "If this is enabled, the Julia seeds will be swapped. This \ lets you try the alternate 'flavor' Julia2 without manually \ swapping the parameters." endparam ; param pattern ; caption = "Seed Pattern" ; default = 21 ; min = 12 ; hint = "Defines the pattern in which the two seeds will be used. \ ; Each digit indicates the seed to use, 1 or 2; when all \ ; digits have been used, the pattern repeats. The default \ ; of 21 gives the original Julia2 behavior." ; endparam param power caption = "Exponent" default = (3,0) hint = "Overall exponent for the equation. (3,0) gives \ the classic NovaM type." endparam param bailout caption = "Bailout" default = 0.00001 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam switch: type = "dmj-NovaJulia2-Step2" seed1 = #pixel seed2 = @seed2 switchseeds = @switchseeds ; pattern = @pattern power = @power bailout = @bailout relax = @relax } dmj-PhoenixMandel { ; ; This type implements the Phoenix types discovered by ; Shigehiro Ushiki. It is somewhat generalized over ; the FractInt implementation. The general equation is ; of the form ; ; z(n+1) = z(n)^a + c*z(n)^b + p*z(n-1) ; ; In FractInt, choices for b are restricted to a-1 and ; a-2. This implementation allows arbitrary choices ; for both a and b. ; ; If a=2 and b=0 (classic Phoenix) then this type will ; work with the dmj-Smooth and dmj-Triangle coloring ; types. ; init: complex y = (0,0) complex newz = (0,0) IF (@start == (0,0)); bug in beta 5 z = #pixel ELSE z = @start ENDIF loop: newz = z^@power1 + z^@power2 * #pixel + @induct * y y = z z = newz bailout: |z| < @bailout default: title = "Phoenix (Mandelbrot)" helpfile = "dmj-pub\dmj-pub-uf-phoenix.htm" maxiter = 1000 center = (-0.5,0) param start caption = "Start Value" default = (0,0) hint = "Starting value for each point. You can use this to \ 'perturb' the fractal." endparam param power1 caption = "Primary Exponent" default = (2,0) hint = "Defines the primary exponent for the fractal. The classic \ Phoenix curve uses exponent 2." endparam param power2 caption = "Secondary Exponent" default = (0,0) hint = "Defines the secondary exponent for the fractal. The classic \ Phoenix curve uses exponent 0." endparam param induct caption = "Phoenix Distortion" default = (0.5,0) hint = "Sets how 'strong' the previous iteration's effect should be \ on the fractal." endparam param bailout caption = "Bailout" default = 1.0e20 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Phoenix set anymore." endparam switch: type = "dmj-PhoenixJulia" seed = #pixel bailout = @bailout power1 = @power1 power2 = @power2 induct = @induct } dmj-PhoenixJulia { ; ; This type implements the Phoenix types discovered by ; Shigehiro Ushiki. It is somewhat generalized over ; the FractInt implementation. The general equation is ; of the form ; ; z(n+1) = z(n)^a + c*z(n)^b + p*z(n-1) ; ; In FractInt, choices for b are restricted to a-1 and ; a-2. This implementation allows arbitrary choices ; for both a and b. ; ; If a=2 and b=0 (classic Phoenix) then this type will ; work with the dmj-Smooth and dmj-Triangle coloring ; types. ; init: complex y = (0,0) complex newz = (0,0) z = #pixel loop: newz = z^@power1 + z^@power2 * @seed + @induct * y y = z z = newz bailout: |z| < @bailout default: title = "Phoenix (Julia)" helpfile = "dmj-pub\dmj-pub-uf-phoenix.htm" maxiter = 1000 center = (0,0) param seed caption = "Julia Seed" default = (0.56667,0) hint = "This is the Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param power1 caption = "Primary Exponent" default = (2,0) hint = "Defines the primary exponent for the fractal. The classic \ Phoenix curve uses exponent 2." endparam param power2 caption = "Secondary Exponent" default = (0,0) hint = "Defines the secondary exponent for the fractal. The classic \ Phoenix curve uses exponent 0." endparam param induct caption = "Phoenix Distortion" default = (-0.5,0) hint = "Sets how 'strong' the previous iteration's effect should be \ on the fractal." endparam param bailout caption = "Bailout" default = 1.0e20 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Phoenix set anymore." endparam switch: type = "dmj-PhoenixMandel" bailout = @bailout power1 = @power1 power2 = @power2 induct = @induct } dmj-PhoenixDNovaMandel { ; ; This is the DoubleNova fractal (Mandelbrot form), ; a modified Newtonian-style fractal. ; ; This variant includes an inductive component similar ; to the Phoenix fractal. ; init: complex zold = (0,0) complex y = (0,0) z = @start IF (@usecritical) z = ( -((@power2-1)*@power2*@coeff2) / \ ((@power1-1)*@power1*@coeff1) ) ^ (1/(@power1-@power2)) ENDIF loop: y = zold zold = z z = z - (@coeff1*z^@power1 + @coeff2*z^@power2 - 1) * @relax / \ (@coeff1*@power1*z^(@power1-1) + @coeff2*@power2*z^(@power2-1)) + #pixel + @induct*y bailout: |z - zold| > @bailout default: title = "PhoenixDoubleNova (Mandelbrot)" helpfile = "dmj-pub\dmj-pub-uf-pdn.htm" maxiter = 1000 periodicity = 0 center = (-0.5,0) magn = 1.5 param start caption = "Start Value" default = (1,0) hint = "Starting value for each point. You can use this to \ 'perturb' the fractal." endparam param power1 caption = "Primary Exponent" default = (4,0) hint = "Defines the primary exponent for the equation." endparam param power2 caption = "Secondary Exponent" default = (2,0) hint = "Defines the secondary exponent for the equation." endparam param coeff1 caption = "Primary Scale" default = (1,0) hint = "Defines the coefficient (multiplier) for the \ primary exponent term." endparam param coeff2 caption = "Secondary Scale" default = (-3,0) hint = "Defines the coefficient (multiplier) for the \ secondary exponent term." endparam param induct caption = "Phoenix Distortion" default = (-0.5,0) hint = "Sets how 'strong' the previous iteration's effect should be \ on the fractal." endparam param bailout caption = "Bailout" default = 0.00001 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam param usecritical caption = "Use Critical Point" default = false hint = "If set, a critical point for the function will \ be used in place of the Start Value." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam switch: type = "dmj-PhoenixDNovaJulia" seed = #pixel power1 = @power1 power2 = @power2 coeff1 = @coeff1 coeff2 = @coeff2 bailout = @bailout relax = @relax } dmj-PhoenixDNovaJulia { ; ; This is the DoubleNova fractal (Julia form), a ; modified Newtonian-style fractal. ; ; This variant includes an inductive component similar ; to the Phoenix fractal. ; init: complex zold = (0,0) complex y = (0,0) z = #pixel loop: y = zold zold = z z = z - (@coeff1*z^@power1 + @coeff2*z^@power2 - 1) * @relax / \ (@coeff1*@power1*z^(@power1-1) + @coeff2*@power2*z^(@power2-1)) + @seed + @induct*y bailout: |z - zold| > @bailout default: title = "PhoenixDoubleNova (Julia)" helpfile = "dmj-pub\dmj-pub-uf-pdn.htm" maxiter = 1000 periodicity = 0 center = (0,0) magn = 1.5 param seed caption = "Julia Seed" default = (0,0) hint = "This is the Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param power1 caption = "Primary Exponent" default = (4,0) hint = "Defines the primary exponent for the equation." endparam param power2 caption = "Secondary Exponent" default = (2,0) hint = "Defines the secondary exponent for the equation." endparam param coeff1 caption = "Primary Scale" default = (1,0) hint = "Defines the coefficient (multiplier) for the \ primary exponent term." endparam param coeff2 caption = "Secondary Scale" default = (-2,0) hint = "Defines the coefficient (multiplier) for the \ secondary exponent term." endparam param induct caption = "Phoenix Distortion" default = (-0.5,0) hint = "Sets how 'strong' the previous iteration's effect should be \ on the fractal." endparam param bailout caption = "Bailout" default = 0.00001 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam switch: type = "dmj-PhoenixDNovaMandel" power1 = @power1 power2 = @power2 coeff1 = @coeff1 coeff2 = @coeff2 bailout = @bailout relax = @relax } dmj-PhoenixDHNovaMandel { ; ; This is the DoubleHalleyNova fractal (Mandelbrot form), ; a modified Newtonian-style fractal. ; ; This variant includes an inductive component similar ; to the Phoenix fractal. ; init: complex y = (0,0) complex zold = (0,0) complex fz = (0,0) complex f1z = (0,0) complex f2z = (0,0) z = @start ; IF (@usecritical) ; ENDIF loop: y = zold zold = z fz = @coeff1*z^@power1 + @coeff2*z^@power2 - 1 f1z = @coeff1*@power1*z^(@power1-1) + @coeff2*@power2*z^(@power2-1) f2z = @coeff1*@power1*(@power1-1)*z^(@power1-2) + @coeff2*@power2*(@power2-1)*z^(@power2-2) z = z - @relax * (2*fz*f1z) / (2*f1z^2 - fz*f2z) + #pixel + @induct*y bailout: |z - zold| > @bailout default: title = "PhoenixDoubleHalleyNova (Mandelbrot)" helpfile = "dmj-pub\dmj-pub-uf-pdhn.htm" maxiter = 1000 periodicity = 0 center = (-0.5,0) magn = 1.5 param start caption = "Start Value" default = (1,0) hint = "Starting value for each point. You can use this to \ 'perturb' the fractal." endparam param power1 caption = "Primary Exponent" default = (4,0) hint = "Defines the primary exponent for the equation." endparam param power2 caption = "Secondary Exponent" default = (2,0) hint = "Defines the secondary exponent for the equation." endparam param coeff1 caption = "Primary Scale" default = (1,0) hint = "Defines the coefficient (multiplier) for the \ primary exponent term." endparam param coeff2 caption = "Secondary Scale" default = (-3,0) hint = "Defines the coefficient (multiplier) for the \ secondary exponent term." endparam param induct caption = "Phoenix Distortion" default = (-0.5,0) hint = "Sets how 'strong' the previous iteration's effect should be \ on the fractal." endparam param bailout caption = "Bailout" default = 0.00001 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam ; param usecritical ; caption = "Use Critical Point" ; default = false ; hint = "If set, a critical point for the function will \ ; be used in place of the Start Value." ; endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam switch: type = "dmj-PhoenixDHNovaJulia" seed = #pixel power1 = @power1 power2 = @power2 coeff1 = @coeff1 coeff2 = @coeff2 bailout = @bailout relax = @relax } dmj-PhoenixDHNovaJulia { ; ; This is the DoubleHalleyNova fractal (Julia form), a ; modified Newtonian-style fractal. ; ; This variant includes an inductive component similar ; to the Phoenix fractal. ; init: complex y = (0,0) complex zold = (0,0) complex fz = (0,0) complex f1z = (0,0) complex f2z = (0,0) z = #pixel loop: y = zold zold = z fz = @coeff1*z^@power1 + @coeff2*z^@power2 - 1 f1z = @coeff1*@power1*z^(@power1-1) + @coeff2*@power2*z^(@power2-1) f2z = @coeff1*@power1*(@power1-1)*z^(@power1-2) + @coeff2*@power2*(@power2-1)*z^(@power2-2) z = z - @relax * (2*fz*f1z) / (2*f1z^2 - fz*f2z) + @seed + @induct*y bailout: |z - zold| > @bailout default: title = "PhoenixDoubleHalleyNova (Julia)" helpfile = "dmj-pub\dmj-pub-uf-pdhn.htm" maxiter = 1000 periodicity = 0 center = (0,0) magn = 1.5 param seed caption = "Julia Seed" default = (0,0) hint = "This is the Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param power1 caption = "Primary Exponent" default = (4,0) hint = "Defines the primary exponent for the equation." endparam param power2 caption = "Secondary Exponent" default = (2,0) hint = "Defines the secondary exponent for the equation." endparam param coeff1 caption = "Primary Scale" default = (1,0) hint = "Defines the coefficient (multiplier) for the \ primary exponent term." endparam param coeff2 caption = "Secondary Scale" default = (-2,0) hint = "Defines the coefficient (multiplier) for the \ secondary exponent term." endparam param induct caption = "Phoenix Distortion" default = (-0.5,0) hint = "Sets how 'strong' the previous iteration's effect should be \ on the fractal." endparam param bailout caption = "Bailout" default = 0.00001 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam switch: type = "dmj-PhoenixDHNovaMandel" power1 = @power1 power2 = @power2 coeff1 = @coeff1 coeff2 = @coeff2 bailout = @bailout relax = @relax } dmj-PhoenixNovaMandel { ; ; This is the PhoenixNova fractal, a Phoenix variant ; of the Nova fractal. This is the Mandelbrot flavor. ; init: complex zsquared = (0,0) complex zcubed = (0,0) complex zold = (0,0) complex y = (0,0) z = @start loop: IF (@power == (3,0)); special optimized routine for power 3 zsquared = sqr(z) zcubed = zsquared * z y = zold zold = z z = z - @relax * (zcubed-1) / (3*zsquared) + #pixel + @induct*y ELSE y = zold zold = z z = z - @relax * (z^@power-1) / (@power * z^(@power-1)) + #pixel + @induct*y ENDIF bailout: |z - zold| > @bailout default: title = "PhoenixNova (Mandelbrot)" helpfile = "dmj-pub\dmj-pub-uf-pn.htm" maxiter = 1000 periodicity = 0 center = (-0.5,0) magn = 1.5 param start caption = "Start Value" default = (1,0) hint = "Starting value for each point. You can use this to \ 'perturb' the fractal." endparam param power caption = "Exponent" default = (3,0) hint = "Overall exponent for the equation. (3,0) gives \ the classic NovaM type." endparam param induct caption = "Phoenix Distortion" default = (-0.5,0) hint = "Sets how 'strong' the previous iteration's effect should be \ on the fractal." endparam param bailout caption = "Bailout" default = 0.00001 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam switch: type = "dmj-PhoenixNovaJulia" seed = #pixel power = @power induct = @induct bailout = @bailout relax = @relax } dmj-PhoenixNovaJulia { ; ; This is the PhoenixNova fractal, a Phoenix variant ; of the Nova fractal. This is the Julia flavor. ; init: complex zsquared = (0,0) complex zcubed = (0,0) complex zold = (0,0) complex y = (0,0) z = #pixel loop: IF (@power == (3,0)); special optimized routine for power 3 zsquared = sqr(z) zcubed = zsquared * z y = zold zold = z z = z - @relax * (zcubed-1) / (3*zsquared) + @seed + @induct*y ELSE y = zold zold = z z = z - @relax * (z^@power-1) / (@power * z^(@power-1)) + @seed + @induct*y ENDIF bailout: |z - zold| > @bailout default: title = "PhoenixNova (Julia)" helpfile = "dmj-pub\dmj-pub-uf-pn.htm" maxiter = 1000 periodicity = 0 center = (0,0) magn = 1.5 param seed caption = "Julia Seed" default = (0,0) hint = "This is the Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param power caption = "Exponent" default = (3,0) hint = "Overall exponent for the equation. (3,0) gives \ the classic Nova type." endparam param induct caption = "Phoenix Distortion" default = (-0.5,0) hint = "Sets how 'strong' the previous iteration's effect should be \ on the fractal." endparam param bailout caption = "Bailout" default = 0.00001 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam switch: type = "dmj-PhoenixNovaMandel" power = @power induct = @induct bailout = @bailout relax = @relax } dmj-PhoenixHNovaMandel { ; ; This is the PhoenixHalleyNova fractal (Mandelbrot ; form), a Phoenix variant of the HalleyNova fractal. ; init: complex nsquaredplusn = sqr(@power) + @power complex nsquaredminusn = sqr(@power) - @power complex zton = (0,0) complex zold = (0,0) complex y = (0,0) z = @start loop: y = zold zold = z zton = z^@power z = z - (2*@power*z * (zton-1)) * @relax / \ (nsquaredplusn*zton + nsquaredminusn) + #pixel + @induct*y bailout: |z - zold| > @bailout default: title = "PhoenixHalleyNova (Mandelbrot)" helpfile = "dmj-pub\dmj-pub-uf-phn.htm" maxiter = 1000 periodicity = 0 center = (-0.5,0) magn = 1.0 param start caption = "Start Value" default = (1,0) hint = "Starting value for each point. You can use this to \ 'perturb' the fractal." endparam param power caption = "Exponent" default = (3,0) hint = "Overall exponent for the equation. (3,0) gives \ the classic HalleyNovaM type." endparam param induct caption = "Phoenix Distortion" default = (-0.5,0) hint = "Sets how 'strong' the previous iteration's effect should be \ on the fractal." endparam param bailout caption = "Bailout" default = 0.00001 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam switch: type = "dmj-PhoenixHNovaJulia" seed = #pixel power = @power induct = @induct bailout = @bailout relax = @relax } dmj-PhoenixHNovaJulia { ; ; This is the PhoenixHalleyNova fractal (Julia form), ; a Phoenix variant of the HalleyNova fractal. ; init: complex nsquaredplusn = sqr(@power) + @power complex nsquaredminusn = sqr(@power) - @power complex zton = (0,0) complex zold = (0,0) complex y = (0,0) z = #pixel loop: y = zold zold = z zton = z^@power z = z - (2*@power*z * (zton-1)) * @relax /\ (nsquaredplusn*zton + nsquaredminusn) + @seed + @induct*y bailout: |z - zold| > @bailout default: title = "PhoenixHalleyNova (Julia)" helpfile = "dmj-pub\dmj-pub-uf-phn.htm" maxiter = 1000 periodicity = 0 center = (0,0) magn = 0.5 param seed caption = "Julia Seed" default = (0,0) hint = "This is the Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param power caption = "Exponent" default = (3,0) hint = "Overall exponent for the equation. (3,0) gives \ the classic HalleyNovaJ type." endparam param induct caption = "Phoenix Distortion" default = (-0.5,0) hint = "Sets how 'strong' the previous iteration's effect should be \ on the fractal." endparam param bailout caption = "Bailout" default = 0.00001 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam switch: type = "dmj-PhoenixHNovaMandel" power = @power induct = @induct bailout = @bailout relax = @relax } dmj-SimurghMandel { ; ; This is the Simurgh fractal, a slight extrapolation ; of the techniques used to produce the Phoenix fractal. ; Its formula is: ; ; z(n+1) = z(n)^a + c*z(n)^b + p*z(n-1) + q*z(n-2) ; ; If a=2 and b=0 then this type will work with the ; dmj-Smooth and dmj-Triangle coloring types. ; init: complex w = (0,0) complex y = (0,0) complex newz = (0,0) IF (@start == (0,0)); bug in beta 5 z = #pixel ELSE z = @start ENDIF loop: newz = z^@power1 + z^@power2 * #pixel + @induct * y + @induct2 * w w = y y = z z = newz bailout: |z| < @bailout default: title = "Simurgh (Mandelbrot)" helpfile = "dmj-pub\dmj-pub-uf-simurgh.htm" maxiter = 1000 center = (-0.5,0) param start caption = "Start Value" default = (0,0) hint = "Starting value for each point. You can use this to \ 'perturb' the fractal." endparam param power1 caption = "Primary Exponent" default = (2,0) hint = "Defines the primary exponent for the fractal." endparam param power2 caption = "Secondary Exponent" default = (0,0) hint = "Defines the secondary exponent for the fractal." endparam param induct caption = "Simurgh Distortion 1" default = (0.5,0) hint = "Sets how 'strong' the previous iteration's effect should be \ on the fractal." endparam param induct2 caption = "Simurgh Distortion 2" default = (-0.25,0) hint = "Sets how 'strong' the next previous iteration's effect should be \ on the fractal." endparam param bailout caption = "Bailout" default = 1.0e20 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Simurgh set anymore." endparam switch: type = "dmj-SimurghJulia" seed = #pixel bailout = @bailout power1 = @power1 power2 = @power2 induct = @induct induct2 = @induct2 } dmj-SimurghJulia { ; ; This is the Simurgh fractal, a slight extrapolation ; of the techniques used to produce the Phoenix fractal. ; Its formula is: ; ; z(n+1) = z(n)^a + c*z(n)^b + p*z(n-1) + q*z(n-2) ; ; If a=2 and b=0 then this type will work with the ; dmj-Smooth and dmj-Triangle coloring types. ; init: complex w = (0,0) complex y = (0,0) complex newz = (0,0) z = #pixel loop: newz = z^@power1 + z^@power2 * @seed + @induct * y + @induct2 * w w = y y = z z = newz bailout: |z| < @bailout default: title = "Simurgh (Julia)" helpfile = "dmj-pub\dmj-pub-uf-simurgh.htm" maxiter = 1000 center = (0,0) param seed caption = "Julia Seed" default = (0.03125,0.5625) hint = "This is the Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param power1 caption = "Primary Exponent" default = (2,0) hint = "Defines the primary exponent for the fractal." endparam param power2 caption = "Secondary Exponent" default = (0,0) hint = "Defines the secondary exponent for the fractal." endparam param induct caption = "Simurgh Distortion 1" default = (0,0) hint = "Sets how 'strong' the previous iteration's effect should be \ on the fractal." endparam param induct2 caption = "Simurgh Distortion 2" default = (-0.5,0) hint = "Sets how 'strong' the next previous iteration's effect should be \ on the fractal." endparam param bailout caption = "Bailout" default = 1.0e20 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Simurgh set anymore." endparam switch: type = "dmj-SimurghMandel" bailout = bailout power1 = @power1 power2 = @power2 induct = @induct induct2 = @induct2 } dmj-SlopeLyapMandel { ; ; This is the LambdaMandelbrot set, but the calculations ; are modified so that z contains a surface normal ; to the set instead of the orbit value. This is ; intended primarily for the Lighting coloring ; method, but might have interesting results for ; other methods, too. ; init: complex c1 = #pixel ; primary iterated point complex c2 = #pixel + @offset ; horizontally offset point complex c3 = #pixel + flip(@offset) ; vertically offset point complex z1 = @start ; starting value complex z2 = @start complex z3 = @start ; complex z1 = @start ; starting value ; complex z2 = @start + @offset ; complex z3 = @start + flip(@offset) int done = 2 float modz = 0.0 float il2 = 1/log(real(@power)) ; Inverse log 2 (precalc). float lp = log(log(@bailout)) ; log(log bailout) (precalc). float e1 = 0.0 ; potentials float e2 = 0.0 float e3 = 0.0 float vx = 0.0 ; normal vector float vy = 0.0 float vz = 0.0 float vd = 0.0 float d1 = 0.0 ; distances float d2 = 0.0 float d3 = 0.0 float s1 = 1.0e20 ; smallest distances float s2 = 1.0e20 float s3 = 1.0e20 ; float a1 = 0.0 ; averages ; float a2 = 0.0 ; float a3 = 0.0 ; float oa1 = 0.0 ; float oa2 = 0.0 ; float oa3 = 0.0 complex g1 = (0,0) ; distance estimates complex g2 = (0,0) complex g3 = (0,0) complex o1 = (0,0) complex o2 = (0,0) complex o3 = (0,0) ; IF (@zmode == 7) ; triangle inequality ; s1 = cabs(c1) ; precalc ; s2 = cabs(c2) ; s3 = cabs(c3) ; ENDIF loop: ; z = #pixel*z*(1-z)^(@power-1) z1 = c1*z1*(1-z1)^(@power-1) ; iterate each point z2 = c2*z2*(1-z2)^(@power-1) ; iterate each point z3 = c3*z3*(1-z3)^(@power-1) ; iterate each point ; z1 = z1^@power + c2 ; z2 = z2^@power + c2 ; z3 = z3^@power + c3 done = done + 1 ; increment iteration counter IF (@zmode == 1) ; smallest |z| d1 = |z1| ; get current distances from origin d2 = |z2| d3 = |z3| IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 2) ; smallest |real(z)| d1 = abs(real(z1)) ; get current distances from i axis d2 = abs(real(z2)) d3 = abs(real(z3)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 3) ; smallest |imag(z)| d1 = abs(imag(z1)) ; get current distances from r axis d2 = abs(imag(z2)) d3 = abs(imag(z3)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 4) ; smallest |real(z)|+|imag(z)| d1 = abs(real(z1))+abs(imag(z1)) ; get current distances from i axis d2 = abs(real(z2))+abs(imag(z2)) d3 = abs(real(z3))+abs(imag(z3)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 5) ; smallest |atan(z)| d1 = abs(atan2(z1)) ; get current angles d2 = abs(atan2(z2)) d3 = abs(atan2(z3)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 6) ; distance estimator o1 = g1 o2 = g2 o3 = g3 g1 = @power * z1^(@power-1) * g1 + 1 ; update distance estimates g2 = @power * z2^(@power-1) * g2 + 1 g3 = @power * z3^(@power-1) * g3 + 1 ; ELSEIF (@zmode == 7 && done > 3) ; triangle inequality ; oa1 = a1 ; oa2 = a2 ; oa3 = a3 ; d1 = cabs(z1 - c1) ; |z| ; d2 = cabs(z2 - c2) ; d3 = cabs(z3 - c3) ; e1 = abs(d1 - s1) ; lower bound ; e2 = abs(d2 - s2) ; e3 = abs(d3 - s3) ; a1 = a1 + (cabs(z1) - e1) / (d1+s1 - e1) ; update average ; a2 = a2 + (cabs(z2) - e2) / (d2+s2 - e2) ; a3 = a3 + (cabs(z3) - e3) / (d3+s3 - e3) ENDIF modz = |z1| IF (modz > @bailout || \ @everyiter || \ done == #maxit + 2) ; done, or every iteration, or last ; determine continuous iteration (height) for each point IF (@zmode == 0) ; height based on potential e1 = (done + il2*lp - il2*log(log(cabs(z1)))) * @zscale e2 = (done + il2*lp - il2*log(log(cabs(z2)))) * @zscale e3 = (done + il2*lp - il2*log(log(cabs(z3)))) * @zscale ELSEIF (@zmode >= 1 && @zmode <= 5) ; height based on smallest |z| e1 = s1 * @zscale e2 = s2 * @zscale e3 = s3 * @zscale ELSEIF (@zmode == 6) ; height based on distance estimator e1 = sqrt(2*log(cabs(z1)) * cabs(z1) / cabs(o1)) * @zscale e2 = sqrt(2*log(cabs(z2)) * cabs(z2) / cabs(o2)) * @zscale e3 = sqrt(2*log(cabs(z3)) * cabs(z3) / cabs(o3)) * @zscale ; ELSEIF (@zmode == 7) ; height based on triangle inequality ; e1 = il2*lp - il2*log(log(cabs(z1))) ; fractional iterations ; e2 = il2*lp - il2*log(log(cabs(z2))) ; e3 = il2*lp - il2*log(log(cabs(z3))) ; e1 = (oa1 + (a1-oa1) * (e1)) * @zscale ; triangle inequality average, smoothed ; e2 = (oa2 + (a2-oa2) * (e2)) * @zscale ; e3 = (oa3 + (a3-oa3) * (e3)) * @zscale ENDIF ; apply transfer function ; a function is not used because these are floats ; and not all functions apply to floats IF (@xfer == 1) ; log e1 = log(e1) e2 = log(e2) e3 = log(e3) ELSEIF (@xfer == 2) ; sqrt e1 = sqrt(e1) e2 = sqrt(e2) e3 = sqrt(e3) ELSEIF (@xfer == 3) ; cuberoot e1 = (e1)^(1/3) e2 = (e2)^(1/3) e3 = (e3)^(1/3) ELSEIF (@xfer == 4) ; exp e1 = exp(e1) e2 = exp(e2) e3 = exp(e3) ELSEIF (@xfer == 5) ; sqr e1 = sqr(e1) e2 = sqr(e2) e3 = sqr(e3) ELSEIF (@xfer == 6) ; cube e1 = (e1)^3 e2 = (e2)^3 e3 = (e3)^3 ELSEIF (@xfer == 7) ; sin e1 = sin(e1) e2 = sin(e2) e3 = sin(e3) ELSEIF (@xfer == 8) ; cos e1 = cos(e1) e2 = cos(e2) e3 = cos(e3) ELSEIF (@xfer == 9) ; tan e1 = tan(e1) e2 = tan(e2) e3 = tan(e3) ENDIF ; apply post-scale e1 = e1 * @zscale2 e2 = e2 * @zscale2 e3 = e3 * @zscale2 ; IF (@zmode == 0) ; surface normal ; determine surface normal ; that is, the normal to the surface defined by: ; (real(c1), imag(c1), e1) ; (real(c2), imag(c2), e2) ; (real(c3), imag(c3), e3) vx = e2-e1 vy = e3-e1 vz = -@offset ; normalize vector vd = 1/sqrt(sqr(vx)+sqr(vy)+sqr(vz)) vx = vx*vd vy = vy*vd vz = vz*vd z = vx + flip(vy) ; fudge z from vector ; ELSEIF (@zmode == 1) ; potential ; ; determine surface normal ; ; that is, the normal to the surface defined by: ; ; (real(z1), imag(z1), e1) ; ; (real(z2), imag(z2), e2) ; ; (real(z3), imag(z3), e3) ; vx = imag(z2-z1)*(e3-e1) - (e2-e1)*imag(z3-z1) ; vy = (e2-e1)*real(z3-z1) - real(z2-z1)*(e3-e1) ; vz = real(z2-z1)*imag(z3-z1) - imag(z2-z1)*real(z3-z1) ; ; normalize vector in 2D ; vd = 1/sqrt(sqr(vx)+sqr(vy)) ; vx = vx*vd ; vy = vy*vd ; z = (vx + flip(vy)) * e1 * (c1/cabs(c1)) ; ENDIF ELSE ; didn't compute z this time z = z1 ; use primary iteration value to keep periodicity working ENDIF IF (modz > @bailout) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope (LambdaMandel)" helpfile = "dmj-pub\dmj-pub-uf-slope.htm" center = (1.0, 0.0) magn = 0.5 maxiter = 1000 param start caption = "Starting Point" default = (0.5,0.0) hint = "Starting value for each point. You can use this to \ 'perturb' the fractal." endparam param power caption = "Exponent" default = (2,0) hint = "Overall exponent for the equation. (2,0) gives \ the classic Mandelbrot type." endparam param bailout caption = "Bail-out Value" default = 1.0e20 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Mandelbrot set anymore." endparam param offset caption = "Orbit Separation" default = 0.00000001 hint = "Defines how far apart the simultaneous orbits are. Smaller \ distances will produce more accurate results." endparam param zmode caption = "Height Value" default = 6 enum = "potential" "smallest |z|" "smallest |real(z)|" \ "smallest |imag(z)|" "smallest summ(z)" "smallest |atan(z)|" \ "distance estimator" ;"triangle inequality" hint = "Specifies what will be used to construct a height value." endparam param xfer caption = "Height Transfer" default = 0 enum = "linear" "log" "sqrt" "cuberoot" "exp" "sqr" "cube" "sin" "cos" "tan" hint = "This function will be applied to the height value \ before a slope is calculated." endparam param zscale caption = "Height Pre-Scale" default = 1.0 hint = "Specifies the ratio between height and distance. Higher \ values will exaggerate differences between high and low. \ In general, you will want to use smaller numbers here." endparam param zscale2 caption = "Height Post-Scale" default = 0.025 hint = "Specifies the ratio between height and distance; like \ Height Pre-Scale, except that this value is applied after \ the transfer function." endparam param everyiter caption = "Every Iteration" default = false hint = "If set, the surface normal will be computed at every \ iteration. If you are using a coloring algorithm which \ processes every iteration, you will need this." endparam switch: type = "dmj-SlopeLyapJulia" seed = #pixel power = @power bailout = @bailout offset = @offset zmode = @zmode xfer = @xfer zscale = @zscale zscale2 = @zscale2 everyiter = @everyiter } dmj-SlopeLyapJulia { ; ; This is the LambdaJulia set, but the calculations ; are modified so that z contains a surface normal ; to the set instead of the orbit value. This is ; intended primarily for the Lighting coloring ; method, but might have interesting results for ; other methods, too. ; init: complex z1 = #pixel ; primary iterated point complex z2 = #pixel + @offset ; horizontally offset point complex z3 = #pixel + flip(@offset) ; vertically offset point ; complex z1 = @start ; starting value ; complex z2 = @start ; complex z3 = @start ; complex z1 = @start ; starting value ; complex z2 = @start + @offset ; complex z3 = @start + flip(@offset) int done = 2 float modz = 0.0 float il2 = 1/log(real(@power)) ; Inverse log 2 (precalc). float lp = log(log(@bailout)) ; log(log bailout) (precalc). float e1 = 0.0 ; potentials float e2 = 0.0 float e3 = 0.0 float vx = 0.0 ; normal vector float vy = 0.0 float vz = 0.0 float vd = 0.0 float d1 = 0.0 ; distances float d2 = 0.0 float d3 = 0.0 float s1 = 1.0e20 ; smallest distances float s2 = 1.0e20 float s3 = 1.0e20 ; float a1 = 0.0 ; averages ; float a2 = 0.0 ; float a3 = 0.0 ; float oa1 = 0.0 ; float oa2 = 0.0 ; float oa3 = 0.0 complex g1 = (0,0) ; distance estimates complex g2 = (0,0) complex g3 = (0,0) complex o1 = (0,0) complex o2 = (0,0) complex o3 = (0,0) ; IF (@zmode == 7) ; triangle inequality ; s1 = cabs(c1) ; precalc ; s2 = cabs(c2) ; s3 = cabs(c3) ; ENDIF loop: ; z = #pixel*z*(1-z)^(@power-1) z1 = @seed*z1*(1-z1)^(@power-1) ; iterate each point z2 = @seed*z2*(1-z2)^(@power-1) ; iterate each point z3 = @seed*z3*(1-z3)^(@power-1) ; iterate each point done = done + 1 ; increment iteration counter IF (@zmode == 1) ; smallest |z| d1 = |z1| ; get current distances from origin d2 = |z2| d3 = |z3| IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 2) ; smallest |real(z)| d1 = abs(real(z1)) ; get current distances from i axis d2 = abs(real(z2)) d3 = abs(real(z3)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 3) ; smallest |imag(z)| d1 = abs(imag(z1)) ; get current distances from r axis d2 = abs(imag(z2)) d3 = abs(imag(z3)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 4) ; smallest |real(z)|+|imag(z)| d1 = abs(real(z1))+abs(imag(z1)) ; get current distances from i axis d2 = abs(real(z2))+abs(imag(z2)) d3 = abs(real(z3))+abs(imag(z3)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 5) ; smallest |atan(z)| d1 = abs(atan2(z1)) ; get current angles d2 = abs(atan2(z2)) d3 = abs(atan2(z3)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 6) ; distance estimator o1 = g1 o2 = g2 o3 = g3 g1 = @power * z1^(@power-1) * g1 + 1 ; update distance estimates g2 = @power * z2^(@power-1) * g2 + 1 g3 = @power * z3^(@power-1) * g3 + 1 ; ELSEIF (@zmode == 7 && done > 3) ; triangle inequality ; oa1 = a1 ; oa2 = a2 ; oa3 = a3 ; d1 = cabs(z1 - c1) ; |z| ; d2 = cabs(z2 - c2) ; d3 = cabs(z3 - c3) ; e1 = abs(d1 - s1) ; lower bound ; e2 = abs(d2 - s2) ; e3 = abs(d3 - s3) ; a1 = a1 + (cabs(z1) - e1) / (d1+s1 - e1) ; update average ; a2 = a2 + (cabs(z2) - e2) / (d2+s2 - e2) ; a3 = a3 + (cabs(z3) - e3) / (d3+s3 - e3) ENDIF modz = |z1| IF (modz > @bailout || \ @everyiter || \ done == #maxit + 2) ; done, or every iteration, or last ; determine continuous iteration (height) for each point IF (@zmode == 0) ; height based on potential e1 = (done + il2*lp - il2*log(log(cabs(z1)))) * @zscale e2 = (done + il2*lp - il2*log(log(cabs(z2)))) * @zscale e3 = (done + il2*lp - il2*log(log(cabs(z3)))) * @zscale ELSEIF (@zmode >= 1 && @zmode <= 5) ; height based on smallest |z| e1 = s1 * @zscale e2 = s2 * @zscale e3 = s3 * @zscale ELSEIF (@zmode == 6) ; height based on distance estimator e1 = sqrt(2*log(cabs(z1)) * cabs(z1) / cabs(o1)) * @zscale e2 = sqrt(2*log(cabs(z2)) * cabs(z2) / cabs(o2)) * @zscale e3 = sqrt(2*log(cabs(z3)) * cabs(z3) / cabs(o3)) * @zscale ; ELSEIF (@zmode == 7) ; height based on triangle inequality ; e1 = il2*lp - il2*log(log(cabs(z1))) ; fractional iterations ; e2 = il2*lp - il2*log(log(cabs(z2))) ; e3 = il2*lp - il2*log(log(cabs(z3))) ; e1 = (oa1 + (a1-oa1) * (e1)) * @zscale ; triangle inequality average, smoothed ; e2 = (oa2 + (a2-oa2) * (e2)) * @zscale ; e3 = (oa3 + (a3-oa3) * (e3)) * @zscale ENDIF ; apply transfer function ; a function is not used because these are floats ; and not all functions apply to floats IF (@xfer == 1) ; log e1 = log(e1) e2 = log(e2) e3 = log(e3) ELSEIF (@xfer == 2) ; sqrt e1 = sqrt(e1) e2 = sqrt(e2) e3 = sqrt(e3) ELSEIF (@xfer == 3) ; cuberoot e1 = (e1)^(1/3) e2 = (e2)^(1/3) e3 = (e3)^(1/3) ELSEIF (@xfer == 4) ; exp e1 = exp(e1) e2 = exp(e2) e3 = exp(e3) ELSEIF (@xfer == 5) ; sqr e1 = sqr(e1) e2 = sqr(e2) e3 = sqr(e3) ELSEIF (@xfer == 6) ; cube e1 = (e1)^3 e2 = (e2)^3 e3 = (e3)^3 ELSEIF (@xfer == 7) ; sin e1 = sin(e1) e2 = sin(e2) e3 = sin(e3) ELSEIF (@xfer == 8) ; cos e1 = cos(e1) e2 = cos(e2) e3 = cos(e3) ELSEIF (@xfer == 9) ; tan e1 = tan(e1) e2 = tan(e2) e3 = tan(e3) ENDIF ; apply post-scale e1 = e1 * @zscale2 e2 = e2 * @zscale2 e3 = e3 * @zscale2 ; IF (@zmode == 0) ; surface normal ; determine surface normal ; that is, the normal to the surface defined by: ; (real(c1), imag(c1), e1) ; (real(c2), imag(c2), e2) ; (real(c3), imag(c3), e3) vx = e2-e1 vy = e3-e1 vz = -@offset ; normalize vector vd = 1/sqrt(sqr(vx)+sqr(vy)+sqr(vz)) vx = vx*vd vy = vy*vd vz = vz*vd z = vx + flip(vy) ; fudge z from vector ; ELSEIF (@zmode == 1) ; potential ; ; determine surface normal ; ; that is, the normal to the surface defined by: ; ; (real(z1), imag(z1), e1) ; ; (real(z2), imag(z2), e2) ; ; (real(z3), imag(z3), e3) ; vx = imag(z2-z1)*(e3-e1) - (e2-e1)*imag(z3-z1) ; vy = (e2-e1)*real(z3-z1) - real(z2-z1)*(e3-e1) ; vz = real(z2-z1)*imag(z3-z1) - imag(z2-z1)*real(z3-z1) ; ; normalize vector in 2D ; vd = 1/sqrt(sqr(vx)+sqr(vy)) ; vx = vx*vd ; vy = vy*vd ; z = (vx + flip(vy)) * e1 * (c1/cabs(c1)) ; ENDIF ELSE ; didn't compute z this time z = z1 ; use primary iteration value to keep periodicity working ENDIF IF (modz > @bailout) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope (LambdaJulia)" helpfile = "dmj-pub\dmj-pub-uf-slope.htm" center = (0.5, 0.0) magn = 0.5 maxiter = 1000 param seed caption = "Julia Seed" default = (1,0) hint = "This is the Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param power caption = "Exponent" default = (2,0) hint = "Overall exponent for the equation. (2,0) gives \ the classic Mandelbrot type." endparam param bailout caption = "Bail-out Value" default = 1.0e20 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Mandelbrot set anymore." endparam param offset caption = "Orbit Separation" default = 0.00000001 hint = "Defines how far apart the simultaneous orbits are. Smaller \ distances will produce more accurate results." endparam param zmode caption = "Height Value" default = 6 enum = "potential" "smallest |z|" "smallest |real(z)|" \ "smallest |imag(z)|" "smallest summ(z)" "smallest |atan(z)|" \ "distance estimator" ;"triangle inequality" hint = "Specifies what will be used to construct a height value." endparam param xfer caption = "Height Transfer" default = 0 enum = "linear" "log" "sqrt" "cuberoot" "exp" "sqr" "cube" "sin" "cos" "tan" hint = "This function will be applied to the height value \ before a slope is calculated." endparam param zscale caption = "Height Pre-Scale" default = 1.0 hint = "Specifies the ratio between height and distance. Higher \ values will exaggerate differences between high and low. \ In general, you will want to use smaller numbers here." endparam param zscale2 caption = "Height Post-Scale" default = 0.025 hint = "Specifies the ratio between height and distance; like \ Height Pre-Scale, except that this value is applied after \ the transfer function." endparam param everyiter caption = "Every Iteration" default = false hint = "If set, the surface normal will be computed at every \ iteration. If you are using a coloring algorithm which \ processes every iteration, you will need this." endparam switch: type = "dmj-SlopeLyapMandel" power = @power bailout = @bailout offset = @offset zmode = @zmode xfer = @xfer zscale = @zscale zscale2 = @zscale2 everyiter = @everyiter } dmj-SlopeMandel { ; ; This is the Mandelbrot set, but the calculations ; are modified so that z contains a surface normal ; to the set instead of the orbit value. This is ; intended primarily for the Lighting coloring ; method, but might have interesting results for ; other methods, too. ; init: complex c1 = #pixel; primary iterated point complex c2 = #pixel + @offset; horizontally offset point complex c3 = #pixel + flip(@offset); vertically offset point complex z1 = @start; starting value complex z2 = @start complex z3 = @start int done = 2 float modz = 0.0 float il2 = 1/log(real(@power)); Inverse log 2 (precalc). float lp = log(log(@bailout)); log(log bailout) (precalc). float e1 = 0.0; potentials float e2 = 0.0 float e3 = 0.0 float vx = 0.0; normal vector float vy = 0.0 float vz = 0.0 float vd = 0.0 float d1 = 0.0; distances float d2 = 0.0 float d3 = 0.0 float s1 = 1.0e20; smallest distances float s2 = 1.0e20 float s3 = 1.0e20 ; float a1 = 0.0; averages ; float a2 = 0.0 ; float a3 = 0.0 ; float oa1 = 0.0 ; float oa2 = 0.0 ; float oa3 = 0.0 complex g1 = (0,0); distance estimates complex g2 = (0,0) complex g3 = (0,0) complex o1 = (0,0) complex o2 = (0,0) complex o3 = (0,0) ; IF (@zmode == 7); triangle inequality ; s1 = cabs(c1); precalc ; s2 = cabs(c2) ; s3 = cabs(c3) ; ENDIF loop: z1 = z1^@power + c1; iterate each point z2 = z2^@power + c2 z3 = z3^@power + c3 done = done + 1; increment iteration counter IF (@zmode == 1); smallest |z| d1 = |z1|; get current distances from origin d2 = |z2| d3 = |z3| IF (d1 < s1); update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 2); smallest |real(z)| d1 = abs(real(z1)); get current distances from i axis d2 = abs(real(z2)) d3 = abs(real(z3)) IF (d1 < s1); update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 3); smallest |imag(z)| d1 = abs(imag(z1)); get current distances from r axis d2 = abs(imag(z2)) d3 = abs(imag(z3)) IF (d1 < s1); update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 4); smallest |real(z)|+|imag(z)| d1 = abs(real(z1))+abs(imag(z1)); get current distances from i axis d2 = abs(real(z2))+abs(imag(z2)) d3 = abs(real(z3))+abs(imag(z3)) IF (d1 < s1); update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 5); smallest |atan(z)| d1 = abs(atan2(z1)); get current angles d2 = abs(atan2(z2)) d3 = abs(atan2(z3)) IF (d1 < s1); update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 6); distance estimator o1 = g1 o2 = g2 o3 = g3 g1 = @power * z1^(@power-1) * g1 + 1; update distance estimates g2 = @power * z2^(@power-1) * g2 + 1 g3 = @power * z3^(@power-1) * g3 + 1 ; ELSEIF (@zmode == 7 && done > 3); triangle inequality ; oa1 = a1 ; oa2 = a2 ; oa3 = a3 ; d1 = cabs(z1 - c1); |z| ; d2 = cabs(z2 - c2) ; d3 = cabs(z3 - c3) ; e1 = abs(d1 - s1); lower bound ; e2 = abs(d2 - s2) ; e3 = abs(d3 - s3) ; a1 = a1 + (cabs(z1) - e1) / (d1+s1 - e1); update average ; a2 = a2 + (cabs(z2) - e2) / (d2+s2 - e2) ; a3 = a3 + (cabs(z3) - e3) / (d3+s3 - e3) ENDIF modz = |z1| IF (modz > @bailout ||\ @everyiter ||\ done == #maxit + 2); done, or every iteration, or last ; determine continuous iteration (height) for each point IF (@zmode == 0); height based on potential e1 = (done + il2*lp - il2*log(log(cabs(z1)))) * @zscale e2 = (done + il2*lp - il2*log(log(cabs(z2)))) * @zscale e3 = (done + il2*lp - il2*log(log(cabs(z3)))) * @zscale ELSEIF (@zmode >= 1 && @zmode <= 5); height based on smallest |z| e1 = s1 * @zscale e2 = s2 * @zscale e3 = s3 * @zscale ELSEIF (@zmode == 6); height based on distance estimator e1 = sqrt(2*log(cabs(z1)) * cabs(z1) / cabs(o1)) * @zscale e2 = sqrt(2*log(cabs(z2)) * cabs(z2) / cabs(o2)) * @zscale e3 = sqrt(2*log(cabs(z3)) * cabs(z3) / cabs(o3)) * @zscale ; ELSEIF (@zmode == 7); height based on triangle inequality ; e1 = il2*lp - il2*log(log(cabs(z1))) ; fractional iterations ; e2 = il2*lp - il2*log(log(cabs(z2))) ; e3 = il2*lp - il2*log(log(cabs(z3))) ; e1 = (oa1 + (a1-oa1) * (e1)) * @zscale; triangle inequality average, smoothed ; e2 = (oa2 + (a2-oa2) * (e2)) * @zscale ; e3 = (oa3 + (a3-oa3) * (e3)) * @zscale ENDIF ; apply transfer function ; a function is not used because these are floats ; and not all functions apply to floats IF (@xfer == 1); log e1 = log(e1) e2 = log(e2) e3 = log(e3) ELSEIF (@xfer == 2); sqrt e1 = sqrt(e1) e2 = sqrt(e2) e3 = sqrt(e3) ELSEIF (@xfer == 3); cuberoot e1 = (e1)^(1/3) e2 = (e2)^(1/3) e3 = (e3)^(1/3) ELSEIF (@xfer == 4); exp e1 = exp(e1) e2 = exp(e2) e3 = exp(e3) ELSEIF (@xfer == 5); sqr e1 = sqr(e1) e2 = sqr(e2) e3 = sqr(e3) ELSEIF (@xfer == 6); cube e1 = (e1)^3 e2 = (e2)^3 e3 = (e3)^3 ELSEIF (@xfer == 7); sin e1 = sin(e1) e2 = sin(e2) e3 = sin(e3) ELSEIF (@xfer == 8); cos e1 = cos(e1) e2 = cos(e2) e3 = cos(e3) ELSEIF (@xfer == 9); tan e1 = tan(e1) e2 = tan(e2) e3 = tan(e3) ENDIF ; apply post-scale e1 = e1 * @zscale2 e2 = e2 * @zscale2 e3 = e3 * @zscale2 ; IF (@zmode == 0); surface normal ; determine surface normal ; that is, the normal to the surface defined by: ; (real(c1), imag(c1), e1) ; (real(c2), imag(c2), e2) ; (real(c3), imag(c3), e3) vx = e2-e1 vy = e3-e1 vz = -@offset ; normalize vector vd = 1/sqrt(sqr(vx)+sqr(vy)+sqr(vz)) vx = vx*vd vy = vy*vd vz = vz*vd z = vx + flip(vy); fudge z from vector ; ELSEIF (@zmode == 1); potential ; ; determine surface normal ; ; that is, the normal to the surface defined by: ; ; (real(z1), imag(z1), e1) ; ; (real(z2), imag(z2), e2) ; ; (real(z3), imag(z3), e3) ; vx = imag(z2-z1)*(e3-e1) - (e2-e1)*imag(z3-z1) ; vy = (e2-e1)*real(z3-z1) - real(z2-z1)*(e3-e1) ; vz = real(z2-z1)*imag(z3-z1) - imag(z2-z1)*real(z3-z1) ; ; normalize vector in 2D ; vd = 1/sqrt(sqr(vx)+sqr(vy)) ; vx = vx*vd ; vy = vy*vd ; z = (vx + flip(vy)) * e1 * (c1/cabs(c1)) ; ENDIF ELSE; didn't compute z this time z = z1; use primary iteration value to keep periodicity working ENDIF IF (modz > @bailout); we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope (Mandelbrot)" helpfile = "dmj-pub\dmj-pub-uf-slope.htm" center = (-0.5, 0.0) maxiter = 1000 param start caption = "Starting Point" default = (0,0) hint = "Starting value for each point. You can use this to \ 'perturb' the fractal." endparam param power caption = "Exponent" default = (2,0) hint = "Overall exponent for the equation. (2,0) gives \ the classic Mandelbrot type." endparam param bailout caption = "Bail-out Value" default = 1.0e20 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Mandelbrot set anymore." endparam param offset caption = "Orbit Separation" default = 0.00000001 hint = "Defines how far apart the simultaneous orbits are. Smaller \ distances will produce more accurate results." endparam param zmode caption = "Height Value" default = 6 enum = "potential" "smallest |z|" "smallest |real(z)|" \ "smallest |imag(z)|" "smallest summ(z)" "smallest |atan(z)|" \ "distance estimator" ;"triangle inequality" hint = "Specifies what will be used to construct a height value." endparam param xfer caption = "Height Transfer" default = 0 enum = "linear" "log" "sqrt" "cuberoot" "exp" "sqr" "cube" "sin" "cos" "tan" hint = "This function will be applied to the height value \ before a slope is calculated." endparam param zscale caption = "Height Pre-Scale" default = 1.0 hint = "Specifies the ratio between height and distance. Higher \ values will exaggerate differences between high and low. \ In general, you will want to use smaller numbers here." endparam param zscale2 caption = "Height Post-Scale" default = 0.025 hint = "Specifies the ratio between height and distance; like \ Height Pre-Scale, except that this value is applied after \ the transfer function." endparam param everyiter caption = "Every Iteration" default = false hint = "If set, the surface normal will be computed at every \ iteration. If you are using a coloring algorithm which \ processes every iteration, you will need this." endparam switch: type = "dmj-SlopeJulia" seed = #pixel power = @power bailout = @bailout offset = @offset zmode = @zmode xfer = @xfer zscale = @zscale zscale2 = @zscale2 everyiter = @everyiter } dmj-SlopeJulia { ; ; This is the Julia set, but the calculations ; are modified so that z contains a surface normal ; to the set instead of the orbit value. This is ; intended primarily for the Lighting coloring ; method, but might have interesting results for ; other methods, too. ; init: complex z1 = #pixel; primary iterated point complex z2 = #pixel + @offset; horizontally offset point complex z3 = #pixel + flip(@offset); vertically offset point int done = 2 float modz = 0.0 float il2 = 1/log(real(@power)); Inverse log 2 (precalc). float lp = log(log(@bailout)); log(log bailout) (precalc). float e1 = 0.0; potentials float e2 = 0.0 float e3 = 0.0 float vx = 0.0; normal vector float vy = 0.0 float vz = 0.0 float vd = 0.0 float d1 = 0.0; distances float d2 = 0.0 float d3 = 0.0 float s1 = 1.0e20; smallest distances float s2 = 1.0e20 float s3 = 1.0e20 complex g1 = (0,0); distance estimates complex g2 = (0,0) complex g3 = (0,0) complex o1 = (0,0) complex o2 = (0,0) complex o3 = (0,0) loop: z1 = z1^@power + @seed; iterate each point z2 = z2^@power + @seed z3 = z3^@power + @seed done = done + 1; increment iteration counter IF (@zmode == 1); smallest |z| d1 = |z1|; get current distances from origin d2 = |z2| d3 = |z3| IF (d1 < s1); update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 2); smallest |real(z)| d1 = abs(real(z1)); get current distances from i axis d2 = abs(real(z2)) d3 = abs(real(z3)) IF (d1 < s1); update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 3); smallest |imag(z)| d1 = abs(imag(z1)); get current distances from r axis d2 = abs(imag(z2)) d3 = abs(imag(z3)) IF (d1 < s1); update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 4); smallest |real(z)|+|imag(z)| d1 = abs(real(z1))+abs(imag(z1)); get current distances from i axis d2 = abs(real(z2))+abs(imag(z2)) d3 = abs(real(z3))+abs(imag(z3)) IF (d1 < s1); update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 5); smallest |atan(z)| d1 = abs(atan2(z1)); get current angles d2 = abs(atan2(z2)) d3 = abs(atan2(z3)) IF (d1 < s1); update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 6); distance estimator o1 = g1 o2 = g2 o3 = g3 g1 = @power * z1^(@power-1) * g1 + 1; update distance estimates g2 = @power * z2^(@power-1) * g2 + 1 g3 = @power * z3^(@power-1) * g3 + 1 ENDIF modz = |z1| IF (modz > @bailout ||\ @everyiter ||\ done == #maxit + 2); done, or every iteration, or last ; determine continuous iteration (height) for each point IF (@zmode == 0); height based on potential e1 = (done + il2*lp - il2*log(log(cabs(z1)))) * @zscale e2 = (done + il2*lp - il2*log(log(cabs(z2)))) * @zscale e3 = (done + il2*lp - il2*log(log(cabs(z3)))) * @zscale ELSEIF (@zmode >= 1 && @zmode <= 5); height based on smallest |z| e1 = s1 * @zscale e2 = s2 * @zscale e3 = s3 * @zscale ELSEIF (@zmode == 6); height based on distance estimator e1 = sqrt(2*log(cabs(z1)) * cabs(z1) / cabs(o1)) * @zscale e2 = sqrt(2*log(cabs(z2)) * cabs(z2) / cabs(o2)) * @zscale e3 = sqrt(2*log(cabs(z3)) * cabs(z3) / cabs(o3)) * @zscale ENDIF ; apply transfer function ; a function is not used because these are floats ; and not all functions apply to floats IF (@xfer == 1); log e1 = log(e1) e2 = log(e2) e3 = log(e3) ELSEIF (@xfer == 2); sqrt e1 = sqrt(e1) e2 = sqrt(e2) e3 = sqrt(e3) ELSEIF (@xfer == 3); cuberoot e1 = (e1)^(1/3) e2 = (e2)^(1/3) e3 = (e3)^(1/3) ELSEIF (@xfer == 4); exp e1 = exp(e1) e2 = exp(e2) e3 = exp(e3) ELSEIF (@xfer == 5); sqr e1 = sqr(e1) e2 = sqr(e2) e3 = sqr(e3) ELSEIF (@xfer == 6); cube e1 = (e1)^3 e2 = (e2)^3 e3 = (e3)^3 ELSEIF (@xfer == 7); sin e1 = sin(e1) e2 = sin(e2) e3 = sin(e3) ELSEIF (@xfer == 8); cos e1 = cos(e1) e2 = cos(e2) e3 = cos(e3) ELSEIF (@xfer == 9); tan e1 = tan(e1) e2 = tan(e2) e3 = tan(e3) ENDIF ; apply post-scale e1 = e1 * @zscale2 e2 = e2 * @zscale2 e3 = e3 * @zscale2 ; IF (@zmode == 0); surface normal ; determine surface normal ; that is, the normal to the surface defined by: ; (real(c1), imag(c1), e1) ; (real(c2), imag(c2), e2) ; (real(c3), imag(c3), e3) vx = e2-e1 vy = e3-e1 vz = -@offset ; normalize vector vd = 1/sqrt(sqr(vx)+sqr(vy)+sqr(vz)) vx = vx*vd vy = vy*vd vz = vz*vd z = vx + flip(vy); fudge z from vector ; ELSEIF (@zmode == 1); potential ; ; determine surface normal ; ; that is, the normal to the surface defined by: ; ; (real(z1), imag(z1), e1) ; ; (real(z2), imag(z2), e2) ; ; (real(z3), imag(z3), e3) ; vx = imag(z2-z1)*(e3-e1) - (e2-e1)*imag(z3-z1) ; vy = (e2-e1)*real(z3-z1) - real(z2-z1)*(e3-e1) ; vz = real(z2-z1)*imag(z3-z1) - imag(z2-z1)*real(z3-z1) ; ; normalize vector in 2D ; vd = 1/sqrt(sqr(vx)+sqr(vy)) ; vx = vx*vd ; vy = vy*vd ; z = (vx + flip(vy)) * e1 * (c1/cabs(c1)) ; ENDIF ELSE; didn't compute z this time z = z1; use primary iteration value to keep periodicity working ENDIF IF (modz > @bailout); we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope (Julia)" helpfile = "dmj-pub\dmj-pub-uf-slope.htm" center = (0.0, 0.0) maxiter = 1000 param seed caption = "Julia Seed" default = (0,0) hint = "This is the Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param power caption = "Exponent" default = (2,0) hint = "Overall exponent for the equation. (2,0) gives \ the classic Julia type." endparam param bailout caption = "Bail-out Value" default = 1.0e20 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Julia set anymore." endparam param offset caption = "Orbit Separation" default = 0.00000001 hint = "Defines how far apart the simultaneous orbits are. Smaller \ distances will produce more accurate results." endparam param zmode caption = "Height Value" default = 6 enum = "potential" "smallest |z|" "smallest |real(z)|" \ "smallest |imag(z)|" "smallest summ(z)" "smallest |atan(z)|" \ "distance estimator" hint = "Specifies what will be used to construct a height value." endparam param xfer caption = "Height Transfer" default = 0 enum = "linear" "log" "sqrt" "cuberoot" "exp" "sqr" "cube" "sin" "cos" "tan" hint = "This function will be applied to the height value \ before a slope is calculated." endparam param zscale caption = "Height Pre-Scale" default = 1.0 hint = "Specifies the ratio between height and distance. Higher \ values will exaggerate differences between high and low. \ In general, you will want to use smaller numbers here." endparam param zscale2 caption = "Height Post-Scale" default = 0.025 hint = "Specifies the ratio between height and distance; like \ Height Pre-Scale, except that this value is applied after \ the transfer function." endparam param everyiter caption = "Every Iteration" default = false hint = "If set, the surface normal will be computed at every \ iteration. If you are using a coloring algorithm which \ processes every iteration, you will need this." endparam switch: type = "dmj-SlopeMandel" power = @power bailout = @bailout offset = @offset zmode = @zmode xfer = @xfer zscale = @zscale zscale2 = @zscale2 everyiter = @everyiter } dmj-SlopeJulia2 { ; ; This is the Julia2 set, but the calculations ; are modified so that z contains a surface normal ; to the set instead of the orbit value. This is ; intended primarily for the Lighting coloring ; method, but might have interesting results for ; other methods, too. ; init: int p = @pattern; Starting pattern int plength = floor(log(p)/log(10)); number of digits in the pattern, - 1 int pmul = floor(10^plength); multiplier to get leftmost digit int pdigit = 0; used for extracted digit BOOL t = FALSE IF (p == 21 && @switchseeds); special optimized pattern t = TRUE; start with the other seed ENDIF complex z1 = #pixel; primary iterated point complex z2 = #pixel + @offset; horizontally offset point complex z3 = #pixel + flip(@offset); vertically offset point int done = 2 float modz = 0.0 float il2 = 1/log(real(@power)); Inverse log 2 (precalc). float lp = log(log(@bailout)); log(log bailout) (precalc). float e1 = 0.0; potentials float e2 = 0.0 float e3 = 0.0 float vx = 0.0; normal vector float vy = 0.0 float vz = 0.0 float vd = 0.0 float d1 = 0.0; distances float d2 = 0.0 float d3 = 0.0 float s1 = 1.0e20; smallest distances float s2 = 1.0e20 float s3 = 1.0e20 complex g1 = (0,0); distance estimates complex g2 = (0,0) complex g3 = (0,0) complex o1 = (0,0) complex o2 = (0,0) complex o3 = (0,0) loop: IF (p == 21); special optimized pattern t = !t; rotate pattern one step IF (t); using second seed z1 = z1^@power + @seed2; iterate each point z2 = z2^@power + @seed2 z3 = z3^@power + @seed2 ; z = z^@power + @seed2 ELSE; using first seed z1 = z1^@power + @seed1; iterate each point z2 = z2^@power + @seed1 z3 = z3^@power + @seed1 ; z = z^@power + @seed1 ENDIF ELSE pdigit = floor(p / pmul); rotate pattern one step p = (p-pdigit*pmul)*10 + pdigit IF (@switchseeds); seeds should be swapped pdigit = 3 - pdigit; use the other seed ENDIF IF (pdigit == 1); using first seed z1 = z1^@power + @seed1; iterate each point z2 = z2^@power + @seed1 z3 = z3^@power + @seed1 ; z = z^@power + @seed1 ELSE; using second seed z1 = z1^@power + @seed2; iterate each point z2 = z2^@power + @seed2 z3 = z3^@power + @seed2 ; z = z^@power + @seed2 ENDIF ENDIF done = done + 1; increment iteration counter IF (@zmode == 1); smallest |z| d1 = |z1|; get current distances from origin d2 = |z2| d3 = |z3| IF (d1 < s1); update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 2); smallest |real(z)| d1 = abs(real(z1)); get current distances from i axis d2 = abs(real(z2)) d3 = abs(real(z3)) IF (d1 < s1); update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 3); smallest |imag(z)| d1 = abs(imag(z1)); get current distances from r axis d2 = abs(imag(z2)) d3 = abs(imag(z3)) IF (d1 < s1); update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 4); smallest |real(z)|+|imag(z)| d1 = abs(real(z1))+abs(imag(z1)); get current distances from i axis d2 = abs(real(z2))+abs(imag(z2)) d3 = abs(real(z3))+abs(imag(z3)) IF (d1 < s1); update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 5); smallest |atan(z)| d1 = abs(atan2(z1)); get current angles d2 = abs(atan2(z2)) d3 = abs(atan2(z3)) IF (d1 < s1); update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 6); distance estimator o1 = g1 o2 = g2 o3 = g3 g1 = @power * z1^(@power-1) * g1 + 1; update distance estimates g2 = @power * z2^(@power-1) * g2 + 1 g3 = @power * z3^(@power-1) * g3 + 1 ENDIF modz = |z1| IF (modz > @bailout ||\ @everyiter ||\ done == #maxit + 2); done, or every iteration, or last ; determine continuous iteration (height) for each point IF (@zmode == 0); height based on potential e1 = (done + il2*lp - il2*log(log(cabs(z1)))) * @zscale e2 = (done + il2*lp - il2*log(log(cabs(z2)))) * @zscale e3 = (done + il2*lp - il2*log(log(cabs(z3)))) * @zscale ELSEIF (@zmode >= 1 && @zmode <= 5); height based on smallest |z| e1 = s1 * @zscale e2 = s2 * @zscale e3 = s3 * @zscale ELSEIF (@zmode == 6); height based on distance estimator e1 = sqrt(2*log(cabs(z1)) * cabs(z1) / cabs(o1)) * @zscale e2 = sqrt(2*log(cabs(z2)) * cabs(z2) / cabs(o2)) * @zscale e3 = sqrt(2*log(cabs(z3)) * cabs(z3) / cabs(o3)) * @zscale ENDIF ; apply transfer function ; a function is not used because these are floats ; and not all functions apply to floats IF (@xfer == 1); log e1 = log(e1) e2 = log(e2) e3 = log(e3) ELSEIF (@xfer == 2); sqrt e1 = sqrt(e1) e2 = sqrt(e2) e3 = sqrt(e3) ELSEIF (@xfer == 3); cuberoot e1 = (e1)^(1/3) e2 = (e2)^(1/3) e3 = (e3)^(1/3) ELSEIF (@xfer == 4); exp e1 = exp(e1) e2 = exp(e2) e3 = exp(e3) ELSEIF (@xfer == 5); sqr e1 = sqr(e1) e2 = sqr(e2) e3 = sqr(e3) ELSEIF (@xfer == 6); cube e1 = (e1)^3 e2 = (e2)^3 e3 = (e3)^3 ELSEIF (@xfer == 7); sin e1 = sin(e1) e2 = sin(e2) e3 = sin(e3) ELSEIF (@xfer == 8); cos e1 = cos(e1) e2 = cos(e2) e3 = cos(e3) ELSEIF (@xfer == 9); tan e1 = tan(e1) e2 = tan(e2) e3 = tan(e3) ENDIF ; apply post-scale e1 = e1 * @zscale2 e2 = e2 * @zscale2 e3 = e3 * @zscale2 ; IF (@zmode == 0); surface normal ; determine surface normal ; that is, the normal to the surface defined by: ; (real(c1), imag(c1), e1) ; (real(c2), imag(c2), e2) ; (real(c3), imag(c3), e3) vx = e2-e1 vy = e3-e1 vz = -@offset ; normalize vector vd = 1/sqrt(sqr(vx)+sqr(vy)+sqr(vz)) vx = vx*vd vy = vy*vd vz = vz*vd z = vx + flip(vy); fudge z from vector ; ELSEIF (@zmode == 1); potential ; ; determine surface normal ; ; that is, the normal to the surface defined by: ; ; (real(z1), imag(z1), e1) ; ; (real(z2), imag(z2), e2) ; ; (real(z3), imag(z3), e3) ; vx = imag(z2-z1)*(e3-e1) - (e2-e1)*imag(z3-z1) ; vy = (e2-e1)*real(z3-z1) - real(z2-z1)*(e3-e1) ; vz = real(z2-z1)*imag(z3-z1) - imag(z2-z1)*real(z3-z1) ; ; normalize vector in 2D ; vd = 1/sqrt(sqr(vx)+sqr(vy)) ; vx = vx*vd ; vy = vy*vd ; z = (vx + flip(vy)) * e1 * (c1/cabs(c1)) ; ENDIF ELSE; didn't compute z this time z = z1; use primary iteration value to keep periodicity working ENDIF IF (modz > @bailout); we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope (Julia2)" helpfile = "dmj-pub\dmj-pub-uf-slope.htm" center = (0.0, 0.0) maxiter = 1000 param seed1 caption = "Julia Seed 1" default = (0,0) hint = "This is the first Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param seed2 caption = "Julia Seed 2" default = (0,0) hint = "This is the second Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param switchseeds caption = "Switch Seeds" default = FALSE hint = "If this is enabled, the Julia seeds will be swapped. This \ lets you try the alternate 'flavor' Julia2 without manually \ swapping the parameters." endparam param pattern caption = "Seed Pattern" default = 21 min = 12 hint = "Defines the pattern in which the two seeds will be used. \ Each digit indicates the seed to use, 1 or 2; when all \ digits have been used, the pattern repeats. The default \ of 21 gives the original Julia2 behavior." endparam param power caption = "Exponent" default = (2,0) hint = "Overall exponent for the equation. (2,0) gives \ the classic Julia type." endparam param bailout caption = "Bail-out Value" default = 1.0e20 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Julia set anymore." endparam param offset caption = "Orbit Separation" default = 0.00000001 hint = "Defines how far apart the simultaneous orbits are. Smaller \ distances will produce more accurate results." endparam param zmode caption = "Height Value" default = 6 enum = "potential" "smallest |z|" "smallest |real(z)|" \ "smallest |imag(z)|" "smallest summ(z)" "smallest |atan(z)|" \ "distance estimator" hint = "Specifies what will be used to construct a height value." endparam param xfer caption = "Height Transfer" default = 0 enum = "linear" "log" "sqrt" "cuberoot" "exp" "sqr" "cube" "sin" "cos" "tan" hint = "This function will be applied to the height value \ before a slope is calculated." endparam param zscale caption = "Height Pre-Scale" default = 1.0 hint = "Specifies the ratio between height and distance. Higher \ values will exaggerate differences between high and low. \ In general, you will want to use smaller numbers here." endparam param zscale2 caption = "Height Post-Scale" default = 0.025 hint = "Specifies the ratio between height and distance; like \ Height Pre-Scale, except that this value is applied after \ the transfer function." endparam param everyiter caption = "Every Iteration" default = false hint = "If set, the surface normal will be computed at every \ iteration. If you are using a coloring algorithm which \ processes every iteration, you will need this." endparam switch: type = "dmj-SlopeMandel" power = @power bailout = @bailout offset = @offset zmode = @zmode xfer = @xfer zscale = @zscale zscale2 = @zscale2 everyiter = @everyiter } dmj-Slope2Mandel { ; ; This is the Mandelbrot set, but the calculations ; are modified so that z contains a surface normal ; to the set instead of the orbit value. This is ; intended primarily for the Lighting coloring ; method, but might have interesting results for ; other methods, too. ; init: complex c1 = #pixel; primary iterated point complex c2 = #pixel + @offset; horizontally offset point complex c3 = #pixel + flip(@offset); vertically offset point complex z1 = @start; starting value complex z2 = @start complex z3 = @start float modz = 0.0 ; float il2 = 1/log(real(@power)); Inverse log 2 (precalc). ; float lp = log(log(@bailout)); log(log bailout) (precalc). float e1 = 0.0; heights float e2 = 0.0 float e3 = 0.0 float vx = 0.0; normal vector float vy = 0.0 float vz = 0.0 float vd = 0.0 int j = 0 ; trap variables float closest = 1e38 float closest1 = 1e38 float d = 0.0 float d2 = 0.0 complex point = (0,0) complex point1 = (0,0) complex point2 = (0,0) complex point3 = (0,0) complex zT = (0,0) complex zP = (0,0) complex cT = (0,0) BOOL done = false int i = 0 int i1 = 0 int iter = 0 float fiter = @trapstart BOOL trapping = false float diameter2 = sqr(@diameter) float r1 = @angle / 90.0 float r2 = @anglestep / 90.0 float s1 = @skew / 90.0 float s2 = @skewstep / 90.0 complex r = (0,1) ^ r1 complex r0 = (0,0) complex s = (0,1) ^ s1 complex rh = (0,1) ^ (@traporder / 8); heart rotation value complex zh = (0,0) complex trapcenter2 = @trapcenter IF (@movetrap); Trap Center follows pixel trapcenter2 = #pixel + @trapcenter ENDIF IF (@trapshape >= 17 || @trapshape <= 19); ripple shapes diameter2 = #pi / @diameter ENDIF IF (@traptype == 1 || @traptype == 4 || \ @traptype == 5 || @traptype == 7 || \ @traptype == 12 || @traptype == 13 || \ @traptype == 14 || @traptype == 15 || \ @traptype == 16 || @traptype == 17 || \ @traptype == 18); last, sum, average, sign average closest = 0.0 ELSEIF (@traptype == 6); product closest = 1.0 ELSEIF (@traptype == 9 || @traptype == 11); second/two farthest closest = 0.0 closest1 = 0.0 ENDIF ; BOOL usesolid = true ; extra copies of trap state variables int z1i = 0 int z2i = 0 int z3i = 0 int z1i1 = 0 int z2i1 = 0 int z3i1 = 0 float z1closest = closest float z2closest = closest float z3closest = closest float z1closest1 = closest1 float z2closest1 = closest1 float z3closest1 = closest1 complex z1point = 0 complex z2point = 0 complex z3point = 0 complex z1point1 = 0 complex z2point1 = 0 complex z3point1 = 0 complex z1point2 = 0 complex z2point2 = 0 complex z3point2 = 0 complex z1point3 = 0 complex z2point3 = 0 complex z3point3 = 0 loop: z1 = z1^@power + c1; iterate each point z2 = z2^@power + c2 z3 = z3^@power + c3 ; update height value as necessary iter = iter + 1; iteration counter IF (@trapskip != 0); we are skipping some iterations fiter = fiter - 1; one less to go before we trap WHILE (fiter < 0.0); iterations all used up IF (trapping); we are currently trapping trapping = false; so stop fiter = fiter + @trapskip; skip this many iterations ELSE; we aren't currently trapping trapping = true; so start fiter = fiter + @trapiter; do this many iterations ENDIF ENDWHILE ENDIF IF (@trapskip == 0.0 || trapping); if we're checking for traps... ; adjust rotation/skew/trapcenter IF (@anglestep != 0); changing rotation angle. r = (0,1) ^ (r1+r2*(iter-1)) ENDIF IF (@skewstep != 0); changing skew angle. s = (0,1) ^ (s1+s2*(iter-1)) ENDIF IF (@trapdrift != (0,0)); changing trap center trapcenter2 = trapcenter2 + @trapdrift ENDIF IF (@traporbit != (0,0)); changing trap orbit trapcenter2 = trapcenter2 * @traporbit ENDIF j = 0 WHILE (j < 3) IF (j == 0) zP = z1 cT = #pixel closest = z1closest closest1 = z1closest1 i = z1i i1 = z1i1 point = z1point point1 = z1point1 point2 = z1point2 point3 = z1point3 ELSEIF (j == 1) zP = z2 cT = #pixel + @offset closest = z2closest closest1 = z2closest1 i = z2i i1 = z2i1 point = z2point point1 = z2point1 point2 = z2point2 point3 = z2point3 ELSE zP = z3 cT = #pixel + flip(@offset) closest = z3closest closest1 = z3closest1 i = z3i i1 = z3i1 point = z3point point1 = z3point1 point2 = z3point2 point3 = z3point3 ENDIF ; rotate/squash/skew/repeat z IF (@traptype == 18); trap only, work on unadulterated pixel zT = cT ELSE; some other trap mode, use z zT = zP ENDIF ; 1. radially repeat IF (@gausss > 0 && @gaussr == 0); concentrically repeating trap, but not radial zT = zT - @gausscenter d = cabs(zT) d = ((d / @gausss) - round(d / @gausss)) * @gausss zT = zT * d / cabs(zT) + @gausscenter ENDIF IF (@gaussr > 0.0); radially repeating trap zT = zT - @gausscenter d = cabs(zT) d2 = atan(imag(zT)/real(zT)) IF (real(zT) < 0) d2 = d2 + #pi ENDIF IF (d2 < 0) d2 = d2 + 2*#pi ENDIF d2 = d2 / (#pi*2) d2 = ((d2 * @gaussr) - round(d2 * @gaussr)) / @gaussr * #pi*2 IF (@gausss > 0); concentrically repeating trap d = ((d / @gausss) - round(d / @gausss)) * @gausss ENDIF IF (@radialmode == 0); standard radial repeat mode zT = cos(d2)*d + flip(sin(d2)*d) + @gausscenter ELSEIF (@radialmode == 1); unwrap mode zT = d + flip(d2) ENDIF ENDIF ; 2. grid repeat IF (@gauss > 0); repeating trap zT = zT - @gaussgcenter zT = ((zT / @gauss) - round(zT / @gauss)) * @gauss zT = zT + @gaussgcenter ENDIF ; 3. rotate zT = (zT - trapcenter2) * r; rotate ; 4. apply aspect IF (@aspect != 1.0) zT = real(zT) + flip(imag(zT) * @aspect) ; apply aspect ENDIF ; 5. skew zT = real(zT * s) + flip(imag(zT)); apply skew ; determine distance from trap--different for each shape IF (@trapshape == 0); point d = cabs(zT) ELSEIF (@trapshape == 1); ring d = abs(cabs(zT) - @diameter) ELSEIF (@trapshape == 2); ring2 d = abs(|zT| - diameter2) ELSEIF (@trapshape == 3); egg d = (cabs(zT-flip(@diameter)*2) + cabs(zT)*@traporder*0.5) * 0.25 ELSEIF (@trapshape == 4); hyperbola d = abs(imag(zT) * real(zT) - @diameter) ELSEIF (@trapshape == 5); hypercross d = abs(imag(zT) * real(zT)) ELSEIF (@trapshape == 6); cross d = abs(real(zT)) d2 = abs(imag(zT)) IF (d2 < d) d = d2 ENDIF ELSEIF (@trapshape == 7); astroid d = abs(real(zT))^@traporder + abs(imag(zT))^@traporder IF (@traporder < 0) d = 1/d ENDIF ELSEIF (@trapshape == 8); diamond d = abs(real(zT)) + abs(imag(zT)) ELSEIF (@trapshape == 9); rectangle d = abs(real(zT)) d2 = abs(imag(zT)) IF (d2 > d) d = d2 ENDIF ELSEIF (@trapshape == 10); box d = abs(real(zT)) d2 = abs(imag(zT)) IF (d2 > d) d = d2 ENDIF d = abs(d - @diameter) ELSEIF (@trapshape == 11); lines d = abs(abs(imag(zT)) - @diameter) ELSEIF (@trapshape == 12); waves d = abs(abs(imag(zT) + sin(real(zT)*@trapfreq)*@traporder*0.25) - @diameter) ELSEIF (@trapshape == 13); mirrored waves d = abs(abs(imag(zT)) - @diameter + sin(real(zT)*@trapfreq)*@traporder*0.25) ELSEIF (@trapshape == 14); mirrored waves 2 d2 = @diameter - sin(real(zT)*@trapfreq)*@traporder*0.25; compute wave height d = abs(abs(imag(zT)) - d2); distance to each wave d2 = abs(abs(imag(zT)) + d2) IF (d2 < d) d = d2 ENDIF ELSEIF (@trapshape == 15); radial waves d2 = atan2(zT) d = abs(cabs(zT) * (1 - sin(d2*@trapfreq)*@traporder*0.125) - @diameter) ELSEIF (@trapshape == 16); radial waves 2 d2 = atan2(zT) d2 = sin(d2*@trapfreq)*@traporder*0.125 d = abs(cabs(zT) * (1 - d2) - @diameter) d2 = abs(cabs(zT) * (1 + d2) - @diameter) IF (d2 < d) d = d2 ENDIF ELSEIF (@trapshape == 17); ring ripples d = cabs(zT) IF (d < @traporder) d = cos(d * diameter2 * @trapfreq) * sqr(1-d/@traporder) ; d = (cos(d * diameter2 * @trapfreq)+1) * sqr(1-d/@traporder) * 0.5 ELSE d = 0 ENDIF ELSEIF (@trapshape == 18); grid ripples d = cabs(zT) IF (d < @traporder) d = (cos(real(zT)*diameter2*@trapfreq) + cos(imag(zT)*diameter2*@trapfreq)) * sqr(1-d/@traporder) * 0.5 ELSE d = 0 ENDIF ELSEIF (@trapshape == 19); radial ripples d = atan2(zT) d2 = cabs(zT) IF (d2 < @traporder) d = cos(4 * d * @trapfreq) * sqr(1-d2/@traporder) ELSE d = 0 ENDIF ELSEIF (@trapshape == 20); pinch d2 = atan2(zT) IF (d2 < 0) d2 = d2 + 2*#pi ENDIF d = sqrt(cabs(zT)) / abs(sin(d2*@traporder*0.5)) ELSEIF (@trapshape == 21); spiral d = 1/(cabs(zT)) * @diameter r0 = (0,1) ^ d zT = zT * r0 d = atan(abs(imag(zT)/real(zT))) ELSEIF (@trapshape == 22); heart zh = real(zT) + flip(abs(imag(zT))) zh = zh*rh * 3 / @diameter d = abs(real(zh) - sqr(imag(zh)) + 3) ENDIF ; apply trap transfer function ; a function is not used because these are floats ; and not all functions apply to floats d = d * @prescale IF (@trapfunc == 1); log d = log(d) ELSEIF (@trapfunc == 2); sqrt d = sqrt(d) ELSEIF (@trapfunc == 3); cuberoot d = (d)^(1/3) ELSEIF (@trapfunc == 4); exp d = exp(d) ELSEIF (@trapfunc == 5); sqr d = sqr(d) ELSEIF (@trapfunc == 6); cube d = (d)^3 ELSEIF (@trapfunc == 7); sin d = sin(d) ELSEIF (@trapfunc == 8); cos d = cos(d) ELSEIF (@trapfunc == 9); tan d = tan(d) ELSEIF (@trapfunc == 10); sinc (modified form) IF (d == 0) d = 1 ELSE d = sin(#pi*d)/d ENDIF ENDIF d = d * @postscale IF (@trapabs); absolute value only d = abs(d) ENDIF ; now adjust closest/point/i as needed IF (@movetrap == false || iter > 1) IF (@traptype == 0); closest IF (d < closest) i = iter point = zP point2 = zT closest = d ENDIF ; IF (d < @threshold) ; usesolid = false ; ENDIF ELSEIF (@traptype == 1); farthest (within threshold) IF (d > closest && d < @threshold) i = iter point = zP point2 = zT closest = d ; usesolid = false ENDIF ELSEIF (@traptype == 2); first (within threshold) IF (d < @threshold && done == false) i = iter point = zP point2 = zT closest = d done = true ; usesolid = false ENDIF ELSEIF (@traptype == 3); last (within threshold) IF (d < @threshold) i = iter point = zP point2 = zT closest = d done = true ; usesolid = false ENDIF ELSEIF (@traptype == 4); sum (within threshold) IF (d < @threshold) i = iter point = point + zP point2 = point2 + zT closest = closest + d ; usesolid = false ENDIF ELSEIF (@traptype == 5); average (within threshold) IF (d < @threshold) i = iter i1 = i1 + 1 point = point + zP point2 = point2 + zT closest = closest + d ; usesolid = false ENDIF ELSEIF (@traptype == 6); product (within threshold) IF (d < @threshold) i = iter point = point * zP / @threshold point2 = point2 * zT / @threshold closest = closest * d / @threshold ; usesolid = false ENDIF ELSEIF (@traptype == 7); sign average IF (d < d2) i = i + 1 point = point + zP point2 = point2 + zT closest = closest + 1 ; usesolid = false ELSE i = i - 1 ENDIF d2 = d ELSEIF (@traptype == 8 || @traptype == 10) ; second/two closest IF (d < closest) i1 = i point1 = point point3 = point2 closest1 = closest i = iter point = zP point2 = zT closest = d ELSEIF (d < closest1) i1 = iter point1 = zP point3 = zT closest1 = d ENDIF ; IF (d < @threshold) ; usesolid = false ; ENDIF ELSEIF (@traptype == 9 || @traptype == 11) ; second/two farthest IF (d > closest && d < @threshold) i1 = i point1 = point point3 = point2 closest1 = closest i = iter point = zP point2 = zT closest = d ; usesolid = false ELSEIF (d > closest1 && d < @threshold) i1 = iter point1 = zP point3 = zT closest1 = d ; usesolid = false ENDIF ELSEIF (@traptype == 12); funky average IF (d < @threshold) i = i + 1 point = zP - point point2 = zT - point2 closest = @threshold - abs(closest - d) ; usesolid = false ENDIF ELSEIF (@traptype == 13); funky average 2 IF (d < @threshold) i = i + 1 point = zP - point point2 = zT - point2 closest = abs(d - @threshold + closest) ; usesolid = false ENDIF ELSEIF (@traptype == 14); funky average 3 (Luke Plant) IF (d < @threshold) i = i + 1 d2 = d/@threshold point = zP + (point-zP) * d2 point2 = zT + (point2-zT) * d2 closest = closest + d ; usesolid = false ENDIF ELSEIF (@traptype == 15); funky average 4 (exponential average) IF (d < @threshold) i = i + 1 point = zP - point point2 = zT - point2 closest = closest + exp(-d) ; usesolid = false ENDIF ELSEIF (@traptype == 16); funky average 5 (average distance change) IF (d < d2) point = point + zP point2 = point2 + zT closest = closest + d2-d ; usesolid = false ENDIF d2 = d ELSEIF (@traptype == 17); funky average 6 (Luke Plant, 1/squared) IF (d < @threshold) i = i + 1 ; usesolid = false ENDIF d2 = sqr(d/@threshold) point = zP + (point-zP) * d2 point2 = zT + (point2-zT) * d2 closest = closest + 1/d2 ELSEIF (@traptype == 18); trap only, do first iteration IF (iter == 1) point = zP point2 = zT closest = d/@threshold ; IF (d < @threshold) ; usesolid = false ; ENDIF ENDIF ENDIF ENDIF IF (j == 0) z1closest = closest z1closest1 = closest1 z1i = i z1i1 = i1 z1point = point z1point1 = point1 z1point2 = point2 z1point3 = point3 ELSEIF (j == 1) z2closest = closest z2closest1 = closest1 z2i = i z2i1 = i1 z2point = point z2point1 = point1 z2point2 = point2 z2point3 = point3 ELSE z3closest = closest z3closest1 = closest1 z3i = i z3i1 = i1 z3point = point z3point1 = point1 z3point2 = point2 z3point3 = point3 ENDIF j = j + 1 ENDWHILE ENDIF ; determine surface normal if necessary modz = |z1| IF (modz > @bailout ||\ @everyiter ||\ iter == #maxit); done, or every iteration, or last ; determine (height) for each point (final calculations) j = 0 WHILE (j < 3) IF (j == 0) zP = z1 cT = #pixel closest = z1closest closest1 = z1closest1 i = z1i i1 = z1i1 point = z1point point1 = z1point1 point2 = z1point2 point3 = z1point3 ELSEIF (j == 1) zP = z2 cT = #pixel + @offset closest = z2closest closest1 = z2closest1 i = z2i i1 = z2i1 point = z2point point1 = z2point1 point2 = z2point2 point3 = z2point3 ELSE zP = z3 cT = #pixel + flip(@offset) closest = z3closest closest1 = z3closest1 i = z3i i1 = z3i1 point = z3point point1 = z3point1 point2 = z3point2 point3 = z3point3 ENDIF IF (@traptype == 5); traptype average point = point / i1 point2 = point2 / i1 closest = closest / i1 ELSEIF (@traptype == 6); traptype product closest = abs(closest) ELSEIF (@traptype == 7); traptype sign average point = point / iter point2 = point2 / iter closest = closest / iter ELSEIF (@traptype == 8 || @traptype == 9) ; second closest or farthest i = i - i1 point = point - point1 point2 = point2 - point3 closest = closest - closest1 ELSEIF (@traptype == 10 || @traptype == 11) ; two closest or farthest i = round((i + i1) / 2) point = (point + point1) / 2 point2 = (point2 + point3) / 2 closest = (closest + closest1) / 2 ELSEIF (@traptype == 14); funky average 3 closest = @threshold * i - closest ENDIF ; choose coloring based on method ; IF (!@solidcolor); solid color not allowed ; #solid = false ; ELSE ; #solid = usesolid ; ENDIF IF (@trapcolor == 0); distance IF (@traptype == 2 || @traptype == 3) ; first or last type d = closest / @threshold ELSE; any other trap type d = closest ENDIF ELSEIF (@trapcolor == 1); magnitude d = cabs(point2) ELSEIF (@trapcolor == 2); real d = abs(real(point2)) ELSEIF (@trapcolor == 3); imaginary d = abs(imag(point2)) ELSEIF (@trapcolor == 4); angle to trap d = atan2(point2) IF (d < 0) d = d + #pi * 2 ENDIF d = d / (#pi * 2) ELSEIF (@trapcolor == 5); angle to trap 2 (no aspect) point = point - @trapcenter d = atan2(point) IF (d < 0) d = d + #pi * 2 ENDIF d = d / (#pi * 2) ELSEIF (@trapcolor == 6); angle to origin d = atan2(point) IF (d < 0) d = d + #pi * 2 ENDIF d = d / (#pi * 2) ELSEIF (@trapcolor == 7); angle to origin 2 (old ReallyCool) d = 0.02 * abs(atan(imag(point) / real(point)) * 180/#pi) ELSEIF (@trapcolor == 8); iteration d = i d = d / #maxiter ENDIF IF (j == 0) e1 = d ELSEIF (j == 1) e2 = d ELSE e3 = d ENDIF j = j + 1 ENDWHILE ; apply pre-scale e1 = e1 * @zscale e2 = e2 * @zscale e3 = e3 * @zscale ; apply transfer function ; a function is not used because these are floats ; and not all functions apply to floats IF (@xfer == 1); log e1 = log(e1) e2 = log(e2) e3 = log(e3) ELSEIF (@xfer == 2); sqrt e1 = sqrt(e1) e2 = sqrt(e2) e3 = sqrt(e3) ELSEIF (@xfer == 3); cuberoot e1 = (e1)^(1/3) e2 = (e2)^(1/3) e3 = (e3)^(1/3) ELSEIF (@xfer == 4); exp e1 = exp(e1) e2 = exp(e2) e3 = exp(e3) ELSEIF (@xfer == 5); sqr e1 = sqr(e1) e2 = sqr(e2) e3 = sqr(e3) ELSEIF (@xfer == 6); cube e1 = (e1)^3 e2 = (e2)^3 e3 = (e3)^3 ELSEIF (@xfer == 7); sin e1 = sin(e1) e2 = sin(e2) e3 = sin(e3) ELSEIF (@xfer == 8); cos e1 = cos(e1) e2 = cos(e2) e3 = cos(e3) ELSEIF (@xfer == 9); tan e1 = tan(e1) e2 = tan(e2) e3 = tan(e3) ENDIF ; apply post-scale e1 = e1 * @zscale2 e2 = e2 * @zscale2 e3 = e3 * @zscale2 ; determine surface normal ; that is, the normal to the surface defined by: ; (real(c1), imag(c1), e1) ; (real(c2), imag(c2), e2) ; (real(c3), imag(c3), e3) vx = e2-e1 vy = e3-e1 vz = -@offset ; normalize vector vd = 1/sqrt(sqr(vx)+sqr(vy)+sqr(vz)) vx = vx*vd vy = vy*vd vz = vz*vd z = vx + flip(vy); fudge z from vector ELSE; didn't compute z this time z = z1; use primary iteration value to keep periodicity working ENDIF IF (modz > @bailout); we're done iter = -1 ENDIF bailout: iter > 0 default: title = "SlopeTrap (Mandelbrot)" helpfile = "dmj-pub\dmj-pub-uf-st.htm" center = (-0.5, 0.0) maxiter = 1000 param start caption = "Starting Point" default = (0,0) hint = "Starting value for each point. You can use this to \ 'perturb' the fractal." endparam param power caption = "Exponent" default = (2,0) hint = "Overall exponent for the equation. (2,0) gives \ the classic Julia type." endparam param bailout caption = "Bail-out Value" default = 1.0e20 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Julia set anymore." endparam param trapshape caption = "Trap Shape" default = 0 enum = "point" "ring" "ring 2" "egg" "hyperbola" "hypercross" \ "cross" "astroid" "diamond" "rectangle" "box" "lines" \ "waves" "mirrored waves" "mirrored waves 2" \ "radial waves" "radial waves 2" "ring ripples" \ "grid ripples" "radial ripples" "pinch" "spiral" "heart" hint = "This is the shape of the orbit trap." endparam param trapcolor caption = "Trap Coloring" default = 0 enum = "distance" "magnitude" "real" "imaginary" "angle to trap" \ "angle to trap 2" "angle to origin" "angle to origin 2" "iteration" hint = "This is the information used to produce a color." endparam param traptype caption = "Trap Mode" default = 0 enum = "closest" "farthest" "first" "last" "sum" "average" "product" \ "sign average" "second closest" "second farthest" "two closest" \ "two farthest" "funky average" "funky average 2" "funky average 3" \ "funky average 4" "funky average 5" "funky average 6" \ "trap only" hint = "This is how points will be chosen to use for coloring." endparam param traporder caption = "Trap Order" default = 4.0 hint = "Number of leaves for the pinch trap shape, the \ exponent to use for astroid curves (try 0.66667), \ 'egginess', or the height of waves." endparam param trapfreq caption = "Trap Frequency" default = 1.0 hint = "The frequency of ripples or waves." endparam param trapcenter caption = "Trap Center" default = (0,0) hint = "This is the location of the trap in the complex plane." endparam param trapdrift caption = "Trap Drift" default = (0,0) hint = "This is the amount the trap center will move with each \ iteration." endparam param traporbit caption = "Trap Orbit" default = (0,0) hint = "The trap center location is multiplied by this value \ with each iteration." endparam param movetrap caption = "Trap Center Moves" default = false hint = "If this is enabled, the trap center will match the \ pixel location instead of being fixed. This overrides \ Trap Center." endparam param aspect caption = "Aspect Ratio" default = 1.0 min = 0.0000000001 hint = "This is how square the trap is. You can distort the \ trap by using a value other than 1.0." endparam param threshold caption = "Threshold" default = 0.25 min = 0 hint = "This is the width of the trap area, used for most \ trap modes." endparam param diameter caption = "Diameter" default = 1.0 ; min = 0 hint = "This is the diameter of the trap (for ring, box, and \ line shapes)." endparam param angle caption = "Rotation" default = 0.0 hint = "This is the angle, in degrees, that the trap should \ be rotated." endparam param anglestep caption = "Rotation Step" default = 0.0 hint = "This is the angle, in degrees, that the trap will \ be rotated with each iteration." endparam param skew caption = "Skew" default = 0.0 hint = "This is the angle, in degrees, to skew the vertical \ axis of the trap shape." endparam param skewstep caption = "Skew Step" default = 0.0 hint = "This is the angle, in degrees, that the skew angle \ should be increased by with each iteration." endparam param trapfunc caption = "Distance Transfer" default = 0 enum = "linear" "log" "sqrt" "cuberoot" "exp" "sqr" "cube" \ "sin" "cos" "tan" "sinc" hint = "This function is applied to trap distances at every \ iteration. It can be used to apply some special effects \ to trap shapes." endparam param prescale caption = "Distance Pre-scale" default = 1.0 hint = "This is a multiplier applied to the trap distance, \ before the Distance Transfer function is applied to it." endparam param postscale caption = "Distance Post-scale" default = 1.0 hint = "This is a multiplier applied to the trap distance, \ after the Distance Transfer function is applied to it." endparam param trapabs caption = "No Negative Distance" default = false hint = "If enabled, eliminates 'negative' distances by taking \ the absolute value of the distance." endparam param trapstart caption = "Start Iteration" default = 0.0 hint = "This is the iteration at which to start watching for \ orbit traps." endparam param trapiter caption = "Trap Iterations" default = 10000.0 hint = "This is the number of iterations to watch for traps \ in a single block." endparam param trapskip caption = "Skip Iterations" default = 0.0 hint = "This is the number of iterations to skip watching for \ traps, after a block of watched iterations." endparam param gauss caption = "Repeat Spacing" default = 0.0 min = 0.0 hint = "This is the spacing at which the trap will repeat, \ all across the complex plane. If zero, trap does \ not repeat." endparam param gaussgcenter caption = "Repeat Center" default = (0,0) hint = "This is the center point of grid trap repetition." endparam param gaussr caption = "Radial Spacing" default = 0.0 min = 0 hint = "This is the number of times the trap will repeat, \ radially around the radial center point. If zero, \ trap does not repeat radially." endparam param gausss caption = "Concentric Spacing" default = 0.0 min = 0 hint = "This is the distance at which the trap will repeat, \ radially out from the radial center point. If zero, \ trap does not repeat radially out." endparam param gausscenter caption = "Radial Center" default = (0,0) hint = "This is the center point of radial trap repetition." endparam param radialmode caption = "Radial Mode" default = 0 enum = "kaleidoscope" "polar coordinates" hint = "Indicates the type of radial repetition to use. The \ two styles produce very different results." endparam param offset caption = "Orbit Separation" default = 0.00000001 hint = "Defines how far apart the simultaneous orbits are. Smaller \ distances will produce more accurate results." endparam param xfer caption = "Height Transfer" default = 0 enum = "linear" "log" "sqrt" "cuberoot" "exp" "sqr" "cube" "sin" "cos" "tan" hint = "This function will be applied to the height value \ before a slope is calculated." endparam param zscale caption = "Height Pre-Scale" default = 1.0 hint = "Specifies the ratio between height and distance. Higher \ values will exaggerate differences between high and low. \ In general, you will want to use smaller numbers here." endparam param zscale2 caption = "Height Post-Scale" default = 0.025 hint = "Specifies the ratio between height and distance; like \ Height Pre-Scale, except that this value is applied after \ the transfer function." endparam param everyiter caption = "Every Iteration" default = false hint = "If set, the surface normal will be computed at every \ iteration. If you are using a coloring algorithm which \ processes every iteration, you will need this." endparam switch: type = "dmj-Slope2Julia" seed = #pixel power = @power bailout = @bailout trapshape = @trapshape trapcolor = @trapcolor traptype = @traptype traporder = @traporder trapfreq = @trapfreq trapcenter = @trapcenter trapdrift = @trapdrift traporbit = @traporbit movetrap = @movetrap aspect = @aspect threshold = @threshold diameter = @diameter angle = @angle anglestep = @anglestep skew = @skew skewstep = @skewstep trapfunc = @trapfunc prescale = @prescale postscale = @postscale trapabs = @trapabs trapstart = @trapstart trapiter = @trapiter trapskip = @trapskip gauss = @gauss gaussr = @gaussr gausss = @gausss gausscenter = @gausscenter radialmode = @radialmode offset = @offset ; zmode = @zmode xfer = @xfer zscale = @zscale zscale2 = @zscale2 everyiter = @everyiter } dmj-Slope2Julia { ; ; This is the Julia set, but the calculations ; are modified so that z contains a surface normal ; to the set instead of the orbit value. This is ; intended primarily for the Lighting coloring ; method, but might have interesting results for ; other methods, too. ; init: complex z1 = #pixel; primary iterated point complex z2 = #pixel + @offset; horizontally offset point complex z3 = #pixel + flip(@offset); vertically offset point float modz = 0.0 ; float il2 = 1/log(real(@power)); Inverse log 2 (precalc). ; float lp = log(log(@bailout)); log(log bailout) (precalc). float e1 = 0.0; heights float e2 = 0.0 float e3 = 0.0 float vx = 0.0; normal vector float vy = 0.0 float vz = 0.0 float vd = 0.0 int j = 0 ; trap variables float closest = 1e38 float closest1 = 1e38 float d = 0.0 float d2 = 0.0 complex point = (0,0) complex point1 = (0,0) complex point2 = (0,0) complex point3 = (0,0) complex zT = (0,0) complex zP = (0,0) complex cT = (0,0) BOOL done = false int i = 0 int i1 = 0 int iter = 0 float fiter = @trapstart BOOL trapping = false float diameter2 = sqr(@diameter) float r1 = @angle / 90.0 float r2 = @anglestep / 90.0 float s1 = @skew / 90.0 float s2 = @skewstep / 90.0 complex r = (0,1) ^ r1 complex r0 = (0,0) complex s = (0,1) ^ s1 complex rh = (0,1) ^ (@traporder / 8); heart rotation value complex zh = (0,0) complex trapcenter2 = @trapcenter IF (@movetrap); Trap Center follows pixel trapcenter2 = #pixel + @trapcenter ENDIF IF (@trapshape >= 17 || @trapshape <= 19); ripple shapes diameter2 = #pi / @diameter ENDIF IF (@traptype == 1 || @traptype == 4 || \ @traptype == 5 || @traptype == 7 || \ @traptype == 12 || @traptype == 13 || \ @traptype == 14 || @traptype == 15 || \ @traptype == 16 || @traptype == 17 || \ @traptype == 18); last, sum, average, sign average closest = 0.0 ELSEIF (@traptype == 6); product closest = 1.0 ELSEIF (@traptype == 9 || @traptype == 11); second/two farthest closest = 0.0 closest1 = 0.0 ENDIF ; BOOL usesolid = true ; extra copies of trap state variables int z1i = 0 int z2i = 0 int z3i = 0 int z1i1 = 0 int z2i1 = 0 int z3i1 = 0 float z1closest = closest float z2closest = closest float z3closest = closest float z1closest1 = closest1 float z2closest1 = closest1 float z3closest1 = closest1 complex z1point = 0 complex z2point = 0 complex z3point = 0 complex z1point1 = 0 complex z2point1 = 0 complex z3point1 = 0 complex z1point2 = 0 complex z2point2 = 0 complex z3point2 = 0 complex z1point3 = 0 complex z2point3 = 0 complex z3point3 = 0 loop: z1 = z1^@power + @seed; iterate each point z2 = z2^@power + @seed z3 = z3^@power + @seed ; update height value as necessary iter = iter + 1; iteration counter IF (@trapskip != 0); we are skipping some iterations fiter = fiter - 1; one less to go before we trap WHILE (fiter < 0.0); iterations all used up IF (trapping); we are currently trapping trapping = false; so stop fiter = fiter + @trapskip; skip this many iterations ELSE; we aren't currently trapping trapping = true; so start fiter = fiter + @trapiter; do this many iterations ENDIF ENDWHILE ENDIF IF (@trapskip == 0.0 || trapping); if we're checking for traps... ; adjust rotation/skew/trapcenter IF (@anglestep != 0); changing rotation angle. r = (0,1) ^ (r1+r2*(iter-1)) ENDIF IF (@skewstep != 0); changing skew angle. s = (0,1) ^ (s1+s2*(iter-1)) ENDIF IF (@trapdrift != (0,0)); changing trap center trapcenter2 = trapcenter2 + @trapdrift ENDIF IF (@traporbit != (0,0)); changing trap orbit trapcenter2 = trapcenter2 * @traporbit ENDIF j = 0 WHILE (j < 3) IF (j == 0) zP = z1 cT = #pixel closest = z1closest closest1 = z1closest1 i = z1i i1 = z1i1 point = z1point point1 = z1point1 point2 = z1point2 point3 = z1point3 ELSEIF (j == 1) zP = z2 cT = #pixel + @offset closest = z2closest closest1 = z2closest1 i = z2i i1 = z2i1 point = z2point point1 = z2point1 point2 = z2point2 point3 = z2point3 ELSE zP = z3 cT = #pixel + flip(@offset) closest = z3closest closest1 = z3closest1 i = z3i i1 = z3i1 point = z3point point1 = z3point1 point2 = z3point2 point3 = z3point3 ENDIF ; rotate/squash/skew/repeat z IF (@traptype == 18); trap only, work on unadulterated pixel zT = cT ELSE; some other trap mode, use z zT = zP ENDIF ; 1. radially repeat IF (@gausss > 0 && @gaussr == 0); concentrically repeating trap, but not radial zT = zT - @gausscenter d = cabs(zT) d = ((d / @gausss) - round(d / @gausss)) * @gausss zT = zT * d / cabs(zT) + @gausscenter ENDIF IF (@gaussr > 0.0); radially repeating trap zT = zT - @gausscenter d = cabs(zT) d2 = atan(imag(zT)/real(zT)) IF (real(zT) < 0) d2 = d2 + #pi ENDIF IF (d2 < 0) d2 = d2 + 2*#pi ENDIF d2 = d2 / (#pi*2) d2 = ((d2 * @gaussr) - round(d2 * @gaussr)) / @gaussr * #pi*2 IF (@gausss > 0); concentrically repeating trap d = ((d / @gausss) - round(d / @gausss)) * @gausss ENDIF IF (@radialmode == 0); standard radial repeat mode zT = cos(d2)*d + flip(sin(d2)*d) + @gausscenter ELSEIF (@radialmode == 1); unwrap mode zT = d + flip(d2) ENDIF ENDIF ; 2. grid repeat IF (@gauss > 0); repeating trap zT = zT - @gaussgcenter zT = ((zT / @gauss) - round(zT / @gauss)) * @gauss zT = zT + @gaussgcenter ENDIF ; 3. rotate zT = (zT - trapcenter2) * r; rotate ; 4. apply aspect IF (@aspect != 1.0) zT = real(zT) + flip(imag(zT) * @aspect) ; apply aspect ENDIF ; 5. skew zT = real(zT * s) + flip(imag(zT)); apply skew ; determine distance from trap--different for each shape IF (@trapshape == 0); point d = cabs(zT) ELSEIF (@trapshape == 1); ring d = abs(cabs(zT) - @diameter) ELSEIF (@trapshape == 2); ring2 d = abs(|zT| - diameter2) ELSEIF (@trapshape == 3); egg d = (cabs(zT-flip(@diameter)*2) + cabs(zT)*@traporder*0.5) * 0.25 ELSEIF (@trapshape == 4); hyperbola d = abs(imag(zT) * real(zT) - @diameter) ELSEIF (@trapshape == 5); hypercross d = abs(imag(zT) * real(zT)) ELSEIF (@trapshape == 6); cross d = abs(real(zT)) d2 = abs(imag(zT)) IF (d2 < d) d = d2 ENDIF ELSEIF (@trapshape == 7); astroid d = abs(real(zT))^@traporder + abs(imag(zT))^@traporder IF (@traporder < 0) d = 1/d ENDIF ELSEIF (@trapshape == 8); diamond d = abs(real(zT)) + abs(imag(zT)) ELSEIF (@trapshape == 9); rectangle d = abs(real(zT)) d2 = abs(imag(zT)) IF (d2 > d) d = d2 ENDIF ELSEIF (@trapshape == 10); box d = abs(real(zT)) d2 = abs(imag(zT)) IF (d2 > d) d = d2 ENDIF d = abs(d - @diameter) ELSEIF (@trapshape == 11); lines d = abs(abs(imag(zT)) - @diameter) ELSEIF (@trapshape == 12); waves d = abs(abs(imag(zT) + sin(real(zT)*@trapfreq)*@traporder*0.25) - @diameter) ELSEIF (@trapshape == 13); mirrored waves d = abs(abs(imag(zT)) - @diameter + sin(real(zT)*@trapfreq)*@traporder*0.25) ELSEIF (@trapshape == 14); mirrored waves 2 d2 = @diameter - sin(real(zT)*@trapfreq)*@traporder*0.25; compute wave height d = abs(abs(imag(zT)) - d2); distance to each wave d2 = abs(abs(imag(zT)) + d2) IF (d2 < d) d = d2 ENDIF ELSEIF (@trapshape == 15); radial waves d2 = atan2(zT) d = abs(cabs(zT) * (1 - sin(d2*@trapfreq)*@traporder*0.125) - @diameter) ELSEIF (@trapshape == 16); radial waves 2 d2 = atan2(zT) d2 = sin(d2*@trapfreq)*@traporder*0.125 d = abs(cabs(zT) * (1 - d2) - @diameter) d2 = abs(cabs(zT) * (1 + d2) - @diameter) IF (d2 < d) d = d2 ENDIF ELSEIF (@trapshape == 17); ring ripples d = cabs(zT) IF (d < @traporder) d = cos(d * diameter2 * @trapfreq) * sqr(1-d/@traporder) ; d = (cos(d * diameter2 * @trapfreq)+1) * sqr(1-d/@traporder) * 0.5 ELSE d = 0 ENDIF ELSEIF (@trapshape == 18); grid ripples d = cabs(zT) IF (d < @traporder) d = (cos(real(zT)*diameter2*@trapfreq) + cos(imag(zT)*diameter2*@trapfreq)) * sqr(1-d/@traporder) * 0.5 ELSE d = 0 ENDIF ELSEIF (@trapshape == 19); radial ripples d = atan2(zT) d2 = cabs(zT) IF (d2 < @traporder) d = cos(4 * d * @trapfreq) * sqr(1-d2/@traporder) ELSE d = 0 ENDIF ELSEIF (@trapshape == 20); pinch d2 = atan2(zT) IF (d2 < 0) d2 = d2 + 2*#pi ENDIF d = sqrt(cabs(zT)) / abs(sin(d2*@traporder*0.5)) ELSEIF (@trapshape == 21); spiral d = 1/(cabs(zT)) * @diameter r0 = (0,1) ^ d zT = zT * r0 d = atan(abs(imag(zT)/real(zT))) ELSEIF (@trapshape == 22); heart zh = real(zT) + flip(abs(imag(zT))) zh = zh*rh * 3 / @diameter d = abs(real(zh) - sqr(imag(zh)) + 3) ENDIF ; apply trap transfer function ; a function is not used because these are floats ; and not all functions apply to floats d = d * @prescale IF (@trapfunc == 1); log d = log(d) ELSEIF (@trapfunc == 2); sqrt d = sqrt(d) ELSEIF (@trapfunc == 3); cuberoot d = (d)^(1/3) ELSEIF (@trapfunc == 4); exp d = exp(d) ELSEIF (@trapfunc == 5); sqr d = sqr(d) ELSEIF (@trapfunc == 6); cube d = (d)^3 ELSEIF (@trapfunc == 7); sin d = sin(d) ELSEIF (@trapfunc == 8); cos d = cos(d) ELSEIF (@trapfunc == 9); tan d = tan(d) ELSEIF (@trapfunc == 10); sinc (modified form) IF (d == 0) d = 1 ELSE d = sin(#pi*d)/d ENDIF ENDIF d = d * @postscale IF (@trapabs); absolute value only d = abs(d) ENDIF ; now adjust closest/point/i as needed IF (@movetrap == false || iter > 1) IF (@traptype == 0); closest IF (d < closest) i = iter point = zP point2 = zT closest = d ENDIF ; IF (d < @threshold) ; usesolid = false ; ENDIF ELSEIF (@traptype == 1); farthest (within threshold) IF (d > closest && d < @threshold) i = iter point = zP point2 = zT closest = d ; usesolid = false ENDIF ELSEIF (@traptype == 2); first (within threshold) IF (d < @threshold && done == false) i = iter point = zP point2 = zT closest = d done = true ; usesolid = false ENDIF ELSEIF (@traptype == 3); last (within threshold) IF (d < @threshold) i = iter point = zP point2 = zT closest = d done = true ; usesolid = false ENDIF ELSEIF (@traptype == 4); sum (within threshold) IF (d < @threshold) i = iter point = point + zP point2 = point2 + zT closest = closest + d ; usesolid = false ENDIF ELSEIF (@traptype == 5); average (within threshold) IF (d < @threshold) i = iter i1 = i1 + 1 point = point + zP point2 = point2 + zT closest = closest + d ; usesolid = false ENDIF ELSEIF (@traptype == 6); product (within threshold) IF (d < @threshold) i = iter point = point * zP / @threshold point2 = point2 * zT / @threshold closest = closest * d / @threshold ; usesolid = false ENDIF ELSEIF (@traptype == 7); sign average IF (d < d2) i = i + 1 point = point + zP point2 = point2 + zT closest = closest + 1 ; usesolid = false ELSE i = i - 1 ENDIF d2 = d ELSEIF (@traptype == 8 || @traptype == 10) ; second/two closest IF (d < closest) i1 = i point1 = point point3 = point2 closest1 = closest i = iter point = zP point2 = zT closest = d ELSEIF (d < closest1) i1 = iter point1 = zP point3 = zT closest1 = d ENDIF ; IF (d < @threshold) ; usesolid = false ; ENDIF ELSEIF (@traptype == 9 || @traptype == 11) ; second/two farthest IF (d > closest && d < @threshold) i1 = i point1 = point point3 = point2 closest1 = closest i = iter point = zP point2 = zT closest = d ; usesolid = false ELSEIF (d > closest1 && d < @threshold) i1 = iter point1 = zP point3 = zT closest1 = d ; usesolid = false ENDIF ELSEIF (@traptype == 12); funky average IF (d < @threshold) i = i + 1 point = zP - point point2 = zT - point2 closest = @threshold - abs(closest - d) ; usesolid = false ENDIF ELSEIF (@traptype == 13); funky average 2 IF (d < @threshold) i = i + 1 point = zP - point point2 = zT - point2 closest = abs(d - @threshold + closest) ; usesolid = false ENDIF ELSEIF (@traptype == 14); funky average 3 (Luke Plant) IF (d < @threshold) i = i + 1 d2 = d/@threshold point = zP + (point-zP) * d2 point2 = zT + (point2-zT) * d2 closest = closest + d ; usesolid = false ENDIF ELSEIF (@traptype == 15); funky average 4 (exponential average) IF (d < @threshold) i = i + 1 point = zP - point point2 = zT - point2 closest = closest + exp(-d) ; usesolid = false ENDIF ELSEIF (@traptype == 16); funky average 5 (average distance change) IF (d < d2) point = point + zP point2 = point2 + zT closest = closest + d2-d ; usesolid = false ENDIF d2 = d ELSEIF (@traptype == 17); funky average 6 (Luke Plant, 1/squared) IF (d < @threshold) i = i + 1 ; usesolid = false ENDIF d2 = sqr(d/@threshold) point = zP + (point-zP) * d2 point2 = zT + (point2-zT) * d2 closest = closest + 1/d2 ELSEIF (@traptype == 18); trap only, do first iteration IF (iter == 1) point = zP point2 = zT closest = d/@threshold ; IF (d < @threshold) ; usesolid = false ; ENDIF ENDIF ENDIF ENDIF IF (j == 0) z1closest = closest z1closest1 = closest1 z1i = i z1i1 = i1 z1point = point z1point1 = point1 z1point2 = point2 z1point3 = point3 ELSEIF (j == 1) z2closest = closest z2closest1 = closest1 z2i = i z2i1 = i1 z2point = point z2point1 = point1 z2point2 = point2 z2point3 = point3 ELSE z3closest = closest z3closest1 = closest1 z3i = i z3i1 = i1 z3point = point z3point1 = point1 z3point2 = point2 z3point3 = point3 ENDIF j = j + 1 ENDWHILE ENDIF ; determine surface normal if necessary modz = |z1| IF (modz > @bailout ||\ @everyiter ||\ iter == #maxit); done, or every iteration, or last ; determine (height) for each point (final calculations) j = 0 WHILE (j < 3) IF (j == 0) zP = z1 cT = #pixel closest = z1closest closest1 = z1closest1 i = z1i i1 = z1i1 point = z1point point1 = z1point1 point2 = z1point2 point3 = z1point3 ELSEIF (j == 1) zP = z2 cT = #pixel + @offset closest = z2closest closest1 = z2closest1 i = z2i i1 = z2i1 point = z2point point1 = z2point1 point2 = z2point2 point3 = z2point3 ELSE zP = z3 cT = #pixel + flip(@offset) closest = z3closest closest1 = z3closest1 i = z3i i1 = z3i1 point = z3point point1 = z3point1 point2 = z3point2 point3 = z3point3 ENDIF IF (@traptype == 5); traptype average point = point / i1 point2 = point2 / i1 closest = closest / i1 ELSEIF (@traptype == 6); traptype product closest = abs(closest) ELSEIF (@traptype == 7); traptype sign average point = point / iter point2 = point2 / iter closest = closest / iter ELSEIF (@traptype == 8 || @traptype == 9) ; second closest or farthest i = i - i1 point = point - point1 point2 = point2 - point3 closest = closest - closest1 ELSEIF (@traptype == 10 || @traptype == 11) ; two closest or farthest i = round((i + i1) / 2) point = (point + point1) / 2 point2 = (point2 + point3) / 2 closest = (closest + closest1) / 2 ELSEIF (@traptype == 14); funky average 3 closest = @threshold * i - closest ENDIF ; choose coloring based on method ; IF (!@solidcolor); solid color not allowed ; #solid = false ; ELSE ; #solid = usesolid ; ENDIF IF (@trapcolor == 0); distance IF (@traptype == 2 || @traptype == 3) ; first or last type d = closest / @threshold ELSE; any other trap type d = closest ENDIF ELSEIF (@trapcolor == 1); magnitude d = cabs(point2) ELSEIF (@trapcolor == 2); real d = abs(real(point2)) ELSEIF (@trapcolor == 3); imaginary d = abs(imag(point2)) ELSEIF (@trapcolor == 4); angle to trap d = atan2(point2) IF (d < 0) d = d + #pi * 2 ENDIF d = d / (#pi * 2) ELSEIF (@trapcolor == 5); angle to trap 2 (no aspect) point = point - @trapcenter d = atan2(point) IF (d < 0) d = d + #pi * 2 ENDIF d = d / (#pi * 2) ELSEIF (@trapcolor == 6); angle to origin d = atan2(point) IF (d < 0) d = d + #pi * 2 ENDIF d = d / (#pi * 2) ELSEIF (@trapcolor == 7); angle to origin 2 (old ReallyCool) d = 0.02 * abs(atan(imag(point) / real(point)) * 180/#pi) ELSEIF (@trapcolor == 8); iteration d = i d = d / #maxiter ENDIF IF (j == 0) e1 = d ELSEIF (j == 1) e2 = d ELSE e3 = d ENDIF j = j + 1 ENDWHILE ; apply pre-scale e1 = e1 * @zscale e2 = e2 * @zscale e3 = e3 * @zscale ; apply transfer function ; a function is not used because these are floats ; and not all functions apply to floats IF (@xfer == 1); log e1 = log(e1) e2 = log(e2) e3 = log(e3) ELSEIF (@xfer == 2); sqrt e1 = sqrt(e1) e2 = sqrt(e2) e3 = sqrt(e3) ELSEIF (@xfer == 3); cuberoot e1 = (e1)^(1/3) e2 = (e2)^(1/3) e3 = (e3)^(1/3) ELSEIF (@xfer == 4); exp e1 = exp(e1) e2 = exp(e2) e3 = exp(e3) ELSEIF (@xfer == 5); sqr e1 = sqr(e1) e2 = sqr(e2) e3 = sqr(e3) ELSEIF (@xfer == 6); cube e1 = (e1)^3 e2 = (e2)^3 e3 = (e3)^3 ELSEIF (@xfer == 7); sin e1 = sin(e1) e2 = sin(e2) e3 = sin(e3) ELSEIF (@xfer == 8); cos e1 = cos(e1) e2 = cos(e2) e3 = cos(e3) ELSEIF (@xfer == 9); tan e1 = tan(e1) e2 = tan(e2) e3 = tan(e3) ENDIF ; apply post-scale e1 = e1 * @zscale2 e2 = e2 * @zscale2 e3 = e3 * @zscale2 ; determine surface normal ; that is, the normal to the surface defined by: ; (real(c1), imag(c1), e1) ; (real(c2), imag(c2), e2) ; (real(c3), imag(c3), e3) vx = e2-e1 vy = e3-e1 vz = -@offset ; normalize vector vd = 1/sqrt(sqr(vx)+sqr(vy)+sqr(vz)) vx = vx*vd vy = vy*vd vz = vz*vd z = vx + flip(vy); fudge z from vector ELSE; didn't compute z this time z = z1; use primary iteration value to keep periodicity working ENDIF IF (modz > @bailout); we're done iter = -1 ENDIF bailout: iter > 0 default: title = "SlopeTrap (Julia)" helpfile = "dmj-pub\dmj-pub-uf-st.htm" center = (0.0, 0.0) maxiter = 1000 param seed caption = "Julia Seed" default = (0,0) hint = "This is the Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param power caption = "Exponent" default = (2,0) hint = "Overall exponent for the equation. (2,0) gives \ the classic Julia type." endparam param bailout caption = "Bail-out Value" default = 1.0e20 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Julia set anymore." endparam param trapshape caption = "Trap Shape" default = 0 enum = "point" "ring" "ring 2" "egg" "hyperbola" "hypercross" \ "cross" "astroid" "diamond" "rectangle" "box" "lines" \ "waves" "mirrored waves" "mirrored waves 2" \ "radial waves" "radial waves 2" "ring ripples" \ "grid ripples" "radial ripples" "pinch" "spiral" "heart" hint = "This is the shape of the orbit trap." endparam param trapcolor caption = "Trap Coloring" default = 0 enum = "distance" "magnitude" "real" "imaginary" "angle to trap" \ "angle to trap 2" "angle to origin" "angle to origin 2" "iteration" hint = "This is the information used to produce a color." endparam param traptype caption = "Trap Mode" default = 0 enum = "closest" "farthest" "first" "last" "sum" "average" "product" \ "sign average" "second closest" "second farthest" "two closest" \ "two farthest" "funky average" "funky average 2" "funky average 3" \ "funky average 4" "funky average 5" "funky average 6" \ "trap only" hint = "This is how points will be chosen to use for coloring." endparam param traporder caption = "Trap Order" default = 4.0 hint = "Number of leaves for the pinch trap shape, the \ exponent to use for astroid curves (try 0.66667), \ 'egginess', or the height of waves." endparam param trapfreq caption = "Trap Frequency" default = 1.0 hint = "The frequency of ripples or waves." endparam param trapcenter caption = "Trap Center" default = (0,0) hint = "This is the location of the trap in the complex plane." endparam param trapdrift caption = "Trap Drift" default = (0,0) hint = "This is the amount the trap center will move with each \ iteration." endparam param traporbit caption = "Trap Orbit" default = (0,0) hint = "The trap center location is multiplied by this value \ with each iteration." endparam param movetrap caption = "Trap Center Moves" default = false hint = "If this is enabled, the trap center will match the \ pixel location instead of being fixed. This overrides \ Trap Center." endparam param aspect caption = "Aspect Ratio" default = 1.0 min = 0.0000000001 hint = "This is how square the trap is. You can distort the \ trap by using a value other than 1.0." endparam param threshold caption = "Threshold" default = 0.25 min = 0 hint = "This is the width of the trap area, used for most \ trap modes." endparam param diameter caption = "Diameter" default = 1.0 ; min = 0 hint = "This is the diameter of the trap (for ring, box, and \ line shapes)." endparam param angle caption = "Rotation" default = 0.0 hint = "This is the angle, in degrees, that the trap should \ be rotated." endparam param anglestep caption = "Rotation Step" default = 0.0 hint = "This is the angle, in degrees, that the trap will \ be rotated with each iteration." endparam param skew caption = "Skew" default = 0.0 hint = "This is the angle, in degrees, to skew the vertical \ axis of the trap shape." endparam param skewstep caption = "Skew Step" default = 0.0 hint = "This is the angle, in degrees, that the skew angle \ should be increased by with each iteration." endparam param trapfunc caption = "Distance Transfer" default = 0 enum = "linear" "log" "sqrt" "cuberoot" "exp" "sqr" "cube" \ "sin" "cos" "tan" "sinc" hint = "This function is applied to trap distances at every \ iteration. It can be used to apply some special effects \ to trap shapes." endparam param prescale caption = "Distance Pre-scale" default = 1.0 hint = "This is a multiplier applied to the trap distance, \ before the Distance Transfer function is applied to it." endparam param postscale caption = "Distance Post-scale" default = 1.0 hint = "This is a multiplier applied to the trap distance, \ after the Distance Transfer function is applied to it." endparam param trapabs caption = "No Negative Distance" default = false hint = "If enabled, eliminates 'negative' distances by taking \ the absolute value of the distance." endparam param trapstart caption = "Start Iteration" default = 0.0 hint = "This is the iteration at which to start watching for \ orbit traps." endparam param trapiter caption = "Trap Iterations" default = 10000.0 hint = "This is the number of iterations to watch for traps \ in a single block." endparam param trapskip caption = "Skip Iterations" default = 0.0 hint = "This is the number of iterations to skip watching for \ traps, after a block of watched iterations." endparam param gauss caption = "Repeat Spacing" default = 0.0 min = 0.0 hint = "This is the spacing at which the trap will repeat, \ all across the complex plane. If zero, trap does \ not repeat." endparam param gaussgcenter caption = "Repeat Center" default = (0,0) hint = "This is the center point of grid trap repetition." endparam param gaussr caption = "Radial Spacing" default = 0.0 min = 0 hint = "This is the number of times the trap will repeat, \ radially around the radial center point. If zero, \ trap does not repeat radially." endparam param gausss caption = "Concentric Spacing" default = 0.0 min = 0 hint = "This is the distance at which the trap will repeat, \ radially out from the radial center point. If zero, \ trap does not repeat radially out." endparam param gausscenter caption = "Radial Center" default = (0,0) hint = "This is the center point of radial trap repetition." endparam param radialmode caption = "Radial Mode" default = 0 enum = "kaleidoscope" "polar coordinates" hint = "Indicates the type of radial repetition to use. The \ two styles produce very different results." endparam param offset caption = "Orbit Separation" default = 0.00000001 hint = "Defines how far apart the simultaneous orbits are. Smaller \ distances will produce more accurate results." endparam param xfer caption = "Height Transfer" default = 0 enum = "linear" "log" "sqrt" "cuberoot" "exp" "sqr" "cube" "sin" "cos" "tan" hint = "This function will be applied to the height value \ before a slope is calculated." endparam param zscale caption = "Height Pre-Scale" default = 1.0 hint = "Specifies the ratio between height and distance. Higher \ values will exaggerate differences between high and low. \ In general, you will want to use smaller numbers here." endparam param zscale2 caption = "Height Post-Scale" default = 0.025 hint = "Specifies the ratio between height and distance; like \ Height Pre-Scale, except that this value is applied after \ the transfer function." endparam param everyiter caption = "Every Iteration" default = false hint = "If set, the surface normal will be computed at every \ iteration. If you are using a coloring algorithm which \ processes every iteration, you will need this." endparam switch: type = "dmj-Slope2Mandel" power = @power bailout = @bailout trapshape = @trapshape trapcolor = @trapcolor traptype = @traptype traporder = @traporder trapfreq = @trapfreq trapcenter = @trapcenter trapdrift = @trapdrift traporbit = @traporbit movetrap = @movetrap aspect = @aspect threshold = @threshold diameter = @diameter angle = @angle anglestep = @anglestep skew = @skew skewstep = @skewstep trapfunc = @trapfunc prescale = @prescale postscale = @postscale trapabs = @trapabs trapstart = @trapstart trapiter = @trapiter trapskip = @trapskip gauss = @gauss gaussr = @gaussr gausss = @gausss gausscenter = @gausscenter radialmode = @radialmode offset = @offset ; zmode = @zmode xfer = @xfer zscale = @zscale zscale2 = @zscale2 everyiter = @everyiter } dmj-SNovaMandel { ; ; This is the SinNova fractal (Mandelbrot form), a ; modified Newtonian-style fractal. The formula ; was first shown to me by Paul Derbyshire (who ; named it Nova). It has also appeared elsewhere ; under other names. Use this formula and the ; Switch feature to select a NovaJulia. ; init: complex zold = (0,0) z = @start loop: zold = z z = z - @relax * (sin(z)^@power-1) / (@power * sin(z)^(@power-1) * cos(z)) + #pixel bailout: |z - zold| > @bailout default: title = "SinNova (Mandelbrot)" helpfile = "dmj-pub\dmj-pub-uf-sn.htm" maxiter = 1000 periodicity = 0 center = (-0.5,0) magn = 1.5 param start caption = "Start Value" default = (1,0) hint = "Starting value for each point. You can use this to \ 'perturb' the fractal." endparam param power caption = "Exponent" default = (3,0) hint = "Overall exponent for the equation. (3,0) gives \ the classic NovaM type." endparam param bailout caption = "Bailout" default = 0.00001 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam switch: type = "dmj-SNovaJulia" seed = #pixel power = @power bailout = @bailout relax = @relax } dmj-SNovaJulia { ; ; This is the SinNova fractal (Julia form), a ; modified Newtonian-style fractal. The formula ; was first shown to me by Paul Derbyshire (who ; named it Nova). It has also appeared elsewhere ; under other names. If you leave the Julia ; seed at the default (0,0), you can use this as ; a general Newton-style fractal as in FractInt. ; init: complex zold = (0,0) z = #pixel loop: zold = z z = z - @relax * (sin(z)^@power-1) / (@power * sin(z)^(@power-1) * cos(z)) + @seed bailout: |z - zold| > @bailout default: title = "SinNova (Julia)" helpfile = "dmj-pub\dmj-pub-uf-sn.htm" maxiter = 1000 periodicity = 0 center = (0,0) magn = 1.5 param seed caption = "Julia Seed" default = (0,0) hint = "This is the Julia seed, a constant parameter which \ defines the shape of the fractal." endparam param power caption = "Exponent" default = (3,0) hint = "Overall exponent for the equation. (3,0) gives \ the classic Nova type." endparam param bailout caption = "Bailout" default = 0.00001 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam switch: type = "dmj-SNovaMandel" power = @power bailout = @bailout relax = @relax } dmj-StutterMandel { ; ; I got this idea while looking at '99 contest entries. ; The essential idea is to perform a normal Mandelbrot ; iteration for a while, and then "reset" the calculation, ; using the current z as a new c and then setting z back ; to the start value. ; init: z = @start c = #pixel float f = @restart loop: f = f - 1 IF (f <= 0) f = f + @restart c = z z = @start ENDIF z = z^@power + c bailout: |z| < @bailout default: title = "StutterMandel" helpfile = "dmj-pub\dmj-pub-uf-stutter.htm" center = (-0.5,0) periodicity = 0 maxiter = 1000 param start caption = "Start Value" default = (0,0) hint = "Starting value for each point. You can use this to \ 'perturb' the fractal." endparam param power caption = "Exponent" default = (2,0) hint = "Overall exponent for the equation. (2,0) gives \ the classic Mandelbrot type." endparam param bailout caption = "Bailout" default = 1e20 hint = "Bailout value; larger values will cause more \ iterations to be done for each point." endparam param restart caption = "Restart Interval" default = 16.0 min = 1e-10 hint = "Specifies the number of iterations before c is reset." endparam } dmj-TorusMandel { ; ; This is a simple implementation of Earl Hinrichs' ; torus-method renderings of the 4D Julibrot fractal. ; Don't try to wrap your head around the 4D torus ; shape, it will cause you pain. :) Just keep in mind ; that each image axis represents a circle in 4D ; space that is perpendicular to the circle used for ; the other image axis. ; ; These images naturally repeat. With the right ; settings, you can make tileable images with them. ; init: complex c = (0,1)^(imag(#pixel)) z = (0,1)^(real(#pixel)) z = real(z)*real(@scale1) + flip(imag(z)*imag(@scale1)) c = real(c)*real(@scale2) + flip(imag(c)*imag(@scale2)) loop: z = z^@power + c bailout: |z| < @bailout default: title = "Torus (Julibrot)" helpfile = "dmj-pub\dmj-pub-uf-tj.htm" maxiter = 1000 center = (0,0) magn = 1.0 param power caption = "Exponent" default = (2,0) hint = "Overall exponent for the equation. (2,0) gives \ the classic Mandelbrot type." endparam param bailout caption = "Bailout" default = 1.0e20 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Mandelbrot set anymore." endparam param scale1 caption = "Ring 1 Scale" default = (1.0,1.0) hint = "Sets the width and height of the ring used for the \ real axis, carved through z space." endparam param scale2 caption = "Ring 2 Scale" default = (1.0,1.0) hint = "Sets the width and height of the ring used for the \ imaginary axis, carved through c space." endparam } dmj-TorusNova { ; ; This is a simple implementation of Earl Hinrichs' ; torus-method renderings of the 4D NovaM/J fractal. ; Don't try to wrap your head around the 4D torus ; shape, it will cause you pain. :) Just keep in mind ; that each image axis represents a circle in 4D ; space that is perpendicular to the circle used for ; the other image axis. ; ; These images naturally repeat. With the right ; settings, you can make tileable images with them. ; init: complex c = (0,1)^(imag(#pixel)) z = (0,1)^(real(#pixel)) z = real(z)*real(@scale1) + flip(imag(z)*imag(@scale1)) c = real(c)*real(@scale2) + flip(imag(c)*imag(@scale2)) complex zsquared = (0,0) complex zcubed = (0,0) complex zold = (0,0) loop: IF (@power == (3,0)); special optimized routine for power 3 zsquared = sqr(z) zcubed = zsquared * z zold = z z = z - @relax * (zcubed-1) / (3*zsquared) + c ELSE zold = z z = z - @relax * (z^@power-1) / (@power * z^(@power-1)) + c ENDIF bailout: |z-zold| > @bailout default: title = "Torus (Nova)" helpfile = "dmj-pub\dmj-pub-uf-tn.htm" maxiter = 1000 periodicity = 0 center = (0,0) magn = 1.0 param power caption = "Exponent" default = (3,0) hint = "Overall exponent for the equation. (3,0) gives \ the classic NovaM type." endparam param bailout caption = "Bailout" default = 0.00001 hint = "Bailout value; smaller values will cause more \ iterations to be done for each point." endparam param relax caption = "Relaxation" default = (1,0) hint = "This can be used to slow down the convergence of \ the formula." endparam param scale1 caption = "Ring 1 Scale" default = (1.0,1.0) hint = "Sets the width and height of the ring used for the \ real axis, carved through z space." endparam param scale2 caption = "Ring 2 Scale" default = (1.0,1.0) hint = "Sets the width and height of the ring used for the \ imaginary axis, carved through c space." endparam }