hypercomplexj+ { ; ; Mutations of "hypercomplexj" ; by Gilles Nadeau - May 2003 ; hypercomplexj & hypercomplex Fractint formula as converted to UF ; by Frederik Slijkerman ; init: complex z = (0.0, 0.0) complex zi = (0.0, 0.0) if (@option == 0) z = pixel zi = p1 elseif (@option == 1) z = real(pixel) + flip(real(p1)) zi = imag(p1) + flip(imag(pixel)) elseif (@option == 2) z = real(p1) + flip(real(pixel)) zi = imag(pixel) + flip(imag(p1)) endif loop: a = fn1(z - imag(zi) + flip(real(zi))) b = fn1(z + imag(zi) - flip(real(zi))) z = (a + b) / 2 + @seed1 zi = (flip(real(b)) + imag(a) - imag(b) - flip(real(a))) / 2 + @seed2 bailout: |zi| + |z| <= @bailout default: title = "Hypercomplex Julia+" maxiter = 500 periodicity = 0 method = multipass float param version default = 0.0 visible = false endparam param option caption = "HX-J option" enum = "1:(origin)" "2:(xw)" "3:(yz)" endparam param seed1 caption = "(c1, ci)" default = (-0.745, 0.0) endparam param seed2 caption = "(cj, ck)" default = (0.113, 0.05) endparam param p1 caption = "(zj, zk)" default = (0.0, 0.0) endparam param bailout caption = "Bailout value" default = 64.0 min = 1 endparam func fn1 caption = "First Function" default = sqr() endfunc switch: type = "hypercomplex+" version = @version p1 = seed2 bailout = bailout option = option fn1 = fn1 } hypercomplex+ { ; ; Mutations of "hypercomplex" ; by Gilles Nadeau - May 2003 ; hypercomplexj & hypercomplex Fractint formula as converted to UF ; by Frederik Slijkerman ; init: complex z = (0.0, 0.0) complex zi = (0.0, 0.0) loop: if (@option == 0) a = fn1(z - imag(zi) + flip(real(zi))) b = fn1(z + imag(zi) - flip(real(zi))) z = (a + b) / 2 + pixel zi = (flip(real(b)) + imag(a) - imag(b) - flip(real(a))) / 2 + p1 elseif (@option == 1) a = fn1(z - imag(zi) + flip(real(zi))) b = fn1(z + imag(zi) - flip(real(zi))) z = (a + b) / 2 + real(pixel) + flip(real(p1)) zi = (flip(real(b)) + imag(a) - imag(b) - flip(real(a))) / 2 + imag(p1) + flip(imag(pixel)) elseif (@option == 2) a = fn1(z - imag(zi) + flip(real(zi))) b = fn1(z + imag(zi) - flip(real(zi))) z = (a + b) / 2 + real(p1) + flip(real(pixel)) zi = (flip(real(b)) + imag(a) - imag(b) - flip(real(a))) / 2 + imag(pixel) + flip(imag(p1)) endif bailout: |zi| + |z| <= @bailout default: title = "Hypercomplex Mandelbrot+" maxiter = 500 periodicity = 0 method = multipass float param version default = 0.0 visible = false endparam param option caption = "HX-M option" enum = "1:(origin)" "2:(xw)" "3:(yz)" endparam param p1 caption = "(cj, ck)" default = (0.0, 0.0) endparam param bailout caption = "Bailout value" default = 64.0 min = 1 endparam func fn1 caption = "First Function" default = sin() endfunc switch: type = "hypercomplexj+" version = @version seed1 = pixel seed2 = p1 bailout = bailout option = option fn1 = fn1 } 4D-Julia { ; Gilles Nadeau, June, 2003 ; 3d option added October, 2007 ; based on the Quaternion formula by Stig Pettersson. ; init: complex z = (0,0) float xx = real(#pixel) float yy = imag(#pixel) float zz = real(@p1) float ww = imag(@p1) float cx = real(@p2) float cy = imag(@p2) float cz = real(@p3) float cw = imag(@p3) float zr = xx float zi = yy float zj = zz float zk = ww float cr = cx float ci = cy float cj = cz float ck = cw float xa = 0.0 float xb = 0.0 float xc = 0.0 float xd = 0.0 float ya = 0.0 float yb = 0.0 float yc = 0.0 float yd = 0.0 float ra = 0.0 float ib = 0.0 float jc = 0.0 float kd = 0.0 float rx = 0.0 float ry = 0.0 float rz = 0.0 if (@version < 1.2) float cs = @cs else cs = 1.0 endif bool s0 = false bool s1 = false if (@dim3 == false) ; (yz plane rotation) ry = yy*cos(#pi*@rotx/180) - zz*sin(#pi*@rotx/180) rz = yy*sin(#pi*@rotx/180) + zz*cos(#pi*@rotx/180) yy = ry zz = rz ry = cy*cos(#pi*@rotx/180) - cz*sin(#pi*@rotx/180) rz = cy*sin(#pi*@rotx/180) + cz*cos(#pi*@rotx/180) cy = ry cz = rz ; (xz plane rotation) rx = zz*sin(#pi*@roty/180) + xx*cos(#pi*@roty/180) rz = zz*cos(#pi*@roty/180) - xx*sin(#pi*@roty/180) xx = rx zz = rz rx = cz*sin(#pi*@roty/180) + cx*cos(#pi*@roty/180) rz = cz*cos(#pi*@roty/180) - cx*sin(#pi*@roty/180) cx = rx cz = rz ; (xy plane rotation) rx = xx*cos(#pi*@rotz/180) - yy*sin(#pi*@rotz/180) ry = xx*sin(#pi*@rotz/180) + yy*cos(#pi*@rotz/180) xx = rx yy = ry rx = cx*cos(#pi*@rotz/180) - cy*sin(#pi*@rotz/180) ry = cx*sin(#pi*@rotz/180) + cy*cos(#pi*@rotz/180) cx = rx cy = ry if @fourthdim == 3 zr = xx zi = yy zj = zz zk = ww cr = cx ci = cy cj = cz ck = cw elseif @fourthdim == 2 zr = xx zi = yy zj = ww zk = zz cr = cx ci = cy cj = cw ck = cz elseif @fourthdim == 1 zr = zz zi = ww zj = xx zk = yy cr = cz ci = cw cj = cx ck = cy else zr = ww zi = zz zj = xx zk = yy cr = cw ci = cz cj = cx ck = cy endif else int stepnum = @stepnum if (@version < 1.19) float zdist = @dist else float zdist = @dist / 2 endif float xx = real(#pixel) float yy = imag(#pixel) float zz = real(@p1) - zdist float ww = imag(@p1) float z0 = zz float zz = z0 if (@version < 1.19) float delta = (1 - zz) / stepnum else float delta = (real(@p1) + zdist - zz) / stepnum endif int n = 0 int i = 0 while (n < stepnum) && (s1 == false) xx = real(#pixel) yy = imag(#pixel) zz = z0 = z0 + delta ww = imag(@p1) ; (yz plane rotation) ry = yy*cos(#pi*@rotx/180) - zz*sin(#pi*@rotx/180) rz = yy*sin(#pi*@rotx/180) + zz*cos(#pi*@rotx/180) yy = ry zz = rz ; (xz plane rotation) rx = zz*sin(#pi*@roty/180) + xx*cos(#pi*@roty/180) rz = zz*cos(#pi*@roty/180) - xx*sin(#pi*@roty/180) xx = rx zz = rz ; (xy plane rotation) rx = xx*cos(#pi*@rotz/180) - yy*sin(#pi*@rotz/180) ry = xx*sin(#pi*@rotz/180) + yy*cos(#pi*@rotz/180) xx = rx yy = ry if @fourthdim == 3 zr = xx zi = yy zj = zz zk = ww elseif @fourthdim == 2 zr = xx zi = yy zj = ww zk = zz elseif @fourthdim == 1 zr = zz zi = ww zj = xx zk = yy else zr = ww zi = zz zj = xx zk = yy endif while (i < #maxiter) && (zr^2 + zi^2 + zj^2 + zk^2 < @bailout) if (@var == 0) ra = zr^2 - zi^2 - zj^2 + zk^2 ib = 2*(zr*zi - zj*zk) jc = 2*(zr*zj - zi*zk) kd = 2*(zr*zk + zi*zj) zr = ra + cr zi = ib + ci zj = jc + cj zk = kd + ck elseif (@var == 1) xa = zr + cr xb = zi + ci xc = zj + cj xd = zk + ck ya = zr - cr yb = zi - ci yc = zj - cj yd = zk - ck zr = xa*ya - xb*yb - xc*yc + xd*yd zi = xb*ya + xa*yb - xd*yc - xc*yd zj = xc*ya - xd*yb + xa*yc - xb*yd zk = xd*ya + xc*yb + xb*yc + xa*yd elseif (@var == 2) ra = zr^3 - 3*zr*(zi^2 + zj^2 - zk^2) + 6*zi*zj*zk ib= -zi^3 + 3*zi*(zr^2 - zj^2 + zk^2) - 6*zr*zj*zk jc= -zj^3 + 3*zj*(zk^2 + zr^2 - zi^2) - 6*zk*zr*zi kd = zk^3 - 3*zk*(zj^2 - zr^2 + zi^2) + 6*zj*zr*zi zr = ra + cr zi = ib + ci zj = jc + cj zk = kd + ck elseif (@var == 3) a = zr - zk + flip(zi + zj) b = zr + zk + flip(zi - zj) c = a ^ @exp d = b ^ @exp zr = (real(c) + real(d)) / 2 + cr zi = (imag(c) + imag(d)) / 2 + ci zj = (imag(c) - imag(d)) / 2 + cj zk = (real(d) - real(c)) / 2 + ck endif i = i + 1 endwhile i = 0 n = n + 1 if (zr^2 + zi^2 + zj^2 + zk^2 < @bailout) s1 = true endif endwhile if (s1 == true) xx = real(#pixel) yy = imag(#pixel) zz = z0 = z0 - delta*cs ww = imag(@p1) ; (yz plane rotation) ry = yy*cos(#pi*@rotx/180) - zz*sin(#pi*@rotx/180) rz = yy*sin(#pi*@rotx/180) + zz*cos(#pi*@rotx/180) yy = ry zz = rz ; (xz plane rotation) rx = zz*sin(#pi*@roty/180) + xx*cos(#pi*@roty/180) rz = zz*cos(#pi*@roty/180) - xx*sin(#pi*@roty/180) xx = rx zz = rz ; (xy plane rotation) rx = xx*cos(#pi*@rotz/180) - yy*sin(#pi*@rotz/180) ry = xx*sin(#pi*@rotz/180) + yy*cos(#pi*@rotz/180) xx = rx yy = ry endif if (s1 == false) && (@dim3 == true) s0 = true endif if @fourthdim == 3 zr = xx zi = yy zj = zz zk = ww elseif @fourthdim == 2 zr = xx zi = yy zj = ww zk = zz elseif @fourthdim == 1 zr = zz zi = ww zj = xx zk = yy else zr = ww zi = zz zj = xx zk = yy endif endif loop: if (s0 == false) if (@var == 0) ra = zr^2 - zi^2 - zj^2 + zk^2 ib = 2*(zr*zi - zj*zk) jc = 2*(zr*zj - zi*zk) kd = 2*(zr*zk + zi*zj) zr = ra + cr zi = ib + ci zj = jc + cj zk = kd + ck elseif (@var == 1) xa = zr + cr xb = zi + ci xc = zj + cj xd = zk + ck ya = zr - cr yb = zi - ci yc = zj - cj yd = zk - ck zr = xa*ya - xb*yb - xc*yc + xd*yd zi = xb*ya + xa*yb - xd*yc - xc*yd zj = xc*ya - xd*yb + xa*yc - xb*yd zk = xd*ya + xc*yb + xb*yc + xa*yd elseif (@var == 2) ra = zr^3 - 3*zr*(zi^2 + zj^2 - zk^2) + 6*zi*zj*zk ib= -zi^3 + 3*zi*(zr^2 - zj^2 + zk^2) - 6*zr*zj*zk jc= -zj^3 + 3*zj*(zk^2 + zr^2 - zi^2) - 6*zk*zr*zi kd = zk^3 - 3*zk*(zj^2 - zr^2 + zi^2) + 6*zj*zr*zi zr = ra + cr zi = ib + ci zj = jc + cj zk = kd + ck elseif (@var == 3) a = zr - zk + flip(zi + zj) b = zr + zk + flip(zi - zj) c = a ^ @exp d = b ^ @exp zr = (real(c) + real(d)) / 2 + cr zi = (imag(c) + imag(d)) / 2 + ci zj = (imag(c) - imag(d)) / 2 + cj zk = (real(d) - real(c)) / 2 + ck endif endif z = zr + flip(zi) bailout: zr^2 + zi^2 + zj^2 + zk^2 <= @bailout default: title = "4D-Julia" maxiter = 149 float param version default = 1.2 visible = false endparam param var caption = "Variation" enum = "First""Second""Third""Fourth" endparam param fourthdim caption = "Fourth dimension" enum = "z1" "zi" "zj" "zk" default = 3 endparam param p2 caption = "(c1, ci)" default = (0.0, 0.0) endparam param p3 caption = "(cj, ck)" default = (0.0, 0.0) endparam param p1 caption = "(zj, zk)" default = (0.0, 0.0) endparam param exp caption = "Exponent" default = 4.0 visible = @var == 3 endparam param rotx caption = "x-rotation" hint = "Rotates yz-plane." default = 0.0 min =-360.0 max = 360.0 endparam param roty caption = "y-rotation" hint = "Rotates zx-plane." default = 0.0 min =-360.0 max = 360.0 endparam param rotz caption = "z-rotation" hint = "Rotates xy-plane." default = 0.0 min =-360.0 max = 360.0 endparam param dim3 caption = "3-dimensional" default = false endparam param dist caption = "z-dist" default = 4.0 visible = @dim3 == true endparam param cs caption = "Color scaling" default = 1.975 visible = @dim3 == true && @version < 1.2 endparam param stepnum caption = "Number of slices" default = 400 visible = @dim3 == true endparam param bailout caption = "Bailout value" default = 64.0 endparam switch: type = "4D-Mandelbrot" version = @version var = @var fourthdim = @fourthdim p1 = @p3 exp = @exp rotx = @rotx roty = @roty rotz = @rotz dim3 = @dim3 dist = @dist cs = @cs stepnum = @stepnum bailout = @bailout } 4D-Mandelbrot { ; Gilles Nadeau, June, 2003 ; 3d option added October, 2007 ; based on the Quaternion formula by Stig Pettersson. ; init: complex z = (0,0) float xx = 0.0 float yy = 0.0 float zz = 0.0 float ww = 0.0 float cx = real(#pixel) float cy = imag(#pixel) float cz = real(@p1) float cw = imag(@p1) float zr = xx float zi = yy float zj = zz float zk = ww float cr = cx float ci = cy float cj = cz float ck = cw float xa = 0.0 float xb = 0.0 float xc = 0.0 float xd = 0.0 float ya = 0.0 float yb = 0.0 float yc = 0.0 float yd = 0.0 float ra = 0.0 float ib = 0.0 float jc = 0.0 float kd = 0.0 float rx = 0.0 float ry = 0.0 float rz = 0.0 if (@version < 1.2) float cs = @cs else cs = 1.0 endif bool s0 = false bool s1 = false ; (yz plane rotation) ry = cy*cos(#pi*@rotx/180) - cz*sin(#pi*@rotx/180) rz = cy*sin(#pi*@rotx/180) + cz*cos(#pi*@rotx/180) cy = ry cz = rz ; (xz plane rotation) rx = cz*sin(#pi*@roty/180) + cx*cos(#pi*@roty/180) rz = cz*cos(#pi*@roty/180) - cx*sin(#pi*@roty/180) cx = rx cz = rz ; (xy plane rotation) rx = cx*cos(#pi*@rotz/180) - cy*sin(#pi*@rotz/180) ry = cx*sin(#pi*@rotz/180) + cy*cos(#pi*@rotz/180) cx = rx cy = ry if @fourthdim == 3 cr = cx ci = cy cj = cz ck = cw elseif @fourthdim == 2 cr = cx ci = cy cj = cw ck = cz elseif @fourthdim == 1 cr = cz ci = cw cj = cx ck = cy else cr = cw ci = cz cj = cx ck = cy endif if (@dim3 == true) int stepnum = @stepnum if (@version < 1.19) float zdist = @dist else float zdist = @dist / 2 endif float xx = 0.0 float yy = 0.0 float zz = 0.0 float ww = 0.0 float cx = real(#pixel) float cy = imag(#pixel) float cz = real(@p1) - zdist float cw = imag(@p1) float z0 = cz float cz = z0 if (@version < 1.19) float delta = (1 - cz) / stepnum else float delta = (real(@p1) + zdist - cz) / stepnum endif int n = 0 int i = 0 while (n < stepnum) && (s1 == false) xx = 0.0 yy = 0.0 zz = 0.0 ww = 0.0 zr = xx zi = yy zj = zz zk = ww cx = real(#pixel) cy = imag(#pixel) cz = z0 = z0 + delta cw = imag(@p1) ; (yz plane rotation) ry = cy*cos(#pi*@rotx/180) - cz*sin(#pi*@rotx/180) rz = cy*sin(#pi*@rotx/180) + cz*cos(#pi*@rotx/180) cy = ry cz = rz ; (xz plane rotation) rx = cz*sin(#pi*@roty/180) + cx*cos(#pi*@roty/180) rz = cz*cos(#pi*@roty/180) - cx*sin(#pi*@roty/180) cx = rx cz = rz ; (xy plane rotation) rx = cx*cos(#pi*@rotz/180) - cy*sin(#pi*@rotz/180) ry = cx*sin(#pi*@rotz/180) + cy*cos(#pi*@rotz/180) cx = rx cy = ry if @fourthdim == 3 cr = cx ci = cy cj = cz ck = cw elseif @fourthdim == 2 cr = cx ci = cy cj = cw ck = cz elseif @fourthdim == 1 cr = cz ci = cw cj = cx ck = cy else cr = cw ci = cz cj = cx ck = cy endif while (i < #maxiter) && (zr^2 + zi^2 + zj^2 + zk^2 < @bailout) if (@var == 0) ra = zr^2 - zi^2 - zj^2 + zk^2 ib = 2*(zr*zi - zj*zk) jc = 2*(zr*zj - zi*zk) kd = 2*(zr*zk + zi*zj) zr = ra + cr zi = ib + ci zj = jc + cj zk = kd + ck elseif (@var == 1) xa = zr + cr xb = zi + ci xc = zj + cj xd = zk + ck ya = zr - cr yb = zi - ci yc = zj - cj yd = zk - ck zr = xa*ya - xb*yb - xc*yc + xd*yd zi = xb*ya + xa*yb - xd*yc - xc*yd zj = xc*ya - xd*yb + xa*yc - xb*yd zk = xd*ya + xc*yb + xb*yc + xa*yd elseif (@var == 2) ra = zr^3 - 3*zr*(zi^2 + zj^2 - zk^2) + 6*zi*zj*zk ib= -zi^3 + 3*zi*(zr^2 - zj^2 + zk^2) - 6*zr*zj*zk jc= -zj^3 + 3*zj*(zk^2 + zr^2 - zi^2) - 6*zk*zr*zi kd = zk^3 - 3*zk*(zj^2 - zr^2 + zi^2) + 6*zj*zr*zi zr = ra + cr zi = ib + ci zj = jc + cj zk = kd + ck elseif (@var == 3) a = zr - zk + flip(zi + zj) b = zr + zk + flip(zi - zj) c = a ^ @exp d = b ^ @exp zr = (real(c) + real(d)) / 2 + cr zi = (imag(c) + imag(d)) / 2 + ci zj = (imag(c) - imag(d)) / 2 + cj zk = (real(d) - real(c)) / 2 + ck endif i = i + 1 endwhile i = 0 n = n + 1 if (zr^2 + zi^2 + zj^2 + zk^2 < @bailout) s1 = true endif endwhile if (s1 == true) xx = 0.0 yy = 0.0 zz = 0.0 ww = 0.0 zr = xx zi = yy zj = zz zk = ww cx = real(#pixel) cy = imag(#pixel) cz = z0 = z0 - delta*cs cw = imag(@p1) ; (yz plane rotation) ry = cy*cos(#pi*@rotx/180) - cz*sin(#pi*@rotx/180) rz = cy*sin(#pi*@rotx/180) + cz*cos(#pi*@rotx/180) cy = ry cz = rz ; (xz plane rotation) rx = cz*sin(#pi*@roty/180) + cx*cos(#pi*@roty/180) rz = cz*cos(#pi*@roty/180) - cx*sin(#pi*@roty/180) cx = rx cz = rz ; (xy plane rotation) rx = cx*cos(#pi*@rotz/180) - cy*sin(#pi*@rotz/180) ry = cx*sin(#pi*@rotz/180) + cy*cos(#pi*@rotz/180) cx = rx cy = ry endif if (s1 == false) && (@dim3 == true) s0 = true endif if @fourthdim == 3 cr = cx ci = cy cj = cz ck = cw elseif @fourthdim == 2 cr = cx ci = cy cj = cw ck = cz elseif @fourthdim == 1 cr = cz ci = cw cj = cx ck = cy else cr = cw ci = cz cj = cx ck = cy endif xx = 0.0 yy = 0.0 zz = 0.0 ww = 0.0 zr = xx zi = yy zj = zz zk = ww endif loop: if (s0 == false) if (@var == 0) ra = zr^2 - zi^2 - zj^2 + zk^2 ib = 2*(zr*zi - zj*zk) jc = 2*(zr*zj - zi*zk) kd = 2*(zr*zk + zi*zj) zr = ra + cr zi = ib + ci zj = jc + cj zk = kd + ck elseif (@var == 1) xa = zr + cr xb = zi + ci xc = zj + cj xd = zk + ck ya = zr - cr yb = zi - ci yc = zj - cj yd = zk - ck zr = xa*ya - xb*yb - xc*yc + xd*yd zi = xb*ya + xa*yb - xd*yc - xc*yd zj = xc*ya - xd*yb + xa*yc - xb*yd zk = xd*ya + xc*yb + xb*yc + xa*yd elseif (@var == 2) ra = zr^3 - 3*zr*(zi^2 + zj^2 - zk^2) + 6*zi*zj*zk ib= -zi^3 + 3*zi*(zr^2 - zj^2 + zk^2) - 6*zr*zj*zk jc= -zj^3 + 3*zj*(zk^2 + zr^2 - zi^2) - 6*zk*zr*zi kd = zk^3 - 3*zk*(zj^2 - zr^2 + zi^2) + 6*zj*zr*zi zr = ra + cr zi = ib + ci zj = jc + cj zk = kd + ck elseif (@var == 3) a = zr - zk + flip(zi + zj) b = zr + zk + flip(zi - zj) c = a ^ @exp d = b ^ @exp zr = (real(c) + real(d)) / 2 + cr zi = (imag(c) + imag(d)) / 2 + ci zj = (imag(c) - imag(d)) / 2 + cj zk = (real(d) - real(c)) / 2 + ck endif endif z = zr + flip(zi) bailout: zr^2 + zi^2 + zj^2 + zk^2 <= @bailout default: title = "4D-Mandelbrot" maxiter = 149 float param version default = 1.2 visible = false endparam param var caption = "Variation" enum = "First""Second""Third""Fourth" endparam param fourthdim caption = "Fourth dimension" enum = "c1" "ci" "cj" "ck" default = 3 endparam param p1 caption = "(cj, ck)" default = (0.0, 0.0) endparam param exp caption = "Exponent" default = 4.0 visible = @var == 3 endparam param rotx caption = "x-rotation" hint = "Rotates yz-plane." default = 0.0 min =-360.0 max = 360.0 endparam param roty caption = "y-rotation" hint = "Rotates zx-plane." default = 0.0 min =-360.0 max = 360.0 endparam param rotz caption = "z-rotation" hint = "Rotates xy-plane." default = 0.0 min =-360.0 max = 360.0 endparam param dim3 caption = "3-dimensional" default = false endparam param dist caption = "z-dist" default = 4.0 visible = @dim3 == true endparam param cs caption = "Color scaling" default = 1.975 visible = @dim3 == true && @version < 1.2 endparam param stepnum caption = "Number of slices" default = 400 visible = @dim3 == true endparam param bailout caption = "Bailout value" default = 64.0 endparam switch: type = "4D-Julia" version = @version var = @var fourthdim = @fourthdim p2 = #pixel p3 = @p1 exp = @exp rotx = @rotx roty = @roty rotz = @rotz dim3 = @dim3 dist = @dist cs = @cs stepnum = @stepnum bailout = @bailout } Cubic-QuatJul { ; Gilles Nadeau, July, 2003 ; init: z = #pixel z1 = real(z) + flip(imag(z)*real(@p1)) zi = imag(@p1)*real(z) + flip(imag(z)) zj = 0 zk = 0 c1 = real(@seed1) ci = imag(@seed1) cj = real(@p2) ck = imag(@p2) loop: q1 = z1*z1 - zi*zi - zj*zj - zk*zk qi = 2*z1*zi qj = 2*z1*zj qk = 2*z1*zk z1 = q1 + c1 zi = qi + ci zj = qj + cj zk = qk + ck z = z1 + zi + zj + zk bailout: |z1| + |zi| + |zj| + |zk| <= @bailout default: title = "Cubic Quat Julia" maxiter = 500 periodicity = 0 method = multipass float param version default = 0.0 visible = false endparam param seed1 caption = "Julia seed" default = (-0.695,0.16) endparam param p1 caption = "Parameter 1" default = (0.0, 0.0) endparam param p2 caption = "Parameter 2" default = (0.305, 0.0) endparam param bailout caption = "Bailout value" default = 64.0 endparam switch: type = "Cubic-Quat" version = @version p1 = p1 p2 = p2 bailout = bailout } Cubic-Quat { ; Gilles Nadeau, July, 2003 ; init: z = #pixel z1 = 0 zi = 0 zj = 0 zk = 0 c1 = real(z) + flip(imag(z)*real(@p1)) ci = imag(@p1)*real(z) + flip(imag(z)) cj = real(@p2) ck = imag(@p2) loop: q1 = z1*z1 - zi*zi - zj*zj - zk*zk qi = 2*z1*zi qj = 2*z1*zj qk = 2*z1*zk z1 = q1 + c1 zi = qi + ci zj = qj + cj zk = qk + ck z = z1 + zi + zj + zk bailout: |z1| + |zi| + |zj| + |zk| <= @bailout default: title = "Cubic Quat Mandelbrot" maxiter = 500 periodicity = 0 method = multipass float param version default = 0.0 visible = false endparam param p1 caption = "Parameter 1" default = (0.0, 0.0) endparam param p2 caption = "Parameter 2" default = (0.0, 0.0) endparam param bailout caption = "Bailout value" default = 64.0 endparam switch: type = "Cubic-QuatJul" version = @version seed1 = #pixel p1 = p1 p2 = p2 bailout = bailout } QuatJulia+ { ; Personal version of some orgfrm formulas ; Gilles Nadeau, May, 2003 ; init: complex z = (0.0, 0.0) complex w = (0.0, 0.0) complex cz = @p2 complex cw = @p3 if (@option == 0) z = real(@fn1(#pixel)) + flip(real(@p1)) w = imag(@p1) + flip(imag(@fn2(#pixel))) elseif (@option == 1) z = real(@p1) + flip(real(@fn1(#pixel))) w = imag(@fn2(#pixel)) + flip(imag(@p1)) endif loop: tz = z^2 - w^2 tw = 2*z*w z = tz + cz w = tw + cw bailout: |z| + |w| < @bailout default: title = "QuatJulia+" maxiter = 500 periodicity = 0 method = multipass float param version default = 0.0 visible = false endparam param option caption = "QuatJ+ option" enum = "1:(xw)" "2:(yz)" endparam param p2 caption = "(c1, ci)" default = (-1.45,0.005) endparam param p3 caption = "(cj, ck)" default = (0.0, 0.0) endparam param p1 caption = "(zj, zk)" default = (0.0, 0.0) endparam param bailout caption = "Bailout value" default = 64.0 endparam func fn1 caption = "First Function" default = ident() endfunc func fn2 caption = "Second Function" default = ident() endfunc switch: type = "QuatMandelbrot+" version = @version bailout = @bailout option = @option fn1 = @fn1 fn2 = @fn2 } QuatMandelbrot+ { ; Personal version of some orgfrm formulas ; Gilles Nadeau, May, 2003 ; init: complex z = (0.0, 0.0) complex w = (0.0, 0.0) complex cz = (0.0, 0.0) complex cw = (0.0, 0.0) if (@option == 0) cz = real(@fn1(#pixel)) + flip(real(@p1)) cw = imag(@p1) + flip(imag(@fn2(#pixel))) elseif (@option == 1) cz = real(@p1) + flip(real(@fn1(#pixel))) cw = imag(@fn2(#pixel)) + flip(imag(@p1)) endif loop: tz = z^2 - w^2 tw = 2*z*w z = tz + cz w = tw + cw bailout: |z| + |w| < @bailout default: title = "QuatMandelbrot+" maxiter = 500 periodicity = 0 method = multipass float param version default = 0.0 visible = false endparam param option caption = "QuatM+ option" enum = "1:(xw)" "2:(yz)" endparam param p1 caption = "(cj, ck)" default = (0.0, 0.0) endparam param bailout caption = "Bailout value" default = 64.0 endparam func fn1 caption = "First Function" default = ident() endfunc func fn2 caption = "Second Function" default = ident() endfunc switch: type = "QuatJulia+" version = @version p2 = #pixel p3 = @p1 bailout = @bailout option = @option fn1 = @fn1 fn2 = @fn2 } Z^n { ; Personal version of some orgfrm formulas ; Gilles Nadeau, July, 2003 ; Original formulas by Benno Schmid - 1997 ; zn-xw, zn-xz, zn-yw, zn-yz ; init: complex z = (0.0, 0.0) complex c = (0.0, 0.0) complex a = #pixel complex b = @p1 if (@formula == 0) z = real(a) + flip(real(b)) c = flip(imag(a)) + imag(b) elseif (@formula == 1) z = real(a) + flip(real(b)) c = imag(a) + flip(imag(b)) elseif (@formula == 2) z = flip(real(a)) + real(b) c = flip(imag(a)) + imag(b) elseif (@formula == 3) z = flip(real(a)) + real(b) c = imag(a) + flip(imag(b)) endif loop: z = z^@n + c bailout: |z| < @bailout default: title = "Z^n" maxiter = 500 method = multipass float param version default = 0.0 visible = false endparam param formula caption = "Z^n formula" enum = "1:(xw)" "2:(xz)" "3:(yw)" "4:(yz)" endparam param p1 caption = "Parameter" default = (0.0, 0.0) endparam param n caption = "Exponent" default = (3.0, 0.0) endparam param bailout caption = "Bailout value" default = 16.0 endparam switch: type = "Z^n" version = @version p1 = #pixel n = n bailout = bailout formula = formula } QuatJul {; Quaternion Julia formula ; Gilles Nadeau, July, 2003 ; Inspired by ; QuatJul v18 of Jon Horner init: float x1 = float x2 = float a = real(#pixel) float y1 = float y2 = float b = imag(#pixel) float z1 = float z2 = float c = real(@zjk) float w1 = float w2 = float d = imag(@zjk) float c1 = real(@c1i) float ci = imag(@c1i) float cj = real(@cjk) float ck = imag(@cjk) loop: int n = 1 x1 = a y1 = b z1 = c w1 = d while n < @power n = n + 1 x2 = a y2 = b z2 = c w2 = d a = x1*x2 - y1*y2 - z1*z2 - w1*w2 b = y1*x2 + x1*y2 c = z1*x2 + x1*z2 d = w1*x2 + x1*w2 endwhile a = a + c1 b = b + ci c = c + cj d = d + ck z = a + flip(b) w = c + flip(d) bailout: |z| + |w| < @bailout default: title = "Quaternion Julia" maxiter = 500 periodicity = 0 method = multipass float param version default = 1.1 visible = false endparam param c1i caption = "(c1, ci)" default = (-0.194, 0.01) endparam param cjk caption = "(cj, ck)" default = (0.6557, 0.01) endparam param zjk caption = "(zj, zk)" default = (0.0, 0.0) endparam param power caption = "Power" default = 2 endparam param bailout caption = "Bailout value" default = 64.0 endparam switch: type = "Quat" version = @version cjk = @cjk power = @power bailout = @bailout } Quat {; Quaternion Mandel formula ; Gilles Nadeau, July, 2003 ; Inspired by ; QuatJul v18 of Jon Horner init: float x1 = float x2 = float a = 0.0 float y1 = float y2 = float b = 0.0 float z1 = float z2 = float c = 0.0 float w1 = float w2 = float d = 0.0 float c1 = real(#pixel) float ci = imag(#pixel) float cj = real(@cjk) float ck = imag(@cjk) loop: int n = 1 x1 = a y1 = b z1 = c w1 = d while n < @power n = n + 1 x2 = a y2 = b z2 = c w2 = d a = x1*x2 - y1*y2 - z1*z2 - w1*w2 b = y1*x2 + x1*y2 c = z1*x2 + x1*z2 d = w1*x2 + x1*w2 endwhile a = a + c1 b = b + ci c = c + cj d = d + ck z = a + flip(b) w = c + flip(d) bailout: |z| + |w| < @bailout default: title = "Quaternion Mandelbrot" maxiter = 500 periodicity = 0 method = multipass float param version default = 1.1 visible = false endparam param notused caption = "notused" default = (0.0, 0.0) visible = false endparam param cjk caption = "(cj, ck)" default = (0.0, 0.0) endparam param power caption = "Power" default = 2 endparam param bailout caption = "Bailout value" default = 64.0 endparam switch: type = "QuatJul" version = @version c1i = #pixel cjk = @cjk power = @power bailout = @bailout } gnd-FractalFenderC { ;Gilles Nadeau, October, 2003 ;Based on my modifications to the Hypercomplex formula ;and Lale Erguner's Durbidaa1 formula, derived from ;FractalFenderC, fract196.frm. ;Special thanks to Susan Chambless, ;for the suggestions and advice. init: ;default to Mandelbrot z = (0.0, 0.0) complex zjk = (0.0, 0.0) complex c1i = #pixel complex cjk = @p1 if( @mode == "Julia" ) z = #pixel zjk = @p3 c1i = @p2 cjk = @p1 endif loop: if (1 < |z| + |zjk|) a = @fn1(z - imag(zjk) + flip(real(zjk))) b = @fn1(z + imag(zjk) - flip(real(zjk))) z = (a + b) / 2 + c1i zjk = (flip(real(b)) + imag(a) - imag(b) - flip(real(a))) / 2 + cjk endif a = @fn2(z - imag(zjk) + flip(real(zjk))) b = @fn2(z + imag(zjk) - flip(real(zjk))) z = (a + b) / 2 + c1i zjk = (flip(real(b)) + imag(a) - imag(b) - flip(real(a))) / 2 + cjk bailout: |z| + |zjk| <= @bailout switch: type = "gnd-FractalFenderC" version = @version p1 = @p1 p2 = #pixel bailout = @bailout fn1 = @fn1 fn2 = @fn2 mode = @switchmode switchMode = mode default: title = "Hypercomplex Fractal Fender C" maxiter = 149 periodicity = 0 method = multipass float param version default = 0.0 visible = false endparam param mode caption = "Current Mode" default = 0 enum = "Mandelbrot" "Julia" visible = false endparam param switchMode caption = "Switch Mode" default = 1 enum = "Mandelbrot" "Julia" visible = false endparam heading caption = "Mandelbrot Mode" visible = @mode==0 endheading heading caption = "Julia Mode" visible = @mode==1 endheading param p2 caption = "(c1, ci)" default = (0.0, 0.0) visible = @mode == 1 endparam param p1 caption = "(cj, ck)" default = (0.0, 0.0) endparam param p3 caption = "(zj, zk)" default = (0.0, 0.0) visible = @mode == 1 endparam param bailout caption = "Bailout value" default = 64.0 min = 1 endparam func fn1 caption = "First Function" default = cosh() endfunc func fn2 caption = "Second Function" default = sqr() endfunc } gnd-HyperSquare { ;Gilles Nadeau, October, 2003 ;Special thanks to Susan Chambless, ;for the suggestions and advice. init: ;default to Mandelbrot z = #pixel x = 0 y = 0 cx = real(z) cy = imag(z)*@p2 if( @mode == "Julia" ) z = #pixel x = real(z) y = imag(z)*@p2 cx = real(@p1) cy = imag(@p1) endif loop: xx = x + cx xy = y + cy yx = x - cx yy = y - cy x = xx*yx - xy*yy y = xx*yy + xy*yx if (@flavor == 0) z = x + y elseif (@flavor == 1) z = x + flip(y) endif bailout: |x| + |y| <= @bailout switch: type = "gnd-HyperSquare" version = @version p1 = #pixel p2 = @p2 flavor = @flavor bailout = @bailout mode = @switchmode switchMode = mode default: title = "Hyper Square" maxiter = 149 periodicity = 0 method = multipass float param version default = 0.0 visible = false endparam param mode caption = "Current Mode" default = 0 enum = "Mandelbrot" "Julia" visible = false endparam param switchMode caption = "Switch Mode" default = 1 enum = "Mandelbrot" "Julia" visible = false endparam heading caption = "Mandelbrot Mode" visible = @mode==0 endheading heading caption = "Julia Mode" visible = @mode==1 endheading param p1 caption = "Julia seed" default = (0.0, 0.0) visible = @mode == 1 endparam param p2 caption = "Plane rotation" default = (0.0, 1.0) endparam param flavor caption = "Combine flavor" enum = "1:(z=x+y)" "2:(z=x+flip(y))" endparam param bailout caption = "Bailout value" default = 64.0 min = 1 endparam } gnd-HyperSquare-Quaternion { ;Gilles Nadeau, November, 2003 ;Inspired by ;1 QuatJul v18 of Jon Horner and ;2 CQuatXY4 of Junichi Sato. ;Special thanks to Susan Chambless, ;for the suggestions and advice. init: ;default to Mandelbrot z = #pixel z1 = 0 zi = 0 zj = 0 zk = 0 c1 = real(z) ci = imag(z)*@h cj = real(@cjk) ck = imag(@cjk) if( @mode == "Julia" ) z = #pixel z1 = real(z) zi = imag(z)*@h zj = real(@zjk) zk = imag(@zjk) c1 = real(@c1i) ci = imag(@c1i) cj = real(@cjk) ck = imag(@cjk) endif loop: x1 = z1 + c1 xi = zi + ci xj = zj + cj xk = zk + ck y1 = z1 - c1 yi = zi - ci yj = zj - cj yk = zk - ck z1 = x1*y1 - xi*yi - xj*yj - xk*yk zi = x1*yi + y1*xi zj = x1*yj + y1*xj zk = x1*yk + y1*xk if (@flavor == 0) z = z1 + zi elseif (@flavor == 1) z = z1 + flip(zi) endif bailout: |z1| + |zi| + |zj| + |zk| <= @bailout switch: type = "gnd-HyperSquare-Quaternion" version = @version c1i = #pixel cjk = @cjk h = @h flavor = @flavor bailout = @bailout mode = @switchmode switchMode = mode default: title = "Hyper Square Quaternion" maxiter = 149 periodicity = 0 method = multipass float param version default = 0.0 visible = false endparam param mode caption = "Current Mode" default = 0 enum = "Mandelbrot" "Julia" visible = false endparam param switchMode caption = "Switch Mode" default = 1 enum = "Mandelbrot" "Julia" visible = false endparam heading caption = "Mandelbrot Mode" visible = @mode==0 endheading heading caption = "Julia Mode" visible = @mode==1 endheading param c1i caption = "(c1, ci)" default = (0.0, 0.0) visible = @mode == 1 endparam param cjk caption = "(cj, ck)" default = (0.0, 0.0) endparam param zjk caption = "(zj, zk)" default = (0.0, 0.0) endparam param h caption = "Plane rotation" default = (0.0, 1.0) endparam param flavor caption = "Combine flavor" enum = "1:(z=z1+zi)" "2:(z=z1+flip(zi))" endparam param bailout caption = "Bailout value" default = 64.0 min = 1 endparam } gnd-antizerr-z^n { ; Personal version of some orgfrm formulas ; Gilles Nadeau, January, 2004 ; Original formulas by Benno Schmid - 1997 ; antizerr-xw, xz, yw, yz ; init: complex z = (0.0, 0.0) complex c = (0.0, 0.0) complex a = #pixel complex b = @p1 if (@formula == 0) ;xw z = @fn1(real(a)) + flip(real(b)) c = imag(b) + flip(imag(a)) elseif (@formula == 1) ;xz z = @fn1(real(a)) + flip(real(b)) c = imag(a) + flip(imag(b)) elseif (@formula == 2) ;yw z = real(b) + flip(@fn1(real(a))) c = imag(b) + flip(imag(a)) elseif (@formula == 3) ;yz z = real(b) + flip(@fn1(real(a))) c = imag(a) + flip(imag(b)) endif loop: z = z^@power + c bailout: |z| < @bailout switch: type = "gnd-antizerr-z^n" version = @version p1 = #pixel power = @power bailout = @bailout formula = @formula fn1 = @fn1 default: title = "Antizerr-z^n" maxiter = 500 method = multipass float param version default = 0.0 visible = false endparam param formula caption = "antizerr formula" enum = "1:(xw)" "2:(xz)" "3:(yw)" "4:(yz)" endparam param p1 caption = "Parameter" default = (0.0, 0.0) endparam param power caption = "Exponent" default = (2.0, 0.0) endparam func fn1 caption = "First Function" default = sqrt() endfunc param bailout caption = "Bailout value" default = 16.0 endparam } gnd-julibrot-4fn { ; Mutations of z3-xw, z3-xz, z3-yw, z3-yz ; by Gilles Nadeau - April 2004 ; Originals formulas by Benno Schmid - 1997 ; init: complex z = (0.0, 0.0) complex c = (0.0, 0.0) complex a = #pixel complex b = @p1 if (@formula == 0) z = real(@fn3(a)) + flip(real(b)) c = flip(imag(@fn4(a))) + imag(b) elseif (@formula == 1) z = real(@fn3(a)) + flip(real(b)) c = imag(@fn4(a)) + flip(imag(b)) elseif (@formula == 2) z = flip(real(@fn3(a))) + real(b) c = flip(imag(@fn4(a))) + imag(b) elseif (@formula == 3) z = flip(real(@fn3(a))) + real(b) c = imag(@fn4(a)) + flip(imag(b)) endif loop: z = @fn1(z)*@fn2(z) + c bailout: |z| < @bailout default: title = "Julibrot 4 Functions" maxiter = 149 method = multipass float param version default = 0.0 visible = false endparam param formula caption = "Formula" enum = "1:(xw)" "2:(xz)" "3:(yw)" "4:(yz)" endparam param p1 caption = "Parameter" default = (0.0, 0.0) endparam func fn1 caption = "First Function" default = ident() endfunc func fn2 caption = "Second Function" default = ident() endfunc func fn3 caption = "Third Function" default = ident() endfunc func fn4 caption = "Fourth Function" default = ident() endfunc param bailout caption = "Bailout value" default = 16.0 endparam switch: type = "gnd-julibrot-4fn" version = @version p1 = #pixel fn1 = @fn1 fn2 = @fn2 fn3 = @fn3 fn4 = @fn4 bailout = @bailout formula = @formula } gnd-QuatJul++ { ; Gilles Nadeau - March 2004 ; Inspired by ; 1 QuatJul v18 of Jon Horner and ; 2 cquatall of Junichi Sato. ; init: z1 = 0 zi = 0 zj = real(@zjk) zk = imag(@zjk) c1 = real(@c1i) ci = imag(@c1i) cj = real(@cjk) ck = imag(@cjk) if (@var1 == 0) z1 = real(@fn1(#pixel)) zi = imag(@fn2(#pixel)) elseif (@var1 == 1) z1 = flip(real(@fn1(#pixel))) zi = flip(imag(@fn2(#pixel))) elseif (@var1 == 2) z1 = real(@fn1(#pixel)) zi = flip(imag(@fn2(#pixel))) elseif (@var1 == 3) z1 = flip(real(@fn1(#pixel))) zi = imag(@fn2(#pixel)) endif loop: if (@var2 == 0) q1 = z1*z1 - zi*zi - zj*zj - zk*zk qi = 2*z1*zi qj = 2*z1*zj qk = 2*z1*zk z1 = q1 + c1 zi = qi + ci zj = qj + cj zk = qk + ck elseif (@var2 == 1) q1 = z1*z1 - zi*zi - zj*zj - zk*zk qi = 2*z1*zi qj = 2*z1*zj qk = 2*z1*zk z1 = conj(q1) + c1 zi = -conj(qi) + ci zj = -conj(qj) + cj zk = -conj(qk) + ck elseif (@var2 == 2) x1 = z1 + c1 xi = zi + ci xj = zj + cj xk = zk + ck y1 = z1 - c1 yi = zi - ci yj = zj - cj yk = zk - ck z1 = x1*y1 - xi*yi - xj*yj - xk*yk zi = x1*yi + y1*xi zj = x1*yj + y1*xj zk = x1*yk + y1*xk elseif (@var2 == 3) x1 = conj(z1) + c1 xi = -conj(zi) + ci xj = -conj(zj) + cj xk = -conj(zk) + ck y1 = conj(z1) - c1 yi = -conj(zi) - ci yj = -conj(zj) - cj yk = -conj(zk) - ck z1 = x1*y1 - xi*yi - xj*yj - xk*yk zi = x1*yi + y1*xi zj = x1*yj + y1*xj zk = x1*yk + y1*xk endif if (@var1 == 0) z = z1 + flip(zi) elseif (@var1 == 1) z = z1 + flip(zi) elseif (@var1 == 2) z = z1 + zi elseif (@var1 == 3) z = z1 + zi endif bailout: |z1| + |zi| + |zj| + |zk| <= @bailout default: title = "Quaternion Julia++" maxiter = 500 method = multipass periodicity = 0 float param version default = 0.0 visible = false endparam param var1 caption = "Variation 1" enum = "First" "Second" "Third" "Fourth" endparam param var2 caption = "Variation 2" enum = "First" "Second" "Third" "Fourth" endparam param c1i caption = "(c1, ci)" default = (-0.745, 0.0) endparam param cjk caption = "(cj, ck)" default = (0.113, 0.05) endparam param zjk caption = "(zj, zk)" default = (0.0, 0.0) endparam param bailout caption = "Bailout value" default = 64.0 endparam func fn1 caption = "Pixel function (Re)" default = ident() endfunc func fn2 caption = "Pixel function (Im)" default = ident() endfunc switch: type = "gnd-QuatMan++" version = @version cjk = @cjk bailout = @bailout var1 = @var1 var2 = @var2 fn1 = @fn1 fn2 = @fn2 } gnd-QuatMan++ { ; Gilles Nadeau - March 2004 ; Inspired by ; 1 QuatJul v18 of Jon Horner and ; 2 cquatall of Junichi Sato. ; init: z1 = 0 zi = 0 zj = 0 zk = 0 c1 = 0 ci = 0 cj = real(@cjk) ck = imag(@cjk) if (@var1 == 0) c1 = real(@fn1(#pixel)) ci = imag(@fn2(#pixel)) elseif (@var1 == 1) c1 = flip(real(@fn1(#pixel))) ci = flip(imag(@fn2(#pixel))) elseif (@var1 == 2) c1 = real(@fn1(#pixel)) ci = flip(imag(@fn2(#pixel))) elseif (@var1 == 3) c1 = flip(real(@fn1(#pixel))) ci = imag(@fn2(#pixel)) endif loop: if (@var2 == 0) q1 = z1*z1 - zi*zi - zj*zj - zk*zk qi = 2*z1*zi qj = 2*z1*zj qk = 2*z1*zk z1 = q1 + c1 zi = qi + ci zj = qj + cj zk = qk + ck elseif (@var2 == 1) q1 = z1*z1 - zi*zi - zj*zj - zk*zk qi = 2*z1*zi qj = 2*z1*zj qk = 2*z1*zk z1 = conj(q1) + c1 zi = -conj(qi) + ci zj = -conj(qj) + cj zk = -conj(qk) + ck elseif (@var2 == 2) x1 = z1 + c1 xi = zi + ci xj = zj + cj xk = zk + ck y1 = z1 - c1 yi = zi - ci yj = zj - cj yk = zk - ck z1 = x1*y1 - xi*yi - xj*yj - xk*yk zi = x1*yi + y1*xi zj = x1*yj + y1*xj zk = x1*yk + y1*xk elseif (@var2 == 3) x1 = conj(z1) + c1 xi = -conj(zi) + ci xj = -conj(zj) + cj xk = -conj(zk) + ck y1 = conj(z1) - c1 yi = -conj(zi) - ci yj = -conj(zj) - cj yk = -conj(zk) - ck z1 = x1*y1 - xi*yi - xj*yj - xk*yk zi = x1*yi + y1*xi zj = x1*yj + y1*xj zk = x1*yk + y1*xk endif if (@var1 == 0) z = z1 + flip(zi) elseif (@var1 == 1) z = z1 + flip(zi) elseif (@var1 == 2) z = z1 + zi elseif (@var1 == 3) z = z1 + zi endif bailout: |z1| + |zi| + |zj| + |zk| <= @bailout default: title = "Quaternion Mandelbrot++" maxiter = 500 method = multipass periodicity = 0 float param version default = 0.0 visible = false endparam param var1 caption = "Variation 1" enum = "First" "Second" "Third" "Fourth" endparam param var2 caption = "Variation 2" enum = "First" "Second" "Third" "Fourth" endparam param cjk caption = "(cj, ck)" default = (0.0, 0.0) endparam param bailout caption = "Bailout value" default = 64.0 endparam func fn1 caption = "Pixel function (Re)" default = ident() endfunc func fn2 caption = "Pixel function (Im)" default = ident() endfunc switch: type = "gnd-QuatJul++" version = @version c1i = #pixel cjk = @cjk bailout = @bailout var1 = @var1 var2 = @var2 fn1 = @fn1 fn2 = @fn2 } gnd-formula-1-complex { ; Gilles Nadeau, April, 2004 ; Based on my modifications to the "formula" ; Original formula by Giuseppe Zito ; init: z = #pixel complex x = (0.0, 0.0) complex y = (0.0, 0.0) complex s0 = (0.0, 0.0) complex s1 = (0.0, 0.0) complex sx = (0.0, 0.0) complex sy = (0.0, 0.0) float cr = real(@p1) float ci = imag(@p1) float dr = real(@p2) float di = imag(@p2) float er = real(@p3) float ei = imag(@p3) loop: x = real(@fn1(z)) y = imag(@fn2(z)) x = @fn3(x) y = @fn4(y) s0 = y if (@op1 == 0) s0 = s0 /cr elseif (@op1 == 1) s0 = s0 *cr elseif (@op1 == 2) s0 = s0 +cr elseif (@op1 == 3) s0 = s0 -cr endif if (@op2 == 0) s0 = s0 *y elseif (@op2 == 1) s0 = s0 /y elseif (@op2 == 2) s0 = s0 +y elseif (@op2 == 3) s0 = s0 -y endif if (@op3 == 0) s0 = s0 *y elseif (@op3 == 1) s0 = s0 /y elseif (@op3 == 2) s0 = s0 +y elseif (@op3 == 3) s0 = s0 -y endif if (@op4 == 0) s0 = s0 -y elseif (@op4 == 1) s0 = s0 +y elseif (@op4 == 2) s0 = s0 /y elseif (@op4 == 3) s0 = s0 *y endif if (@op5 == 0) s0 = s0 *ci elseif (@op5 == 1) s0 = s0 /ci elseif (@op5 == 2) s0 = s0 +ci elseif (@op5 == 3) s0 = s0 -ci endif sx = s0 s0 = y if (@op6 == 0) s0 = s0 /dr elseif (@op6 == 1) s0 = s0 *dr elseif (@op6 == 2) s0 = s0 +dr elseif (@op6 == 3) s0 = s0 -dr endif if (@op7 == 0) s0 = s0 +y elseif (@op7 == 1) s0 = s0 -y elseif (@op7 == 2) s0 = s0 /y elseif (@op7 == 3) s0 = s0 *y endif if (@op8 == 0) s0 = s0 *y elseif (@op8 == 1) s0 = s0 /y elseif (@op8 == 2) s0 = s0 +y elseif (@op8 == 3) s0 = s0 -y endif if (@op9 == 0) s0 = s0 -di elseif (@op9 == 1) s0 = s0 +di elseif (@op9 == 2) s0 = s0 /di elseif (@op9 == 3) s0 = s0 *di endif if (@op10 == 0) s0 = s0 -y elseif (@op10 == 1) s0 = s0 +y elseif (@op10 == 2) s0 = s0 /y elseif (@op10 == 3) s0 = s0 *y endif if (@op11 == 0) s0 = s0 +y elseif (@op11 == 1) s0 = s0 -y elseif (@op11 == 2) s0 = s0 /y elseif (@op11 == 3) s0 = s0 *y endif s1 = er if (@op12 == 0) s1 = s1 *x elseif (@op12 == 1) s1 = s1 /x elseif (@op12 == 2) s1 = s1 +x elseif (@op12 == 3) s1 = s1 -x endif if (@op13 == 0) s1 = s1 /x elseif (@op13 == 1) s1 = s1 *x elseif (@op13 == 2) s1 = s1 +x elseif (@op13 == 3) s1 = s1 -x endif if (@op14 == 0) s1 = s1 -ei elseif (@op14 == 1) s1 = s1 +ei elseif (@op14 == 2) s1 = s1 /ei elseif (@op14 == 3) s1 = s1 *ei endif if (@op15 == 0) s0 = s0 *s1 elseif (@op15 == 1) s0 = s0 /s1 elseif (@op15 == 2) s0 = s0 +s1 elseif (@op15 == 3) s0 = s0 -s1 endif if (@op16 == 0) s0 = s0 /x elseif (@op16 == 1) s0 = s0 *x elseif (@op16 == 2) s0 = s0 +x elseif (@op16 == 3) s0 = s0 -x endif if (@op17 == 0) s0 = s0 -y elseif (@op17 == 1) s0 = s0 +y elseif (@op17 == 2) s0 = s0 /y elseif (@op17 == 3) s0 = s0 *y endif if (@op18 == 0) s0 = s0 +x elseif (@op18 == 1) s0 = s0 -x elseif (@op18 == 2) s0 = s0 /x elseif (@op18 == 3) s0 = s0 *x endif if (@op19 == 0) s0 = s0 +y elseif (@op19 == 1) s0 = s0 -y elseif (@op19 == 2) s0 = s0 /y elseif (@op19 == 3) s0 = s0 *y endif sy = s0 z = sx + flip(sy) bailout: |sx| < @bailout && |sx| > -@bailout && |sy| < @bailout && |sy| > -@bailout default: title = "Formula 1 Complex" maxiter = 149 method = multipass periodicity = 0 float param version default = 0.0 visible = false endparam param p1 caption = "Parameter 1" default = (0.68162298, 0.96401101) endparam param p2 caption = "Parameter 2" default = (-0.95945197, -0.458745) endparam param p3 caption = "Parameter 3" default = (-0.425805, -0.36000001) endparam param op1 caption = "Operator 1 (cr)" enum = "/" "*" "+" "-" endparam param op2 caption = "Operator 2 (y)" enum = "*" "/" "+" "-" endparam param op3 caption = "Operator 3 (y)" enum = "*" "/" "+" "-" endparam param op4 caption = "Operator 4 (y)" enum = "-" "+" "/" "*" endparam param op5 caption = "Operator 5 (ci)" enum = "*" "/" "+" "-" endparam param op6 caption = "Operator 6 (dr)" enum = "/" "*" "+" "-" endparam param op7 caption = "Operator 7 (y)" enum = "+" "-" "/" "*" endparam param op8 caption = "Operator 8 (y)" enum = "*" "/" "+" "-" endparam param op9 caption = "Operator 9 (di)" enum = "-" "+" "/" "*" endparam param op10 caption = "Operator 10 (y)" enum = "-" "+" "/" "*" endparam param op11 caption = "Operator 11 (y)" enum = "+" "-" "/" "*" endparam param op12 caption = "Operator 12 (x)" enum = "*" "/" "+" "-" endparam param op13 caption = "Operator 13 (x)" enum = "/" "*" "+" "-" endparam param op14 caption = "Operator 14 (ei)" enum = "-" "+" "/" "*" endparam param op15 caption = "Operator 15 (s1)" enum = "*" "/" "+" "-" endparam param op16 caption = "Operator 16 (x)" enum = "/" "*" "+" "-" endparam param op17 caption = "Operator 17 (y)" enum = "-" "+" "/" "*" endparam param op18 caption = "Operator 18 (x)" enum = "+" "-" "/" "*" endparam param op19 caption = "Operator 19 (y)" enum = "+" "-" "/" "*" endparam func fn1 caption = "Function 1" default = ident() endfunc func fn2 caption = "Function 2" default = ident() endfunc func fn3 caption = "Function 3" default = ident() endfunc func fn4 caption = "Function 4" default = ident() endfunc param bailout caption = "Bailout value" default = 4.0 min = 1 endparam switch: type = "gnd-formula-2-complex" version = @version p1 = #pixel p2 = @p2 p3 = @p3 op1 = @op1 op2 = @op2 op3 = @op3 op4 = @op4 op5 = @op5 op6 = @op6 op7 = @op7 op8 = @op8 op9 = @op9 op10 = @op10 op11 = @op11 op12 = @op12 op13 = @op13 op14 = @op14 op15 = @op15 op16 = @op16 op17 = @op17 op18 = @op18 op19 = @op19 fn1 = @fn1 fn2 = @fn2 fn3 = @fn3 fn4 = @fn4 bailout = @bailout } gnd-formula-2-complex { ; Gilles Nadeau, April, 2004 ; Based on my modifications to the "formula" ; Original formula by Giuseppe Zito ; init: z = #pixel complex x = (0.0, 0.0) complex y = (0.0, 0.0) complex s0 = (0.0, 0.0) complex s1 = (0.0, 0.0) complex sx = (0.0, 0.0) complex sy = (0.0, 0.0) float cr = real(@p1) float ci = imag(@p1) float dr = real(@p2) float di = imag(@p2) float er = real(@p3) float ei = imag(@p3) loop: x = real(@fn1(z)) y = imag(@fn2(z)) x = @fn3(x) y = @fn4(y) s0 = y if (@op1 == 0) s0 = s0 /cr elseif (@op1 == 1) s0 = s0 *cr elseif (@op1 == 2) s0 = s0 +cr elseif (@op1 == 3) s0 = s0 -cr endif if (@op2 == 0) s0 = s0 *y elseif (@op2 == 1) s0 = s0 /y elseif (@op2 == 2) s0 = s0 +y elseif (@op2 == 3) s0 = s0 -y endif if (@op3 == 0) s0 = s0 *y elseif (@op3 == 1) s0 = s0 /y elseif (@op3 == 2) s0 = s0 +y elseif (@op3 == 3) s0 = s0 -y endif if (@op4 == 0) s0 = s0 -y elseif (@op4 == 1) s0 = s0 +y elseif (@op4 == 2) s0 = s0 /y elseif (@op4 == 3) s0 = s0 *y endif if (@op5 == 0) s0 = s0 *ci elseif (@op5 == 1) s0 = s0 /ci elseif (@op5 == 2) s0 = s0 +ci elseif (@op5 == 3) s0 = s0 -ci endif sx = s0 s0 = y if (@op6 == 0) s0 = s0 /dr elseif (@op6 == 1) s0 = s0 *dr elseif (@op6 == 2) s0 = s0 +dr elseif (@op6 == 3) s0 = s0 -dr endif if (@op7 == 0) s0 = s0 +y elseif (@op7 == 1) s0 = s0 -y elseif (@op7 == 2) s0 = s0 /y elseif (@op7 == 3) s0 = s0 *y endif if (@op8 == 0) s0 = s0 *y elseif (@op8 == 1) s0 = s0 /y elseif (@op8 == 2) s0 = s0 +y elseif (@op8 == 3) s0 = s0 -y endif if (@op9 == 0) s0 = s0 -di elseif (@op9 == 1) s0 = s0 +di elseif (@op9 == 2) s0 = s0 /di elseif (@op9 == 3) s0 = s0 *di endif if (@op10 == 0) s0 = s0 -y elseif (@op10 == 1) s0 = s0 +y elseif (@op10 == 2) s0 = s0 /y elseif (@op10 == 3) s0 = s0 *y endif if (@op11 == 0) s0 = s0 +y elseif (@op11 == 1) s0 = s0 -y elseif (@op11 == 2) s0 = s0 /y elseif (@op11 == 3) s0 = s0 *y endif s1 = er if (@op12 == 0) s1 = s1 *x elseif (@op12 == 1) s1 = s1 /x elseif (@op12 == 2) s1 = s1 +x elseif (@op12 == 3) s1 = s1 -x endif if (@op13 == 0) s1 = s1 /x elseif (@op13 == 1) s1 = s1 *x elseif (@op13 == 2) s1 = s1 +x elseif (@op13 == 3) s1 = s1 -x endif if (@op14 == 0) s1 = s1 -ei elseif (@op14 == 1) s1 = s1 +ei elseif (@op14 == 2) s1 = s1 /ei elseif (@op14 == 3) s1 = s1 *ei endif if (@op15 == 0) s0 = s0 *s1 elseif (@op15 == 1) s0 = s0 /s1 elseif (@op15 == 2) s0 = s0 +s1 elseif (@op15 == 3) s0 = s0 -s1 endif if (@op16 == 0) s0 = s0 /x elseif (@op16 == 1) s0 = s0 *x elseif (@op16 == 2) s0 = s0 +x elseif (@op16 == 3) s0 = s0 -x endif if (@op17 == 0) s0 = s0 -y elseif (@op17 == 1) s0 = s0 +y elseif (@op17 == 2) s0 = s0 /y elseif (@op17 == 3) s0 = s0 *y endif if (@op18 == 0) s0 = s0 +x elseif (@op18 == 1) s0 = s0 -x elseif (@op18 == 2) s0 = s0 /x elseif (@op18 == 3) s0 = s0 *x endif if (@op19 == 0) s0 = s0 +y elseif (@op19 == 1) s0 = s0 -y elseif (@op19 == 2) s0 = s0 /y elseif (@op19 == 3) s0 = s0 *y endif sy = s0 z = sx + flip(sy) bailout: |sx| < @bailout && |sx| > -@bailout && |sy| < @bailout && |sy| > -@bailout default: title = "Formula 2 Complex" maxiter = 149 method = multipass periodicity = 0 float param version default = 0.0 visible = false endparam param p1 caption = "Parameter 1" default = (0.68162298, 0.96401101) endparam param p2 caption = "Parameter 2" default = (-0.95945197, -0.458745) endparam param p3 caption = "Parameter 3" default = (-0.425805, -0.36000001) endparam param op1 caption = "Operator 1 (cr)" enum = "/" "*" "+" "-" endparam param op2 caption = "Operator 2 (y)" enum = "*" "/" "+" "-" endparam param op3 caption = "Operator 3 (y)" enum = "*" "/" "+" "-" endparam param op4 caption = "Operator 4 (y)" enum = "-" "+" "/" "*" endparam param op5 caption = "Operator 5 (ci)" enum = "*" "/" "+" "-" endparam param op6 caption = "Operator 6 (dr)" enum = "/" "*" "+" "-" endparam param op7 caption = "Operator 7 (y)" enum = "+" "-" "/" "*" endparam param op8 caption = "Operator 8 (y)" enum = "*" "/" "+" "-" endparam param op9 caption = "Operator 9 (di)" enum = "-" "+" "/" "*" endparam param op10 caption = "Operator 10 (y)" enum = "-" "+" "/" "*" endparam param op11 caption = "Operator 11 (y)" enum = "+" "-" "/" "*" endparam param op12 caption = "Operator 12 (x)" enum = "*" "/" "+" "-" endparam param op13 caption = "Operator 13 (x)" enum = "/" "*" "+" "-" endparam param op14 caption = "Operator 14 (ei)" enum = "-" "+" "/" "*" endparam param op15 caption = "Operator 15 (s1)" enum = "*" "/" "+" "-" endparam param op16 caption = "Operator 16 (x)" enum = "/" "*" "+" "-" endparam param op17 caption = "Operator 17 (y)" enum = "-" "+" "/" "*" endparam param op18 caption = "Operator 18 (x)" enum = "+" "-" "/" "*" endparam param op19 caption = "Operator 19 (y)" enum = "+" "-" "/" "*" endparam func fn1 caption = "Function 1" default = ident() endfunc func fn2 caption = "Function 2" default = ident() endfunc func fn3 caption = "Function 3" default = ident() endfunc func fn4 caption = "Function 4" default = ident() endfunc param bailout caption = "Bailout value" default = 4.0 min = 1 endparam switch: type = "gnd-formula-3-complex" version = @version p1 = @p1 p2 = #pixel p3 = @p3 op1 = @op1 op2 = @op2 op3 = @op3 op4 = @op4 op5 = @op5 op6 = @op6 op7 = @op7 op8 = @op8 op9 = @op9 op10 = @op10 op11 = @op11 op12 = @op12 op13 = @op13 op14 = @op14 op15 = @op15 op16 = @op16 op17 = @op17 op18 = @op18 op19 = @op19 fn1 = @fn1 fn2 = @fn2 fn3 = @fn3 fn4 = @fn4 bailout = @bailout } gnd-formula-3-complex { ; Gilles Nadeau, April, 2004 ; Based on my modifications to the "formula" ; Original formula by Giuseppe Zito ; init: z = #pixel complex x = (0.0, 0.0) complex y = (0.0, 0.0) complex s0 = (0.0, 0.0) complex s1 = (0.0, 0.0) complex sx = (0.0, 0.0) complex sy = (0.0, 0.0) float cr = real(@p1) float ci = imag(@p1) float dr = real(@p2) float di = imag(@p2) float er = real(@p3) float ei = imag(@p3) loop: x = real(@fn1(z)) y = imag(@fn2(z)) x = @fn3(x) y = @fn4(y) s0 = y if (@op1 == 0) s0 = s0 /cr elseif (@op1 == 1) s0 = s0 *cr elseif (@op1 == 2) s0 = s0 +cr elseif (@op1 == 3) s0 = s0 -cr endif if (@op2 == 0) s0 = s0 *y elseif (@op2 == 1) s0 = s0 /y elseif (@op2 == 2) s0 = s0 +y elseif (@op2 == 3) s0 = s0 -y endif if (@op3 == 0) s0 = s0 *y elseif (@op3 == 1) s0 = s0 /y elseif (@op3 == 2) s0 = s0 +y elseif (@op3 == 3) s0 = s0 -y endif if (@op4 == 0) s0 = s0 -y elseif (@op4 == 1) s0 = s0 +y elseif (@op4 == 2) s0 = s0 /y elseif (@op4 == 3) s0 = s0 *y endif if (@op5 == 0) s0 = s0 *ci elseif (@op5 == 1) s0 = s0 /ci elseif (@op5 == 2) s0 = s0 +ci elseif (@op5 == 3) s0 = s0 -ci endif sx = s0 s0 = y if (@op6 == 0) s0 = s0 /dr elseif (@op6 == 1) s0 = s0 *dr elseif (@op6 == 2) s0 = s0 +dr elseif (@op6 == 3) s0 = s0 -dr endif if (@op7 == 0) s0 = s0 +y elseif (@op7 == 1) s0 = s0 -y elseif (@op7 == 2) s0 = s0 /y elseif (@op7 == 3) s0 = s0 *y endif if (@op8 == 0) s0 = s0 *y elseif (@op8 == 1) s0 = s0 /y elseif (@op8 == 2) s0 = s0 +y elseif (@op8 == 3) s0 = s0 -y endif if (@op9 == 0) s0 = s0 -di elseif (@op9 == 1) s0 = s0 +di elseif (@op9 == 2) s0 = s0 /di elseif (@op9 == 3) s0 = s0 *di endif if (@op10 == 0) s0 = s0 -y elseif (@op10 == 1) s0 = s0 +y elseif (@op10 == 2) s0 = s0 /y elseif (@op10 == 3) s0 = s0 *y endif if (@op11 == 0) s0 = s0 +y elseif (@op11 == 1) s0 = s0 -y elseif (@op11 == 2) s0 = s0 /y elseif (@op11 == 3) s0 = s0 *y endif s1 = er if (@op12 == 0) s1 = s1 *x elseif (@op12 == 1) s1 = s1 /x elseif (@op12 == 2) s1 = s1 +x elseif (@op12 == 3) s1 = s1 -x endif if (@op13 == 0) s1 = s1 /x elseif (@op13 == 1) s1 = s1 *x elseif (@op13 == 2) s1 = s1 +x elseif (@op13 == 3) s1 = s1 -x endif if (@op14 == 0) s1 = s1 -ei elseif (@op14 == 1) s1 = s1 +ei elseif (@op14 == 2) s1 = s1 /ei elseif (@op14 == 3) s1 = s1 *ei endif if (@op15 == 0) s0 = s0 *s1 elseif (@op15 == 1) s0 = s0 /s1 elseif (@op15 == 2) s0 = s0 +s1 elseif (@op15 == 3) s0 = s0 -s1 endif if (@op16 == 0) s0 = s0 /x elseif (@op16 == 1) s0 = s0 *x elseif (@op16 == 2) s0 = s0 +x elseif (@op16 == 3) s0 = s0 -x endif if (@op17 == 0) s0 = s0 -y elseif (@op17 == 1) s0 = s0 +y elseif (@op17 == 2) s0 = s0 /y elseif (@op17 == 3) s0 = s0 *y endif if (@op18 == 0) s0 = s0 +x elseif (@op18 == 1) s0 = s0 -x elseif (@op18 == 2) s0 = s0 /x elseif (@op18 == 3) s0 = s0 *x endif if (@op19 == 0) s0 = s0 +y elseif (@op19 == 1) s0 = s0 -y elseif (@op19 == 2) s0 = s0 /y elseif (@op19 == 3) s0 = s0 *y endif sy = s0 z = sx + flip(sy) bailout: |sx| < @bailout && |sx| > -@bailout && |sy| < @bailout && |sy| > -@bailout default: title = "Formula 3 Complex" maxiter = 149 method = multipass periodicity = 0 float param version default = 0.0 visible = false endparam param p1 caption = "Parameter 1" default = (0.68162298, 0.96401101) endparam param p2 caption = "Parameter 2" default = (-0.95945197, -0.458745) endparam param p3 caption = "Parameter 3" default = (-0.425805, -0.36000001) endparam param op1 caption = "Operator 1 (cr)" enum = "/" "*" "+" "-" endparam param op2 caption = "Operator 2 (y)" enum = "*" "/" "+" "-" endparam param op3 caption = "Operator 3 (y)" enum = "*" "/" "+" "-" endparam param op4 caption = "Operator 4 (y)" enum = "-" "+" "/" "*" endparam param op5 caption = "Operator 5 (ci)" enum = "*" "/" "+" "-" endparam param op6 caption = "Operator 6 (dr)" enum = "/" "*" "+" "-" endparam param op7 caption = "Operator 7 (y)" enum = "+" "-" "/" "*" endparam param op8 caption = "Operator 8 (y)" enum = "*" "/" "+" "-" endparam param op9 caption = "Operator 9 (di)" enum = "-" "+" "/" "*" endparam param op10 caption = "Operator 10 (y)" enum = "-" "+" "/" "*" endparam param op11 caption = "Operator 11 (y)" enum = "+" "-" "/" "*" endparam param op12 caption = "Operator 12 (x)" enum = "*" "/" "+" "-" endparam param op13 caption = "Operator 13 (x)" enum = "/" "*" "+" "-" endparam param op14 caption = "Operator 14 (ei)" enum = "-" "+" "/" "*" endparam param op15 caption = "Operator 15 (s1)" enum = "*" "/" "+" "-" endparam param op16 caption = "Operator 16 (x)" enum = "/" "*" "+" "-" endparam param op17 caption = "Operator 17 (y)" enum = "-" "+" "/" "*" endparam param op18 caption = "Operator 18 (x)" enum = "+" "-" "/" "*" endparam param op19 caption = "Operator 19 (y)" enum = "+" "-" "/" "*" endparam func fn1 caption = "Function 1" default = ident() endfunc func fn2 caption = "Function 2" default = ident() endfunc func fn3 caption = "Function 3" default = ident() endfunc func fn4 caption = "Function 4" default = ident() endfunc param bailout caption = "Bailout value" default = 4.0 min = 1 endparam switch: type = "gnd-formula-4-complex" version = @version p1 = @p1 p2 = @p2 p3 = #pixel op1 = @op1 op2 = @op2 op3 = @op3 op4 = @op4 op5 = @op5 op6 = @op6 op7 = @op7 op8 = @op8 op9 = @op9 op10 = @op10 op11 = @op11 op12 = @op12 op13 = @op13 op14 = @op14 op15 = @op15 op16 = @op16 op17 = @op17 op18 = @op18 op19 = @op19 fn1 = @fn1 fn2 = @fn2 fn3 = @fn3 fn4 = @fn4 bailout = @bailout } gnd-formula-4-complex { ; Gilles Nadeau, April, 2004 ; Based on my modifications to the "formula" ; Original formula by Giuseppe Zito ; init: z = #pixel complex x = (0.0, 0.0) complex y = (0.0, 0.0) complex s0 = (0.0, 0.0) complex s1 = (0.0, 0.0) complex sx = (0.0, 0.0) complex sy = (0.0, 0.0) float cr = real(@p1) float ci = imag(@p1) float dr = real(@p2) float di = imag(@p2) float er = real(@p3) float ei = imag(@p3) loop: x = real(@fn1(z)) y = imag(@fn2(z)) x = @fn3(x) y = @fn4(y) s0 = y if (@op1 == 0) s0 = s0 /cr elseif (@op1 == 1) s0 = s0 *cr elseif (@op1 == 2) s0 = s0 +cr elseif (@op1 == 3) s0 = s0 -cr endif if (@op2 == 0) s0 = s0 *y elseif (@op2 == 1) s0 = s0 /y elseif (@op2 == 2) s0 = s0 +y elseif (@op2 == 3) s0 = s0 -y endif if (@op3 == 0) s0 = s0 *y elseif (@op3 == 1) s0 = s0 /y elseif (@op3 == 2) s0 = s0 +y elseif (@op3 == 3) s0 = s0 -y endif if (@op4 == 0) s0 = s0 -y elseif (@op4 == 1) s0 = s0 +y elseif (@op4 == 2) s0 = s0 /y elseif (@op4 == 3) s0 = s0 *y endif if (@op5 == 0) s0 = s0 *ci elseif (@op5 == 1) s0 = s0 /ci elseif (@op5 == 2) s0 = s0 +ci elseif (@op5 == 3) s0 = s0 -ci endif sx = s0 s0 = y if (@op6 == 0) s0 = s0 /dr elseif (@op6 == 1) s0 = s0 *dr elseif (@op6 == 2) s0 = s0 +dr elseif (@op6 == 3) s0 = s0 -dr endif if (@op7 == 0) s0 = s0 +y elseif (@op7 == 1) s0 = s0 -y elseif (@op7 == 2) s0 = s0 /y elseif (@op7 == 3) s0 = s0 *y endif if (@op8 == 0) s0 = s0 *y elseif (@op8 == 1) s0 = s0 /y elseif (@op8 == 2) s0 = s0 +y elseif (@op8 == 3) s0 = s0 -y endif if (@op9 == 0) s0 = s0 -di elseif (@op9 == 1) s0 = s0 +di elseif (@op9 == 2) s0 = s0 /di elseif (@op9 == 3) s0 = s0 *di endif if (@op10 == 0) s0 = s0 -y elseif (@op10 == 1) s0 = s0 +y elseif (@op10 == 2) s0 = s0 /y elseif (@op10 == 3) s0 = s0 *y endif if (@op11 == 0) s0 = s0 +y elseif (@op11 == 1) s0 = s0 -y elseif (@op11 == 2) s0 = s0 /y elseif (@op11 == 3) s0 = s0 *y endif s1 = er if (@op12 == 0) s1 = s1 *x elseif (@op12 == 1) s1 = s1 /x elseif (@op12 == 2) s1 = s1 +x elseif (@op12 == 3) s1 = s1 -x endif if (@op13 == 0) s1 = s1 /x elseif (@op13 == 1) s1 = s1 *x elseif (@op13 == 2) s1 = s1 +x elseif (@op13 == 3) s1 = s1 -x endif if (@op14 == 0) s1 = s1 -ei elseif (@op14 == 1) s1 = s1 +ei elseif (@op14 == 2) s1 = s1 /ei elseif (@op14 == 3) s1 = s1 *ei endif if (@op15 == 0) s0 = s0 *s1 elseif (@op15 == 1) s0 = s0 /s1 elseif (@op15 == 2) s0 = s0 +s1 elseif (@op15 == 3) s0 = s0 -s1 endif if (@op16 == 0) s0 = s0 /x elseif (@op16 == 1) s0 = s0 *x elseif (@op16 == 2) s0 = s0 +x elseif (@op16 == 3) s0 = s0 -x endif if (@op17 == 0) s0 = s0 -y elseif (@op17 == 1) s0 = s0 +y elseif (@op17 == 2) s0 = s0 /y elseif (@op17 == 3) s0 = s0 *y endif if (@op18 == 0) s0 = s0 +x elseif (@op18 == 1) s0 = s0 -x elseif (@op18 == 2) s0 = s0 /x elseif (@op18 == 3) s0 = s0 *x endif if (@op19 == 0) s0 = s0 +y elseif (@op19 == 1) s0 = s0 -y elseif (@op19 == 2) s0 = s0 /y elseif (@op19 == 3) s0 = s0 *y endif sy = s0 z = sx + flip(sy) bailout: |sx| < @bailout && |sx| > -@bailout && |sy| < @bailout && |sy| > -@bailout default: title = "Formula 4 Complex" maxiter = 149 method = multipass periodicity = 0 float param version default = 0.0 visible = false endparam param p1 caption = "Parameter 1" default = (0.68162298, 0.96401101) endparam param p2 caption = "Parameter 2" default = (-0.95945197, -0.458745) endparam param p3 caption = "Parameter 3" default = (-0.425805, -0.36000001) endparam param op1 caption = "Operator 1 (cr)" enum = "/" "*" "+" "-" endparam param op2 caption = "Operator 2 (y)" enum = "*" "/" "+" "-" endparam param op3 caption = "Operator 3 (y)" enum = "*" "/" "+" "-" endparam param op4 caption = "Operator 4 (y)" enum = "-" "+" "/" "*" endparam param op5 caption = "Operator 5 (ci)" enum = "*" "/" "+" "-" endparam param op6 caption = "Operator 6 (dr)" enum = "/" "*" "+" "-" endparam param op7 caption = "Operator 7 (y)" enum = "+" "-" "/" "*" endparam param op8 caption = "Operator 8 (y)" enum = "*" "/" "+" "-" endparam param op9 caption = "Operator 9 (di)" enum = "-" "+" "/" "*" endparam param op10 caption = "Operator 10 (y)" enum = "-" "+" "/" "*" endparam param op11 caption = "Operator 11 (y)" enum = "+" "-" "/" "*" endparam param op12 caption = "Operator 12 (x)" enum = "*" "/" "+" "-" endparam param op13 caption = "Operator 13 (x)" enum = "/" "*" "+" "-" endparam param op14 caption = "Operator 14 (ei)" enum = "-" "+" "/" "*" endparam param op15 caption = "Operator 15 (s1)" enum = "*" "/" "+" "-" endparam param op16 caption = "Operator 16 (x)" enum = "/" "*" "+" "-" endparam param op17 caption = "Operator 17 (y)" enum = "-" "+" "/" "*" endparam param op18 caption = "Operator 18 (x)" enum = "+" "-" "/" "*" endparam param op19 caption = "Operator 19 (y)" enum = "+" "-" "/" "*" endparam func fn1 caption = "Function 1" default = ident() endfunc func fn2 caption = "Function 2" default = ident() endfunc func fn3 caption = "Function 3" default = ident() endfunc func fn4 caption = "Function 4" default = ident() endfunc param bailout caption = "Bailout value" default = 4.0 min = 1 endparam switch: type = "gnd-formula-1-complex" version = @version p1 = @p1 p2 = @p2 p3 = @p3 op1 = @op1 op2 = @op2 op3 = @op3 op4 = @op4 op5 = @op5 op6 = @op6 op7 = @op7 op8 = @op8 op9 = @op9 op10 = @op10 op11 = @op11 op12 = @op12 op13 = @op13 op14 = @op14 op15 = @op15 op16 = @op16 op17 = @op17 op18 = @op18 op19 = @op19 fn1 = @fn1 fn2 = @fn2 fn3 = @fn3 fn4 = @fn4 bailout = @bailout } gnd+as+sdc-dissected-MandJul { ; Gilles Nadeau, Andrea Spinozzi and Susan Chambless, April, 2004 ; modified and revised by Susan Chambless, April, 2004 Init: z = #pixel ; default to Mandelbrot float x = real(@start) float y = imag(@start) float cr = real(@fn3(z)) float ci = imag(@fn4(z)) if ( @mode == "Julia" ) float x = real(@fn3(z)) float y = imag(@fn4(z)) float cr = real(@seed) float ci = imag(@seed) endif float sr = real(@p1) float si = imag(@p1) Loop: float tx = 0.0 float ty = 0.0 float test = 0.0 if (@method == "1") tx = sqr(x^sr) - sqr(y^si) ty = 2*x*y x = tx + cr y = ty + ci elseif (@method == "2") if (@op1 == 0) tx = x*x - y*y ty = 2*x*y elseif (@op1 == 1) tx = x*x + y*y ty = 2*x*y endif x = tx + cr y = ty^si + ci elseif (@method == "3") if (@op1 == 0) tx = x*x - y*y ty = 2*x*y elseif (@op1 == 1) tx = x*x + y*y ty = 2*x*y endif x = tx^sr + cr y = ty^si + ci elseif (@method == "4") if (@op1 == 0) tx = x*x - y*y ty = 2*x*y elseif (@op1 == 1) tx = x*x + y*y ty = 2*x*y endif x = tx^sr + cr y = ty + ci endif z = @fn1(x) + flip(@fn2(y)) ; convert to complex w/ functions x = real(z) ; convert back to re & im y = imag(z) if (@bailoutMode == 0) ; |x| + |y| test = |x| + |y| elseif (@bailoutMode == 1) ; |z| test = |z| elseif (@bailoutMode == 2) ; |x| test = |x| elseif (@bailoutMode == 3) ; |y| test = |y| elseif (@bailoutMode == 4) ; |fcn(z)| test = |@bailoutFn(z)| else ; should never happen but we test = |z| ; don't want an infinite loop endif Bailout: test < @bailout Default: title = "Dissected Mandelbrot" maxiter = 100 method = multipass periodicity = 0 float param version default = 0.0 visible = false endparam param mode caption = "Current Mode" default = 0 enum = "Mandelbrot" "Julia" visible = false endparam param switchMode caption = "Switch Mode" default = 1 enum = "Mandelbrot" "Julia" visible = false endparam heading caption = "Mandelbrot Mode" visible = @mode==0 endheading heading caption = "Julia Mode" visible = @mode==1 endheading complex param seed caption = "Julia seed" default = ( 0.26, 0.0 ) visible = @mode==1 endparam complex param start caption = "Initial Z Value" default = ( 0.0, 0.0 ) visible = @mode==0 endparam param method caption = "Method" enum = "1" "2" "3" "4" endparam param op1 caption = "Operator" enum = "-" "+" visible = @method != 0 endparam param p1 caption = "Power" default = (1.0, 1.0) endparam float param bailout caption = "Bailout value" default = 4.0 min = 1 endparam param bailoutMode caption = "Bailout Mode" enum = "|x|+|y|" "|z|" "|x|" "|y|" "|fcn(z)|" endparam func bailoutFn caption = "Bailout Function" default = sqr() visible = @bailoutMode == 4 endfunc func fn3 caption = "Initial Real Function" default = ident() endfunc func fn4 caption = "Initial Imag Function" default = ident() endfunc func fn1 caption = "Real Loop Function" default = ident() endfunc func fn2 caption = "Imag Loop Function" default = ident() endfunc Switch: type = "gnd+as+sdc-dissected-MandJul" version = @version seed = #pixel start = @start method= @method op1 = @op1 p1 = @p1 fn1 = @fn1 fn2 = @fn2 fn3 = @fn3 fn4 = @fn4 bailoutMode = @bailoutMode bailoutFn = @bailoutFn mode = @switchmode switchMode = mode bailout = @bailout } gnd+as+sdc-dissected-cpx { ; Gilles Nadeau, Andrea Spinozzi and Susan Chambless, May, 2004 ; init: complex z = (0.0,0.0) complex c = (0.0, 0.0) complex zx = (0.0,0.0) complex wy = (0.0,0.0) complex czx = (0.0,0.0) complex cwy = (0.0,0.0) complex qzx = (0.0,0.0) complex qwy = (0.0,0.0) complex pzr = (0.0,0.0) complex pwi = (0.0,0.0) complex tzx = (0.0,0.0) complex twy = (0.0,0.0) if (@mode == "Mandelbrot") ; hold the initial Z constant for all points, ; vary the constant C across the complex plane z = (0.0, 0.0) zx = real(z) wy = imag(z) c = #pixel if (@var == 0) czx = real(c) cwy = imag(c) elseif (@var == 1) czx = flip(real(c)) cwy = flip(imag(c)) elseif (@var == 2) czx = real(c) cwy = flip(imag(c)) elseif (@var == 3) czx = flip(real(c)) cwy = imag(c) endif elseif (@mode == "Julia") ; vary the initial Z across the complex plane ; hold C constant for all points z = #pixel c = @seed czx = real(c) cwy = imag(c) if (@var == 0) zx = real(z) wy = imag(z) elseif (@var == 1) zx = flip(real(z)) wy = flip(imag(z)) elseif (@var == 2) zx = real(z) wy = flip(imag(z)) elseif (@var == 3) zx = flip(real(z)) wy = imag(z) endif endif pzr = real(@p1) pwi = imag(@p1) qzx = sqr(zx)^pzr qwy = sqr(wy)^pwi loop: if (@selectloop == 0) tzx = @fn1(qzx) - @fn2(qwy) + @fn3(czx) twy = (2*zx*wy) + @fn4(cwy) elseif (@selectloop == 1) tzx = @fn1(qzx) + @fn2(qwy) + @fn3(czx) twy = (2*zx*wy) + @fn4(cwy) endif zx = @fn5(tzx) wy = @fn6(twy) qzx = sqr(zx)^pzr qwy = sqr(wy)^pwi zx = @fn7(zx) wy = @fn8(wy) if (@flavor == 0) z = zx + flip(wy) elseif (@flavor == 1) z = zx + wy endif bailout: |zx| + |wy| < @bailout default: title = "Dissected Mandelbrot Complex" magn = 1.0 angle = 0 method = multipass periodicity = 0 maxiter = 500 float param version default = 0.0 visible = false endparam Heading caption = "Mandelbrot Mode" visible = (@mode == 0) Endheading Heading caption = "Julia Mode" visible = (@mode == 1) Endheading param mode caption = "Mode" enum = "Mandelbrot" "Julia" default = 0 visible = false endparam param switchmode caption = "Switch Mode" enum = "Mandelbrot" "Julia" default = 1 visible = false endparam param selectloop caption = "Select Formula" enum = "1st. Formula""2nd. Formula" default = 0 endparam param var caption = "Variations" enum = "1""2""3""4" default = 0 endparam param seed caption = "Seed Value" default = (0.0,0.0) visible = (@mode == 1) endparam param p1 caption = "Parameter" default = (1.0,1.0) endparam param flavor caption = "Combine flavor" enum = "1:(z=zx+flip(wy))" "2:(z=zx+wy)" endparam param bailout caption = "Bailout Value" default = 64.0 min = 1.0 endparam Heading caption = "Functions" Endheading func fn1 caption = "Function 1" default = ident() endfunc func fn2 caption = "Function 2" default = ident() endfunc func fn3 caption = "Function 3" default = ident() endfunc func fn4 caption = "Function 4" default = ident() endfunc func fn5 caption = "Function 5" default = ident() endfunc func fn6 caption = "Function 6" default = ident() endfunc func fn7 caption = "Function 7" default = ident() endfunc func fn8 caption = "Function 8" default = ident() endfunc switch: type = "gnd+as+sdc-dissected-cpx" version = @version seed = #pixel p1 = @p1 flavor = @flavor bailout = @bailout fn1 = @fn1 fn2 = @fn2 fn3 = @fn3 fn4 = @fn4 fn5 = @fn5 fn6 = @fn6 fn7 = @fn7 fn8 = @fn8 var = @var selectloop = @selectloop mode = @switchmode switchmode = @mode } gnd+as+sdc-quat-cpx { ; Gilles Nadeau, Andrea Spinozzi and Susan Chambless, May, 2004 ; init: complex z = (0.0,0.0) complex c = (0.0, 0.0) complex zx = (0.0,0.0) complex wy = (0.0,0.0) complex cz = (0.0,0.0) complex cw = (0.0,0.0) complex qzx = (0.0,0.0) complex qwy = (0.0,0.0) complex pzr = (0.0,0.0) complex pwi = (0.0,0.0) complex tzx = (0.0,0.0) complex twy = (0.0,0.0) if (@mode == "Mandelbrot") ; hold the initial z constant for all points, ; vary the constant across the complex plane z = (0.0, 0.0) zx = real(z) wy = imag(z) c = #pixel if (@var == 0) cz = real(c) cw = imag(c) elseif (@var == 1) cz = flip(real(c)) cw = flip(imag(c)) elseif (@var == 2) cz = real(c) cw = flip(imag(c)) elseif (@var == 3) cz = flip(real(c)) cw = imag(c) endif elseif (@mode == "Julia") ; vary the initial z across the complex plane, ; hold c constant for all points z = #pixel cz = @seed1 cw = @seed2 if (@var == 0) zx = real(z) wy = imag(z) elseif (@var == 1) zx = flip(real(z)) wy = flip(imag(z)) elseif (@var == 2) zx = real(z) wy = flip(imag(z)) elseif (@var == 3) zx = flip(real(z)) wy = imag(z) endif endif pzr = real(@p1) pwi = imag(@p1) qzx = sqr(zx)^pzr qwy = sqr(wy)^pwi loop: if (@selectloop == 0) tzx = @fn1(qzx) - @fn2(qwy) + @fn3(cz) twy = (2*zx*wy) + @fn4(cw) elseif (@selectloop == 1) tzx = @fn1(qzx) + @fn2(qwy) + @fn3(cz) twy = (2*zx*wy) + @fn4(cw) endif zx = @fn5(tzx) wy = @fn6(twy) qzx = sqr(zx)^pzr qwy = sqr(wy)^pwi zx = @fn7(zx) wy = @fn8(wy) if (@flavor == 0) z = zx + flip(wy) elseif (@flavor == 1) z = zx + wy endif bailout: |zx| + |wy| < @bailout default: title = "Quat Mandelbrot Complex" magn = 1.0 angle = 0 method = multipass periodicity = 0 maxiter = 500 float param version default = 0.0 visible = false endparam Heading caption = "Mandelbrot Mode" visible = (@mode == 0) Endheading Heading caption = "Julia Mode" visible = (@mode == 1) Endheading param mode caption = "Mode" enum = "Mandelbrot" "Julia" default = 0 visible = false endparam param switchmode caption = "Switch Mode" enum = "Mandelbrot" "Julia" default = 1 visible = false endparam param selectloop caption = "Select Formula" enum = "1st. Formula""2nd. Formula" default = 0 endparam param var caption = "Variations" enum = "1""2""3""4" default = 0 endparam param seed1 caption = "Seed 1" default = (0.0,0.0) visible = (@mode == "Julia") endparam param seed2 caption = "Seed 2" default = (0.0,0.0) visible = (@mode == "Julia") endparam param p1 caption = "Parameter" default = (1.0,1.0) endparam param flavor caption = "Combine flavor" enum = "1:(z=zx+flip(wy))" "2:(z=zx+wy)" endparam param bailout caption = "Bailout Value" default = 64.0 min = 1.0 endparam Heading caption = "Functions" Endheading func fn1 caption = "Function 1" default = ident() endfunc func fn2 caption = "Function 2" default = ident() endfunc func fn3 caption = "Function 3" default = ident() endfunc func fn4 caption = "Function 4" default = ident() endfunc func fn5 caption = "Function 5" default = ident() endfunc func fn6 caption = "Function 6" default = ident() endfunc func fn7 caption = "Function 7" default = ident() endfunc func fn8 caption = "Function 8" default = ident() endfunc switch: type = "gnd+as+sdc-quat-cpx" version = @version seed1 = #pixel p1 = @p1 flavor = @flavor bailout = @bailout fn1 = @fn1 fn2 = @fn2 fn3 = @fn3 fn4 = @fn4 fn5 = @fn5 fn6 = @fn6 fn7 = @fn7 fn8 = @fn8 var = @var selectloop = @selectloop mode = @switchmode switchmode = @mode } gnd-Triternion_Jul { ; based on the formula by Russell Walsmith ; Gilles Nadeau, May, 2004 ; init: complex z1 = (0.0, 0.0) complex z2 = (0.0, 0.0) complex z3 = @zjk complex c1 = (0.0, 0.0) complex c2 = (0.0, 0.0) complex c3 = @cjk if (@var == 0) z1 = real(#pixel) z2 = imag(#pixel) c1 = real(@c1i) c2 = imag(@c1i) elseif (@var == 1) z1 = flip(real(#pixel)) z2 = flip(imag(#pixel)) c1 = flip(real(@c1i)) c2 = flip(imag(@c1i)) elseif (@var == 2) z1 = real(#pixel) z2 = flip(imag(#pixel)) c1 = real(@c1i) c2 = flip(imag(@c1i)) elseif (@var == 3) z1 = flip(real(#pixel)) z2 = imag(#pixel) c1 = flip(real(@c1i)) c2 = imag(@c1i) endif loop: t1 = z1*z1 + z2*z3 + z3*z2 t2 = z1*z2 + z2*z1 + z3*z3 t3 = z1*z3 + z2*z2 + z3*z1 z1 = @fn1(t1) + c1 z2 = @fn2(t2) + c2 z3 = @fn3(t3) + c3 if (@flavor == 0) z = z1 + flip(z2) elseif (@flavor == 1) z = z1 + z2 endif bailout: |z1| + |z2| + |z3| < @bailout default: title = "Triternion Julia" method = multipass periodicity = 0 maxiter = 500 float param version default = 0.0 visible = false endparam param var caption = "Variation" enum = "1""2""3""4" endparam param c1i caption = "(c1, ci)" default = (-0.686, 0.175) endparam param cjk caption = "(cj, ck)" default = (0.0, 0.0) endparam param zjk caption = "(zj, zk)" default = (0.0, 0.0) endparam Heading caption = "Functions" Endheading func fn1 caption = "Function 1" default = ident() endfunc func fn2 caption = "Function 2" default = ident() endfunc func fn3 caption = "Function 3" default = ident() endfunc param flavor caption = "Combine flavor" enum = "1:(z=z1+flip(z2))" "2:(z=z1+z2)" endparam param bailout caption = "Bailout value" default = 64.0 endparam switch: type = "gnd-Triternion_Man" version = @version fn1 = @fn1 fn2 = @fn2 fn3 = @fn3 var = @var flavor = @flavor bailout = @bailout } gnd-Triternion_Man { ; Original formula MrT by Russell Walsmith ; Gilles Nadeau, May, 2004 ; init: complex z1 = (0.0, 0.0) complex z2 = (0.0, 0.0) complex z3 = (0.0, 0.0) complex c1 = (0.0, 0.0) complex c2 = (0.0, 0.0) complex c3 = @cjk if (@var == 0) c1 = real(#pixel) c2 = imag(#pixel) elseif (@var == 1) c1 = flip(real(#pixel)) c2 = flip(imag(#pixel)) elseif (@var == 2) c1 = real(#pixel) c2 = flip(imag(#pixel)) elseif (@var == 3) c1 = flip(real(#pixel)) c2 = imag(#pixel) endif loop: t1 = z1*z1 + z2*z3 + z3*z2 t2 = z1*z2 + z2*z1 + z3*z3 t3 = z1*z3 + z2*z2 + z3*z1 z1 = @fn1(t1) + c1 z2 = @fn2(t2) + c2 z3 = @fn3(t3) + c3 if (@flavor == 0) z = z1 + flip(z2) elseif (@flavor == 1) z = z1 + z2 endif bailout: |z1| + |z2| + |z3| < @bailout default: title = "Triternion Mandelbrot" method = multipass periodicity = 0 maxiter = 500 float param version default = 0.0 visible = false endparam param var caption = "Variation" enum = "1""2""3""4" endparam param cjk caption = "(cj, ck)" default = (0.0, 0.0) endparam Heading caption = "Functions" Endheading func fn1 caption = "Function 1" default = ident() endfunc func fn2 caption = "Function 2" default = ident() endfunc func fn3 caption = "Function 3" default = ident() endfunc param flavor caption = "Combine flavor" enum = "1:(z=z1+flip(z2))" "2:(z=z1+z2)" endparam param bailout caption = "Bailout value" default = 64.0 endparam switch: type = "gnd-Triternion_Jul" version = @version c1i = #pixel cjk = @cjk fn1 = @fn1 fn2 = @fn2 fn3 = @fn3 var = @var flavor = @flavor bailout = @bailout } gnd-T_Sisters_J { ; based on the formula by Jos Hendriks ; Gilles Nadeau, May, 2004 ; init: complex s1 = @p1 complex s2 = @p2 complex z1 = (0.0, 0.0) complex z2 = (0.0, 0.0) complex c1 = (0.0, 0.0) complex c2 = (0.0, 0.0) if (@var == 0) z1 = real(#pixel) z2 = imag(#pixel)*s1 c1 = real(@seed) c2 = imag(@seed)*s1 elseif (@var == 1) z1 = flip(real(#pixel)) z2 = flip(imag(#pixel)*s1) c1 = flip(real(@seed)) c2 = flip(imag(@seed)*s1) elseif (@var == 2) z1 = real(#pixel) z2 = flip(imag(#pixel)*s1) c1 = real(@seed) c2 = flip(imag(@seed)*s1) elseif (@var == 3) z1 = flip(real(#pixel)) z2 = imag(#pixel)*s1 c1 = flip(real(@seed)) c2 = imag(@seed)*s1 endif loop: t1 = z1*z1 + real(s2)*z2 t2 = z2*z2 + imag(s2)*z1 z1 = @fn1(t1) + c1 z2 = @fn2(t2) + c2 if (@flavor == 0) z = z1 + flip(z2) elseif (@flavor == 1) z = z1 + z2 endif bailout: |z1| + |z2| <= @bailout default: title = "T Sisters J" method = multipass periodicity = 0 maxiter = 500 float param version default = 0.0 visible = false endparam param var caption = "Variation" enum = "1""2""3""4" endparam param seed caption = "Julia seed" default = (0.0, 0.0) endparam param p1 caption = "Parameter 1" default = (0.0, 1.0) endparam param p2 caption = "Parameter 2" default = (0.0, 0.0) endparam Heading caption = "Functions" Endheading func fn1 caption = "Function 1" default = ident() endfunc func fn2 caption = "Function 2" default = ident() endfunc param flavor caption = "Combine flavor" enum = "1:(z=z1+flip(z2))" "2:(z=z1+z2)" endparam param bailout caption = "Bailout value" default = 64.0 endparam switch: type = "gnd-T_Sisters_M" version = @version p1 = @p1 p2 = @p2 fn1 = @fn1 fn2 = @fn2 var = @var flavor = @flavor bailout = @bailout } gnd-T_Sisters_M { ; Original formula by Jos Hendriks ; Gilles Nadeau, May, 2004 ; init: complex s1 = @p1 complex s2 = @p2 complex z1 = (0.0, 0.0) complex z2 = (0.0, 0.0) complex c1 = (0.0, 0.0) complex c2 = (0.0, 0.0) if (@var == 0) c1 = real(#pixel) c2 = imag(#pixel)*s1 elseif (@var == 1) c1 = flip(real(#pixel)) c2 = flip(imag(#pixel)*s1) elseif (@var == 2) c1 = real(#pixel) c2 = flip(imag(#pixel)*s1) elseif (@var == 3) c1 = flip(real(#pixel)) c2 = imag(#pixel)*s1 endif loop: t1 = z1*z1 + real(s2)*z2 t2 = z2*z2 + imag(s2)*z1 z1 = @fn1(t1) + c1 z2 = @fn2(t2) + c2 if (@flavor == 0) z = z1 + flip(z2) elseif (@flavor == 1) z = z1 + z2 endif bailout: |z1| + |z2| <= @bailout default: title = "T Sisters M" method = multipass periodicity = 0 maxiter = 500 float param version default = 0.0 visible = false endparam param var caption = "Variation" enum = "1""2""3""4" endparam param p1 caption = "Parameter 1" default = (0.0, 1.0) endparam param p2 caption = "Parameter 2" default = (0.0, 0.0) endparam Heading caption = "Functions" Endheading func fn1 caption = "Function 1" default = ident() endfunc func fn2 caption = "Function 2" default = ident() endfunc param flavor caption = "Combine flavor" enum = "1:(z=z1+flip(z2))" "2:(z=z1+z2)" endparam param bailout caption = "Bailout value" default = 64.0 endparam switch: type = "gnd-T_Sisters_J" version = @version seed = #pixel p1 = @p1 p2 = @p2 fn1 = @fn1 fn2 = @fn2 var = @var flavor = @flavor bailout = @bailout } gnd-gaussian_distj2 { ; based on the formula by Jos Hendriks ; Gilles Nadeau, May, 2004 ; init: complex sigma = @p2 complex mu = @p1 complex z = #pixel complex c = 1 /(sqr(2*pi)*sigma),scalingfactor=50 complex c1 = scalingfactor*@seed loop: z = c*@fn1(-.5*((z-mu)/sigma)^2)*c1 bailout: |z| <= @bailout default: title = "Gaussian distJ2" method = multipass periodicity = 0 maxiter = 500 magn = 1.0 float param version default = 0.0 visible = false endparam param seed caption = "Julia seed" default = (-1.28, 0.33) endparam param p1 caption = "Parameter 1" default = (0.0, 0.0) endparam param p2 caption = "Parameter 2" default = (1.0, 0.0) endparam func fn1 caption = "Function" default = exp() endfunc param bailout caption = "Bailout value" default = 100.0 endparam switch: type = "gnd-gaussian_distm2" version = @version p1 = @p1 p2 = @p2 fn1 = @fn1 bailout = @bailout } gnd-gaussian_distm2 { ; Original formula by Jos Hendriks ; Gilles Nadeau, May, 2004 ; init: complex sigma = @p2 complex mu = @p1 complex z = (0.0, 0.0) complex c = 1 /(sqr(2*pi)*sigma),scalingfactor=50 complex c1 = scalingfactor*#pixel loop: z = c*@fn1(-.5*((z-mu)/sigma)^2)*c1 bailout: |z| <= @bailout default: title = "Gaussian distM2" method = multipass periodicity = 0 maxiter = 500 magn = 1.0 float param version default = 0.0 visible = false endparam param p1 caption = "Parameter 1" default = (0.0, 0.0) endparam param p2 caption = "Parameter 2" default = (1.0, 0.0) endparam func fn1 caption = "Function" default = exp() endfunc param bailout caption = "Bailout value" default = 100.0 endparam switch: type = "gnd-gaussian_distj2" version = @version seed = #pixel p1 = @p1 p2 = @p2 fn1 = @fn1 bailout = @bailout } gnd-TGirl_Jul { ; based on the formula by Russell Walsmith ; Gilles Nadeau, May, 2004 ; init: complex z1 = (0.0, 0.0) complex z2 = (0.0, 0.0) complex z3 = @zjk complex c1 = (0.0, 0.0) complex c2 = (0.0, 0.0) complex c3 = @cjk if (@var == 0) z1 = real(#pixel) z2 = imag(#pixel)*@p1 c1 = real(@c1i) c2 = imag(@c1i)*@p1 elseif (@var == 1) z1 = flip(real(#pixel)) z2 = flip(imag(#pixel)*@p1) c1 = flip(real(@c1i)) c2 = flip(imag(@c1i)*@p1) elseif (@var == 2) z1 = real(#pixel) z2 = flip(imag(#pixel)*@p1) c1 = real(@c1i) c2 = flip(imag(@c1i)*@p1) elseif (@var == 3) z1 = flip(real(#pixel)) z2 = imag(#pixel)*@p1 c1 = flip(real(@c1i)) c2 = imag(@c1i)*@p1 endif loop: t1 = z1*z1 + 2*z2*z3 t2 = z3*z3 + 2*z1*z2 t3 = z2*z2 + 2*z3*z1 z1 = @fn1(t1) + c1 z2 = @fn2(t2) + c2 z3 = @fn3(t3) + c3 if (@flavor == 0) z = z1 + z2 elseif (@flavor == 1) z = z1 + flip(z2) endif bailout: |z1| + |z2| + |z3| < @bailout default: title = "T Girl Julia" method = multipass periodicity = 0 maxiter = 500 float param version default = 0.0 visible = false endparam param var caption = "Variation" enum = "1""2""3""4" endparam param c1i caption = "(c1, ci)" default = (-0.495, 0.375) endparam param cjk caption = "(cj, ck)" default = (0.0, 0.0) endparam param zjk caption = "(zj, zk)" default = (0.0, 0.0) endparam param p1 caption = "Plane rotation" default = (0.0, -1.0) endparam Heading caption = "Functions" Endheading func fn1 caption = "Function 1" default = ident() endfunc func fn2 caption = "Function 2" default = ident() endfunc func fn3 caption = "Function 3" default = ident() endfunc param flavor caption = "Combine flavor" enum = "1:(z=z1+z2)" "2:(z=z1+flip(z2))" endparam param bailout caption = "Bailout value" default = 64.0 endparam switch: type = "gnd-TGirl_Man" version = @version p1 = @p1 fn1 = @fn1 fn2 = @fn2 fn3 = @fn3 var = @var flavor = @flavor bailout = @bailout } gnd-TGirl_Man { ; Original formula by Russell Walsmith ; Gilles Nadeau, May, 2004 ; init: complex z1 = (0.0, 0.0) complex z2 = (0.0, 0.0) complex z3 = (0.0, 0.0) complex c1 = (0.0, 0.0) complex c2 = (0.0, 0.0) complex c3 = @cjk if (@var == 0) c1 = real(#pixel) c2 = imag(#pixel)*@p1 elseif (@var == 1) c1 = flip(real(#pixel)) c2 = flip(imag(#pixel)*@p1) elseif (@var == 2) c1 = real(#pixel) c2 = flip(imag(#pixel)*@p1) elseif (@var == 3) c1 = flip(real(#pixel)) c2 = imag(#pixel)*@p1 endif loop: t1 = z1*z1 + 2*z2*z3 t2 = z3*z3 + 2*z1*z2 t3 = z2*z2 + 2*z3*z1 z1 = @fn1(t1) + c1 z2 = @fn2(t2) + c2 z3 = @fn3(t3) + c3 if (@flavor == 0) z = z1 + z2 elseif (@flavor == 1) z = z1 + flip(z2) endif bailout: |z1| + |z2| + |z3| < @bailout default: title = "T Girl Mandelbrot" method = multipass periodicity = 0 maxiter = 500 float param version default = 0.0 visible = false endparam param var caption = "Variation" enum = "1""2""3""4" endparam param cjk caption = "(cj, ck)" default = (0.0, 0.0) endparam param p1 caption = "Plane rotation" default = (0.0, -1.0) endparam Heading caption = "Functions" Endheading func fn1 caption = "Function 1" default = ident() endfunc func fn2 caption = "Function 2" default = ident() endfunc func fn3 caption = "Function 3" default = ident() endfunc param flavor caption = "Combine flavor" enum = "1:(z=z1+z2)" "2:(z=z1+flip(z2))" endparam param bailout caption = "Bailout value" default = 64.0 endparam switch: type = "gnd-TGirl_Jul" version = @version c1i = #pixel cjk = @cjk p1 = @p1 fn1 = @fn1 fn2 = @fn2 fn3 = @fn3 var = @var flavor = @flavor bailout = @bailout } gnd-super-cubic_Jul { ; Triternion Julia Set ; based on the formula by Russell Walsmith ; Gilles Nadeau, May, 2004 ; init: complex z1 = (0.0, 0.0) complex z2 = (0.0, 0.0) complex z3 = @p3 complex c1 = (0.0, 0.0) complex c2 = (0.0, 0.0) complex c3 = @p1 if (@var == 0) z1 = real(#pixel) z2 = imag(#pixel)*@p2 c1 = real(@seed) c2 = imag(@seed)*@p2 elseif (@var == 1) z1 = flip(real(#pixel)) z2 = flip(imag(#pixel)*@p2) c1 = flip(real(@seed)) c2 = flip(imag(@seed)*@p2) elseif (@var == 2) z1 = real(#pixel) z2 = flip(imag(#pixel)*@p2) c1 = real(@seed) c2 = flip(imag(@seed)*@p2) elseif (@var == 3) z1 = flip(real(#pixel)) z2 = imag(#pixel)*@p2 c1 = flip(real(@seed)) c2 = imag(@seed)*@p2 endif loop: t1 = z1^3 + 3*z2^2*z1 + 3*z3^2*z1 + 2*z1*z2*z3 t2 = z2^3 + 3*z1^2*z2 + 3*z3^2*z2 + 2*z1*z2*z3 t3 = z3^3 + 3*z1^2*z3 + 3*z2^2*z3 + 2*z1*z2*z3 z1 = @fn1(t1) + c1 z2 = @fn2(t2) + c2 z3 = @fn3(t3) + c3 if (@flavor == 0) z = z1 + z2 elseif (@flavor == 1) z = z1 + flip(z2) endif bailout: |z1| + |z2| + |z3| < @bailout default: title = "Super Cubic Julia" method = multipass periodicity = 0 maxiter = 500 float param version default = 0.0 visible = false endparam param var caption = "Variation" enum = "1""2""3""4" endparam param seed caption = "(c1, ci)" default = (0.475, -0.583) endparam param p1 caption = "(cj, ck)" default = (0.0, 0.0) endparam param p3 caption = "(zj, zk)" default = (0.0, 0.0) endparam param p2 caption = "Plane rotation" default = (0.0, 1.0) endparam Heading caption = "Functions" Endheading func fn1 caption = "Function 1" default = ident() endfunc func fn2 caption = "Function 2" default = ident() endfunc func fn3 caption = "Function 3" default = ident() endfunc param flavor caption = "Combine flavor" enum = "1:(z=z1+z2)" "2:(z=z1+flip(z2))" endparam param bailout caption = "Bailout value" default = 64.0 endparam switch: type = "gnd-super-cubic_Man" version = @version p1 = @p1 p2 = @p2 fn1 = @fn1 fn2 = @fn2 fn3 = @fn3 var = @var flavor = @flavor bailout = @bailout } gnd-super-cubic_Man { ; Triternion Mandelbrot Set ; Original formula Ptest2 by Russell Walsmith ; Gilles Nadeau, May, 2004 ; init: complex z1 = (0.0, 0.0) complex z2 = (0.0, 0.0) complex z3 = (0.0, 0.0) complex c1 = (0.0, 0.0) complex c2 = (0.0, 0.0) complex c3 = @p1 if (@var == 0) c1 = real(#pixel) c2 = imag(#pixel)*@p2 elseif (@var == 1) c1 = flip(real(#pixel)) c2 = flip(imag(#pixel)*@p2) elseif (@var == 2) c1 = real(#pixel) c2 = flip(imag(#pixel)*@p2) elseif (@var == 3) c1 = flip(real(#pixel)) c2 = imag(#pixel)*@p2 endif loop: t1 = z1^3 + 3*z2^2*z1 + 3*z3^2*z1 + 2*z1*z2*z3 t2 = z2^3 + 3*z1^2*z2 + 3*z3^2*z2 + 2*z1*z2*z3 t3 = z3^3 + 3*z1^2*z3 + 3*z2^2*z3 + 2*z1*z2*z3 z1 = @fn1(t1) + c1 z2 = @fn2(t2) + c2 z3 = @fn3(t3) + c3 if (@flavor == 0) z = z1 + z2 elseif (@flavor == 1) z = z1 + flip(z2) endif bailout: |z1| + |z2| + |z3| < @bailout default: title = "Super Cubic Mandelbrot" method = multipass periodicity = 0 maxiter = 500 float param version default = 0.0 visible = false endparam param var caption = "Variation" enum = "1""2""3""4" endparam param p1 caption = "(cj, ck)" default = (0.0, 0.0) endparam param p2 caption = "Plane rotation" default = (0.0, 1.0) endparam Heading caption = "Functions" Endheading func fn1 caption = "Function 1" default = ident() endfunc func fn2 caption = "Function 2" default = ident() endfunc func fn3 caption = "Function 3" default = ident() endfunc param flavor caption = "Combine flavor" enum = "1:(z=z1+z2)" "2:(z=z1+flip(z2))" endparam param bailout caption = "Bailout value" default = 64.0 endparam switch: type = "gnd-super-cubic_Jul" version = @version seed = #pixel p1 = @p1 p2 = @p2 fn1 = @fn1 fn2 = @fn2 fn3 = @fn3 var = @var flavor = @flavor bailout = @bailout } gnd-3D_Jset { ; based on the formula by Russell Walsmith ; Triternion Julia Set ; Gilles Nadeau, May, 2004 ; init: complex z1 = real(#pixel) complex z2 = - real(#pixel) complex w1 = imag(#pixel)*@p1 complex w2 = - imag(#pixel)*@p1 complex v1 = real(@zjk) complex v2 = imag(@zjk) complex cz = real(@c1i) complex cw = imag(@c1i)*@p1 complex cv = @cjk loop: a1 = z1^2 + z2^2 + 2*w1*w2 + 2*v1*v2 a2 = 2*z1*z2 + 2*w1*v2 + 2*w2*v1 b1 = w2^2 + v2^2 + 2*z1*w1 + 2*z2*v1 b2 = w1^2 + v1^2 + 2*z1*w2 + 2*z2*v2 c1 = 2*z1*v1 + 2*z2*w1 + 2*w2*v2 c2 = 2*z1*v2 + 2*z2*w2 + 2*w1*v1 z1 = @fn1(a1) + cz z2 = @fn1(a2) - cz w1 = @fn2(b1) + cw w2 = @fn2(b2) - cw v1 = @fn3(c1) + cv v2 = @fn3(c2) - cv if (@flavor == 0) z = z1 - z2 + flip(w1 - w2) elseif (@flavor == 1) z = z1 - z2 + w1 - w2 endif bailout: |z1| + |z2| + |w1| + |w2| + |v1| + |v2| < @bailout default: title = "3D_Julia Set" method = multipass periodicity = 0 maxiter = 500 magn = 1.5 float param version default = 0.0 visible = false endparam param c1i caption = "(c1, ci)" default = (-0.4, 0.11) endparam param cjk caption = "(cj, ck)" default = (0.0, 0.0) endparam param zjk caption = "(zj, zk)" default = (0.0, 0.0) endparam param p1 caption = "Plane rotation" default = (1.0, 0.0) endparam Heading caption = "Functions" Endheading func fn1 caption = "Function 1" default = ident() endfunc func fn2 caption = "Function 2" default = ident() endfunc func fn3 caption = "Function 3" default = ident() endfunc param flavor caption = "Combine flavor" enum = "1:(z=z1-z2+flip(w1-w2))" "2:(z=z1-z2+w1-w2)" endparam param bailout caption = "Bailout value" default = 10000.0 endparam switch: type = "gnd-3D_Mset" version = @version cjk = @cjk p1 = @p1 fn1 = @fn1 fn2 = @fn2 fn3 = @fn3 flavor = @flavor bailout = @bailout } gnd-3D_Mset { ; Original formula by Russell Walsmith ; http://www.fibonacci-arrays.com/Triternions.pdf ; Gilles Nadeau, May, 2004 ; init: complex z1 = (0.0, 0.0) complex z2 = (0.0, 0.0) complex w1 = (0.0, 0.0) complex w2 = (0.0, 0.0) complex v1 = (0.0, 0.0) complex v2 = (0.0, 0.0) complex cz = real(#pixel) complex cw = imag(#pixel)*@p1 complex cv = @cjk loop: a1 = z1^2 + z2^2 + 2*w1*w2 + 2*v1*v2 a2 = 2*z1*z2 + 2*w1*v2 + 2*w2*v1 b1 = w2^2 + v2^2 + 2*z1*w1 + 2*z2*v1 b2 = w1^2 + v1^2 + 2*z1*w2 + 2*z2*v2 c1 = 2*z1*v1 + 2*z2*w1 + 2*w2*v2 c2 = 2*z1*v2 + 2*z2*w2 + 2*w1*v1 z1 = @fn1(a1) + cz z2 = @fn1(a2) - cz w1 = @fn2(b1) + cw w2 = @fn2(b2) - cw v1 = @fn3(c1) + cv v2 = @fn3(c2) - cv if (@flavor == 0) z = z1 - z2 + flip(w1 - w2) elseif (@flavor == 1) z = z1 - z2 + w1 - w2 endif bailout: |z1| + |z2| + |w1| + |w2| + |v1| + |v2| < @bailout default: title = "3D_Mandelbrot Set" method = multipass periodicity = 0 maxiter = 500 magn = 1.5 float param version default = 0.0 visible = false endparam param cjk caption = "(cj, ck)" default = (0.0, 0.0) endparam param p1 caption = "Plane rotation" default = (1.0, 0.0) endparam Heading caption = "Functions" Endheading func fn1 caption = "Function 1" default = ident() endfunc func fn2 caption = "Function 2" default = ident() endfunc func fn3 caption = "Function 3" default = ident() endfunc param flavor caption = "Combine flavor" enum = "1:(z=z1-z2+flip(w1-w2))" "2:(z=z1-z2+w1-w2)" endparam param bailout caption = "Bailout value" default = 10000.0 endparam switch: type = "gnd-3D_Jset" version = @version c1i = #pixel cjk = @cjk p1 = @p1 fn1 = @fn1 fn2 = @fn2 fn3 = @fn3 flavor = @flavor bailout = @bailout } gnd-D4e_Jset { ; based on the formula by Russell Walsmith ; Triternion Julia Set ; Gilles Nadeau, May, 2004 ; init: complex z1 = real(#pixel) complex z2 = - real(#pixel) complex w1 = imag(#pixel)*@p1 complex w2 = - imag(#pixel)*@p1 complex v1 = real(@zjk) complex v2 = imag(@zjk) complex u1 = real(@zjk2) complex u2 = imag(@zjk2) complex cz = real(@c1i) complex cw = imag(@c1i)*@p1 complex cv = @cjk complex cu = @cjk2 loop: a1 = z1^2 + z2^2 + v1^2 + u1^2 + v2^2 + u2^2 + 2*w1*w2 a2 = w1^2 + w2^2 + 2*z1*z2 + 2*v1*v2 + 2*u1*u2 b1 = 2*z1*w1 + 2*z2*w2 + v1*u1 + u1*v2 + v2*u2 + u2*v1 b2 = 2*z1*w2 + 2*z2*w1 + v1*u2 + u1*v1 + v2*u1 + u2*v2 c1 = 2*z1*v1 + 2*z2*v2 + w1*u1 + w2*u2 + u1*w2 + u2*w1 c2 = 2*z1*v2 + 2*z2*v1 + w1*u2 + w2*u1 + u1*w1 + u2*w2 d1 = 2*z1*u1 + 2*z2*u2 + w1*v2 + w2*v1 + v1*w1 + v2*w2 d2 = 2*z1*u2 + 2*z2*u1 + w1*v1 + w2*v2 + v1*w2 + v2*w1 z1 = @fn1(a1) + cz z2 = @fn1(a2) - cz w1 = @fn2(b1) + cw w2 = @fn2(b2) - cw v1 = @fn3(c1) + cv v2 = @fn3(c2) - cv u1 = @fn4(d1) + cu u2 = @fn4(d2) - cu if (@flavor == 0) z = z1 - z2 + flip(w1 - w2) elseif (@flavor == 1) z = z1 - z2 + w1 - w2 endif bailout: |z1| + |z2| + |w1| + |w2| + |v1| + |v2| + |u1| + |u2| < @bailout default: title = "D4e_Julia Set" method = multipass periodicity = 0 maxiter = 500 magn = 2.0 float param version default = 0.0 visible = false endparam param c1i caption = "(c1, ci)" default = (-0.4, 0.11) endparam param cjk caption = "1st. (cj, ck)" default = (0.0, 0.0) endparam param cjk2 caption = "2nd. (cj, ck)" default = (0.0, 0.0) endparam param zjk caption = "1st.(zj, zk)" default = (0.0, 0.0) endparam param zjk2 caption = "2nd. (zj, zk)" default = (0.0, 0.0) endparam param p1 caption = "Plane rotation" default = (1.0, 0.0) endparam Heading caption = "Functions" Endheading func fn1 caption = "Function 1" default = ident() endfunc func fn2 caption = "Function 2" default = ident() endfunc func fn3 caption = "Function 3" default = ident() endfunc func fn4 caption = "Function 4" default = ident() endfunc param flavor caption = "Combine flavor" enum = "1:(z=z1-z2+flip(w1-w2))" "2:(z=z1-z2+w1-w2)" endparam param bailout caption = "Bailout value" default = 64.0 endparam switch: type = "gnd-D4e_Mset" version = @version cjk = @cjk cjk2 = @cjk2 p1 = @p1 fn1 = @fn1 fn2 = @fn2 fn3 = @fn3 fn4 = @fn4 flavor = @flavor bailout = @bailout } gnd-D4e_Mset { ; Original formula by Russell Walsmith ; http://www.fibonacci-arrays.com/Triternions.pdf ; Gilles Nadeau, May, 2004 ; init: complex z1 = (0.0, 0.0) complex z2 = (0.0, 0.0) complex w1 = (0.0, 0.0) complex w2 = (0.0, 0.0) complex v1 = (0.0, 0.0) complex v2 = (0.0, 0.0) complex u1 = (0.0, 0.0) complex u2 = (0.0, 0.0) complex cz = real(#pixel) complex cw = imag(#pixel)*@p1 complex cv = @cjk complex cu = @cjk2 loop: a1 = z1^2 + z2^2 + v1^2 + u1^2 + v2^2 + u2^2 + 2*w1*w2 a2 = w1^2 + w2^2 + 2*z1*z2 + 2*v1*v2 + 2*u1*u2 b1 = 2*z1*w1 + 2*z2*w2 + v1*u1 + u1*v2 + v2*u2 + u2*v1 b2 = 2*z1*w2 + 2*z2*w1 + v1*u2 + u1*v1 + v2*u1 + u2*v2 c1 = 2*z1*v1 + 2*z2*v2 + w1*u1 + w2*u2 + u1*w2 + u2*w1 c2 = 2*z1*v2 + 2*z2*v1 + w1*u2 + w2*u1 + u1*w1 + u2*w2 d1 = 2*z1*u1 + 2*z2*u2 + w1*v2 + w2*v1 + v1*w1 + v2*w2 d2 = 2*z1*u2 + 2*z2*u1 + w1*v1 + w2*v2 + v1*w2 + v2*w1 z1 = @fn1(a1) + cz z2 = @fn1(a2) - cz w1 = @fn2(b1) + cw w2 = @fn2(b2) - cw v1 = @fn3(c1) + cv v2 = @fn3(c2) - cv u1 = @fn4(d1) + cu u2 = @fn4(d2) - cu if (@flavor == 0) z = z1 - z2 + flip(w1 - w2) elseif (@flavor == 1) z = z1 - z2 + w1 - w2 endif bailout: |z1| + |z2| + |w1| + |w2| + |v1| + |v2| + |u1| + |u2| < @bailout default: title = "D4e_Mandelbrot Set" method = multipass periodicity = 0 maxiter = 500 magn = 2.0 float param version default = 0.0 visible = false endparam param cjk caption = "1st. (cj, ck)" default = (0.0, 0.0) endparam param cjk2 caption = "2nd. (cj, ck)" default = (0.0, 0.0) endparam param p1 caption = "Plane rotation" default = (1.0, 0.0) endparam Heading caption = "Functions" Endheading func fn1 caption = "Function 1" default = ident() endfunc func fn2 caption = "Function 2" default = ident() endfunc func fn3 caption = "Function 3" default = ident() endfunc func fn4 caption = "Function 4" default = ident() endfunc param flavor caption = "Combine flavor" enum = "1:(z=z1-z2+flip(w1-w2))" "2:(z=z1-z2+w1-w2)" endparam param bailout caption = "Bailout value" default = 64.0 endparam switch: type = "gnd-D4e_Jset" version = @version c1i = #pixel cjk = @cjk cjk2 = @cjk2 p1 = @p1 fn1 = @fn1 fn2 = @fn2 fn3 = @fn3 fn4 = @fn4 flavor = @flavor bailout = @bailout } gnd-dissected-mandphoenix { ; Gilles Nadeau, May, 2004 ; init: complex z = (0.0, 0.0) complex c = (0.0, 0.0) complex x = (0.0, 0.0) complex y = (0.0, 0.0) complex cx = (0.0, 0.0) complex cy = (0.0, 0.0) complex nx = (0.0, 0.0) complex ny = (0.0, 0.0) complex tx = (0.0, 0.0) complex ty = (0.0, 0.0) complex qx = (0.0, 0.0) complex qy = (0.0, 0.0) if (@mode == "Mandelbrot") ; hold the initial Z constant for all points, ; vary the constant C across the complex plane z = @start + #pixel c = #pixel elseif (@mode == "Julia") ; vary the initial Z across the complex plane ; hold C constant for all points z = #pixel c = @seed endif if (@var == 0) x = real(z) y = imag(z)*@p1 cx = real(c) cy = imag(c)*@p1 elseif (@var == 1) x = flip(real(z)) y = flip(imag(z)*@p1) cx = flip(real(c)) cy = flip(imag(c)*@p1) elseif (@var == 2) x = real(z) y = flip(imag(z)*@p1) cx = real(c) cy = flip(imag(c)*@p1) elseif (@var == 3) x = flip(real(z)) y = imag(z)*@p1 cx = flip(real(c)) cy = imag(c)*@p1 endif qx = sqr(x) qy = sqr(y) loop: tx = qx - qy + cx + cy*nx ty = 2*x*y + cy*ny nx = x ny = y x = tx y = ty qx = sqr(x) qy = sqr(y) if (@flavor == 0) z = x + flip(y) elseif (@flavor == 1) z = x + y endif bailout: |x| + |y| < @bailout default: title = "Dissected Phoenix Mandelbrot" magn = 1.0 angle = 0 method = multipass periodicity = 0 maxiter = 500 float param version default = 0.0 visible = false endparam Heading caption = "Mandelbrot Mode" visible = (@mode == 0) Endheading Heading caption = "Julia Mode" visible = (@mode == 1) Endheading param mode caption = "Mode" enum = "Mandelbrot" "Julia" default = 0 visible = false endparam param switchmode caption = "Switch Mode" enum = "Mandelbrot" "Julia" default = 1 visible = false endparam param var caption = "Variation" enum = "1""2""3""4" default = 0 endparam param start caption = "Perturbation" default = (0.0, 0.0) visible = (@mode == 0) endparam param seed caption = "Seed Value" default = (0.0, 0.0) visible = (@mode == 1) endparam param p1 caption = "Plane rotation" default = (1.0, 0.0) endparam param flavor caption = "Combine flavor" enum = "1:(z=x+flip(y))" "2:(z=x+y)" endparam param bailout caption = "Bailout Value" default = 64.0 min = 1.0 endparam switch: type = "gnd-dissected-mandphoenix" version = @version seed = #pixel p1 = @p1 flavor = @flavor bailout = @bailout var = @var mode = @switchmode switchmode = @mode } gnd-mandphoenixhyperclx { ; Gilles Nadeau, May, 2004 ; init: ;default to Mandelbrot z = @start + #pixel complex w = (0.0, 0.0) complex temp = (0.0, 0.0) complex zjk = (0.0, 0.0) complex c1i = #pixel complex cjk = @p1 if( @mode == "Julia" ) z = #pixel w = (0.0, 0.0) temp = (0.0, 0.0) zjk = @p3 c1i = @p2 cjk = @p1 endif loop: if (@selectloop == 0) a = @fn1(z - imag(zjk) + flip(real(zjk))) b = @fn1(z + imag(zjk) - flip(real(zjk))) temp = (a + b) / 2 + real(c1i) + imag(c1i) * w zjk = (flip(real(b)) + imag(a) - imag(b) - flip(real(a))) / 2 + cjk w = z z = temp elseif (@selectloop == 1) a = @fn1(z - imag(zjk) + flip(real(zjk))) b = @fn1(z + imag(zjk) - flip(real(zjk))) temp = (a + b) / 2 + c1i + @induct * w zjk = (flip(real(b)) + imag(a) - imag(b) - flip(real(a))) / 2 + cjk w = z z = temp endif bailout: |z| + |zjk| <= @bailout switch: type = "gnd-mandphoenixhyperclx" version = @version p1 = @p1 p2 = #pixel selectloop = @selectloop induct = @induct bailout = @bailout fn1 = @fn1 mode = @switchmode switchMode = mode default: title = "Phoenix Mandelbrot (Hypercomplex)" maxiter = 500 periodicity = 0 method = multipass float param version default = 0.0 visible = false endparam param mode caption = "Current Mode" default = 0 enum = "Mandelbrot" "Julia" visible = false endparam param switchMode caption = "Switch Mode" default = 1 enum = "Mandelbrot" "Julia" visible = false endparam heading caption = "Mandelbrot Mode" visible = @mode==0 endheading heading caption = "Julia Mode" visible = @mode==1 endheading param selectloop caption = "Select Formula" enum = "1st. Formula""2nd. Formula" default = 0 endparam param start caption = "Perturbation" default = (0.0, 0.0) visible = @mode == 0 endparam param p2 caption = "(c1, ci)" default = (0.0, 0.0) visible = @mode == 1 endparam param p1 caption = "(cj, ck)" default = (0.0, 0.0) endparam param p3 caption = "(zj, zk)" default = (0.0, 0.0) visible = @mode == 1 endparam param induct caption = "Phoenix Distortion" default = (0.5, 0.0) visible = @selectloop == 1 endparam param bailout caption = "Bailout value" default = 64.0 min = 1 endparam func fn1 caption = "First Function" default = sqr() endfunc } gnd-triternions { ; based on formulae by Russell Walsmith ; http://www.fibonacci-arrays.com/Triternions.pdf ; Gilles Nadeau, May, 2004 ; init: complex z = (0.0, 0.0) complex c = (0.0, 0.0) complex w = @p1 complex x1 = (0.0, 0.0) complex x2 = (0.0, 0.0) complex y1 = (0.0, 0.0) complex y2 = (0.0, 0.0) complex v1 = (0.0, 0.0) complex v2 = (0.0, 0.0) complex w1 = (0.0, 0.0) complex w2 = (0.0, 0.0) complex cx = (0.0, 0.0) complex cy = (0.0, 0.0) complex cv = @cjk complex cw = @cjk2 if (@mode == "Mandelbrot") ; hold the initial Z constant for all points, ; vary the constant C across the complex plane z = (0.0, 0.0) c = #pixel elseif (@mode == "Julia") ; vary the initial Z across the complex plane ; hold C constant for all points z = #pixel c = @c1i endif if (@var == 0) x1 = real(z) x2 = - real(z) y1 = imag(z)*w y2 = - imag(z)*w cx = real(c) cy = imag(c)*w elseif (@var == 1) x1 = flip(real(z)) x2 = - flip(real(z)) y1 = flip(imag(z)*w) y2 = - flip(imag(z)*w) cx = flip(real(c)) cy = flip(imag(c)*w) elseif (@var == 2) x1 = real(z) x2 = - real(z) y1 = flip(imag(z)*w) y2 = - flip(imag(z)*w) cx = real(c) cy = flip(imag(c)*w) elseif (@var == 3) x1 = flip(real(z)) x2 = - flip(real(z)) y1 = imag(z)*w y2 = - imag(z)*w cx = flip(real(c)) cy = imag(c)*w endif if (@zjkinitmethod == 0) v1 = real(@zjk) v2 = imag(@zjk) w1 = real(@zjk2) w2 = imag(@zjk2) elseif (@zjkinitmethod == 1) v1 = @zjk v2 = - @zjk w1 = @zjk2 w2 = - @zjk2 endif loop: if (@formula == 0) a1 = x1^2 + x2^2 + v1^2 + w1^2 + v2^2 + w2^2 + 2*y1*y2 a2 = y1^2 + y2^2 + 2*x1*x2 + 2*v1*v2 + 2*w1*w2 b1 = 2*x1*y1 + 2*x2*y2 + v1*w1 + w1*v2 + v2*w2 + w2*v1 b2 = 2*x1*y2 + 2*x2*y1 + v1*w2 + w1*v1 + v2*w1 + w2*v2 c1 = 2*x1*v1 + 2*x2*v2 + y1*w1 + y2*w2 + w1*y2 + w2*y1 c2 = 2*x1*v2 + 2*x2*v1 + y1*w2 + y2*w1 + w1*y1 + w2*y2 d1 = 2*x1*w1 + 2*x2*w2 + y1*v2 + y2*v1 + v1*y1 + v2*y2 d2 = 2*x1*w2 + 2*x2*w1 + y1*v1 + y2*v2 + v1*y2 + v2*y1 x1 = a1 + cx x2 = a2 - cx y1 = b1 + cy y2 = b2 - cy v1 = c1 + cv v2 = c2 - cv w1 = d1 + cw w2 = d2 - cw elseif (@formula == 1) a1 = x1^2 + x2^2 + 2*y1*y2 + 2*v1*v2 + 2*w1*w2 a2 = y1^2 + y2^2 + 2*x1*x2 + 2*v1*w1 + 2*v2*w2 b1 = v1^2 + w2^2 + 2*x1*y1 + 2*x2*y2 + 2*v2*w1 b2 = v2^2 + w2^2 + 2*x1*y2 + 2*x2*y1 + 2*v1*w2 c1 = 2*x1*v1 + 2*x2*w2 + 2*y1*v2 + 2*y2*w1 c2 = 2*x1*v2 + 2*x2*w1 + 2*y1*w2 + 2*y2*v1 d1 = 2*x1*w1 + 2*x2*v2 + 2*y1*v1 + 2*y2*w2 d2 = 2*x1*w2 + 2*x2*v1 + 2*y1*w1 + 2*y2*v2 x1 = a1 + cx x2 = a2 - cx y1 = b1 + cy y2 = b2 - cy v1 = c1 + cv v2 = c2 - cv w1 = d1 + cw w2 = d2 - cw elseif (@formula == 2) a1 = x1^2 + x2^2 + 2*y1*y2 + 2*v1*v2 a2 = 2*x1*x2 + 2*y1*v2 + 2*y2*v1 b1 = y2^2 + v2^2 + 2*x1*y1 + 2*x2*v1 b2 = y1^2 + v1^2 + 2*x1*y2 + 2*x2*v2 c1 = 2*x1*v1 + 2*x2*y1 + 2*y2*v2 c2 = 2*x1*v2 + 2*x2*y2 + 2*y1*v1 x1 = a1 + cx x2 = a2 - cx y1 = b1 + cy y2 = b2 - cy v1 = c1 + cv v2 = c2 - cv elseif (@formula == 3) a1 = x1^2 + x2^2 + y1^2 + v2^2 + 2*y1*v1 a2 = 2*x1*x2 + y1*y2 + v1*v2 + y2*v1 + v2*y1 b1 = v1^2 + 2*x1*y1 + x2*y2 + y2*v2 + v2*x2 b2 = 2*x1*y2 + y1*v2 + v1*x2 + x2*y1 + v2*v1 c1 = y1^2 + 2*x1*v1 + x2*v2 + y2*x2 + v2*y2 c2 = 2*x1*v2 + y1*x2 + v1*y2 + x2*v1 + y2*y1 x1 = a1 + cx x2 = a2 - cx y1 = b1 + cy y2 = b2 - cy v1 = c1 + cv v2 = c2 - cv elseif (@formula == 4) a1 = x1^2 + x2^2 + 2*y1*v1 + 2*y2*v2 a2 = 2*x1*x2 + 2*y1*v2 + 2*y2*v1 b1 = v1^2 + v2^2 + 2*x1*y1 + 2*x2*y2 b2 = 2*x1*y2 + 2*x2*y1 + 2*v1*v2 c1 = y1^2 + y2^2 + 2*x1*v1 + 2*x2*v2 c2 = 2*x1*v2 + 2*x2*v1 + 2*y1*y2 x1 = a1 + cx x2 = a2 - cx y1 = b1 + cy y2 = b2 - cy v1 = c1 + cv v2 = c2 - cv endif if (@flavor == 0) z = x1 - x2 + flip(y1 - y2) elseif (@flavor == 1) z = x1 - x2 + y1 - y2 endif bailout: |x1| + |x2| + |y1| + |y2| + |v1| + |v2| + |w1| + |w2| < @bailout default: title = "Triternions" magn = 1.7 angle = 0 method = multipass periodicity = 0 maxiter = 500 float param version default = 0.0 visible = false endparam Heading caption = "Mandelbrot Mode" visible = (@mode == 0) Endheading Heading caption = "Julia Mode" visible = (@mode == 1) Endheading param mode caption = "Mode" enum = "Mandelbrot" "Julia" default = 0 visible = false endparam param switchmode caption = "Switch Mode" enum = "Mandelbrot" "Julia" default = 1 visible = false endparam param formula caption = "Select Formula" enum = "D4e_Set""CP8e_Set""3D_Set""D3e_Set""MrTe_Set" default = 0 endparam param var caption = "Variation" enum = "1""2""3""4" default = 0 endparam param c1i caption = "(c1, ci)" default = (0.0, 0.0) visible = @mode == 1 endparam param cjk caption = "1st. (cj, ck)" default = (0.0, 0.0) endparam param cjk2 caption = "2nd. (cj, ck)" default = (0.0, 0.0) endparam param zjk caption = "1st. (zj, zk)" default = (0.0, 0.0) visible = @mode == 1 endparam param zjk2 caption = "2nd. (zj, zk)" default = (0.0, 0.0) visible = @mode == 1 endparam param p1 caption = "Plane rotation" default = (1.0, 0.0) endparam param zjkinitmethod caption = "zjk init method" enum = "1:(real(zjk), imag(zjk))" "2:(+ zjk, - zjk)" visible = @mode == 1 endparam param flavor caption = "Combine flavor" enum = "1:(z=x1-x2+flip(y1-y2))" "2:(z=x1-x2+y1-y2)" endparam param bailout caption = "Bailout Value" default = 64.0 min = 1.0 endparam switch: type = "gnd-triternions" version = @version c1i = #pixel cjk = @cjk cjk2 = @cjk2 p1 = @p1 var = @var formula = @formula flavor = @flavor bailout = @bailout mode = @switchmode switchmode = @mode } gnd+as+sdc-dissected-cpx2 { ; Gilles Nadeau, Andrea Spinozzi and Susan Chambless, May, 2004 ; init: complex z = (0.0,0.0) complex c = (0.0, 0.0) complex zx = (0.0,0.0) complex wy = (0.0,0.0) complex czx = (0.0,0.0) complex cwy = (0.0,0.0) complex qzx = (0.0,0.0) complex qwy = (0.0,0.0) complex tzx = (0.0,0.0) complex twy = (0.0,0.0) if (@mode == "Mandelbrot") ; hold the initial Z constant for all points, ; vary the constant C across the complex plane z = (0.0, 0.0) c = #pixel if (@var == 0) czx = @p1*real(c) cwy = imag(c)*@p1 elseif (@var == 1) czx = flip(real(c)) cwy = flip(imag(c)*@p1) elseif (@var == 2) czx = real(c) cwy = flip(imag(c)*@p1) elseif (@var == 3) czx = flip(real(c)) cwy = imag(c)*@p1 endif elseif (@mode == "Julia") ; vary the initial Z across the complex plane ; hold C constant for all points z = #pixel c = @seed if (@var == 0) zx = real(z) wy = imag(z)*@p1 czx = real(c) cwy = imag(c)*@p1 elseif (@var == 1) zx = flip(real(z)) wy = flip(imag(z)*@p1) czx = flip(real(c)) cwy = flip(imag(c)*@p1) elseif (@var == 2) zx = real(z) wy = flip(imag(z)*@p1) czx = real(c) cwy = flip(imag(c)*@p1) elseif (@var == 3) zx = flip(real(z)) wy = imag(z)*@p1 czx = flip(real(c)) cwy = imag(c)*@p1 endif endif qzx = sqr(zx) qwy = sqr(wy) loop: if (@selectloop == 0) tzx = @fn1(qzx) - @fn2(qwy) + @fn3(czx) twy = (2*zx*wy) + @fn4(cwy) elseif (@selectloop == 1) tzx = @fn1(qzx) + @fn2(qwy) + @fn3(czx) twy = (2*zx*wy) + @fn4(cwy) endif zx = @fn5(tzx) wy = @fn6(twy) qzx = sqr(zx) qwy = sqr(wy) zx = @fn7(zx) wy = @fn8(wy) if (@flavor == 0) z = zx + flip(wy) elseif (@flavor == 1) z = zx + wy endif bailout: |zx| + |wy| < @bailout default: title = "Dissected Mandelbrot Complex 2" magn = 1.0 angle = 0 method = multipass periodicity = 0 maxiter = 500 float param version default = 0.0 visible = false endparam Heading caption = "Mandelbrot Mode" visible = (@mode == 0) Endheading Heading caption = "Julia Mode" visible = (@mode == 1) Endheading param mode caption = "Mode" enum = "Mandelbrot" "Julia" default = 0 visible = false endparam param switchmode caption = "Switch Mode" enum = "Mandelbrot" "Julia" default = 1 visible = false endparam param selectloop caption = "Select Formula" enum = "1st. Formula""2nd. Formula" default = 0 endparam param var caption = "Variations" enum = "1""2""3""4" default = 0 endparam param seed caption = "Seed Value" default = (0.0,0.0) visible = (@mode == 1) endparam param p1 caption = "Plane rotation" default = (1.0,0.0) endparam param flavor caption = "Bailout flavor" enum = "1:(z=zx+flip(wy))" "2:(z=zx+wy)" endparam param bailout caption = "Bailout Value" default = 64.0 min = 1.0 endparam Heading caption = "Functions" Endheading func fn1 caption = "Function 1" default = ident() endfunc func fn2 caption = "Function 2" default = ident() endfunc func fn3 caption = "Function 3" default = ident() endfunc func fn4 caption = "Function 4" default = ident() endfunc func fn5 caption = "Function 5" default = ident() endfunc func fn6 caption = "Function 6" default = ident() endfunc func fn7 caption = "Function 7" default = ident() endfunc func fn8 caption = "Function 8" default = ident() endfunc switch: type = "gnd+as+sdc-dissected-cpx2" version = @version seed = #pixel p1 = @p1 flavor = @flavor bailout = @bailout fn1 = @fn1 fn2 = @fn2 fn3 = @fn3 fn4 = @fn4 fn5 = @fn5 fn6 = @fn6 fn7 = @fn7 fn8 = @fn8 var = @var selectloop = @selectloop mode = @switchmode switchmode = @mode } gnd-chaoticmandphoenix { ; Gilles Nadeau, May, 2004 ; init: ;default to Mandelbrot z = (0.0, 0.0) + #pixel complex w = (0.0, 0.0) complex temp = (0.0, 0.0) complex zjk = (0.0, 0.0) complex c1i = #pixel complex cjk = @p1 if( @mode == "Julia" ) z = #pixel w = (0.0, 0.0) temp = (0.0, 0.0) zjk = @p3 c1i = @p2 cjk = @p1 endif loop: if (@selectloop == 0) if (1 < |z| + |zjk|) a = @fn1(z - imag(zjk) + flip(real(zjk))) b = @fn1(z + imag(zjk) - flip(real(zjk))) temp = (a + b) / 2 + real(c1i) + imag(c1i) * w zjk = (flip(real(b)) + imag(a) - imag(b) - flip(real(a))) / 2 + cjk w = z z = temp endif a = @fn2(z - imag(zjk) + flip(real(zjk))) b = @fn2(z + imag(zjk) - flip(real(zjk))) temp = (a + b) / 2 + real(c1i) + imag(c1i) * w zjk = (flip(real(b)) + imag(a) - imag(b) - flip(real(a))) / 2 + cjk w = z z = temp elseif (@selectloop == 1) if (1 < |z| + |zjk|) a = @fn1(z - imag(zjk) + flip(real(zjk))) b = @fn1(z + imag(zjk) - flip(real(zjk))) temp = (a + b) / 2 + c1i + @induct * w zjk = (flip(real(b)) + imag(a) - imag(b) - flip(real(a))) / 2 + cjk w = z z = temp endif a = @fn2(z - imag(zjk) + flip(real(zjk))) b = @fn2(z + imag(zjk) - flip(real(zjk))) temp = (a + b) / 2 + c1i + @induct * w zjk = (flip(real(b)) + imag(a) - imag(b) - flip(real(a))) / 2 + cjk w = z z = temp endif bailout: |z| + |zjk| <= @bailout switch: type = "gnd-chaoticmandphoenix" version = @version p1 = @p1 p2 = #pixel selectloop = @selectloop induct = @induct bailout = @bailout fn1 = @fn1 fn2 = @fn2 mode = @switchmode switchMode = mode default: title = "Chaotic Phoenix Mandelbrot" maxiter = 500 periodicity = 0 method = multipass float param version default = 0.0 visible = false endparam param mode caption = "Current Mode" default = 0 enum = "Mandelbrot" "Julia" visible = false endparam param switchMode caption = "Switch Mode" default = 1 enum = "Mandelbrot" "Julia" visible = false endparam heading caption = "Mandelbrot Mode" visible = @mode==0 endheading heading caption = "Julia Mode" visible = @mode==1 endheading param selectloop caption = "Select Formula" enum = "1st. Formula""2nd. Formula" default = 0 endparam param p2 caption = "(c1, ci)" default = (0.0, 0.0) visible = @mode == 1 endparam param p1 caption = "(cj, ck)" default = (0.0, 0.0) endparam param p3 caption = "(zj, zk)" default = (0.0, 0.0) visible = @mode == 1 endparam param induct caption = "Phoenix Distortion" default = (0.5, 0.0) visible = @selectloop == 1 endparam param bailout caption = "Bailout value" default = 64.0 min = 1 endparam func fn1 caption = "First Function" default = cosh() endfunc func fn2 caption = "Second Function" default = sqr() endfunc } gnd-hypercomplexzpower { ; Gilles Nadeau, June, 2004 ; init: complex z = (0.0, 0.0) complex w = (0.0, 0.0) complex cz = (0.0, 0.0) complex cw = (0.0, 0.0) complex a = (0.0, 0.0) complex b = (0.0, 0.0) float x1 = 0.0 float yi = 0.0 float zj = 0.0 float wk = 0.0 float c1 = 0.0 float ci = 0.0 float cj = 0.0 float ck = 0.0 ;default to Mandelbrot z = (0.0, 0.0) w = (0.0, 0.0) cz = #pixel cw = @p1 if( @mode == "Julia" ) z = #pixel w = @p3 cz = @p2 cw = @p1 endif if (@var == 0) x1 = real(z) yi = imag(z) zj = real(w) wk = imag(w) c1 = real(cz) ci = imag(cz) cj = real(cw) ck = imag(cw) elseif (@var == 1) x1 = real(w) yi = imag(w) zj = real(z) wk = imag(z) c1 = real(cw) ci = imag(cw) cj = real(cz) ck = imag(cz) elseif (@var == 2) x1 = real(z) yi = imag(w) zj = real(w) wk = imag(z) c1 = real(cz) ci = imag(cw) cj = real(cw) ck = imag(cz) elseif (@var == 3) x1 = real(w) yi = imag(z) zj = real(z) wk = imag(w) c1 = real(cw) ci = imag(cz) cj = real(cz) ck = imag(cw) endif loop: a = @fn1(x1 - wk + flip(yi + zj)) ^ @power b = @fn1(x1 + wk + flip(yi - zj)) ^ @power x1 = (real(a) + real(b)) / 2 + c1 yi = (imag(a) + imag(b)) / 2 + ci zj = (imag(a) - imag(b)) / 2 + cj wk = (real(b) - real(a)) / 2 + ck z = x1 + flip(yi) w = zj + flip(wk) bailout: |z| + |w| <= @bailout switch: type = "gnd-hypercomplexzpower" version = @version var = @var p1 = @p1 p2 = #pixel power = @power bailout = @bailout fn1 = @fn1 mode = @switchmode switchMode = mode default: title = "Hypercomplex Mandelbrot z^n" maxiter = 500 periodicity = 0 method = multipass float param version default = 0.0 visible = false endparam param mode caption = "Current Mode" default = 0 enum = "Mandelbrot" "Julia" visible = false endparam param switchMode caption = "Switch Mode" default = 1 enum = "Mandelbrot" "Julia" visible = false endparam heading caption = "Mandelbrot Mode" visible = @mode==0 endheading heading caption = "Julia Mode" visible = @mode==1 endheading param var caption = "Variation" enum = "xy""zw""xw""yz" default = 0 endparam param p2 caption = "(c1, ci)" default = (0.0, 0.0) visible = @mode == 1 endparam param p1 caption = "(cj, ck)" default = (0.0, 0.0) endparam param p3 caption = "(zj, zk)" default = (0.0, 0.0) visible = @mode == 1 endparam param power caption = "Exponent" default = (3.0, 0.0) endparam param bailout caption = "Bailout value" default = 64.0 min = 1 endparam func fn1 caption = "First Function" default = ident() endfunc } gnd-hypercomplexmandelfn { ; Gilles Nadeau, June, 2004 ; init: ;default to Mandelbrot complex z = (0.0, 0.0) + #pixel complex zjk = (0.0, 0.0) complex c1i = #pixel complex cjk = @p1 if( @mode == "Lambda" ) z = #pixel zjk = @p3 c1i = @p2 cjk = @p1 endif loop: a = c1i * @fn1(z - imag(zjk) + flip(real(zjk))) b = c1i * @fn1(z + imag(zjk) - flip(real(zjk))) z = (a + b) / 2 zjk = (flip(real(b)) + imag(a) - imag(b) - flip(real(a))) / 2 + cjk bailout: |z| + |zjk| <= @bailout switch: type = "gnd-hypercomplexmandelfn" version = @version p1 = @p1 p2 = #pixel bailout = @bailout fn1 = @fn1 mode = @switchmode switchMode = mode default: title = "Hypercomplex Mandelbrot c * fn(z)" maxiter = 500 periodicity = 0 method = multipass magn = 0.5 float param version default = 0.0 visible = false endparam param mode caption = "Current Mode" default = 0 enum = "Mandelbrot" "Lambda" visible = false endparam param switchMode caption = "Switch Mode" default = 1 enum = "Mandelbrot" "Lambda" visible = false endparam heading caption = "Mandelbrot Mode" visible = @mode==0 endheading heading caption = "Lambda Mode" visible = @mode==1 endheading param p2 caption = "(c1, ci)" default = (0.0, 0.0) visible = @mode == 1 endparam param p1 caption = "(cj, ck)" default = (0.0, 0.0) endparam param p3 caption = "(zj, zk)" default = (0.0, 0.0) visible = @mode == 1 endparam param bailout caption = "Bailout value" default = 64.0 min = 1 endparam func fn1 caption = "First Function" default = sin() endfunc } gnd-T-sets { ; based on formulae by Russell Walsmith ; http://www.fibonacci-arrays.com/Triternions.pdf ; T_Sisters by Jos Hendriks ; Gilles Nadeau, May, 2004 ; init: complex z = (0.0, 0.0) complex c = (0.0, 0.0) complex w = @p1 complex z1 = (0.0, 0.0) complex z2 = (0.0, 0.0) complex z3 = @zjk complex c1 = (0.0, 0.0) complex c2 = (0.0, 0.0) complex c3 = @cjk if (@mode == "Mandelbrot") z = (0.0, 0.0) c = #pixel elseif (@mode == "Julia") z = #pixel c = @c1i endif if (@var == 0) z1 = real(z) z2 = imag(z)*w c1 = real(c) c2 = imag(c)*w elseif (@var == 1) z1 = flip(real(z)) z2 = flip(imag(z)*w) c1 = flip(real(c)) c2 = flip(imag(c)*w) elseif (@var == 2) z1 = real(z) z2 = flip(imag(z)*w) c1 = real(c) c2 = flip(imag(c)*w) elseif (@var == 3) z1 = flip(real(z)) z2 = imag(z)*w c1 = flip(real(c)) c2 = imag(c)*w endif loop: if (@formula == 0) t1 = z1^2 + 2*z2*z3 t2 = z3^2 + 2*z1*z2 t3 = z2^2 + 2*z1*z3 z1 = t1 + c1 z2 = t2 + c2 z3 = t3 + c3 elseif (@formula == 1) t1 = z1^2 - w^2*z1*z2 - w^2*z1*z3 t2 = z2^2 - w^2*z1*z2 - w^2*z2*z3 t3 = z3^2 - w^2*z3*z2 - w^2*z1*z3 z1 = t1 + c1 z2 = t2 + c2 z3 = t3 + c3 elseif (@formula == 2) t1 = z1^3 + 3*z2^2*z1 + 3*z3^2*z1 + 2*z1*z2*z3 t2 = z2^3 + 3*z1^2*z2 + 3*z3^2*z2 + 2*z1*z2*z3 t3 = z3^3 + 3*z1^2*z3 + 3*z2^2*z3 + 2*z1*z2*z3 z1 = t1 + c1 z2 = t2 + c2 z3 = t3 + c3 elseif (@formula == 3) t1 = z1^2 + real(c3)*z2 t2 = z2^2 + imag(c3)*z1 z1 = t1 + c1 z2 = t2 + c2 elseif (@formula == 4) t1= z1^3 + z2^3 + z3^3 + 6*z1*z2*z3 t2= 3*z2*z1^2 + 3*z3*z2^2 + 3*z1*z3^2 t3= 3*z3*z1^2 + 3*z1*z2^2 + 3*z2*z3^2 z1 = t1 + c1 z2 = t2 + c2 z3 = t3 + c3 endif if (@flavor == 0) z = z1 + z2 elseif (@flavor == 1) z = z1 + flip(z2) endif bailout: |z1| + |z2| + |z3| < @bailout default: title = "T Sets" magn = 1.0 angle = 0 method = multipass periodicity = 0 maxiter = 500 float param version default = 0.0 visible = false endparam Heading caption = "Mandelbrot Mode" visible = (@mode == 0) Endheading Heading caption = "Julia Mode" visible = (@mode == 1) Endheading param mode caption = "Mode" enum = "Mandelbrot" "Julia" default = 0 visible = false endparam param switchmode caption = "Switch Mode" enum = "Mandelbrot" "Julia" default = 1 visible = false endparam param formula caption = "Select Formula" enum = "MrT_Set""Ptest_Set""Ptest2_Set""TSisters_Set""Cubic MrT_Set" default = 0 endparam param var caption = "Variation" enum = "1""2""3""4" default = 0 endparam param c1i caption = "(c1, ci)" default = (0.0, 0.0) visible = @mode == 1 endparam param cjk caption = "(cj, ck)" default = (0.0, 0.0) endparam param zjk caption = "(zj, zk)" default = (0.0, 0.0) visible = @mode == 1 endparam param p1 caption = "Plane rotation" default = (0.0, 1.0) endparam param flavor caption = "Combine flavor" enum = "1:(z=z1+z2)" "2:(z=z1+flip(z2))" endparam param bailout caption = "Bailout Value" default = 64.0 min = 1.0 endparam switch: type = "gnd-T-sets" version = @version c1i = #pixel cjk = @cjk p1 = @p1 var = @var formula = @formula flavor = @flavor bailout = @bailout mode = @switchmode switchmode = @mode } gnd-chaotic_triternion { ; based on formulae by Jos Hendriks and Russell Walsmith ; Gilles Nadeau, June, 2004 ; init: complex z = (0.0, 0.0) complex c = (0.0, 0.0) complex w = @p2 complex t1 = real(@p1) complex t2 = imag(@p1) complex x1 = (0.0, 0.0) complex x2 = (0.0, 0.0) complex y1 = (0.0, 0.0) complex y2 = (0.0, 0.0) complex cx = (0.0, 0.0) complex cy = (0.0, 0.0) if (@mode == "Mandelbrot") z = (0.0, 0.0) c = #pixel elseif (@mode == "Julia") z = #pixel c = @seed endif if (@var == 0) x1 = real(z) x2 = - real(z) y1 = imag(z)*w y2 = - imag(z)*w cx = real(c) cy = imag(c)*w elseif (@var == 1) x1 = flip(real(z)) x2 = - flip(real(z)) y1 = flip(imag(z)*w) y2 = - flip(imag(z)*w) cx = flip(real(c)) cy = flip(imag(c)*w) elseif (@var == 2) x1 = real(z) x2 = - real(z) y1 = flip(imag(z)*w) y2 = - flip(imag(z)*w) cx = real(c) cy = flip(imag(c)*w) elseif (@var == 3) x1 = flip(real(z)) x2 = - flip(real(z)) y1 = imag(z)*w y2 = - imag(z)*w cx = flip(real(c)) cy = imag(c)*w endif loop: x1 = @fn1(x1) x2 = @fn2(x2) y1 = @fn3(y1) y2 = @fn4(y2) a1 = x1^2 + x2^2 + t1*y1 a2 = 2*x1*x2 + t1*y2 b1 = y1^2 + y2^2 + t2*x1 b2 = 2*y1*y2 + t2*x2 x1 = a1 + cx x2 = a2 - cx y1 = b1 + cy y2 = b2 - cy if (@flavor == 0) z = x1 - x2 + y1 - y2 elseif (@flavor == 1) z = x1 - x2 + flip(y1 - y2) endif bailout: |x1| + |x2| + |y1| + |y2| < @bailout default: title = "Chaotic Triternion" magn = 2.0 angle = 0 method = multipass periodicity = 0 maxiter = 500 float param version default = 0.0 visible = false endparam Heading caption = "Mandelbrot Mode" visible = (@mode == 0) Endheading Heading caption = "Julia Mode" visible = (@mode == 1) Endheading param mode caption = "Mode" enum = "Mandelbrot" "Julia" default = 0 visible = false endparam param switchmode caption = "Switch Mode" enum = "Mandelbrot" "Julia" default = 1 visible = false endparam param var caption = "Variation" enum = "1""2""3""4" default = 0 endparam param seed caption = "Julia seed" default = (0.0, 0.0) visible = @mode == 1 endparam param p1 caption = "Parameter 1" default = (0.5, 0.25) endparam param p2 caption = "Parameter 2" default = (0.0, 1.0) endparam param flavor caption = "Combine flavor" enum = "1:(z=x1-x2+y1-y2)" "2:(z=x1-x2+flip(y1-y2))" endparam param bailout caption = "Bailout Value" default = 64.0 min = 1.0 endparam Heading caption = "Functions" Endheading func fn1 caption = "Function 1" default = ident() endfunc func fn2 caption = "Function 2" default = ident() endfunc func fn3 caption = "Function 3" default = ident() endfunc func fn4 caption = "Function 4" default = ident() endfunc switch: type = "gnd-chaotic_triternion" version = @version seed = #pixel p1 = @p1 p2 = @p2 var = @var flavor = @flavor bailout = @bailout fn1 = @fn1 fn2 = @fn2 fn3 = @fn3 fn4 = @fn4 mode = @switchmode switchmode = @mode } gnd-triternions_XY { ; based on formulae ; 1 MrTe and 3D_Mset of Russell Walsmith and ; 2 CQuatXY of Junichi Sato. ; Gilles Nadeau, June, 2004 ; init: complex z = (0.0, 0.0) complex c = (0.0, 0.0) complex w = @p1 complex x1 = (0.0, 0.0) complex x2 = (0.0, 0.0) complex y1 = (0.0, 0.0) complex y2 = (0.0, 0.0) complex v1 = (0.0, 0.0) complex v2 = (0.0, 0.0) complex cx = (0.0, 0.0) complex cy = (0.0, 0.0) complex cv = @cjk if (@mode == "Mandelbrot") ; hold the initial Z constant for all points, ; vary the constant C across the complex plane z = (0.0, 0.0) c = #pixel elseif (@mode == "Julia") ; vary the initial Z across the complex plane ; hold C constant for all points z = #pixel c = @c1i endif if (@var == 0) x1 = real(z) x2 = - real(z) y1 = imag(z)*w y2 = - imag(z)*w cx = real(c) cy = imag(c)*w elseif (@var == 1) x1 = flip(real(z)) x2 = - flip(real(z)) y1 = flip(imag(z)*w) y2 = - flip(imag(z)*w) cx = flip(real(c)) cy = flip(imag(c)*w) elseif (@var == 2) x1 = real(z) x2 = - real(z) y1 = flip(imag(z)*w) y2 = - flip(imag(z)*w) cx = real(c) cy = flip(imag(c)*w) elseif (@var == 3) x1 = flip(real(z)) x2 = - flip(real(z)) y1 = imag(z)*w y2 = - imag(z)*w cx = flip(real(c)) cy = imag(c)*w endif if (@zjkinitmethod == 0) v1 = real(@zjk) v2 = imag(@zjk) elseif (@zjkinitmethod == 1) v1 = @zjk v2 = - @zjk endif loop: if (@formula == 0) xx1 = x1 + cx xx2 = x2 - cx xy1 = y1 + cy xy2 = y2 - cy xv1 = v1 + cv xv2 = v2 - cv yx1 = x1 - cx yx2 = x2 + cx yy1 = y1 - cy yy2 = y2 + cy yv1 = v1 - cv yv2 = v2 + cv x1 = xx1*yx1 + xx2*yx2 + xy1*yv1 + yy1*xv1 + xy2*yv2 + yy2*xv2 x2 = xx1*yx2 + yx1*xx2 + xy1*yv2 + yy1*xv2 + xy2*yv1 + yy2*xv1 y1 = xv1*yv1 + xv2*yv2 + xx1*yy1 + yx1*xy1 + xx2*yy2 + yx2*xy2 y2 = xx1*yy2 + yx1*xy2 + xx2*yy1 + yx2*xy1 + xv1*yv2 + yv1*xv2 v1 = xy1*yy1 + xy2*yy2 + xx1*yv1 + yx1*xv1 + xx2*yv2 + yx2*xv2 v2 = xx1*yv2 + yx1*xv2 + xx2*yv1 + yx2*xv1 + xy1*yy2 + yy1*xy2 elseif (@formula == 1) xx1 = x1 + cx xx2 = x2 - cx xy1 = y1 + cy xy2 = y2 - cy xv1 = v1 + cv xv2 = v2 - cv yx1 = x1 - cx yx2 = x2 + cx yy1 = y1 - cy yy2 = y2 + cy yv1 = v1 - cv yv2 = v2 + cv x1 = xx1*yx1 + xx2*yx2 + xy1*yy2 + yy1*xy2 + xv1*yv2 + yv1*xv2 x2 = xx1*yx2 + yx1*xx2 + xy1*yv2 + yy1*xv2 + xy2*yv1 + yy2*xv1 y1 = xy2*yy2 + xv2*yv2 + xx1*yy1 + yx1*xy1 + xx2*yv1 + yx2*xv1 y2 = xy1*yy1 + xv1*yv1 + xx1*yy2 + yx1*xy2 + xx2*yv2 + yx2*xv2 v1 = xx1*yv1 + yx1*xv1 + xx2*yy1 + yx2*xy1 + xy2*yv2 + yy2*xv2 v2 = xx1*yv2 + yx1*xv2 + xx2*yy2 + yx2*xy2 + xy1*yv1 + yy1*xv1 elseif (@formula == 2) xx1 = x1 + cx xx2 = x2 - cx xy1 = y1 + cy xy2 = y2 - cy xv1 = v1 + cv xv2 = v2 - cv yx1 = x1 - cx yx2 = x2 + cx yy1 = y1 - cy yy2 = y2 + cy yv1 = v1 - cv yv2 = v2 + cv x1 = xx1*yx1 + xx2*yx2 + xy1*yy2 + xy2*yy1 + xv1*yv2 + xv2*yv1 x2 = xx1*yx2 + xx2*yx1 + xy1*yy1 + xy2*yy2 + xv1*yv1 + xv2*yv2 y1 = xx1*yy1 + yx1*xy1 + xx2*yy2 + yx2*xy2 y2 = xx1*yy2 + yx1*xy2 + xx2*yy1 + yx2*xy1 v1 = xx1*yv1 + yx1*xv1 + xx2*yv2 + yx2*xv2 v2 = xx1*yv2 + yx1*xv2 + xx2*yv1 + yx2*xv1 endif if (@flavor == 0) z = x1 - x2 + flip(y1 - y2) elseif (@flavor == 1) z = x1 - x2 + y1 - y2 endif bailout: |x1| + |x2| + |y1| + |y2| + |v1| + |v2| < @bailout default: title = "Triternions XY Sets" magn = 2.0 angle = 0 method = multipass periodicity = 0 maxiter = 500 float param version default = 0.0 visible = false endparam Heading caption = "Mandelbrot Mode" visible = (@mode == 0) Endheading Heading caption = "Julia Mode" visible = (@mode == 1) Endheading param mode caption = "Mode" enum = "Mandelbrot" "Julia" default = 0 visible = false endparam param switchmode caption = "Switch Mode" enum = "Mandelbrot" "Julia" default = 1 visible = false endparam param formula caption = "Select Formula" enum = "MrT-XY_Set""3D-XY_Set""Classic T-XY_Set" default = 0 endparam param var caption = "Variation" enum = "1""2""3""4" default = 0 endparam param c1i caption = "(c1, ci)" default = (0.0, 0.0) visible = @mode == 1 endparam param cjk caption = "(cj, ck)" default = (0.0, 0.0) endparam param zjk caption = "(zj, zk)" default = (0.0, 0.0) visible = @mode == 1 endparam param p1 caption = "Plane rotation" default = (1.0, 0.0) endparam param zjkinitmethod caption = "zjk init method" enum = "1:(real(zjk), imag(zjk))" "2:(+ zjk, - zjk)" visible = @mode == 1 endparam param flavor caption = "Combine flavor" enum = "1:(z=x1-x2+flip(y1-y2))" "2:(z=x1-x2+y1-y2)" endparam param bailout caption = "Bailout Value" default = 64.0 min = 1.0 endparam switch: type = "gnd-triternions_XY" version = @version c1i = #pixel cjk = @cjk p1 = @p1 var = @var formula = @formula flavor = @flavor bailout = @bailout mode = @switchmode switchmode = @mode } gnd-CP8_XY { ; based on formulae ; 1 CP8e of Russell Walsmith and ; 2 CQuatXY of Junichi Sato. ; Gilles Nadeau, June, 2004 ; init: complex z = (0.0, 0.0) complex c = (0.0, 0.0) complex w = @p1 complex x1 = (0.0, 0.0) complex x2 = (0.0, 0.0) complex y1 = (0.0, 0.0) complex y2 = (0.0, 0.0) complex v1 = (0.0, 0.0) complex v2 = (0.0, 0.0) complex w1 = (0.0, 0.0) complex w2 = (0.0, 0.0) complex cx = (0.0, 0.0) complex cy = (0.0, 0.0) complex cv = @cjk complex cw = @cjk2 if (@mode == "Mandelbrot") ; hold the initial Z constant for all points, ; vary the constant C across the complex plane z = (0.0, 0.0) c = #pixel elseif (@mode == "Julia") ; vary the initial Z across the complex plane ; hold C constant for all points z = #pixel c = @c1i endif if (@var == 0) x1 = real(z) x2 = - real(z) y1 = imag(z)*w y2 = - imag(z)*w cx = real(c) cy = imag(c)*w elseif (@var == 1) x1 = flip(real(z)) x2 = - flip(real(z)) y1 = flip(imag(z)*w) y2 = - flip(imag(z)*w) cx = flip(real(c)) cy = flip(imag(c)*w) elseif (@var == 2) x1 = real(z) x2 = - real(z) y1 = flip(imag(z)*w) y2 = - flip(imag(z)*w) cx = real(c) cy = flip(imag(c)*w) elseif (@var == 3) x1 = flip(real(z)) x2 = - flip(real(z)) y1 = imag(z)*w y2 = - imag(z)*w cx = flip(real(c)) cy = imag(c)*w endif if (@zjkinitmethod == 0) v1 = real(@zjk) v2 = imag(@zjk) w1 = real(@zjk2) w2 = imag(@zjk2) elseif (@zjkinitmethod == 1) v1 = @zjk v2 = - @zjk w1 = @zjk2 w2 = - @zjk2 endif loop: xx1 = x1 + cx xx2 = x2 - cx xy1 = y1 + cy xy2 = y2 - cy xv1 = v1 + cv xv2 = v2 - cv xw1 = w1 + cw xw2 = w2 - cw yx1 = x1 - cx yx2 = x2 + cx yy1 = y1 - cy yy2 = y2 + cy yv1 = v1 - cv yv2 = v2 + cv yw1 = w1 - cw yw2 = w2 + cw x1 = xx1*yx1 + xx2*yx2 + xy1*yy2 + yy1*xy2 + xv1*yv2 + yv1*xv2 + xw1*yw2 + yw1*xw2 x2 = xy1*yy1 + xy2*yy2 + xx1*yx2 + yx1*xx2 + xv1*yw1 + yv1*xw1 + xv2*yw2 + yv2*xw2 y1 = xv1*yv1 + xw2*yw2 + xx1*yy1 + yx1*xy1 + xx2*yy2 + yx2*xy2 + xv2*yw1 + yv2*xw1 y2 = xv2*yv2 + xw2*yw2 + xx1*yy2 + yx1*xy2 + xx2*yy1 + yx2*xy1 + xv1*yw2 + yv1*xw2 v1 = xx1*yv1 + yx1*xv1 + xx2*yw2 + yx2*xw2 + xy1*yv2 + yy1*xv2 + xy2*yw1 + yy2*xw1 v2 = xx1*yv2 + yx1*xv2 + xx2*yw1 + yx2*xw1 + xy1*yw2 + yy1*xw2 + xy2*yv1 + yy2*xv1 w1 = xx1*yw1 + yx1*xw1 + xx2*yv2 + yx2*xv2 + xy1*yv1 + yy1*xv1 + xy2*yw2 + yy2*xw2 w2 = xx1*yw2 + yx1*xw2 + xx2*yv1 + yx2*xv1 + xy1*yw1 + yy1*xw1 + xy2*yv2 + yy2*xv2 if (@flavor == 0) z = x1 - x2 + flip(y1 - y2) elseif (@flavor == 1) z = x1 - x2 + y1 - y2 endif bailout: |x1| + |x2| + |y1| + |y2| + |v1| + |v2| + |w1| + |w2| < @bailout default: title = "CP8 XY Set" magn = 2.0 angle = 0 method = multipass periodicity = 0 maxiter = 500 float param version default = 0.0 visible = false endparam Heading caption = "Mandelbrot Mode" visible = (@mode == 0) Endheading Heading caption = "Julia Mode" visible = (@mode == 1) Endheading param mode caption = "Mode" enum = "Mandelbrot" "Julia" default = 0 visible = false endparam param switchmode caption = "Switch Mode" enum = "Mandelbrot" "Julia" default = 1 visible = false endparam param var caption = "Variation" enum = "1""2""3""4" default = 0 endparam param c1i caption = "(c1, ci)" default = (0.0, 0.0) visible = @mode == 1 endparam param cjk caption = "1st. (cj, ck)" default = (0.0, 0.0) endparam param cjk2 caption = "2nd. (cj, ck)" default = (0.0, 0.0) endparam param zjk caption = "1st. (zj, zk)" default = (0.0, 0.0) visible = @mode == 1 endparam param zjk2 caption = "2nd. (zj, zk)" default = (0.0, 0.0) visible = @mode == 1 endparam param p1 caption = "Plane rotation" default = (1.0, 0.0) endparam param zjkinitmethod caption = "zjk init method" enum = "1:(real(zjk), imag(zjk))" "2:(+ zjk, - zjk)" visible = @mode == 1 endparam param flavor caption = "Combine flavor" enum = "1:(z=x1-x2+flip(y1-y2))" "2:(z=x1-x2+y1-y2)" endparam param bailout caption = "Bailout Value" default = 64.0 min = 1.0 endparam switch: type = "gnd-CP8_XY" version = @version c1i = #pixel cjk = @cjk cjk2 = @cjk2 p1 = @p1 var = @var flavor = @flavor bailout = @bailout mode = @switchmode switchmode = @mode } gnd-CCT-XY_set { ; this formula is similar at D4e of Russell Walsmith ; based on formulae ; 1 D4e of Russell Walsmith and ; 2 CQuatXY of Junichi Sato. ; Gilles Nadeau, June, 2004 ; init: complex z = (0.0, 0.0) complex c = (0.0, 0.0) complex w = @p1 complex x1 = (0.0, 0.0) complex x2 = (0.0, 0.0) complex y1 = (0.0, 0.0) complex y2 = (0.0, 0.0) complex v1 = (0.0, 0.0) complex v2 = (0.0, 0.0) complex w1 = (0.0, 0.0) complex w2 = (0.0, 0.0) complex cx = (0.0, 0.0) complex cy = (0.0, 0.0) complex cv = @cjk complex cw = @cjk2 if (@mode == "Mandelbrot") ; hold the initial Z constant for all points, ; vary the constant C across the complex plane z = (0.0, 0.0) c = #pixel elseif (@mode == "Julia") ; vary the initial Z across the complex plane ; hold C constant for all points z = #pixel c = @c1i endif if (@var == 0) x1 = real(z) x2 = - real(z) y1 = imag(z)*w y2 = - imag(z)*w cx = real(c) cy = imag(c)*w elseif (@var == 1) x1 = flip(real(z)) x2 = - flip(real(z)) y1 = flip(imag(z)*w) y2 = - flip(imag(z)*w) cx = flip(real(c)) cy = flip(imag(c)*w) elseif (@var == 2) x1 = real(z) x2 = - real(z) y1 = flip(imag(z)*w) y2 = - flip(imag(z)*w) cx = real(c) cy = flip(imag(c)*w) elseif (@var == 3) x1 = flip(real(z)) x2 = - flip(real(z)) y1 = imag(z)*w y2 = - imag(z)*w cx = flip(real(c)) cy = imag(c)*w endif if (@zjkinitmethod == 0) v1 = real(@zjk) v2 = imag(@zjk) w1 = real(@zjk2) w2 = imag(@zjk2) elseif (@zjkinitmethod == 1) v1 = @zjk v2 = - @zjk w1 = @zjk2 w2 = - @zjk2 endif loop: xx1 = x1 + cx xx2 = x2 - cx xy1 = y1 + cy xy2 = y2 - cy xv1 = v1 + cv xv2 = v2 - cv xw1 = w1 + cw xw2 = w2 - cw yx1 = x1 - cx yx2 = x2 + cx yy1 = y1 - cy yy2 = y2 + cy yv1 = v1 - cv yv2 = v2 + cv yw1 = w1 - cw yw2 = w2 + cw x1 = xx1*yx1 + xx2*yx2 + xy1*yy2 + yy1*xy2 + xv1*yv2 + yv1*xv2 + xw1*yw2 + yw1*xw2 x2 = xx1*yx2 + yx1*xx2 + xy1*yy1 + xy2*yy2 + xv1*yv1 + xv2*yv2 + xw1*yw1 + xw2*yw2 y1 = xx1*yy1 + yx1*xy1 + xx2*yy2 + yx2*xy2 + xv1*yw1 + xv2*yw2 + xv1*yw2 + xv2*yw1 y2 = xx1*yy2 + yx1*xy2 + xx2*yy1 + yx2*xy1 + xv1*yw2 + xv2*yw1 + xv1*yw1 + xv2*yw2 v1 = xx1*yv1 + yx1*xv1 + xx2*yv2 + yx2*xv2 + xy1*yw1 + xy2*yw2 + xy1*yw2 + xy2*yw1 v2 = xx1*yv2 + yx1*xv2 + xx2*yv1 + yx2*xv1 + xy2*yw1 + xy1*yw2 + xy1*yw1 + xy2*yw2 w1 = xx1*yw1 + yx1*xw1 + xx2*yw2 + yx2*xw2 + xy1*yv1 + xy2*yv2 + xy1*yv2 + xy2*yv1 w2 = xx1*yw2 + yx1*xw2 + xx2*yw1 + yx2*xw1 + xy2*yv1 + xy1*yv2 + xy1*yv1 + xy2*yv2 if (@flavor == 0) z = x1 - x2 + flip(y1 - y2) elseif (@flavor == 1) z = x1 - x2 + y1 - y2 endif bailout: |x1| + |x2| + |y1| + |y2| + |v1| + |v2| + |w1| + |w2| < @bailout default: title = "Complexified T-XY Set" magn = 2.0 angle = 0 method = multipass periodicity = 0 maxiter = 500 float param version default = 0.0 visible = false endparam Heading caption = "Mandelbrot Mode" visible = (@mode == 0) Endheading Heading caption = "Julia Mode" visible = (@mode == 1) Endheading param mode caption = "Mode" enum = "Mandelbrot" "Julia" default = 0 visible = false endparam param switchmode caption = "Switch Mode" enum = "Mandelbrot" "Julia" default = 1 visible = false endparam param var caption = "Variation" enum = "1""2""3""4" default = 0 endparam param c1i caption = "(c1, ci)" default = (0.0, 0.0) visible = @mode == 1 endparam param cjk caption = "1st. (cj, ck)" default = (0.0, 0.0) endparam param cjk2 caption = "2nd. (cj, ck)" default = (0.0, 0.0) endparam param zjk caption = "1st. (zj, zk)" default = (0.0, 0.0) visible = @mode == 1 endparam param zjk2 caption = "2nd. (zj, zk)" default = (0.0, 0.0) visible = @mode == 1 endparam param p1 caption = "Plane rotation" default = (1.0, 0.0) endparam param zjkinitmethod caption = "zjk init method" enum = "1:(real(zjk), imag(zjk))" "2:(+ zjk, - zjk)" visible = @mode == 1 endparam param flavor caption = "Combine flavor" enum = "1:(z=x1-x2+flip(y1-y2))" "2:(z=x1-x2+y1-y2)" endparam param bailout caption = "Bailout Value" default = 64.0 min = 1.0 endparam switch: type = "gnd-CCT-XY_set" version = @version c1i = #pixel cjk = @cjk cjk2 = @cjk2 p1 = @p1 var = @var flavor = @flavor bailout = @bailout mode = @switchmode switchmode = @mode } gnd-mandphoenixfnhyperclx { ; Gilles Nadeau, June, 2004 ; init: ;default to Mandelbrot z = (0.0, 0.0) + #pixel complex w = (0.0, 0.0) complex temp = (0.0, 0.0) complex zjk = (0.0, 0.0) complex c1i = #pixel complex cjk = @p1 if( @mode == "Julia" ) z = #pixel w = (0.0, 0.0) temp = (0.0, 0.0) zjk = @p3 c1i = @p2 cjk = @p1 endif loop: a = c1i * @fn1(z - imag(zjk) + flip(real(zjk))) b = c1i * @fn1(z + imag(zjk) - flip(real(zjk))) temp = (a + b) / 2 + @induct * w zjk = (flip(real(b)) + imag(a) - imag(b) - flip(real(a))) / 2 + cjk w = z z = temp bailout: |z| + |zjk| <= @bailout switch: type = "gnd-mandphoenixfnhyperclx" version = @version p1 = @p1 p2 = #pixel induct = @induct bailout = @bailout fn1 = @fn1 mode = @switchmode switchMode = mode default: title = "4D Phoenix Mandelbrot c * fn(z)" maxiter = 500 periodicity = 0 method = multipass float param version default = 0.0 visible = false endparam param mode caption = "Current Mode" default = 0 enum = "Mandelbrot" "Julia" visible = false endparam param switchMode caption = "Switch Mode" default = 1 enum = "Mandelbrot" "Julia" visible = false endparam heading caption = "Mandelbrot Mode" visible = @mode==0 endheading heading caption = "Julia Mode" visible = @mode==1 endheading param p2 caption = "(c1, ci)" default = (0.0, 0.0) visible = @mode == 1 endparam param p1 caption = "(cj, ck)" default = (0.0, 0.0) endparam param p3 caption = "(zj, zk)" default = (0.0, 0.0) visible = @mode == 1 endparam param induct caption = "Phoenix Distortion" default = (0.5, 0.0) endparam param bailout caption = "Bailout value" default = 64.0 min = 1 endparam func fn1 caption = "First Function" default = cos() endfunc } gnd-CCubicQuat { ; Gilles Nadeau, June, 2004 ; init: complex z = (0.0, 0.0) complex w = @p1 complex v = @p2 complex u = @p3 complex cz = (0.0, 0.0) complex cw = @seedw complex cv = @seedv complex cu = @seedu complex qz = (0.0, 0.0) complex qw = (0.0, 0.0) complex qv = (0.0, 0.0) complex qu = (0.0, 0.0) complex tz = (0.0, 0.0) complex tw = (0.0, 0.0) complex tv = (0.0, 0.0) complex tu = (0.0, 0.0) if (@mode == "Mandelbrot") z = (0.0, 0.0) cz = #pixel elseif (@mode == "Julia") z = #pixel cz = @seedz endif qz = sqr(z) qw = sqr(w) qv = sqr(v) qu = sqr(u) loop: if (@formula == 0) tz = z*qz - 3*qw*z - 3*qv*z - 3*qu*z tw = 3*qz*w - 3*qv*w - 3*qu*w - w*qw tv = 3*qz*v - 3*qw*v - 3*qu*v - v*qv tu = 3*qz*u - 3*qw*u - 3*qv*u - u*qu z = tz + cz w = tw + cw v = tv + cv u = tu + cu elseif (@formula == 1) tz = z*qz - 3*qw*z - 3*qv*z - 3*qu*z tw = 3*qz*w - w*qw tv = 3*qz*v - v*qv tu = 3*qz*u - u*qu z = tz + cz w = tw + cw v = tv + cv u = tu + cu endif qz = sqr(z) qw = sqr(w) qv = sqr(v) qu = sqr(u) bailout: |z| + |w| + |v| + |u| <= @bailout default: title = "Complexified Cubic Quaternion" magn = 1.0 angle = 0 method = multipass periodicity = 0 maxiter = 500 float param version default = 0.0 visible = false endparam Heading caption = "Mandelbrot Mode" visible = (@mode == 0) Endheading Heading caption = "Julia Mode" visible = (@mode == 1) Endheading param mode caption = "Mode" enum = "Mandelbrot" "Julia" default = 0 visible = false endparam param switchmode caption = "Switch Mode" enum = "Mandelbrot" "Julia" default = 1 visible = false endparam param formula caption = "Select formula" enum = "First" "Second" default = 0 endparam param seedz caption = "(c1, ci)" default = (0.0, 0.0) visible = @mode == 1 endparam param seedw caption = "1st. (cj, ck)" default = (0.0, 0.0) endparam param seedv caption = "2nd. (cj, ck)" default = (0.0, 0.0) endparam param seedu caption = "3rd. (cj, ck)" default = (0.0, 0.0) endparam param p1 caption = "1st. (zj, zk)" default = (0.0, 0.0) visible = @mode == 1 endparam param p2 caption = "2nd. (zj, zk)" default = (0.0, 0.0) visible = @mode == 1 endparam param p3 caption = "3rd. (zj, zk)" default = (0.0, 0.0) visible = @mode == 1 endparam param bailout caption = "Bailout Value" default = 64.0 min = 1.0 endparam switch: type = "gnd-CCubicQuat" version = @version formula = @formula seedz = #pixel seedw = @seedw seedv = @seedv seedu = @seedu bailout = @bailout mode = @switchmode switchmode = @mode } gnd-CCubic_T { ; Gilles Nadeau, June, 2004 ; init: complex z = (0.0, 0.0) complex c = (0.0, 0.0) complex x = (0.0, 0.0) complex y = (0.0, 0.0) complex w = @p1 complex v = @p2 complex u = @p3 complex cx = (0.0, 0.0) complex cy = (0.0, 0.0) complex cw = @seedw complex cv = @seedv complex cu = @seedu complex qx = (0.0, 0.0) complex qy = (0.0, 0.0) complex qw = (0.0, 0.0) complex qv = (0.0, 0.0) complex qu = (0.0, 0.0) complex tx = (0.0, 0.0) complex ty = (0.0, 0.0) complex tw = (0.0, 0.0) complex tv = (0.0, 0.0) complex tu = (0.0, 0.0) if (@mode == "Mandelbrot") z = (0.0, 0.0) c = #pixel elseif (@mode == "Julia") z = #pixel c = @seed endif if (@var == 0) x = real(z) y = imag(z) cx = real(c) cy = imag(c) elseif (@var == 1) x = flip(real(z)) y = flip(imag(z)) cx = flip(real(c)) cy = flip(imag(c)) elseif (@var == 2) x = real(z) y = flip(imag(z)) cx = real(c) cy = flip(imag(c)) elseif (@var == 3) x = flip(real(z)) y = imag(z) cx = flip(real(c)) cy = imag(c) endif qx = sqr(x) qy = sqr(y) qw = sqr(w) qv = sqr(v) qu = sqr(u) loop: tx = x*qx - 3*qy*x - 3*qw*x - 3*qv*x - 3*qu*x ty = 3*qx*y - 3*qw*y - 3*qv*y - 3*qu*y - y*qy tw = 3*qx*w - 3*qy*w - 3*qv*w - 3*qu*w - w*qw tv = 3*qx*v - 3*qy*v - 3*qw*v - 3*qu*v - v*qv tu = 3*qx*u - 3*qy*u - 3*qw*u - 3*qv*u - u*qu x = tx + cx y = ty + cy w = tw + cw v = tv + cv u = tu + cu qx = sqr(x) qy = sqr(y) qw = sqr(w) qv = sqr(v) qu = sqr(u) if (@flavor == 0) z = x + flip(y) elseif (@flavor == 1) z = x + y endif bailout: |x| + |y| + |w| + |v| + |u| <= @bailout default: title = "Complexified Cubic Triternion" magn = 1.0 angle = 0 method = multipass periodicity = 0 maxiter = 500 float param version default = 0.0 visible = false endparam Heading caption = "Mandelbrot Mode" visible = (@mode == 0) Endheading Heading caption = "Julia Mode" visible = (@mode == 1) Endheading param mode caption = "Mode" enum = "Mandelbrot" "Julia" default = 1 visible = false endparam param switchmode caption = "Switch Mode" enum = "Mandelbrot" "Julia" default = 0 visible = false endparam param var caption = "Variation" enum = "1""2""3""4" default = 0 endparam param seed caption = "(c1, ci)" default = (0.0, 0.764) visible = @mode == 1 endparam param seedw caption = "1st. (cj, ck)" default = (0.0, 0.113) endparam param seedv caption = "2nd. (cj, ck)" default = (0.0, 0.0) endparam param seedu caption = "3rd. (cj, ck)" default = (0.0, 0.0) endparam param p1 caption = "1st. (zj, zk)" default = (0.0, 0.0) visible = @mode == 1 endparam param p2 caption = "2nd. (zj, zk)" default = (0.0, 0.0) visible = @mode == 1 endparam param p3 caption = "3rd. (zj, zk)" default = (0.0, 0.0) visible = @mode == 1 endparam param flavor caption = "Combine flavor" enum = "1:(z=x+flip(y))" "2:(z=x+y)" endparam param bailout caption = "Bailout Value" default = 64.0 min = 1.0 endparam switch: type = "gnd-CCubic_T" version = @version seed = #pixel seedw = @seedw seedv = @seedv seedu = @seedu var = @var flavor = @flavor bailout = @bailout mode = @switchmode switchmode = @mode } gnd-popcornjulclx { ; Gilles Nadeau, June, 2004 ; init: complex z = #pixel float x = real(z) float y = imag(z) float x_temp = 0.0 float y_temp = 0.0 loop: x_temp = x - real(@h * @fn1(y + @fn2(@c * y))) \ - imag(@h * @fn3(x + @fn4(@c * x))) y_temp = y - real(@h * @fn3(x + @fn4(@c * x))) \ - imag(@h * @fn1(y + @fn2(@c * y))) x = x_temp y = y_temp z = x + flip(y) bailout: |z| <= @bailout default: title = "Popcorn Julia Complex" magn = 0.7 angle = 0 method = multipass periodicity = 0 maxiter = 500 float param version default = 0.0 visible = false endparam param h caption = "Step size" default = (0.05, 0.0) endparam param c caption = "Constant C" default = (3.0, 0.0) endparam func fn1 caption = "First Function" default = sin() endfunc func fn2 caption = "Second Function" default = tan() endfunc func fn3 caption = "Third Function" default = sin() endfunc func fn4 caption = "Fourth Function" default = tan() endfunc param bailout caption = "Bailout value" default = 4.0 endparam } gnd-popcorn { ; Gilles Nadeau, july, 2004 ; init: complex z = #pixel float x = real(z) float y = imag(z) float x_temp = 0.0 float y_temp = 0.0 int iter = 0 loop: iter = iter + 1 x_temp = x - real(@h * @fn1(y + @fn2(@c * y))) \ - imag(@h * @fn3(x + @fn4(@c * x))) y_temp = y - real(@h * @fn3(x + @fn4(@c * x))) \ - imag(@h * @fn1(y + @fn2(@c * y))) x = x_temp y = y_temp z = x + flip(y) bailout: iter < #maxiter default: title = "Popcorn" magn = 0.7 angle = 0 method = multipass periodicity = 0 maxiter = 20 float param version default = 0.0 visible = false endparam param h caption = "Step size" default = (0.05, 0.0) endparam param c caption = "Constant C" default = (3.0, 0.0) endparam func fn1 caption = "First Function" default = sin() endfunc func fn2 caption = "Second Function" default = tan() endfunc func fn3 caption = "Third Function" default = sin() endfunc func fn4 caption = "Fourth Function" default = tan() endfunc } gnd-hypercomplexpopcornjul { ; Gilles Nadeau, March, 2005 ; init: complex z = #pixel complex w = @ct complex h = @h complex cc = @cc complex cd = @cw complex ca = cc + cd*1i complex cb = cc - cd*1i float xa = 0.0 float ya = 0.0 float xb = 0.0 float yb = 0.0 loop: xa = real(z) - imag(w) ya = imag(z) + real(w) xb = real(z) + imag(w) yb = imag(z) - real(w) if (@var == 0) a = xa - h * @fn1(ya + @fn2(cc * ya)) \ +flip(ya - h * @fn3(xa + @fn4(cc * xa))) b = xb - h * @fn1(yb + @fn2(cc * yb)) \ +flip(yb - h * @fn3(xb + @fn4(cc * xb))) z = (a + b) / 2 w = (b - a)*1i / 2 + cd elseif (@var == 1) a = xa - h * @fn1(ya + @fn2(ca * ya)) \ +flip(ya - h * @fn3(xa + @fn4(ca * xa))) b = xb - h * @fn1(yb + @fn2(cb * yb)) \ +flip(yb - h * @fn3(xb + @fn4(cb * xb))) z = (a + b) / 2 w = (b - a)*1i / 2 endif bailout: |z| + |w| <= @bailout default: title = "Popcorn Julia (hypercomplex)" maxiter = 149 magn = 0.7 float param version default = 1.16 visible = false endparam param var caption = "Variation" enum = "First""Second" endparam param h caption = "Step size" default = (0.05, 0.0) endparam param cc caption = "Constant C" default = (3.0, 0.0) endparam param cw caption = "Constant D" default = (0.0, 0.0) endparam param ct caption = "4-dim value" default = (0.0, 0.0) endparam func fn1 caption = "First Function" default = sin() endfunc func fn2 caption = "Second Function" default = tan() endfunc func fn3 caption = "Third Function" default = sin() endfunc func fn4 caption = "Fourth Function" default = tan() endfunc param bailout caption = "Bailout value" default = 4.0 endparam } gnd-hypercomplexpopcorn { ; Gilles Nadeau, March, 2005 ; init: complex z = #pixel complex w = @ct complex h = @h complex cc = @cc complex cd = @cw complex ca = cc + cd*1i complex cb = cc - cd*1i float xa = 0.0 float ya = 0.0 float xb = 0.0 float yb = 0.0 int iter = 0 loop: xa = real(z) - imag(w) ya = imag(z) + real(w) xb = real(z) + imag(w) yb = imag(z) - real(w) if (@var == 0) a = xa - h * @fn1(ya + @fn2(cc * ya)) \ +flip(ya - h * @fn3(xa + @fn4(cc * xa))) b = xb - h * @fn1(yb + @fn2(cc * yb)) \ +flip(yb - h * @fn3(xb + @fn4(cc * xb))) z = (a + b) / 2 w = (b - a)*1i / 2 + cd elseif (@var == 1) a = xa - h * @fn1(ya + @fn2(ca * ya)) \ +flip(ya - h * @fn3(xa + @fn4(ca * xa))) b = xb - h * @fn1(yb + @fn2(cb * yb)) \ +flip(yb - h * @fn3(xb + @fn4(cb * xb))) z = (a + b) / 2 w = (b - a)*1i / 2 endif iter = iter + 1 bailout: iter < #maxiter default: title = "Popcorn (hypercomplex)" maxiter = 20 magn = 0.2 float param version default = 1.16 visible = false endparam param var caption = "Variation" enum = "First""Second" endparam param h caption = "Step size" default = (0.05, 0.0) endparam param cc caption = "Constant C" default = (3.0, 0.0) endparam param cw caption = "Constant D" default = (0.0, 0.0) endparam param ct caption = "(zj, zk)" default = (0.0, 0.0) endparam func fn1 caption = "First Function" default = sin() endfunc func fn2 caption = "Second Function" default = tan() endfunc func fn3 caption = "Third Function" default = sin() endfunc func fn4 caption = "Fourth Function" default = tan() endfunc } gnd-hypercomplexdynamic { ; Gilles Nadeau, March, 2005 ; init: complex z = #pixel complex w = @ct complex dt = @dt complex aa = @aa complex cc = @ba complex cd = @cw complex ca = cc + cd*1i complex cb = cc - cd*1i float xa = 0.0 float ya = 0.0 float xb = 0.0 float yb = 0.0 int iter = 0 loop: xa = real(z) - imag(w) ya = imag(z) + real(w) xb = real(z) + imag(w) yb = imag(z) - real(w) if (@var == 0) a = xa - dt * @fn1(ya + aa * @fn2(cc * ya)) \ +flip(ya + dt * @fn3(xa + aa * @fn4(cc * xa))) b = xb - dt * @fn1(yb + aa * @fn2(cc * yb)) \ +flip(yb + dt * @fn3(xb + aa * @fn4(cc * xb))) z = (a + b) / 2 w = (b - a)*1i / 2 + cd elseif (@var == 1) a = xa - dt * @fn1(ya + aa * @fn2(ca * ya)) \ +flip(ya + dt * @fn3(xa + aa * @fn4(ca * xa))) b = xb - dt * @fn1(yb + aa * @fn2(cb * yb)) \ +flip(yb + dt * @fn3(xb + aa * @fn4(cb * xb))) z = (a + b) / 2 w = (b - a)*1i / 2 endif iter = iter + 1 bailout: iter < #maxiter default: title = "Dynamic (hypercomplex)" maxiter = 20 magn = 0.2 float param version default = 1.15 visible = false endparam param var caption = "Variation" enum = "First""Second" endparam param dt caption = "Step size" default = (0.05, 0.0) endparam param aa caption = "Alpha" default = (3.0, 0.0) endparam param ba caption = "Beta" default = (3.0, 0.0) endparam param cw caption = "Gamma" default = (0.0, 0.0) endparam param ct caption = "(zj, zk)" default = (0.0, 0.0) endparam func fn1 caption = "First Function" default = sin() endfunc func fn2 caption = "Second Function" default = sin() endfunc func fn3 caption = "Third Function" default = sin() endfunc func fn4 caption = "Fourth Function" default = sin() endfunc } gnd-4Dimensional { ; Gilles Nadeau, July, 2004 ; init: complex z = (0.0, 0.0) complex w = (0.0, 0.0) complex cz = (0.0, 0.0) complex cw = (0.0, 0.0) complex a = (0.0, 0.0) complex b = (0.0, 0.0) float ax = 0.0 float ay = 0.0 float bx = 0.0 float by = 0.0 float x1 = 0.0 float yi = 0.0 float zj = 0.0 float wk = 0.0 float c1 = 0.0 float ci = 0.0 float cj = 0.0 float ck = 0.0 float x1_temp = 0.0 float yi_temp = 0.0 float zj_temp = 0.0 float wk_temp = 0.0 if (@mode == "Mandelbrot") z = (0.0, 0.0) w = (0.0, 0.0) cz = #pixel cw = @cjk elseif (@mode == "Julia") z = #pixel w = @zjk cz = @c1i cw = @cjk endif if (@var == 0) x1 = real(z) yi = imag(z) zj = real(w) wk = imag(w) c1 = real(cz) ci = imag(cz) cj = real(cw) ck = imag(cw) elseif (@var == 1) x1 = real(w) yi = imag(w) zj = real(z) wk = imag(z) c1 = real(cw) ci = imag(cw) cj = real(cz) ck = imag(cz) elseif (@var == 2) x1 = real(z) yi = imag(w) zj = real(w) wk = imag(z) c1 = real(cz) ci = imag(cw) cj = real(cw) ck = imag(cz) elseif (@var == 3) x1 = real(w) yi = imag(z) zj = real(z) wk = imag(w) c1 = real(cw) ci = imag(cz) cj = real(cz) ck = imag(cw) endif loop: if (@formula == 0) a = @fn1(x1 - wk + flip(yi + zj)) ^ @power b = @fn1(x1 + wk + flip(yi - zj)) ^ @power ax = real(a), ay = imag(a) bx = real(b), by = imag(b) x1 = (ax + bx) / 2 + c1 yi = (ay + by) / 2 + ci zj = (ay - by) / 2 + cj wk = (bx - ax) / 2 + ck elseif (@formula == 1) x1_temp = x1*x1 - yi*yi - zj*zj + wk*wk yi_temp = x1*yi + yi*x1 - zj*wk - wk*zj zj_temp = x1*zj - yi*wk + zj*x1 - wk*yi wk_temp = x1*wk + yi*zj + zj*yi + wk*x1 x1 = x1_temp + c1 yi = yi_temp + ci zj = zj_temp + cj wk = wk_temp + ck elseif (@formula == 2) x1_temp = x1*x1 - yi*yi - zj*zj - wk*wk yi_temp = x1*yi + yi*x1 + zj*wk - wk*zj zj_temp = x1*zj - yi*wk + zj*x1 + wk*yi wk_temp = x1*wk + yi*zj - zj*yi + wk*x1 x1 = x1_temp + c1 yi = yi_temp + ci zj = zj_temp + cj wk = wk_temp + ck elseif (@formula == 3) x1_temp = x1*x1 + yi*zj + zj*yi yi_temp = x1*yi + yi*x1 + zj*zj zj_temp = x1*zj + zj*x1 + yi*yi x1 = x1_temp + c1 yi = yi_temp + ci zj = zj_temp + cj elseif (@formula == 4) x1_temp = x1*x1*x1 - 3*yi*yi*x1 + 3*zj*zj*x1 yi_temp = 3*x1*x1*yi + 3*zj*zj*yi - yi*yi*yi zj_temp = 3*x1*x1*zj - 3*yi*yi*zj + zj*zj*zj x1 = x1_temp + c1 yi = yi_temp + ci zj = zj_temp + cj elseif (@formula == 5) if (1 < |z| + |w|) a = @fn2(x1 - wk + flip(yi + zj)) b = @fn2(x1 + wk + flip(yi - zj)) ax = real(a), ay = imag(a) bx = real(b), by = imag(b) x1 = (ax + bx) / 2 + c1 yi = (ay + by) / 2 + ci zj = (ay - by) / 2 + cj wk = (bx - ax) / 2 + ck endif a = (x1 - wk + flip(yi + zj)) ^ @exp b = (x1 + wk + flip(yi - zj)) ^ @exp ax = real(a), ay = imag(a) bx = real(b), by = imag(b) x1 = (ax + bx) / 2 + c1 yi = (ay + by) / 2 + ci zj = (ay - by) / 2 + cj wk = (bx - ax) / 2 + ck elseif (@formula == 6) a = cz * @fn3(x1 - wk + flip(yi + zj)) ^ @exp2 b = cz * @fn3(x1 + wk + flip(yi - zj)) ^ @exp2 ax = real(a), ay = imag(a) bx = real(b), by = imag(b) x1 = (ax + bx) / 2 + c1 yi = (ay + by) / 2 + ci zj = (ay - by) / 2 + cj wk = (bx - ax) / 2 + ck endif z = x1 + flip(yi) w = zj + flip(wk) bailout: |z| + |w| <= @bailout default: title = "4-Dimensional Sets" magn = 1.0 angle = 0 method = multipass periodicity = 0 maxiter = 149 float param version default = 0.0 visible = false endparam Heading caption = "Mandelbrot Mode" visible = (@mode == 0) Endheading Heading caption = "Julia Mode" visible = (@mode == 1) Endheading param mode caption = "Mode" enum = "Mandelbrot" "Julia" default = 0 visible = false endparam param switchmode caption = "Switch Mode" enum = "Mandelbrot" "Julia" default = 1 visible = false endparam param formula caption = "Select Formula" enum = "Hypercomplex""Classic H""Classic Quaternion" \ "Triternion""T Cubic""Fender C""c * fn(z) + c" default = 0 endparam param var caption = "Variation" enum = "xy""zw""xw""yz" default = 0 endparam param c1i caption = "(c1, ci)" default = (0.0, 0.0) visible = @mode == 1 endparam param cjk caption = "(cj, ck)" default = (0.0, 0.0) endparam param zjk caption = "(zj, zk)" default = (0.0, 0.0) visible = @mode == 1 endparam param power caption = "Exponent" default = (2.0, 0.0) visible = @formula == 0 endparam param exp caption = "Exponent" default = (2.0, 0.0) visible = @formula == 5 endparam param exp2 caption = "Exponent" default = (1.0, 0.0) visible = @formula == 6 endparam param bailout caption = "Bailout Value" default = 64.0 min = 1.0 endparam func fn1 caption = "First Function" default = ident() visible = @formula == 0 endfunc func fn2 caption = "First Function" default = cosh() visible = @formula == 5 endfunc func fn3 caption = "First Function" default = sqr() visible = @formula == 6 endfunc switch: type = "gnd-4Dimensional" version = @version c1i = #pixel cjk = @cjk formula = @formula var = @var power = @power exp = @exp exp2 = @exp2 bailout = @bailout fn1 = @fn1 fn2 = @fn2 fn3 = @fn3 mode = @switchmode switchmode = @mode } gnd-CHyper_Jset {; Complexified Quaternion Julia formula ; Gilles Nadeau, July, 2004 ; init: complex z = #pixel complex w = @zjk complex v = @zjk2 complex u = @zjk3 complex cz = @c1i complex cw = @cjk complex cv = @cjk2 complex cu = @cjk3 float zr = 0.0 float zi = 0.0 float wr = 0.0 float wi = 0.0 float vr = 0.0 float vi = 0.0 float ur = 0.0 float ui = 0.0 float czr = 0.0 float czi = 0.0 float cwr = 0.0 float cwi = 0.0 float cvr = 0.0 float cvi = 0.0 float cur = 0.0 float cui = 0.0 if (@var == 0) zr = real(z) zi = imag(z) wr = real(w) wi = imag(w) vr = real(v) vi = imag(v) ur = real(u) ui = imag(u) czr = real(cz) czi = imag(cz) cwr = real(cw) cwi = imag(cw) cvr = real(cv) cvi = imag(cv) cur = real(cu) cui = imag(cu) elseif (@var == 1) zr = real(w) zi = imag(w) wr = real(z) wi = imag(z) vr = real(v) vi = imag(v) ur = real(u) ui = imag(u) czr = real(cw) czi = imag(cw) cwr = real(cz) cwi = imag(cz) cvr = real(cv) cvi = imag(cv) cur = real(cu) cui = imag(cu) elseif (@var == 2) zr = real(z) zi = imag(w) wr = real(w) wi = imag(z) vr = real(v) vi = imag(v) ur = real(u) ui = imag(u) czr = real(cz) czi = imag(cw) cwr = real(cw) cwi = imag(cz) cvr = real(cv) cvi = imag(cv) cur = real(cu) cui = imag(cu) elseif (@var == 3) zr = real(w) zi = imag(z) wr = real(z) wi = imag(w) vr = real(v) vi = imag(v) ur = real(u) ui = imag(u) czr = real(cw) czi = imag(cz) cwr = real(cz) cwi = imag(cw) cvr = real(cv) cvi = imag(cv) cur = real(cu) cui = imag(cu) endif loop: a1 = @fn1(zr - wi + flip(zi + wr)) ^ @power b1 = @fn1(zr + wi + flip(zi - wr)) ^ @power a2 = @fn1(zr - vi + flip(zi + vr)) ^ @power b2 = @fn1(zr + vi + flip(zi - vr)) ^ @power a3 = @fn1(zr - ui + flip(zi + ur)) ^ @power b3 = @fn1(zr + ui + flip(zi - ur)) ^ @power nz = 2*@fn1(zr + flip(zi)) ^ @power z = ((a1 + b1) + (a2 + b2) + (a3 + b3)) / 2 - nz w = (imag(a1) - imag(b1) + flip(real(b1) - real(a1))) / 2 v = (imag(a2) - imag(b2) + flip(real(b2) - real(a2))) / 2 u = (imag(a3) - imag(b3) + flip(real(b3) - real(a3))) / 2 zr = real(z) + czr zi = imag(z) + czi wr = real(w) + cwr wi = imag(w) + cwi vr = real(v) + cvr vi = imag(v) + cvi ur = real(u) + cur ui = imag(u) + cui z = zr + flip(zi) w = wr + flip(wi) v = vr + flip(vi) u = ur + flip(ui) bailout: |z| + |w| + |v| + |u| <= @bailout default: title = "C Hypercomplex Julia Set" magn = 1.0 method = multipass periodicity = 0 maxiter = 149 float param version default = 1.0 visible = false endparam param var caption = "Variation" enum = "xy""zw""xw""yz" default = 0 endparam param c1i caption = "(c1, ci)" default = (-0.745, 0.0) endparam param cjk caption = "1st. (cj, ck)" default = (0.113, 0.05) endparam param cjk2 caption = "2nd. (cj, ck)" default = (0.0, 0.0) endparam param cjk3 caption = "3rd. (cj, ck)" default = (0.0, 0.0) endparam param zjk caption = "1st.(zj, zk)" default = (0.0, 0.0) endparam param zjk2 caption = "2nd. (zj, zk)" default = (0.0, 0.0) endparam param zjk3 caption = "3rd. (zj, zk)" default = (0.0, 0.0) endparam param power caption = "Exponent" default = (1.0, 0.0) endparam param bailout caption = "Bailout Value" default = 64.0 min = 1.0 endparam func fn1 caption = "First Function" default = sqr() endfunc switch: type = "gnd-CHyper_Mset" version = @version cjk = @cjk cjk2 = @cjk2 cjk3 = @cjk3 var = @var power = @power fn1 = @fn1 bailout = @bailout } gnd-CHyper_Mset {; Complexified Quaternion Mandel formula ; Gilles Nadeau, July, 2004 ; init: complex z = (0.0, 0.0) complex w = (0.0, 0.0) complex v = (0.0, 0.0) complex u = (0.0, 0.0) complex cz = #pixel complex cw = @cjk complex cv = @cjk2 complex cu = @cjk3 float zr = 0.0 float zi = 0.0 float wr = 0.0 float wi = 0.0 float vr = 0.0 float vi = 0.0 float ur = 0.0 float ui = 0.0 float czr = 0.0 float czi = 0.0 float cwr = 0.0 float cwi = 0.0 float cvr = 0.0 float cvi = 0.0 float cur = 0.0 float cui = 0.0 if (@var == 0) zr = real(z) zi = imag(z) wr = real(w) wi = imag(w) vr = real(v) vi = imag(v) ur = real(u) ui = imag(u) czr = real(cz) czi = imag(cz) cwr = real(cw) cwi = imag(cw) cvr = real(cv) cvi = imag(cv) cur = real(cu) cui = imag(cu) elseif (@var == 1) zr = real(w) zi = imag(w) wr = real(z) wi = imag(z) vr = real(v) vi = imag(v) ur = real(u) ui = imag(u) czr = real(cw) czi = imag(cw) cwr = real(cz) cwi = imag(cz) cvr = real(cv) cvi = imag(cv) cur = real(cu) cui = imag(cu) elseif (@var == 2) zr = real(z) zi = imag(w) wr = real(w) wi = imag(z) vr = real(v) vi = imag(v) ur = real(u) ui = imag(u) czr = real(cz) czi = imag(cw) cwr = real(cw) cwi = imag(cz) cvr = real(cv) cvi = imag(cv) cur = real(cu) cui = imag(cu) elseif (@var == 3) zr = real(w) zi = imag(z) wr = real(z) wi = imag(w) vr = real(v) vi = imag(v) ur = real(u) ui = imag(u) czr = real(cw) czi = imag(cz) cwr = real(cz) cwi = imag(cw) cvr = real(cv) cvi = imag(cv) cur = real(cu) cui = imag(cu) endif loop: a1 = @fn1(zr - wi + flip(zi + wr)) ^ @power b1 = @fn1(zr + wi + flip(zi - wr)) ^ @power a2 = @fn1(zr - vi + flip(zi + vr)) ^ @power b2 = @fn1(zr + vi + flip(zi - vr)) ^ @power a3 = @fn1(zr - ui + flip(zi + ur)) ^ @power b3 = @fn1(zr + ui + flip(zi - ur)) ^ @power nz = 2*@fn1(zr + flip(zi)) ^ @power z = ((a1 + b1) + (a2 + b2) + (a3 + b3)) / 2 - nz w = (imag(a1) - imag(b1) + flip(real(b1) - real(a1))) / 2 v = (imag(a2) - imag(b2) + flip(real(b2) - real(a2))) / 2 u = (imag(a3) - imag(b3) + flip(real(b3) - real(a3))) / 2 zr = real(z) + czr zi = imag(z) + czi wr = real(w) + cwr wi = imag(w) + cwi vr = real(v) + cvr vi = imag(v) + cvi ur = real(u) + cur ui = imag(u) + cui z = zr + flip(zi) w = wr + flip(wi) v = vr + flip(vi) u = ur + flip(ui) bailout: |z| + |w| + |v| + |u| <= @bailout default: title = "C Hypercomplex Mandelbrot Set" magn = 1.0 method = multipass periodicity = 0 maxiter = 149 float param version default = 1.0 visible = false endparam param var caption = "Variation" enum = "xy""zw""xw""yz" default = 0 endparam param cjk caption = "1st. (cj, ck)" default = (0.0, 0.0) endparam param cjk2 caption = "2nd. (cj, ck)" default = (0.0, 0.0) endparam param cjk3 caption = "3rd. (cj, ck)" default = (0.0, 0.0) endparam param power caption = "Exponent" default = (1.0, 0.0) endparam param bailout caption = "Bailout Value" default = 64.0 min = 1.0 endparam func fn1 caption = "First Function" default = sin() endfunc switch: type = "gnd-CHyper_Jset" version = @version c1i = #pixel cjk = @cjk cjk2 = @cjk2 cjk3 = @cjk3 var = @var power = @power fn1 = @fn1 bailout = @bailout } gnd-CubicQuatJul { ; Gilles Nadeau, July, 2004 ; Inspired by ; 1 QuatJul v18 of Jon Horner ; 2 Ptest2 of Russell Walsmith ; init: complex z = #pixel complex w = @zjk complex cz = @c1i complex cw = @cjk float a = real(z) float b = imag(z) float c = real(w) float d = imag(w) float ca = real(cz) float cb = imag(cz) float cc = real(cw) float cd = imag(cw) float a1 = a float bi = b float cj = c float dk = d loop: float qa = sqr(a) float qb = sqr(b) float qc = sqr(c) float qd = sqr(d) if (@var == 0) a1 = a*qa - 3*a*qb - 3*a*qc + 3*a*qd bi =-b*qb + 3*b*qa - 3*b*qc + 3*b*qd cj =-c*qc + 3*c*qa - 3*c*qb + 3*c*qd dk = d*qd + 3*d*qa - 3*d*qb - 3*d*qc elseif (@var == 1) a1 = a*qa - 3*a*qb - 3*a*qc - 3*a*qd bi =-b*qb + 3*b*qa - b*qc - b*qd cj =-c*qc + 3*c*qa - c*qb - c*qd dk =-d*qd + 3*d*qa - d*qb - d*qc endif a = a1 + ca b = bi + cb c = cj + cc d = dk + cd z = a + flip(b) w = c + flip(d) bailout: |z| + |w| <= @bailout default: title = "Cubic Quaternion Julia Set" maxiter = 500 periodicity = 0 method = multipass float param version default = 1.0 visible = false endparam param var caption = "Variation" enum = "First""Second" endparam param c1i caption = "(c1, ci)" default = (0.0, 0.764) endparam param cjk caption = "(cj, ck)" default = (0.0, 0.113) endparam param zjk caption = "(zj, zk)" default = (0.0, 0.0) endparam param bailout caption = "Bailout value" default = 64.0 endparam switch: type = "gnd-CubicQuat" version = @version cjk = @cjk var = @var bailout = @bailout } gnd-CubicQuat { ; Gilles Nadeau, July, 2004 ; init: complex z = (0.0, 0.0) complex w = (0.0, 0.0) complex cz = #pixel complex cw = @cjk float a = real(z) float b = imag(z) float c = real(w) float d = imag(w) float ca = real(cz) float cb = imag(cz) float cc = real(cw) float cd = imag(cw) float a1 = a float bi = b float cj = c float dk = d loop: float qa = sqr(a) float qb = sqr(b) float qc = sqr(c) float qd = sqr(d) if (@var == 0) a1 = a*qa - 3*a*qb - 3*a*qc + 3*a*qd bi =-b*qb + 3*b*qa - 3*b*qc + 3*b*qd cj =-c*qc + 3*c*qa - 3*c*qb + 3*c*qd dk = d*qd + 3*d*qa - 3*d*qb - 3*d*qc elseif (@var == 1) a1 = a*qa - 3*a*qb - 3*a*qc - 3*a*qd bi =-b*qb + 3*b*qa - b*qc - b*qd cj =-c*qc + 3*c*qa - c*qb - c*qd dk =-d*qd + 3*d*qa - d*qb - d*qc endif a = a1 + ca b = bi + cb c = cj + cc d = dk + cd z = a + flip(b) w = c + flip(d) bailout: |z| + |w| <= @bailout default: title = "Cubic Quaternion Mandelbrot Set" maxiter = 500 periodicity = 0 method = multipass float param version default = 1.0 visible = false endparam param var caption = "Variation" enum = "First""Second" endparam param cjk caption = "(cj, ck)" default = (0.0, 0.0) endparam param bailout caption = "Bailout value" default = 64.0 endparam switch: type = "gnd-CubicQuatJul" version = @version c1i = #pixel cjk = @cjk var = @var bailout = @bailout } gnd-popcorn_v { ; Gilles Nadeau, 24 Oct 2004 ; Inspired from the Advanced Gnarl formula from Mark Townsend. ; variations of Pickover's Popcorn. ; init: complex z = #pixel complex c1 = @c1 complex c2 = @c2 float x = real(z) float y = imag(z) float cx1 = real(c1) float cy1 = imag(c1) float cx2 = real(c2) float cy2 = imag(c2) float x_temp = 0.0 float y_temp = 0.0 int iter = 0 loop: bool scenario1 = false iter = iter + 1 ; Determine scenario to be used: if ( @seq == 1 ) ; First scenario scenario1 = true elseif ( @seq == 2 ) ; Second scenario scenario1 = false elseif ( iter % @modBy < @modCmp ); Modulation scenario1 = true endif if(scenario1 == true) x_temp = x - real(@h1 * @fn1(y + @fn2(cx1 * (y + @fn3(cy1 * y))))) y_temp = y - imag(@h1 * @fn4(x + @fn5(cx1 * (x + @fn6(cy1 * x))))) else x_temp = x - real(@h2 * @fn7(y + @fn8(cx2 * (y + @fn9(cy2 * y))))) y_temp = y - imag(@h2 * @fn10(x + @fn11(cx2 * (x + @fn12(cy2 * x))))) endif x = x_temp y = y_temp z = x + flip(y) bailout: iter < #maxiter default: title = "Popcorn V" magn = 0.2 method = multipass periodicity = 0 maxiter = 20 float param version default = 0.0 visible = false endparam int param seq enum = "Modulation" "First Scenario" "Second Scenario" default = 0 caption = "Scenario Sequence" endparam int param modBy default = 10 caption = "Mod By" hint = "Iteration Modulated by This" endparam int param modCmp default = 5 caption = "Mod Compare" hint = "Modulated Iteration < this -> formula 1" endparam heading caption = "Scenario 1" visible = @seq!=2 endheading param h1 caption = "Step size" default = (0.05, 0.05) visible = @seq!=2 endparam param c1 caption = "Constant C" default = (1.0, 2.0) visible = @seq!=2 endparam func fn1 caption = "First Function Y" default = sin() visible = @seq!=2 endfunc func fn2 caption = "Second Function Y" default = tan() visible = @seq!=2 endfunc func fn3 caption = "Third Function Y" default = ident() visible = @seq!=2 endfunc func fn4 caption = "First Function X" default = sin() visible = @seq!=2 endfunc func fn5 caption = "Second Function X" default = tan() visible = @seq!=2 endfunc func fn6 caption = "Third Function X" default = ident() visible = @seq!=2 endfunc heading caption = "Scenario 2" visible = @seq!=1 endheading param h2 caption = "Step size" default = (0.05, 0.05) visible = @seq!=1 endparam param c2 caption = "Constant C" default = (1.0, 2.0) visible = @seq!=1 endparam func fn7 caption = "First Function Y" default = sin() visible = @seq!=1 endfunc func fn8 caption = "Second Function Y" default = tan() visible = @seq!=1 endfunc func fn9 caption = "Third Function Y" default = ident() visible = @seq!=1 endfunc func fn10 caption = "First Function X" default = sin() visible = @seq!=1 endfunc func fn11 caption = "Second Function X" default = tan() visible = @seq!=1 endfunc func fn12 caption = "Third Function X" default = ident() visible = @seq!=1 endfunc } gnd-popcornjul_v { ; Gilles Nadeau, 24 Oct 2004 ; Inspired from the Advanced Gnarl formula from Mark Townsend ; variations of Pickover's Popcorn. ; init: complex z = #pixel complex c1 = @c1 complex c2 = @c2 float x = real(z) float y = imag(z) float cx1 = real(c1) float cy1 = imag(c1) float cx2 = real(c2) float cy2 = imag(c2) float x_temp = 0.0 float y_temp = 0.0 int iter = 0 loop: bool scenario1 = false iter = iter + 1 ; Determine scenario to be used: if ( @seq == 1 ) ; First scenario scenario1 = true elseif ( @seq == 2 ) ; Second scenario scenario1 = false elseif ( iter % @modBy < @modCmp ); Modulation scenario1 = true endif if(scenario1 == true) x_temp = x - real(@h1 * @fn1(y + @fn2(cx1 * (y + @fn3(cy1 * y))))) y_temp = y - imag(@h1 * @fn4(x + @fn5(cx1 * (x + @fn6(cy1 * x))))) else x_temp = x - real(@h2 * @fn7(y + @fn8(cx2 * (y + @fn9(cy2 * y))))) y_temp = y - imag(@h2 * @fn10(x + @fn11(cx2 * (x + @fn12(cy2 * x))))) endif x = x_temp y = y_temp z = x + flip(y) bailout: |z| < @bailout default: title = "Popcorn Julia V" magn = 0.7 method = multipass periodicity = 0 maxiter = 500 float param version default = 0.0 visible = false endparam float param bailout caption = "Bailout Value" default = 4.0 endparam int param seq enum = "Modulation" "First Scenario" "Second Scenario" default = 0 caption = "Scenario Sequence" endparam int param modBy default = 10 caption = "Mod By" hint = "Iteration Modulated by This" endparam int param modCmp default = 5 caption = "Mod Compare" hint = "Modulated Iteration < this -> formula 1" endparam heading caption = "Scenario 1" visible = @seq!=2 endheading param h1 caption = "Step size" default = (0.05, 0.05) visible = @seq!=2 endparam param c1 caption = "Constant C" default = (1.0, 2.0) visible = @seq!=2 endparam func fn1 caption = "First Function Y" default = sin() visible = @seq!=2 endfunc func fn2 caption = "Second Function Y" default = tan() visible = @seq!=2 endfunc func fn3 caption = "Third Function Y" default = ident() visible = @seq!=2 endfunc func fn4 caption = "First Function X" default = sin() visible = @seq!=2 endfunc func fn5 caption = "Second Function X" default = tan() visible = @seq!=2 endfunc func fn6 caption = "Third Function X" default = ident() visible = @seq!=2 endfunc heading caption = "Scenario 2" visible = @seq!=1 endheading param h2 caption = "Step size" default = (0.05, 0.05) visible = @seq!=1 endparam param c2 caption = "Constant C" default = (1.0, 2.0) visible = @seq!=1 endparam func fn7 caption = "First Function Y" default = sin() visible = @seq!=1 endfunc func fn8 caption = "Second Function Y" default = tan() visible = @seq!=1 endfunc func fn9 caption = "Third Function Y" default = ident() visible = @seq!=1 endfunc func fn10 caption = "First Function X" default = sin() visible = @seq!=1 endfunc func fn11 caption = "Second Function X" default = tan() visible = @seq!=1 endfunc func fn12 caption = "Third Function X" default = ident() visible = @seq!=1 endfunc } gnd-BirdOfPrey { ; original formula by Jon Osuch ; UF version by Gilles Nadeau, 24 Oct 2004 init: ;default to Mandelbrot z = (0.0, 0.0) c = #pixel if( @mode == "Julia" ) z = #pixel c = @seed endif loop: z = @fn1(@fn2(@fn3(z) + c)) + c bailout: |z| <= @bailout default: title = "Bird Of Prey" maxiter = 149 periodicity = 0 method = multipass float param version default = 0.0 visible = false endparam param mode caption = "Current Mode" default = 0 enum = "Mandelbrot" "Julia" visible = false endparam param switchMode caption = "Switch Mode" default = 1 enum = "Mandelbrot" "Julia" visible = false endparam heading caption = "Mandelbrot Mode" visible = @mode==0 endheading heading caption = "Julia Mode" visible = @mode==1 endheading param seed caption = "Julia seed" default = (0.0, 0.0) visible = @mode == 1 endparam param bailout caption = "Bailout value" default = 4.0 min = 1 endparam func fn1 caption = "First Function" default = conj() endfunc func fn2 caption = "Second Function" default = cos() endfunc func fn3 caption = "Third Function" default = sqr() endfunc switch: type = "gnd-BirdOfPrey" version = @version seed = #pixel bailout = @bailout fn1 = @fn1 fn2 = @fn2 fn3 = @fn3 mode = @switchmode switchMode = mode } gnd-fBmGnarly { ; ; Modified Gnarly formula from Mark Townsend ; Compound with the models of fBm formulas from Damien M. Jones. ; Fractional Brownian Motion coloring method. ; ; This is the basic Gnarly 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. ; ; version 1.12, November 2004 ; Gilles Nadeau, 25/11/2004 ; init: z = #pixel complex oz = z float x = real(z) float y = imag(z) float xx = 0 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 xx = x if @formula == 0 ; Martin x = y - sin(x) y = @d - xx elseif @formula == 1 ; Popcorn x = x - real(@h * @pn1(y + @pn2(real(@c) * y))) y = y - imag(@h * @pn3(xx + @pn4(imag(@c) * xx))) elseif @formula == 2 ; Vine if @flavor == 0 x = x - real(@h * @vn1(y + @vn2(real(@a) * y ))) y = y + imag(@h * @vn3(xx + @vn4(imag(@a) * xx))) elseif @flavor == 1 x = x - real(@h * @vn1(y^real(@b) + @vn2(real(@a) * y))) y = y + imag(@h * @vn3(xx^imag(@b) + @vn4(imag(@a) * xx))) elseif @flavor == 2 x = x - real(@h * @vn1(y + @vn2(real(@a) * (y + @vn5(real(@a) * y))))) y = y + imag(@h * @vn3(xx + @vn4(imag(@a) * (xx + @vn6(imag(@a) * xx))))) else float newx = y float newy = x int j = 0 while j < @flavor j = j + 1 newx = y + real(@vn7(real(@a) * newx)) newy = x + real(@vn8(imag(@a) * newy)) endwhile x = x - real(@h * @vn9(newx)) y = y + imag(@h * @vn10(newy)) endif elseif @formula == 3 ; Gnarl x = x - real(@h * @gn1(y + @gn2(real(@a) * (y + @gn3(real(@b) * y))))) y = y + imag(@h * @gn4(xx + @gn5(imag(@a) * (xx + @gn6(imag(@b) * xx))))) elseif @formula == 4 ; Dynamic x = x - real(@h * @dn1(y + real(@a) * @dn2(real(@b) * y))) y = y + imag(@h * @dn3(xx + imag(@a) * @dn4(imag(@b) * xx))) endif z = x + flip(y) IF (@coloronly); only using fBm on coloring oz = z ENDIF if (@fBm == true) 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 fx0 = floor(real(p)) float fy0 = floor(imag(p)) float bx0 = fx0 % 256 float by0 = fy0 % 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) - fx0 float ry0 = imag(p) - fy0 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 + real(@nfn1(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+@coloroffset)*0.5*@distortion ENDIF 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 = "fBm Gnarly" maxiter = 20 periodicity = 0 method = multipass magn = 0.2 param version caption = "Version" default = 1.12 visible = false endparam param formula caption = "Formula" enum = "Martin" "Popcorn" "Vine" "Gnarl" "Dynamic" default = 1 endparam param h caption = "Step Size" default = (0.05, 0.05) visible = @formula == 1 || @formula == 2 || @formula == 3 || @formula == 4 endparam param a caption = "Alpha" default = (3.0, 3.0) visible = @formula == 2 || @formula == 3 || @formula == 4 endparam param b caption = "Beta" default = (2.0, 2.0) visible = @formula == 2 || @formula == 3 || @formula == 4 endparam param c caption = "Constant C" default = (3.0, 3.0) visible = @formula == 1 endparam float param d caption = "Martin Parameter" default = #pi visible = @formula == 0 endparam param flavor caption = "Vine flavor" hint = "This is the 'flavor' for the Vine formula." default = 2 min = 0 visible = @formula == 2 endparam param bailout caption = "Bailout" default = 1.0e20 endparam heading caption = "Popcorn functions" visible = @formula == 1 endheading func pn1 caption = "Popcorn #1" default = sin() visible = @formula == 1 endfunc func pn2 caption = "Popcorn #2" default = tan() visible = @formula == 1 endfunc func pn3 caption = "Popcorn #3" default = sin() visible = @formula == 1 endfunc func pn4 caption = "Popcorn #4" default = tan() visible = @formula == 1 endfunc heading caption = "Vine functions" visible = @formula == 2 endheading func vn1 caption = "Vine #1" default = sin() visible = @formula == 2 endfunc func vn2 caption = "Vine #2" default = sin() visible = @formula == 2 endfunc func vn3 caption = "Vine #3" default = sin() visible = @formula == 2 endfunc func vn4 caption = "Vine #4" default = sin() visible = @formula == 2 endfunc func vn5 caption = "Vine #5" default = sin() visible = @formula == 2 endfunc func vn6 caption = "Vine #6" default = sin() visible = @formula == 2 endfunc func vn7 caption = "Vine #7" default = sin() visible = @formula == 2 endfunc func vn8 caption = "Vine #8" default = sin() visible = @formula == 2 endfunc func vn9 caption = "Vine #9" default = sin() visible = @formula == 2 endfunc func vn10 caption = "Vine #10" default = sin() visible = @formula == 2 endfunc heading caption = "Gnarl functions" visible = @formula == 3 endheading func gn1 caption = "Gnarl #1" default = sin() visible = @formula == 3 endfunc func gn2 caption = "Gnarl #2" default = sin() visible = @formula == 3 endfunc func gn3 caption = "Gnarl #3" default = sin() visible = @formula == 3 endfunc func gn4 caption = "Gnarl #4" default = sin() visible = @formula == 3 endfunc func gn5 caption = "Gnarl #5" default = sin() visible = @formula == 3 endfunc func gn6 caption = "Gnarl #6" default = sin() visible = @formula == 3 endfunc heading caption = "Dynamic functions" visible = @formula == 4 endheading func dn1 caption = "Dynamic #1" default = sin() visible = @formula == 4 endfunc func dn2 caption = "Dynamic #2" default = tan() visible = @formula == 4 endfunc func dn3 caption = "Dynamic #3" default = sin() visible = @formula == 4 endfunc func dn4 caption = "Dynamic #4" default = tan() visible = @formula == 4 endfunc bool param fBm caption = "fBm texturing?" default = true endparam heading caption = "fBm Parameters" visible = @fBm == true endheading param distortion caption = "Distortion Strength" default = 1.0 hint = "This is the amount the noise distorts the image." visible = @fBm == true 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." visible = @fBm == true endparam param distangle caption = "Distortion Angle" default = 0.0 hint = "This is the angle to rotate the distortion." visible = @fBm == true 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." visible = @fBm == true 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." visible = @fBm == true endparam param coloroffset caption = "Coloring Offset" default = 0.0 hint = "Sets the coloring offset from zero. Increase this if you see \ large areas of solid color." visible = @fBm == true 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." visible = @fBm == true endparam param scale caption = "Noise Scale" default = 1.0 hint = "This is the overall scale of the noise." visible = @fBm == true endparam param angle caption = "Noise Rotation" default = 0.0 hint = "This is the angle, in degrees, of the noise." visible = @fBm == true endparam param step caption = "Noise Scale Step" default = 0.5 hint = "This is the step in scale between noise iterations." visible = @fBm == true endparam param anglestep caption = "Noise Rotation Step" default = 37.0 hint = "This is the angle, in degrees, to rotate between noise \ iterations." visible = @fBm == true endparam param octaves caption = "Noise Octaves" default = 7 min = 1 hint = "This is the number of iterations of the noise formula." visible = @fBm == true endparam param npower caption = "Noise Exponent" default = 2.0 hint = "This is the exponent used to scramble numbers." visible = @fBm == true endparam param noisestart caption = "Start Iteration" default = 0.0 hint = "This is the iteration at which to start adding noise." visible = @fBm == true endparam param noiseiter caption = "Noise Iterations" default = 10000.0 hint = "This is the number of iterations to add noise to." visible = @fBm == true endparam param noiseskip caption = "Skip Iterations" default = 0.0 hint = "This is the number of iterations to skip adding noise \ before starting again." visible = @fBm == true endparam func nfn1 caption = "Noise Function" default = ident() visible = @fBm == true endfunc param coloronly caption = "Coloring Only" default = true 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." visible = @fBm == true endparam } gnd-Gnarly+fBm { ; ; Modified Gnarly formula from Mark Townsend ; Compound with the models of fBm formulas from Damien M. Jones. ; Fractional Brownian Motion coloring method. ; ; This is the basic Gnarly 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. ; ; version 1.12, December 2004 ; Gilles Nadeau, 5/12/2004 ; ; Use outside coloring. ; init: z = #pixel complex oz = z float x = real(z) float y = imag(z) float xx = 0 int iter = 0 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 x = real(z) y = imag(z) xx = x if @formula == 0 ; Martin x = y - sin(x) y = @d - xx elseif @formula == 1 ; Popcorn x = x - real(@h * @pn1(y + @pn2(real(@c) * y))) y = y - imag(@h * @pn3(xx + @pn4(imag(@c) * xx))) elseif @formula == 2 ; Vine if @flavor == 0 x = x - real(@h * @vn1(y + @vn2(real(@a) * y ))) y = y + imag(@h * @vn3(xx + @vn4(imag(@a) * xx))) elseif @flavor == 1 x = x - real(@h * @vn1(y^real(@b) + @vn2(real(@a) * y))) y = y + imag(@h * @vn3(xx^imag(@b) + @vn4(imag(@a) * xx))) elseif @flavor == 2 x = x - real(@h * @vn1(y + @vn2(real(@a) * (y + @vn5(real(@a) * y))))) y = y + imag(@h * @vn3(xx + @vn4(imag(@a) * (xx + @vn6(imag(@a) * xx))))) else float newx = y float newy = x int j = 0 while j < @flavor j = j + 1 newx = y + real(@vn7(real(@a) * newx)) newy = x + real(@vn8(imag(@a) * newy)) endwhile x = x - real(@h * @vn9(newx)) y = y + imag(@h * @vn10(newy)) endif elseif @formula == 3 ; Gnarl x = x - real(@h * @gn1(y + @gn2(real(@a) * (y + @gn3(real(@b) * y))))) y = y + imag(@h * @gn4(xx + @gn5(imag(@a) * (xx + @gn6(imag(@b) * xx))))) elseif @formula == 4 ; Dynamic x = x - real(@h * @dn1(y + real(@a) * @dn2(real(@b) * y))) y = y + imag(@h * @dn3(xx + imag(@a) * @dn4(imag(@b) * xx))) endif z = x + flip(y) IF (@coloronly); only using fBm on coloring oz = z ENDIF if (@fBm == true) 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 fx0 = floor(real(p)) float fy0 = floor(imag(p)) float bx0 = fx0 % 256 float by0 = fy0 % 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) - fx0 float ry0 = imag(p) - fy0 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 + real(@nfn1(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+@coloroffset)*0.5*@distortion ENDIF endif IF (@coloronly == false); not just using fBm on coloring oz = z; value for bailout is fBm'ed z ENDIF iter = iter + 1 bailout: iter < #maxiter default: title = "Gnarly + fBm" maxiter = 20 periodicity = 0 method = multipass magn = 0.2 param version caption = "Version" default = 1.12 visible = false endparam param formula caption = "Formula" enum = "Martin" "Popcorn" "Vine" "Gnarl" "Dynamic" default = 1 endparam param h caption = "Step Size" default = (0.05, 0.05) visible = @formula == 1 || @formula == 2 || @formula == 3 || @formula == 4 endparam param a caption = "Alpha" default = (3.0, 3.0) visible = @formula == 2 || @formula == 3 || @formula == 4 endparam param b caption = "Beta" default = (2.0, 2.0) visible = @formula == 2 || @formula == 3 || @formula == 4 endparam param c caption = "Constant C" default = (3.0, 3.0) visible = @formula == 1 endparam float param d caption = "Martin Parameter" default = #pi visible = @formula == 0 endparam param flavor caption = "Vine flavor" hint = "This is the 'flavor' for the Vine formula." default = 2 min = 0 visible = @formula == 2 endparam heading caption = "Popcorn functions" visible = @formula == 1 endheading func pn1 caption = "Popcorn #1" default = sin() visible = @formula == 1 endfunc func pn2 caption = "Popcorn #2" default = tan() visible = @formula == 1 endfunc func pn3 caption = "Popcorn #3" default = sin() visible = @formula == 1 endfunc func pn4 caption = "Popcorn #4" default = tan() visible = @formula == 1 endfunc heading caption = "Vine functions" visible = @formula == 2 endheading func vn1 caption = "Vine #1" default = sin() visible = @formula == 2 endfunc func vn2 caption = "Vine #2" default = sin() visible = @formula == 2 endfunc func vn3 caption = "Vine #3" default = sin() visible = @formula == 2 endfunc func vn4 caption = "Vine #4" default = sin() visible = @formula == 2 endfunc func vn5 caption = "Vine #5" default = sin() visible = @formula == 2 endfunc func vn6 caption = "Vine #6" default = sin() visible = @formula == 2 endfunc func vn7 caption = "Vine #7" default = sin() visible = @formula == 2 endfunc func vn8 caption = "Vine #8" default = sin() visible = @formula == 2 endfunc func vn9 caption = "Vine #9" default = sin() visible = @formula == 2 endfunc func vn10 caption = "Vine #10" default = sin() visible = @formula == 2 endfunc heading caption = "Gnarl functions" visible = @formula == 3 endheading func gn1 caption = "Gnarl #1" default = sin() visible = @formula == 3 endfunc func gn2 caption = "Gnarl #2" default = sin() visible = @formula == 3 endfunc func gn3 caption = "Gnarl #3" default = sin() visible = @formula == 3 endfunc func gn4 caption = "Gnarl #4" default = sin() visible = @formula == 3 endfunc func gn5 caption = "Gnarl #5" default = sin() visible = @formula == 3 endfunc func gn6 caption = "Gnarl #6" default = sin() visible = @formula == 3 endfunc heading caption = "Dynamic functions" visible = @formula == 4 endheading func dn1 caption = "Dynamic #1" default = sin() visible = @formula == 4 endfunc func dn2 caption = "Dynamic #2" default = tan() visible = @formula == 4 endfunc func dn3 caption = "Dynamic #3" default = sin() visible = @formula == 4 endfunc func dn4 caption = "Dynamic #4" default = tan() visible = @formula == 4 endfunc bool param fBm caption = "fBm texturing?" default = true endparam heading caption = "fBm Parameters" visible = @fBm == true endheading param distortion caption = "Distortion Strength" default = 0.5 hint = "This is the amount the noise distorts the image." visible = @fBm == true 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." visible = @fBm == true endparam param distangle caption = "Distortion Angle" default = 0.0 hint = "This is the angle to rotate the distortion." visible = @fBm == true 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." visible = @fBm == true 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." visible = @fBm == true endparam param coloroffset caption = "Coloring Offset" default = 0.0 hint = "Sets the coloring offset from zero. Increase this if you see \ large areas of solid color." visible = @fBm == true 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." visible = @fBm == true endparam param scale caption = "Noise Scale" default = 1.0 hint = "This is the overall scale of the noise." visible = @fBm == true endparam param angle caption = "Noise Rotation" default = 0.0 hint = "This is the angle, in degrees, of the noise." visible = @fBm == true endparam param step caption = "Noise Scale Step" default = 0.5 hint = "This is the step in scale between noise iterations." visible = @fBm == true endparam param anglestep caption = "Noise Rotation Step" default = 37.0 hint = "This is the angle, in degrees, to rotate between noise \ iterations." visible = @fBm == true endparam param octaves caption = "Noise Octaves" default = 7 min = 1 hint = "This is the number of iterations of the noise formula." visible = @fBm == true endparam param npower caption = "Noise Exponent" default = 2.0 hint = "This is the exponent used to scramble numbers." visible = @fBm == true endparam param noisestart caption = "Start Iteration" default = 0.0 hint = "This is the iteration at which to start adding noise." visible = @fBm == true endparam param noiseiter caption = "Noise Iterations" default = 10000.0 hint = "This is the number of iterations to add noise to." visible = @fBm == true endparam param noiseskip caption = "Skip Iterations" default = 0.0 hint = "This is the number of iterations to skip adding noise \ before starting again." visible = @fBm == true endparam func nfn1 caption = "Noise Function" default = ident() visible = @fBm == true endfunc param coloronly caption = "Coloring Only" default = true 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." visible = @fBm == true endparam } gnd-4-D-Gnarly+fBm { ; ; Modified Gnarly formula from Mark Townsend ; Compound with the models of fBm formulas from Damien M. Jones. ; Fractional Brownian Motion coloring method. ; ; This is the basic Gnarly 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. ; ; version 1.25, May 2005 ; Gilles Nadeau, 16/05/2005 ; ; Use outside coloring. ; init: z = #pixel w = @ct complex oz = z complex ow = w complex nz = z complex nw = w complex ha = (0,0) complex hb = (0,0) float xa = 0.0 float ya = 0.0 float xb = 0.0 float yb = 0.0 float xc = 0.0 float xd = 0.0 float rx = 0.0 float ry = 0.0 float rz = 0.0 int iter = 0 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 ; (yz plane rotation) ry = imag(z)*cos(#pi*@rotx/180) - real(w)*sin(#pi*@rotx/180) rz = imag(z)*sin(#pi*@rotx/180) + real(w)*cos(#pi*@rotx/180) z = real(z) + ry*1i w = rz + imag(w)*1i ; (xz plane rotation) rx = real(w)*sin(#pi*@roty/180) + real(z)*cos(#pi*@roty/180) rz = real(w)*cos(#pi*@roty/180) - real(z)*sin(#pi*@roty/180) z = rx + imag(z)*1i w = rz + imag(w)*1i ; (xy plane rotation) rx = real(z)*cos(#pi*@rotz/180) - imag(z)*sin(#pi*@rotz/180) ry = real(z)*sin(#pi*@rotz/180) + imag(z)*cos(#pi*@rotz/180) z = rx + ry*1i if @fourthdim == 3 oz = z ow = w elseif @fourthdim == 2 oz = z ow = flip(w) elseif @fourthdim == 1 oz = w ow = z else oz = flip(w) ow = z endif z = oz w = ow loop: if (@fBm) 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 endif IF (@coloronly); only using fBm on coloring z = oz; restore z from un-fBm'ed copy w = ow ENDIF xa = real(z) - imag(w) ya = imag(z) + real(w) xb = real(z) + imag(w) yb = imag(z) - real(w) xc = xa xd = xb if @formula == 0 ; Martin xa = ya - real(@mn1(xa)) ya = @d - xc xb = yb - real(@mn1(xb)) yb = @d - xd elseif @formula == 1 ; Popcorn xa = xa - real(@h) * real(@pn1(ya + @pn2(real(@c) * ya))) ya = ya - imag(@h) * real(@pn3(xc + @pn4(imag(@c) * xc))) xb = xb - real(@h) * real(@pn1(yb + @pn2(real(@c) * yb))) yb = yb - imag(@h) * real(@pn3(xd + @pn4(imag(@c) * xd))) elseif @formula == 2 ; Vine if @flavor == 0 xa = xa - real(@h) * real(@vn1(ya + @vn2(real(@a) * ya))) ya = ya + imag(@h) * real(@vn3(xc + @vn4(imag(@a) * xc))) xb = xb - real(@h) * real(@vn1(yb + @vn2(real(@a) * yb))) yb = yb + imag(@h) * real(@vn3(xd + @vn4(imag(@a) * xd))) elseif @flavor == 1 xa = xa - real(@h) * real(@vn1(ya^real(@b) + @vn2(real(@a) * ya))) ya = ya + imag(@h) * real(@vn3(xc^imag(@b) + @vn4(imag(@a) * xc))) xb = xb - real(@h) * real(@vn1(yb^real(@b) + @vn2(real(@a) * yb))) yb = yb + imag(@h) * real(@vn3(xd^imag(@b) + @vn4(imag(@a) * xd))) elseif @flavor == 2 xa = xa - real(@h) * real(@vn1(ya + @vn2(real(@a) * (ya + @vn5(real(@a) * ya))))) ya = ya + imag(@h) * real(@vn3(xc + @vn4(imag(@a) * (xc + @vn6(imag(@a) * xc))))) xb = xb - real(@h) * real(@vn1(yb + @vn2(real(@a) * (yb + @vn5(real(@a) * yb))))) yb = yb + imag(@h) * real(@vn3(xd + @vn4(imag(@a) * (xd + @vn6(imag(@a) * xd))))) else float newxa = ya float newya = xa float newxb = yb float newyb = xb int j = 0 while j < @flavor j = j + 1 newxa = ya + real(@vn7(real(@a) * newxa)) newya = xa + real(@vn8(imag(@a) * newya)) newxb = yb + real(@vn7(real(@a) * newxb)) newyb = xb + real(@vn8(imag(@a) * newyb)) endwhile xa = xa - real(@h) * real(@vn9(newxa)) ya = ya + imag(@h) * real(@vn10(newya)) xb = xb - real(@h) * real(@vn9(newxb)) yb = yb + imag(@h) * real(@vn10(newyb)) endif elseif @formula == 3 ; Gnarl xa = xa - real(@h) * real(@gn1(ya + @gn2(real(@a) * (ya + @gn3(real(@b) * ya))))) ya = ya + imag(@h) * real(@gn4(xc + @gn5(imag(@a) * (xc + @gn6(imag(@b) * xc))))) xb = xb - real(@h) * real(@gn1(yb + @gn2(real(@a) * (yb + @gn3(real(@b) * yb))))) yb = yb + imag(@h) * real(@gn4(xd + @gn5(imag(@a) * (xd + @gn6(imag(@b) * xd))))) elseif @formula == 4 ; Dynamic xa = xa - real(@h) * real(@dn1(ya + real(@a) * @dn2(real(@b) * ya))) ya = ya + imag(@h) * real(@dn3(xc + imag(@a) * @dn4(imag(@b) * xc))) xb = xb - real(@h) * real(@dn1(yb + real(@a) * @dn2(real(@b) * yb))) yb = yb + imag(@h) * real(@dn3(xd + imag(@a) * @dn4(imag(@b) * xd))) endif ha = xa + flip(ya) hb = xb + flip(yb) z = (ha + hb) / 2 w = (hb - ha) / 2*1i IF (@coloronly); only using fBm on coloring oz = z ow = w ENDIF if (@version > 1.22) if @fourthdim == 3 z = oz w = ow elseif @fourthdim == 2 z = oz w = flip(ow) elseif @fourthdim == 1 z = ow w = oz else z = ow w = flip(oz) endif endif if (@fBm == true) IF (@noisemethod == 0) 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 fx = floor(real(p)) float fy = floor(imag(p)) float bx0 = fx % 256 float by0 = fy % 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) - fx float ry0 = imag(p) - fy 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 + real(@nfn1(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 + @coloroffset)*0.5*@distortion ENDIF ELSE IF (@noiseskip == 0.0 || noise); adding noise this iteration complex pa = ha * @scale * r + @offset complex pb = hb * @scale * r + @offset float suma = 0.0 float sumb = 0.0 float freq = 1.0 complex va = (0,0) complex vb = (0,0) int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxa = floor(real(pa)) float fya = floor(imag(pa)) float bx0a = fxa % 256 float by0a = fya % 256 IF (bx0a < 0) bx0a = bx0a + 256 ENDIF IF (by0a < 0) by0a = by0a + 256 ENDIF float bx1a = (bx0a + 1) % 256 float by1a = (by0a + 1) % 256 float rx0a = real(pa) - fxa float ry0a = imag(pa) - fya float rx1a = rx0a - 1 float ry1a = ry0a - 1 float fxb = floor(real(pb)) float fyb = floor(imag(pb)) float bx0b = fxb % 256 float by0b = fyb % 256 IF (bx0b < 0) bx0b = bx0b + 256 ENDIF IF (by0b < 0) by0b = by0b + 256 ENDIF float bx1b = (bx0b + 1) % 256 float by1b = (by0b + 1) % 256 float rx0b = real(pb) - fxb float ry0b = imag(pb) - fyb float rx1b = rx0b - 1 float ry1b = ry0b - 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 b00a = (bx0a^@npower % 65536 + by0a)^@npower % 65536 float b10a = (bx1a^@npower % 65536 + by0a)^@npower % 65536 float b01a = (bx0a^@npower % 65536 + by1a)^@npower % 65536 float b11a = (bx1a^@npower % 65536 + by1a)^@npower % 65536 float b00b = (bx0b^@npower % 65536 + by0b)^@npower % 65536 float b10b = (bx1b^@npower % 65536 + by0b)^@npower % 65536 float b01b = (bx0b^@npower % 65536 + by1b)^@npower % 65536 float b11b = (bx1b^@npower % 65536 + by1b)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0a = (b00a)^@npower*0.25 % 512 - 256 float g_b10_0a = (b10a)^@npower*0.25 % 512 - 256 float g_b01_0a = (b01a)^@npower*0.25 % 512 - 256 float g_b11_0a = (b11a)^@npower*0.25 % 512 - 256 float g_b00_1a = (b00a+1)^@npower*0.25 % 512 - 256 float g_b10_1a = (b10a+1)^@npower*0.25 % 512 - 256 float g_b01_1a = (b01a+1)^@npower*0.25 % 512 - 256 float g_b11_1a = (b11a+1)^@npower*0.25 % 512 - 256 float g_b00_0b = (b00b)^@npower*0.25 % 512 - 256 float g_b10_0b = (b10b)^@npower*0.25 % 512 - 256 float g_b01_0b = (b01b)^@npower*0.25 % 512 - 256 float g_b11_0b = (b11b)^@npower*0.25 % 512 - 256 float g_b00_1b = (b00b+1)^@npower*0.25 % 512 - 256 float g_b10_1b = (b10b+1)^@npower*0.25 % 512 - 256 float g_b01_1b = (b01b+1)^@npower*0.25 % 512 - 256 float g_b11_1b = (b11b+1)^@npower*0.25 % 512 - 256 ; normalize each vector float da = 0.0 float db = 0.0; da = 1 / sqrt(sqr(g_b00_0a) + sqr(g_b00_1a)) g_b00_0a = g_b00_0a * da g_b00_1a = g_b00_1a * da da = 1 / sqrt(sqr(g_b10_0a) + sqr(g_b10_1a)) g_b10_0a = g_b10_0a * da g_b10_1a = g_b10_1a * da da = 1 / sqrt(sqr(g_b01_0a) + sqr(g_b01_1a)) g_b01_0a = g_b01_0a * da g_b01_1a = g_b01_1a * da da = 1 / sqrt(sqr(g_b11_0a) + sqr(g_b11_1a)) g_b11_0a = g_b11_0a * da g_b11_1a = g_b11_1a * da db = 1 / sqrt(sqr(g_b00_0b) + sqr(g_b00_1b)) g_b00_0b = g_b00_0b * db g_b00_1b = g_b00_1b * db db = 1 / sqrt(sqr(g_b10_0b) + sqr(g_b10_1b)) g_b10_0b = g_b10_0b * db g_b10_1b = g_b10_1b * db db = 1 / sqrt(sqr(g_b01_0b) + sqr(g_b01_1b)) g_b01_0b = g_b01_0b * db g_b01_1b = g_b01_1b * db db = 1 / sqrt(sqr(g_b11_0b) + sqr(g_b11_1b)) g_b11_0b = g_b11_0b * db g_b11_1b = g_b11_1b * db ; produce colors for each corner float u1a = rx0a * g_b00_0a + ry0a * g_b00_1a float v1a = rx1a * g_b10_0a + ry0a * g_b10_1a float u2a = rx0a * g_b01_0a + ry1a * g_b01_1a float v2a = rx1a * g_b11_0a + ry1a * g_b11_1a float u1b = rx0b * g_b00_0b + ry0b * g_b00_1b float v1b = rx1b * g_b10_0b + ry0b * g_b10_1b float u2b = rx0b * g_b01_0b + ry1b * g_b01_1b float v2b = rx1b * g_b11_0b + ry1b * g_b11_1b ; interpolate between corners using ; bilinear filtering float sxa = sqr(rx0a) * (3 - rx0a*2) float sya = sqr(ry0a) * (3 - ry0a*2) float aa = u1a + sxa*(v1a-u1a) float ba = u2a + sxa*(v2a-u2a) float sxb = sqr(rx0b) * (3 - rx0b*2) float syb = sqr(ry0b) * (3 - ry0b*2) float ab = u1b + sxb*(v1b-u1b) float bb = u2b + sxb*(v2b-u2b) suma = suma + real(@nfn1(aa + sya*(ba-aa)))*freq sumb = sumb + real(@nfn1(ab + syb*(bb-ab)))*freq freq = freq * @step pa = pa * r2 / @step pb = pb * r2 / @step i = i - 1 ENDWHILE IF (@style == 0); radial distortion va = (ha-c)/cabs(ha-c) * r3; use vector based on angle to distortion center vb = (hb-c)/cabs(hb-c) * r3 ELSEIF (@style == 1); linear distortion va = r3; just use rotation vector vb = r3 ENDIF ha = ha + va * (suma + @coloroffset) * 0.5 * @distortion hb = hb + vb * (sumb + @coloroffset) * 0.5 * @distortion if (@version > 1.22) nz = (ha + hb) / 2 nw = (hb - ha) / 2*1i if @fourthdim == 3 z = nz w = nw elseif @fourthdim == 2 z = nz w = flip(nw) elseif @fourthdim == 1 z = nw w = nz else z = nw w = flip(nz) endif else z = (ha + hb) / 2 w = (hb - ha) / 2*1i endif ENDIF ENDIF endif IF (@coloronly == false); not just using fBm on coloring oz = z; value for bailout is fBm'ed z ow = w ENDIF iter = iter + 1 bailout: iter < #maxiter default: title = "4-D Gnarly + fBm" maxiter = 20 periodicity = 0 method = multipass magn = 0.2 param version caption = "Version" default = 1.25 visible = false endparam param formula caption = "Formula" enum = "Martin" "Popcorn" "Vine" "Gnarl" "Dynamic" default = 1 endparam param fourthdim caption = "Fourth dimension" enum = "z1" "zi" "zj" "zk" default = 3 endparam param h caption = "Step Size" default = (0.05, 0.05) visible = @formula == 1 || @formula == 2 || @formula == 3 || @formula == 4 endparam param a caption = "Alpha" default = (3.0, 3.0) visible = @formula == 2 || @formula == 3 || @formula == 4 endparam param b caption = "Beta" default = (2.0, 2.0) visible = @formula == 2 || @formula == 3 || @formula == 4 endparam param c caption = "Constant C" default = (3.0, 3.0) visible = @formula == 1 endparam float param d caption = "Martin Parameter" default = #pi visible = @formula == 0 endparam param flavor caption = "Vine flavor" hint = "This is the 'flavor' for the Vine formula." default = 2 min = 0 visible = @formula == 2 endparam param ct caption = "(zj, zk)" default = (0.0, 0.0) endparam param rotx caption = "x-rotation" hint = "Rotates yz-plane." default = 0.0 min = -360.0 max = 360.0 endparam param roty caption = "y-rotation" hint = "Rotates zx-plane." default = 0.0 min = -360.0 max = 360.0 endparam param rotz caption = "z-rotation" hint = "Rotates xy-plane." default = 0.0 min = -360.0 max = 360.0 endparam func mn1 caption = "Martin function" default = sin() visible = @formula == 0 endfunc heading caption = "Popcorn functions" visible = @formula == 1 endheading func pn1 caption = "Popcorn #1" default = sin() visible = @formula == 1 endfunc func pn2 caption = "Popcorn #2" default = tan() visible = @formula == 1 endfunc func pn3 caption = "Popcorn #3" default = sin() visible = @formula == 1 endfunc func pn4 caption = "Popcorn #4" default = tan() visible = @formula == 1 endfunc heading caption = "Vine functions" visible = @formula == 2 endheading func vn1 caption = "Vine #1" default = sin() visible = @formula == 2 endfunc func vn2 caption = "Vine #2" default = sin() visible = @formula == 2 endfunc func vn3 caption = "Vine #3" default = sin() visible = @formula == 2 endfunc func vn4 caption = "Vine #4" default = sin() visible = @formula == 2 endfunc func vn5 caption = "Vine #5" default = sin() visible = @formula == 2 endfunc func vn6 caption = "Vine #6" default = sin() visible = @formula == 2 endfunc func vn7 caption = "Vine #7" default = sin() visible = @formula == 2 endfunc func vn8 caption = "Vine #8" default = sin() visible = @formula == 2 endfunc func vn9 caption = "Vine #9" default = sin() visible = @formula == 2 endfunc func vn10 caption = "Vine #10" default = sin() visible = @formula == 2 endfunc heading caption = "Gnarl functions" visible = @formula == 3 endheading func gn1 caption = "Gnarl #1" default = sin() visible = @formula == 3 endfunc func gn2 caption = "Gnarl #2" default = sin() visible = @formula == 3 endfunc func gn3 caption = "Gnarl #3" default = sin() visible = @formula == 3 endfunc func gn4 caption = "Gnarl #4" default = sin() visible = @formula == 3 endfunc func gn5 caption = "Gnarl #5" default = sin() visible = @formula == 3 endfunc func gn6 caption = "Gnarl #6" default = sin() visible = @formula == 3 endfunc heading caption = "Dynamic functions" visible = @formula == 4 endheading func dn1 caption = "Dynamic #1" default = sin() visible = @formula == 4 endfunc func dn2 caption = "Dynamic #2" default = tan() visible = @formula == 4 endfunc func dn3 caption = "Dynamic #3" default = sin() visible = @formula == 4 endfunc func dn4 caption = "Dynamic #4" default = tan() visible = @formula == 4 endfunc bool param fBm caption = "fBm texturing?" default = true endparam heading caption = "fBm Parameters" visible = @fBm == true endheading param noisemethod caption = "Noise Method" enum = "normal" "fourth dimension" default = 0 visible = @fBm == true endparam param distortion caption = "Distortion Strength" default = 1.0 hint = "This is the amount the noise distorts the image." visible = @fBm == true 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." visible = @fBm == true endparam param distangle caption = "Distortion Angle" default = 0.0 hint = "This is the angle to rotate the distortion." visible = @fBm == true 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." visible = @fBm == true 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." visible = @fBm == true endparam param coloroffset caption = "Coloring Offset" default = 0.0 hint = "Sets the coloring offset from zero. Increase this if you see \ large areas of solid color." visible = @fBm == true 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." visible = @fBm == true endparam param scale caption = "Noise Scale" default = 1.0 hint = "This is the overall scale of the noise." visible = @fBm == true endparam param angle caption = "Noise Rotation" default = 0.0 hint = "This is the angle, in degrees, of the noise." visible = @fBm == true endparam param step caption = "Noise Scale Step" default = 0.5 hint = "This is the step in scale between noise iterations." visible = @fBm == true endparam param anglestep caption = "Noise Rotation Step" default = 37.0 hint = "This is the angle, in degrees, to rotate between noise \ iterations." visible = @fBm == true endparam param octaves caption = "Noise Octaves" default = 7 min = 1 hint = "This is the number of iterations of the noise formula." visible = @fBm == true endparam param npower caption = "Noise Exponent" default = 2.0 hint = "This is the exponent used to scramble numbers." visible = @fBm == true endparam param noisestart caption = "Start Iteration" default = 0.0 hint = "This is the iteration at which to start adding noise." visible = @fBm == true endparam param noiseiter caption = "Noise Iterations" default = 10000.0 hint = "This is the number of iterations to add noise to." visible = @fBm == true endparam param noiseskip caption = "Skip Iterations" default = 0.0 hint = "This is the number of iterations to skip adding noise \ before starting again." visible = @fBm == true endparam func nfn1 caption = "Noise Function" default = ident() visible = @fBm == true endfunc param coloronly caption = "Coloring Only" default = true 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." visible = @fBm == true && @version < 1.25 endparam } gnd-Slope_Gnarly { ; based upon the slope (Mandelbrot) ; formula of Damien Jones ; modified Gnarly formula from Mark Townsend ; compound with the models of slope formulas from Ron Barnett. ; version 1.22, December 2004 ; Gilles Nadeau, 07/12/2004 ; modified by Ron Barnett 03/10/2005 ; ; Use inside coloring. ; init: complex z1 = @tscale*#pixel; primary iterated point complex z2 = @tscale*#pixel + @offset; horizontally offset point complex z3 = @tscale*#pixel + flip(@offset); vertically offset point complex oldz1 = 0 complex oldz2 = 0 complex oldz3 = 0 int done = 2 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 iterexp1 = 0.0 float iterexp2 = 0.0 float iterexp3 = 0.0 complex polar = 0.0 complex af1 = 0.0 complex af2 = 0.0 loop: oldz1 = z1 float x = real(z1) float y = imag(z1) float xx = x if @formula == 0 ; Martin x = y - sin(x) y = @d - xx elseif @formula == 1 ; Popcorn x = x - real(@h * @pfn1(y + @pfn2(real(@c) * y))) y = y - imag(@h * @pfn3(xx + @pfn4(imag(@c) * xx))) elseif @formula == 2 ; Vine if @flavor == 0 x = x - real(@h * @vfn1(y + @vfn2(real(@aa) * y ))) y = y + imag(@h * @vfn3(xx + @vfn4(imag(@aa) * xx))) elseif @flavor == 1 x = x - real(@h * @vfn1(y^real(@ba) + @vfn2(real(@aa) * y))) y = y + imag(@h * @vfn3(xx^imag(@ba) + @vfn4(imag(@aa) * xx))) elseif @flavor == 2 x = x - real(@h * @vfn1(y + @vfn2(real(@aa) * (y + @vfn5(real(@aa) * y))))) y = y + imag(@h * @vfn3(xx + @vfn4(imag(@aa) * (xx + @vfn6(imag(@aa) * xx))))) else float newx = y float newy = x int j = 0 while j < @flavor j = j + 1 newx = y + real(@vfn7(real(@aa) * newx)) newy = x + real(@vfn8(imag(@aa) * newy)) endwhile x = x - real(@h * @vfn9(newx)) y = y + imag(@h * @vfn10(newy)) endif elseif @formula == 3 ; Gnarl x = x - real(@h * @gfn1(y + @gfn2(real(@aa) * (y + @gfn3(real(@ba) * y))))) y = y + imag(@h * @gfn4(xx + @gfn5(imag(@aa) * (xx + @gfn6(imag(@ba) * xx))))) elseif @formula == 4 ; Dynamic x = x - real(@h * @dfn1(y + real(@aa) * @dfn2(real(@ba) * y))) y = y + imag(@h * @dfn3(xx + imag(@aa) * @dfn4(imag(@ba) * xx))) endif z1 = x + flip(y) if (@slope == true) oldz2 = z2 float x = real(z2) float y = imag(z2) float xx = x if @formula == 0 ; Martin x = y - sin(x) y = @d - xx elseif @formula == 1 ; Popcorn x = x - real(@h * @pfn1(y + @pfn2(real(@c) * y))) y = y - imag(@h * @pfn3(xx + @pfn4(imag(@c) * xx))) elseif @formula == 2 ; Vine if @flavor == 0 x = x - real(@h * @vfn1(y + @vfn2(real(@aa) * y ))) y = y + imag(@h * @vfn3(xx + @vfn4(imag(@aa) * xx))) elseif @flavor == 1 x = x - real(@h * @vfn1(y^real(@ba) + @vfn2(real(@aa) * y))) y = y + imag(@h * @vfn3(xx^imag(@ba) + @vfn4(imag(@aa) * xx))) elseif @flavor == 2 x = x - real(@h * @vfn1(y + @vfn2(real(@aa) * (y + @vfn5(real(@aa) * y))))) y = y + imag(@h * @vfn3(xx + @vfn4(imag(@aa) * (xx + @vfn6(imag(@aa) * xx))))) else float newx = y float newy = x int j = 0 while j < @flavor j = j + 1 newx = y + real(@vfn7(real(@aa) * newx)) newy = x + real(@vfn8(imag(@aa) * newy)) endwhile x = x - real(@h * @vfn9(newx)) y = y + imag(@h * @vfn10(newy)) endif elseif @formula == 3 ; Gnarl x = x - real(@h * @gfn1(y + @gfn2(real(@aa) * (y + @gfn3(real(@ba) * y))))) y = y + imag(@h * @gfn4(xx + @gfn5(imag(@aa) * (xx + @gfn6(imag(@ba) * xx))))) elseif @formula == 4 ; Dynamic x = x - real(@h * @dfn1(y + real(@aa) * @dfn2(real(@ba) * y))) y = y + imag(@h * @dfn3(xx + imag(@aa) * @dfn4(imag(@ba) * xx))) endif z2 = x + flip(y) oldz3 = z3 float x = real(z3) float y = imag(z3) float xx = x if @formula == 0 ; Martin x = y - sin(x) y = @d - xx elseif @formula == 1 ; Popcorn x = x - real(@h * @pfn1(y + @pfn2(real(@c) * y))) y = y - imag(@h * @pfn3(xx + @pfn4(imag(@c) * xx))) elseif @formula == 2 ; Vine if @flavor == 0 x = x - real(@h * @vfn1(y + @vfn2(real(@aa) * y ))) y = y + imag(@h * @vfn3(xx + @vfn4(imag(@aa) * xx))) elseif @flavor == 1 x = x - real(@h * @vfn1(y^real(@ba) + @vfn2(real(@aa) * y))) y = y + imag(@h * @vfn3(xx^imag(@ba) + @vfn4(imag(@aa) * xx))) elseif @flavor == 2 x = x - real(@h * @vfn1(y + @vfn2(real(@aa) * (y + @vfn5(real(@aa) * y))))) y = y + imag(@h * @vfn3(xx + @vfn4(imag(@aa) * (xx + @vfn6(imag(@aa) * xx))))) else float newx = y float newy = x int j = 0 while j < @flavor j = j + 1 newx = y + real(@vfn7(real(@aa) * newx)) newy = x + real(@vfn8(imag(@aa) * newy)) endwhile x = x - real(@h * @vfn9(newx)) y = y + imag(@h * @vfn10(newy)) endif elseif @formula == 3 ; Gnarl x = x - real(@h * @gfn1(y + @gfn2(real(@aa) * (y + @gfn3(real(@ba) * y))))) y = y + imag(@h * @gfn4(xx + @gfn5(imag(@aa) * (xx + @gfn6(imag(@ba) * xx))))) elseif @formula == 4 ; Dynamic x = x - real(@h * @dfn1(y + real(@aa) * @dfn2(real(@ba) * y))) y = y + imag(@h * @dfn3(xx + imag(@aa) * @dfn4(imag(@ba) * xx))) endif z3 = x + flip(y) If @zmode==58 If @converge==true iterexp1 = iterexp1 + exp(-1/(cabs(oldz1 - z1))) iterexp2 = iterexp2 + exp(-1/(cabs(oldz2 - z2))) iterexp3 = iterexp3 + exp(-1/(cabs(oldz3 - z3))) else iterexp1 = iterexp1 + exp(-cabs(z1)) iterexp2 = iterexp2 + exp(-cabs(z2)) iterexp3 = iterexp3 + exp(-cabs(z3)) endif endif done = done + 1; increment iteration counter IF (@zmode == 0) ; 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 == 1) ; 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 == 2) ; 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 == 3) ; 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 == 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 |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 == 6) ; 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 == 7) ; smallest |function1(z)| d1 = abs(real(fn1(z1))) + abs(imag(fn1(z1))) ; get current distances d2 = abs(real(fn1(z2))) + abs(imag(fn1(z2))) d3 = abs(real(fn1(z3))) + abs(imag(fn1(z3))) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 8) ; smallest |function2(z)| d1 = cabs(fn1(z1)) ; get current distances d2 = cabs(fn1(z2)) d3 = cabs(fn1(z3)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 9) ; smallest Lemniscate Distance theta = atan(imag(#z)/real(#z)) r = 1.5*@a*(cos(2*theta))^0.5 polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 10) ; smallest Cardiod Distance theta = atan(imag(#z)/real(#z)) r = 5*@a*(1-cos(theta)) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 11) ; smallest Conchoid Distance theta = atan(imag(#z)/real(#z)) r = 0.2*(@a + @b*cos(theta))/cos(theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 12) ; smallest Cycloid Distance theta = atan(imag(#z)/real(#z)) r = 2*cabs(#z) polar = r*(theta-sin(theta)) + flip(r*(1-cos(theta))) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 13) ; smallest Archimedes Distance theta = atan(imag(#z)/real(#z)) r = 3.5*@a*theta polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 14) ; smallest Log Spiral Distance theta = atan(imag(#z)/real(#z)) r = exp(@a*theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 15) ; smallest Rose Distance theta = atan(imag(#z)/real(#z)) r = @a*cos(theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 16) ; smallest Bifolium Distance theta = atan(imag(#z)/real(#z)) r = 16*@a*sin(theta)^2*cos(theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 17) ; smallest Astroid Distance theta = atan(imag(#z)/real(#z)) af1 = @afn1(theta)^imag(@apwr) af2 = @afn2(theta)^imag(@apwr) polar = 1.75*@a*(af1 + flip(af2)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 18) ; smallest Cissoid of Diocles Distance theta = atan(imag(#z)/real(#z)) r = 2*@a*sin(theta)*tan(theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 19) ; smallest Cochleoid Distance theta = atan(imag(#z)/real(#z)) r = 1.25*@a*sin(theta)/theta polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 20) ; smallest Folium of Descartes Distance theta = atan(imag(#z)/real(#z)) r = @a*tan(theta)/(cos(theta)*(1+tan(theta)^3)) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 21) ; smallest Limacon of Pascal Distance theta = atan(imag(#z)/real(#z)) r = 0.03*@b + 1.5*@a*cos(theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 22) ; smallest Lituus Distance theta = atan(imag(#z)/real(#z)) r = 0.6*@a/theta^0.5 polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 23) ; smallest Nephroid Distance theta = atan(imag(#z)/real(#z)) af1 = 3*@afn1(theta) - @afn1(theta/3) af2 = 3*@afn2(theta) - @afn2(theta/3) polar = 0.75*@a*(af1 + flip(af2)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 24) ; smallest Strophoid Distance theta = atan(imag(#z)/real(#z)) r = 0.2*@b*sin(@a-2*theta)/sin(@a-theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 25) ; smallest Witch of Agnesi theta = atan(imag(#z)/real(#z)) af1 = 2*cotan(theta) af2 = 1-cos(2*theta) polar = 0.1*@a*(af1 + flip(af2)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 26) ; smallest Curtate Cycloid theta = atan(imag(#z)/real(#z)) af1 = 2*@a*theta - 0.1*@b*@afn2(theta) af2 = 2*@a - 0.1*@b*@afn1(theta) polar = af1 + flip(af2) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 27) ; smallest Epicycloid theta = atan(imag(#z)/real(#z)) af1 = (5*@a+@b)*@afn1(theta) - @b*@afn1((5*@a+@b)*theta/@b) af2 = (5*@a+@b)*@afn2(theta) - @b*@afn2((5*@a+@b)*theta/@b) polar = 0.5*(af1 + flip(af2)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 28) ; smallest Ellipse Evolute theta = atan(imag(#z)/real(#z)) af1 = (@a^2-(0.7*@b)^2)/@a*@afn1(theta)^(real(@apwr)) af2 = ((0.7*@b)^2-@a^2)/(0.7*@b)*@afn2(theta)^(imag(@apwr)) polar = 0.2*(af1 + flip(af2)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 29) ; smallest Tractrix theta = atan(imag(#z)/real(#z)) af1 = @a*(log(tan(theta/2))-@afn1(theta)) af2 = @a*@afn2(theta) polar = 0.25*(af1 + flip(af2)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 30) ; smallest Kampyle of Eudoxus Distance theta = atan(imag(#z)/real(#z)) r = @a/cos(theta)^2 polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 31) ; smallest Circle Catacaustic theta = atan(imag(#z)/real(#z)) af1 = 2*@b*(1-3*2*@b*cos(theta)+2*2*@b*cos(theta)^3)/(-(1+2*(2*@b)^2)+3*2*@b*cos(theta)) af2 = 2*(2*@b)^2*sin(theta)^3/(1+2*(2*@b)^2-3*@b*cos(theta)) polar = 1.5*@a*(af1 + flip(af2)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 32) ; smallest Deltoid Catacaustic theta = atan(imag(#z)/real(#z)) af1 = 3*@afn1(theta) + @afn1(3*theta+#pi/2*@b) - @afn1(#pi/2*@b) af2 = 3*@afn2(theta) + @afn2(3*theta+#pi/2*@b) - @afn2(#pi/2*@b) polar = 0.35*@a*(af1 + flip(af2)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 33) ; smallest Ellipse Catacaustic theta = atan(imag(#z)/real(#z)) af1 = 4*@a*(@a-@b)*(@a*@b)*sin(theta)^3/(@a^2+@b^2+(@b^2-@a^2)*cos(2*theta)) af2 = 4*@b*(@b^2-@a^2)*cos(theta)^3/(@a^2+@b^2+3*(@b^2-@a^2)*cos(2*theta)) polar = 0.25*(af1 + flip(af2)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 34) ; smallest Log Spiral Catacaustic theta = atan(imag(#z)/real(#z)) af1 = 2*@b*exp(2*@b*theta)*(2*@b*cos(theta)-sin(theta))/(1+(2*@b^2)) af2 = 2*@b*exp(2*@b*theta)*(2*@b*cos(theta)+sin(theta))/(1+(2*@b^2)) polar = @a*(af1 + flip(af2)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 35) ; smallest Butterfly Distance theta = atan(imag(#z)/real(#z)) r = 1.25*@a*(exp(sin(theta))-2*cos(4*theta)+sin(1/24*(2*theta-#pi))) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 36) ; smallest Gear Curve theta = atan(imag(#z)/real(#z)) af1 = (0.25*@a+1/@b*tanh(@b*sin(@pn*theta)))*cos(theta) af2 = (0.25*@a+1/@b*tanh(@b*sin(@pn*theta)))*sin(theta) polar = (af1 + flip(af2)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 37) ; smallest Arachnida 1 Distance theta = atan(imag(#z)/real(#z)) r = @a*sin(@pn*theta)/sin((@pn-1)*theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 38) ; smallest Arachnida 2 Distance theta = atan(imag(#z)/real(#z)) r = @a*sin(@pn*theta)/sin((@pn+1)*theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 39) ; smallest Cayley's Sextic Distance theta = atan(imag(#z)/real(#z)) r = 1.5*@a*cos(theta)^3 polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 40) ; smallest Cycloid of Seva Distance theta = atan(imag(#z)/real(#z)) r = 0.5*@a*(1+2*cos(2*theta)) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 41) ; smallest Devil's Curve Distance theta = atan(imag(#z)/real(#z)) r = (((0.5*@a*sin(theta))^2-(0.2*@b*cos(theta))^2)/(sin(theta)^2-cos(theta)^2))^0.5 polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 42) ; smallest Eight Curve Distance theta = atan(imag(#z)/real(#z)) r = @a*cos(theta)^(-2)*cos(2*theta)^0.5 polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 43) ; smallest Epispiral Distance theta = atan(imag(#z)/real(#z)) r = 0.25*@a/cos(@pn*theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 44) ; smallest Hipopede Distance theta = atan(imag(#z)/real(#z)) r = (0.5*@b*(0.5*@a-(0.5*@b)^2*cos(theta)))^0.5 polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 45) ; smallest Maltese Cross Distance theta = atan(imag(#z)/real(#z)) r = 0.5*@a/(cos(theta)*sin(theta)*(cos(theta)^2-sin(theta)^2))^0.5 polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 46) ; smallest Ophiuride Distance theta = atan(imag(#z)/real(#z)) r = (0.01*@b*sin(theta)-4.5*@a*cos(theta))*tan(theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 47) ; smallest Quadratrix of Hippias Distance theta = atan(imag(#z)/real(#z)) r = @a*theta/sin(theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 48) ; smallest Poinsot Spiral 1 Distance theta = atan(imag(#z)/real(#z)) r = 1.5*@a/cosh(@pn*theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 49) ; smallest Poinsot Spiral 2 Distance theta = atan(imag(#z)/real(#z)) r = @a/sinh(@pn*theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 50) ; smallest Quadrifolium Distance theta = atan(imag(#z)/real(#z)) r = 2.5*@a*sin(2*theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 51) ; smallest Scarabaeus Distance theta = atan(imag(#z)/real(#z)) r = 0.5*@b*cos(2*theta)-@a*cos(theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 52) ; smallest Semicubical Parabola Distance theta = atan(imag(#z)/real(#z)) r = 1.5*@a*(cos(3*@b*theta))^(1/(3*@b)) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 53) ; smallest Swastika Curve Distance theta = atan(imag(#z)/real(#z)) r = 2.25*@a*(sin(theta)*cos(theta)/(sin(theta)^4-cos(theta)^4))^0.5 polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 54) ; smallest Trifolium Distance theta = atan(imag(#z)/real(#z)) r = -2*@a*cos(3*theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 55) ; smallest Tschirnhausen Cubic Distance theta = atan(imag(#z)/real(#z)) r = @a/cos(theta/3)^3 polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 56) ; smallest Bicorn theta = atan(imag(#z)/real(#z)) af1 = @a*sin(theta) af2 = @a*cos(theta)^2*(2+cos(theta))/(3+sin(theta)^2) polar = 1.5*(af1 + flip(af2)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 57) ; smallest Cruciform theta = atan(imag(#z)/real(#z)) af1 = 0.1*@a/cos(theta) af2 = 0.02*@b/sin(theta) polar = 1.5*(af1 + flip(af2)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ENDIF If @converge==true IF (|z1-oldz1| < @bailout2 ||\ @everyiter ||\ done == #maxit + 2); done, or every iteration, or last ; determine continuous iteration (height) for each point IF (@zmode >= 0 && @zmode <= 57) ; height based on smallest |z| e1 = s1 * @zscale e2 = s2 * @zscale e3 = s3 * @zscale ELSEIF (@zmode == 58) e1 = iterexp1 * @zscale e2 = iterexp2 * @zscale e3 = iterexp3 * @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 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 else IF (|z1| > @bailout ||\ @everyiter ||\ done == #maxit + 2); done, or every iteration, or last ; determine continuous iteration (height) for each point IF (@zmode >= 0 && @zmode <= 57) ; height based on smallest |z| e1 = s1 * @zscale e2 = s2 * @zscale e3 = s3 * @zscale ELSEIF (@zmode == 58) e1 = iterexp1 * @zscale e2 = iterexp2 * @zscale e3 = iterexp3 * @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 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 endif else z = z1 endif If @converge==true if (|z1-oldz1| < @bailout2); we're done done = 0 endif else if (|z1| > @bailout); we're done done = 0 endif endif bailout: (done > 0) default: title = "Slope Gnarly" center = (0.0,0.0) magn = 0.2 maxiter = 20 param version caption = "Version" default = 1.22 visible = false endparam heading caption = "Slope Gnarly" endheading heading caption = "Use Damien's Lighting Coloring" endheading heading caption = "Or Ron's 3D Texturizer Formulas" endheading heading caption = "Most other coloring formulas" endheading heading caption = "can also be used." endheading param formula caption = "Formula" enum = "Martin" "Popcorn" "Vine" "Gnarl" "Dynamic" default = 1 endparam param tscale caption = "Gnarly Scale" default = 1.0 endparam param h caption = "Step Size" default = (0.05, 0.05) visible = @formula == 1 || @formula == 2 || @formula == 3 || @formula == 4 endparam param aa caption = "Alpha" default = (3.0, 3.0) visible = @formula == 2 || @formula == 3 || @formula == 4 endparam param ba caption = "Beta" default = (2.0, 2.0) visible = @formula == 2 || @formula == 3 || @formula == 4 endparam param c caption = "Constant C" default = (3.0, 3.0) visible = @formula == 1 endparam float param d caption = "Martin Parameter" default = #pi visible = @formula == 0 endparam param flavor caption = "Vine flavor" hint = "This is the 'flavor' for the Vine formula." default = 2 min = 0 visible = @formula == 2 endparam param converge caption = "Convergent Bailout" default = false endparam param bailout caption = "Bailout" default = 1e20 visible=@converge==false endparam param bailout2 caption = "Bailout" default = 0.001 visible=@converge==true endparam heading caption = "Popcorn functions" visible = @formula == 1 endheading func pfn1 caption = "Popcorn #1" default = sin() visible = @formula == 1 endfunc func pfn2 caption = "Popcorn #2" default = tan() visible = @formula == 1 endfunc func pfn3 caption = "Popcorn #3" default = sin() visible = @formula == 1 endfunc func pfn4 caption = "Popcorn #4" default = tan() visible = @formula == 1 endfunc heading caption = "Vine functions" visible = @formula == 2 endheading func vfn1 caption = "Vine #1" default = sin() visible = @formula == 2 endfunc func vfn2 caption = "Vine #2" default = sin() visible = @formula == 2 endfunc func vfn3 caption = "Vine #3" default = sin() visible = @formula == 2 endfunc func vfn4 caption = "Vine #4" default = sin() visible = @formula == 2 endfunc func vfn5 caption = "Vine #5" default = sin() visible = @formula == 2 endfunc func vfn6 caption = "Vine #6" default = sin() visible = @formula == 2 endfunc func vfn7 caption = "Vine #7" default = sin() visible = @formula == 2 endfunc func vfn8 caption = "Vine #8" default = sin() visible = @formula == 2 endfunc func vfn9 caption = "Vine #9" default = sin() visible = @formula == 2 endfunc func vfn10 caption = "Vine #10" default = sin() visible = @formula == 2 endfunc heading caption = "Gnarl functions" visible = @formula == 3 endheading func gfn1 caption = "Gnarl #1" default = sin() visible = @formula == 3 endfunc func gfn2 caption = "Gnarl #2" default = sin() visible = @formula == 3 endfunc func gfn3 caption = "Gnarl #3" default = sin() visible = @formula == 3 endfunc func gfn4 caption = "Gnarl #4" default = sin() visible = @formula == 3 endfunc func gfn5 caption = "Gnarl #5" default = sin() visible = @formula == 3 endfunc func gfn6 caption = "Gnarl #6" default = sin() visible = @formula == 3 endfunc heading caption = "Dynamic functions" visible = @formula == 4 endheading func dfn1 caption = "Dynamic #1" default = sin() visible = @formula == 4 endfunc func dfn2 caption = "Dynamic #2" default = tan() visible = @formula == 4 endfunc func dfn3 caption = "Dynamic #3" default = sin() visible = @formula == 4 endfunc func dfn4 caption = "Dynamic #4" default = tan() visible = @formula == 4 endfunc bool param slope caption = "Apply slope?" default = true endparam heading caption = "Slope Parameters" visible = @slope==true endheading param offset caption = "Orbit Separation" default = 0.01 hint = "Defines how far apart the simultaneous orbits are. Smaller \ distances will produce more accurate results." visible = @slope==true endparam param zmode caption = "Height Value" default = 58 enum = "smallest |z|" "smallest |real(z)|" "smallest |imag(z)|" \ "smallest |sum(z)|" "smallest |product(z)|" \ "|smallest quotient(z)|" "smallest |atan(z)|" \ "smallest |function1(z)|" "smallest |function2(z)|" \ "Lemniscate" "Cardiod" "Conchoid" "Cycloid" "Archimedes" \ "Log Spiral" "Rose" "Bifolium" "Astroid" "Cissoid of Diocles" \ "Cochleoid" "Folium of Descartes" "Limacon of Pascal" \ "Lituus" "Nephroid" "Strophoid" "Witch of Agnesi" \ "Curtate Cycloid" "Epicycloid" "Ellipse Evolute" "Tractrix" \ "Kampyle of Eudoxus" "Circle Catacaustic" "Deltoid Catacaustic" \ "Ellipse Catacaustic" "Log Spiral Catacaustic" "Butterfly" \ "Gear Curve" "Arachnida 1" "Arachnida 2" "Cayley's Sectic" \ "Cycloid of Seva" "Devil's Curve" "Eight Curve" "Epispiral" \ "Hipopede" "Maltese Cross" "Ophiuride" "Quadratrix of Hippias" \ "Poinsot Spiral 1" "Poinsot Spiral 2" "Quadrifolium" "Scarabaeus" \ "Semicubical Parabola" "Swastika Curve" "Trifolium" \ "Tschirnhausen Cubic" "Bicorn" "Cruciform" "smoothed iteration" hint = "Specifies what will be used to construct a height value." visible = @slope==true endparam func fn1 caption = "Transmute Function" default = sin() visible = @zmode==7 || @zmode ==8 && @slope==true endfunc param a caption = "Polar Parameter" default = 0.2 visible=@zmode==9 || @zmode==10 || @zmode==11 || @zmode==13 || @zmode==14 \ || @zmode==15 || @zmode==16 || @zmode==17 || @zmode==18 || @zmode==19 \ || @zmode==20 || @zmode==21 || @zmode==22 || @zmode==23 || @zmode==24 \ || @zmode==25 || @zmode==26 || @zmode==27 || @zmode==28 || @zmode==29 \ || @zmode==30 || @zmode==31 || @zmode==32 || @zmode==33 || @zmode==34 \ || @zmode==35 || @zmode==36 || @zmode==37 || @zmode==38 || @zmode==39 \ || @zmode==40 || @zmode==41 || @zmode==42 || @zmode==43 || @zmode==44 \ || @zmode==45 || @zmode==46 || @zmode==47 || @zmode==48 || @zmode==49 \ || @zmode==50 || @zmode==51 || @zmode==52 || @zmode==53 || @zmode==54 \ || @zmode==55 || @zmode==56 || @zmode==57 && @slope==true endparam param b caption = "2nd Polar Parameter" default = 1.0 visible=@zmode==11 || @zmode==21 || @zmode==24 || @zmode==26 || @zmode==27 \ || @zmode==28 || @zmode==31 || @zmode==32 || @zmode==33 || @zmode==34 \ || @zmode==36 || @zmode==41 || @zmode==44 || @zmode==46 || @zmode==51 \ || @zmode==52 || @zmode==57 && @slope==true endparam param pn caption = "Polar Integer" default = 3 visible=@zmode==36 || @zmode==37 || @zmode==38 || @zmode==43 || @zmode==48 \ || @zmode==49 && @slope==true endparam param apwr caption = "Polar Power" default = (3.0,3.0) visible = @zmode==17 || @zmode==28 && @slope==true endparam func afn1 caption = "Polar Fn 1" default = cos() visible = @zmode==17 || @zmode==23 || @zmode==26 || @zmode==27 || @zmode==28 \ || @zmode==29 || @zmode==32 && @slope==true endfunc func afn2 caption = "Polar Fn 2" default = sin() visible = @zmode==17 || @zmode==23 || @zmode==26 || @zmode==27 || @zmode==28 \ || @zmode==29 || @zmode==32 && @slope==true endfunc param xfer caption = "Height Transfer" default = 1 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." visible = @slope==true 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." visible = @slope==true endparam param zscale2 caption = "Height Post-Scale" default = 1.0 hint = "Specifies the ratio between height and distance; like \ Height Pre-Scale, except that this value is applied after \ the transfer function." visible = @slope==true 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." visible = @slope==true endparam } gnd-AdvancedGnarly+fBm { ; Inspired by ; 1 Advanced Gnarl by Mark Townsend and ; 2 Embrangle and Kology by Susan Chambless. ; Modified Gnarly formula from Mark Townsend ; Compound with the models of fBm formulas from Damien M. Jones. ; Fractional Brownian Motion coloring method. ; ; This is the basic Advanced Gnarly 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. ; ; version 1.13, December 2004 ; Special thanks to Susan Chambless, ; for the suggestions and advice. ; Many thanks to Mark and Damien for allowing me to publish it. ; Gilles Nadeau, 19/12/2004 ; ; Use inside coloring. ; init: z = #pixel complex oz = z float x = real(z) float y = imag(z) float xx = 0 int iter = 0 int seed = random(@randomseed) 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 bool scenario1 = false iter = iter + 1 x = real(z) y = imag(z) xx = x ; Determine scenario to be used: if (@version > 1.11) if ( @seq == 1 ) ; First scenario scenario1 = true elseif ( @seq == 2 ) ; Second scenario scenario1 = false elseif ( @seq==3 ) seed = random(seed) if ( abs(seed)/#randomrange < @prob1 ) scenario1 = true else scenario1 = false endif elseif ( @seq == 0 ); Modulation if (iter % @modBy < @modCmp) scenario1 = true else scenario1 = false endif endif else if ( @seq == 1 ) ; First scenario scenario1 = true elseif ( @seq == 2 ) ; Second scenario scenario1 = false elseif ( iter % @modBy < @modCmp ); Modulation scenario1 = true elseif ( @seq==3 ) seed = random(seed) if ( abs(seed)/#randomrange < @prob1 ) scenario1 = true endif else scenario1 = false endif endif if(scenario1 == true) if @formula1 == 0 ; Martin x = y - real(@mn1(x)) y = @d1 - xx elseif @formula1 == 1 ; Popcorn x = x - real(@h1 * @pn1(y + @pn2(real(@c1) * y))) y = y - imag(@h1 * @pn3(xx + @pn4(imag(@c1) * xx))) elseif @formula1 == 2 ; Vine if @flavor1 == 0 x = x - real(@h1 * @vn1(y + @vn2(real(@a1) * y ))) y = y + imag(@h1 * @vn3(xx + @vn4(imag(@a1) * xx))) elseif @flavor1 == 1 x = x - real(@h1 * @vn1(y^real(@b1) + @vn2(real(@a1) * y))) y = y + imag(@h1 * @vn3(xx^imag(@b1) + @vn4(imag(@a1) * xx))) elseif @flavor1 == 2 x = x - real(@h1 * @vn1(y + @vn2(real(@a1) * (y + @vn5(real(@a1) * y))))) y = y + imag(@h1 * @vn3(xx + @vn4(imag(@a1) * (xx + @vn6(imag(@a1) * xx))))) else float newx = y float newy = x int j = 0 while j < @flavor1 j = j + 1 newx = y + real(@vn7(real(@a1) * newx)) newy = x + real(@vn8(imag(@a1) * newy)) endwhile x = x - real(@h1 * @vn9(newx)) y = y + imag(@h1 * @vn10(newy)) endif elseif @formula1 == 3 ; Gnarl x = x - real(@h1 * @gn1(y + @gn2(real(@a1) * (y + @gn3(real(@b1) * y))))) y = y + imag(@h1 * @gn4(xx + @gn5(imag(@a1) * (xx + @gn6(imag(@b1) * xx))))) elseif @formula1 == 4 ; Dynamic x = x - real(@h1 * @dn1(y + real(@a1) * @dn2(real(@b1) * y))) y = y + imag(@h1 * @dn3(xx + imag(@a1) * @dn4(imag(@b1) * xx))) endif else if @formula2 == 0 ; Martin x = y - real(@mfn1(x)) y = @d2 - xx elseif @formula2 == 1 ; Popcorn x = x - real(@h2 * @pfn1(y + @pfn2(real(@c2) * y))) y = y - imag(@h2 * @pfn3(xx + @pfn4(imag(@c2) * xx))) elseif @formula2 == 2 ; Vine if @flavor2 == 0 x = x - real(@h2 * @vfn1(y + @vfn2(real(@a2) * y ))) y = y + imag(@h2 * @vfn3(xx + @vfn4(imag(@a2) * xx))) elseif @flavor2 == 1 x = x - real(@h2 * @vfn1(y^real(@b2) + @vfn2(real(@a2) * y))) y = y + imag(@h2 * @vfn3(xx^imag(@b2) + @vfn4(imag(@a2) * xx))) elseif @flavor2 == 2 x = x - real(@h2 * @vfn1(y + @vfn2(real(@a2) * (y + @vfn5(real(@a2) * y))))) y = y + imag(@h2 * @vfn3(xx + @vfn4(imag(@a2) * (xx + @vfn6(imag(@a2) * xx))))) else float newx = y float newy = x int k = 0 while k < @flavor2 k = k + 1 newx = y + real(@vfn7(real(@a2) * newx)) newy = x + real(@vfn8(imag(@a2) * newy)) endwhile x = x - real(@h2 * @vfn9(newx)) y = y + imag(@h2 * @vfn10(newy)) endif elseif @formula2 == 3 ; Gnarl x = x - real(@h2 * @gfn1(y + @gfn2(real(@a2) * (y + @gfn3(real(@b2) * y))))) y = y + imag(@h2 * @gfn4(xx + @gfn5(imag(@a2) * (xx + @gfn6(imag(@b2) * xx))))) elseif @formula2 == 4 ; Dynamic x = x - real(@h2 * @dfn1(y + real(@a2) * @dfn2(real(@b2) * y))) y = y + imag(@h2 * @dfn3(xx + imag(@a2) * @dfn4(imag(@b2) * xx))) endif endif z = x + flip(y) IF (@coloronly); only using fBm on coloring oz = z ENDIF if (@fBm == true) 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 fx0 = floor(real(p)) float fy0 = floor(imag(p)) float bx0 = fx0 % 256 float by0 = fy0 % 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) - fx0 float ry0 = imag(p) - fy0 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 + real(@nfn1(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+@coloroffset)*0.5*@distortion ENDIF 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 = "Advanced Gnarly + fBm" maxiter = 20 periodicity = 0 method = multipass magn = 0.2 param version caption = "Version" default = 1.13 visible = false endparam int param seq enum = "Modulation" "First Scenario" "Second Scenario" "Random" default = 0 caption = "Scenario Sequence" endparam int param modBy default = 10 caption = "Mod By" hint = "Iteration Modulated by This" visible = @seq==0 endparam int param modCmp default = 5 caption = "Mod Compare" hint = "Modulated Iteration < this -> Scenario 1" visible = @seq==0 endparam int param randomseed caption = "Random Seed" default = 123456 visible = @seq==3 endparam float param prob1 caption = "Prob for Func 1" default = 0.5 min = 0.0 max = 1.0 visible = @seq==3 endparam float param bailout caption = "Bailout Value" default = 1.0e20 endparam heading caption = "Scenario 1" visible = @seq!=2 endheading param formula1 caption = "Formula" enum = "Martin" "Popcorn" "Vine" "Gnarl" "Dynamic" visible = @seq!=2 default = 3 endparam param h1 caption = "Step Size" default = (0.05, 0.05) visible = @formula1 == 1 || @formula1 == 2 || @formula1 == 3 || @formula1 == 4 && @seq!=2 endparam param a1 caption = "Alpha" default = (3.0, 3.0) visible = @formula1 == 2 || @formula1 == 3 || @formula1 == 4 && @seq!=2 endparam param b1 caption = "Beta" default = (2.0, 2.0) visible = @formula1 == 2 || @formula1 == 3 || @formula1 == 4 && @seq!=2 endparam param c1 caption = "Constant C" default = (3.0, 3.0) visible = @formula1 == 1 && @seq!=2 endparam float param d1 caption = "Martin Parameter" default = #pi visible = @formula1 == 0 && @seq!=2 endparam param flavor1 caption = "Vine flavor" hint = "This is the 'flavor' for the Vine formula." default = 2 min = 0 visible = @formula1 == 2 && @seq!=2 endparam func mn1 caption = "Martin function" default = sin() visible = @formula1 == 0 && @seq!=2 endfunc heading caption = "Popcorn functions" visible = @formula1 == 1 && @seq!=2 endheading func pn1 caption = "Popcorn #1" default = sin() visible = @formula1 == 1 && @seq!=2 endfunc func pn2 caption = "Popcorn #2" default = tan() visible = @formula1 == 1 && @seq!=2 endfunc func pn3 caption = "Popcorn #3" default = sin() visible = @formula1 == 1 && @seq!=2 endfunc func pn4 caption = "Popcorn #4" default = tan() visible = @formula1 == 1 && @seq!=2 endfunc heading caption = "Vine functions" visible = @formula1 == 2 && @seq!=2 endheading func vn1 caption = "Vine #1" default = sin() visible = @formula1 == 2 && @seq!=2 endfunc func vn2 caption = "Vine #2" default = sin() visible = @formula1 == 2 && @seq!=2 endfunc func vn3 caption = "Vine #3" default = sin() visible = @formula1 == 2 && @seq!=2 endfunc func vn4 caption = "Vine #4" default = sin() visible = @formula1 == 2 && @seq!=2 endfunc func vn5 caption = "Vine #5" default = sin() visible = @formula1 == 2 && @seq!=2 endfunc func vn6 caption = "Vine #6" default = sin() visible = @formula1 == 2 && @seq!=2 endfunc func vn7 caption = "Vine #7" default = sin() visible = @formula1 == 2 && @seq!=2 endfunc func vn8 caption = "Vine #8" default = sin() visible = @formula1 == 2 && @seq!=2 endfunc func vn9 caption = "Vine #9" default = sin() visible = @formula1 == 2 && @seq!=2 endfunc func vn10 caption = "Vine #10" default = sin() visible = @formula1 == 2 && @seq!=2 endfunc heading caption = "Gnarl functions" visible = @formula1 == 3 && @seq!=2 endheading func gn1 caption = "Gnarl #1" default = sin() visible = @formula1 == 3 && @seq!=2 endfunc func gn2 caption = "Gnarl #2" default = sin() visible = @formula1 == 3 && @seq!=2 endfunc func gn3 caption = "Gnarl #3" default = sin() visible = @formula1 == 3 && @seq!=2 endfunc func gn4 caption = "Gnarl #4" default = sin() visible = @formula1 == 3 && @seq!=2 endfunc func gn5 caption = "Gnarl #5" default = sin() visible = @formula1 == 3 && @seq!=2 endfunc func gn6 caption = "Gnarl #6" default = sin() visible = @formula1 == 3 && @seq!=2 endfunc heading caption = "Dynamic functions" visible = @formula1 == 4 && @seq!=2 endheading func dn1 caption = "Dynamic #1" default = sin() visible = @formula1 == 4 && @seq!=2 endfunc func dn2 caption = "Dynamic #2" default = tan() visible = @formula1 == 4 && @seq!=2 endfunc func dn3 caption = "Dynamic #3" default = sin() visible = @formula1 == 4 && @seq!=2 endfunc func dn4 caption = "Dynamic #4" default = tan() visible = @formula1 == 4 && @seq!=2 endfunc heading caption = "Scenario 2" visible = @seq!=1 endheading param formula2 caption = "Formula" enum = "Martin" "Popcorn" "Vine" "Gnarl" "Dynamic" visible = @seq!=1 default = 4 endparam param h2 caption = "Step Size" default = (0.05, 0.05) visible = @formula2 == 1 || @formula2 == 2 || @formula2 == 3 || @formula2 == 4 && @seq!=1 endparam param a2 caption = "Alpha" default = (3.0, 3.0) visible = @formula2 == 2 || @formula2 == 3 || @formula2 == 4 && @seq!=1 endparam param b2 caption = "Beta" default = (3.0, 3.0) visible = @formula2 == 2 || @formula2 == 3 || @formula2 == 4 && @seq!=1 endparam param c2 caption = "Constant C" default = (8.0, 8.0) visible = @formula2 == 1 && @seq!=1 endparam float param d2 caption = "Martin Parameter" default = #pi visible = @formula2 == 0 && @seq!=1 endparam param flavor2 caption = "Vine flavor" hint = "This is the 'flavor' for the Vine formula." default = 2 min = 0 visible = @formula2 == 2 && @seq!=1 endparam func mfn1 caption = "Martin function" default = cos() visible = @formula2 == 0 && @seq!=1 endfunc heading caption = "Popcorn functions" visible = @formula2 == 1 && @seq!=1 endheading func pfn1 caption = "Popcorn #1" default = sin() visible = @formula2 == 1 && @seq!=1 endfunc func pfn2 caption = "Popcorn #2" default = cos() visible = @formula2 == 1 && @seq!=1 endfunc func pfn3 caption = "Popcorn #3" default = sin() visible = @formula2 == 1 && @seq!=1 endfunc func pfn4 caption = "Popcorn #4" default = cos() visible = @formula2 == 1 && @seq!=1 endfunc heading caption = "Vine functions" visible = @formula2 == 2 && @seq!=1 endheading func vfn1 caption = "Vine #1" default = sin() visible = @formula2 == 2 && @seq!=1 endfunc func vfn2 caption = "Vine #2" default = cos() visible = @formula2 == 2 && @seq!=1 endfunc func vfn3 caption = "Vine #3" default = sin() visible = @formula2 == 2 && @seq!=1 endfunc func vfn4 caption = "Vine #4" default = cos() visible = @formula2 == 2 && @seq!=1 endfunc func vfn5 caption = "Vine #5" default = sin() visible = @formula2 == 2 && @seq!=1 endfunc func vfn6 caption = "Vine #6" default = sin() visible = @formula2 == 2 && @seq!=1 endfunc func vfn7 caption = "Vine #7" default = sin() visible = @formula2 == 2 && @seq!=1 endfunc func vfn8 caption = "Vine #8" default = sin() visible = @formula2 == 2 && @seq!=1 endfunc func vfn9 caption = "Vine #9" default = cos() visible = @formula2 == 2 && @seq!=1 endfunc func vfn10 caption = "Vine #10" default = cos() visible = @formula2 == 2 && @seq!=1 endfunc heading caption = "Gnarl functions" visible = @formula2 == 3 && @seq!=1 endheading func gfn1 caption = "Gnarl #1" default = cos() visible = @formula2 == 3 && @seq!=1 endfunc func gfn2 caption = "Gnarl #2" default = abs() visible = @formula2 == 3 && @seq!=1 endfunc func gfn3 caption = "Gnarl #3" default = cabs() visible = @formula2 == 3 && @seq!=1 endfunc func gfn4 caption = "Gnarl #4" default = cos() visible = @formula2 == 3 && @seq!=1 endfunc func gfn5 caption = "Gnarl #5" default = abs() visible = @formula2 == 3 && @seq!=1 endfunc func gfn6 caption = "Gnarl #6" default = cabs() visible = @formula2 == 3 && @seq!=1 endfunc heading caption = "Dynamic functions" visible = @formula2 == 4 && @seq!=1 endheading func dfn1 caption = "Dynamic #1" default = sin() visible = @formula2 == 4 && @seq!=1 endfunc func dfn2 caption = "Dynamic #2" default = sin() visible = @formula2 == 4 && @seq!=1 endfunc func dfn3 caption = "Dynamic #3" default = sin() visible = @formula2 == 4 && @seq!=1 endfunc func dfn4 caption = "Dynamic #4" default = sin() visible = @formula2 == 4 && @seq!=1 endfunc bool param fBm caption = "fBm texturing?" default = true endparam heading caption = "fBm Parameters" visible = @fBm == true endheading param distortion caption = "Distortion Strength" default = 0.5 hint = "This is the amount the noise distorts the image." visible = @fBm == true 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." visible = @fBm == true endparam param distangle caption = "Distortion Angle" default = 0.0 hint = "This is the angle to rotate the distortion." visible = @fBm == true 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." visible = @fBm == true 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." visible = @fBm == true endparam param coloroffset caption = "Coloring Offset" default = 0.0 hint = "Sets the coloring offset from zero. Increase this if you see \ large areas of solid color." visible = @fBm == true 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." visible = @fBm == true endparam param scale caption = "Noise Scale" default = 1.0 hint = "This is the overall scale of the noise." visible = @fBm == true endparam param angle caption = "Noise Rotation" default = 0.0 hint = "This is the angle, in degrees, of the noise." visible = @fBm == true endparam param step caption = "Noise Scale Step" default = 0.5 hint = "This is the step in scale between noise iterations." visible = @fBm == true endparam param anglestep caption = "Noise Rotation Step" default = 37.0 hint = "This is the angle, in degrees, to rotate between noise \ iterations." visible = @fBm == true endparam param octaves caption = "Noise Octaves" default = 7 min = 1 hint = "This is the number of iterations of the noise formula." visible = @fBm == true endparam param npower caption = "Noise Exponent" default = 2.0 hint = "This is the exponent used to scramble numbers." visible = @fBm == true endparam param noisestart caption = "Start Iteration" default = 0.0 hint = "This is the iteration at which to start adding noise." visible = @fBm == true endparam param noiseiter caption = "Noise Iterations" default = 10000.0 hint = "This is the number of iterations to add noise to." visible = @fBm == true endparam param noiseskip caption = "Skip Iterations" default = 0.0 hint = "This is the number of iterations to skip adding noise \ before starting again." visible = @fBm == true endparam func nfn1 caption = "Noise Function" default = ident() visible = @fBm == true endfunc param coloronly caption = "Coloring Only" default = true 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." visible = @fBm == true endparam } gnd-Slope_AdvancedGnarly { ; based upon the slope (Mandelbrot) ; formula of Damien Jones ; Inspired by ; 1 Advanced Gnarl by Mark Townsend and ; 2 Embrangle and Kology by Susan Chambless. ; Modified Gnarly formula from Mark Townsend ; compound with the models of slope formulas from Ron Barnett. ; ; version 1.19, December 2004 ; Special thanks to Susan Chambless, ; for the suggestions and advice. ; Many thanks to Mark, Ron and Damien for allowing me to publish it. ; Gilles Nadeau, 26/12/2004 ; Damien's fBm added September, 2005 ; Use inside coloring. ; init: complex z1 = @tscale*#pixel; primary iterated point complex z2 = z1 + @offset; horizontally offset point complex z3 = z1 + flip(@offset); vertically offset point complex oz1 = z1 complex oz2 = z2 complex oz3 = z3 int done = 2 int seed = random(@randomseed) float modz = 0.0 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 iterexp1 = 0.0 float iterexp2 = 0.0 float iterexp3 = 0.0 float sum1 = 0.0 float sum2 = 0.0 float sum3 = 0.0 complex polar = 0.0 complex af1 = 0.0 complex af2 = 0.0 int iter = 0 complex c = @distcenter IF (@centermove) c = #center ENDIF complex r1 = (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 (@fBm) 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 endif IF (@coloronly); only using fBm on coloring z1 = oz1; restore z from un-fBm'ed copy z2 = oz2 z3 = oz3 ENDIF float x1 = real(z1) float x2 = real(z2) float x3 = real(z3) float y1 = imag(z1) float y2 = imag(z2) float y3 = imag(z3) float xx1 = x1 float xx2 = x2 float xx3 = x3 bool scenario1 = false iter = iter + 1 ; Determine scenario to be used: if (@version > 1.11) if ( @seq == 1 ) ; First scenario scenario1 = true elseif ( @seq == 2 ) ; Second scenario scenario1 = false elseif ( @seq==3 ) seed = random(seed) if ( abs(seed)/#randomrange < @prob1 ) scenario1 = true else scenario1 = false endif elseif ( @seq == 0 ); Modulation if (iter % @modBy < @modCmp) scenario1 = true else scenario1 = false endif endif else if ( @seq == 1 ) ; First scenario scenario1 = true elseif ( @seq == 2 ) ; Second scenario scenario1 = false elseif ( iter % @modBy < @modCmp ); Modulation scenario1 = true elseif ( @seq==3 ) seed = random(seed) if ( abs(seed)/#randomrange < @prob1 ) scenario1 = true endif else scenario1 = false endif endif if(scenario1 == true) if @formula1 == 0 ; Martin x1 = y1 - real(@mn1(x1)) y1 = @d1 - xx1 elseif @formula1 == 1 ; Popcorn x1 = x1 - real(@h1 * @pn1(y1 + @pn2(real(@c1) * y1))) y1 = y1 - imag(@h1 * @pn3(xx1 + @pn4(imag(@c1) * xx1))) elseif @formula1 == 2 ; Vine if @flavor1 == 0 x1 = x1 - real(@h1 * @vn1(y1 + @vn2(real(@a1) * y1 ))) y1 = y1 + imag(@h1 * @vn3(xx1 + @vn4(imag(@a1) * xx1))) elseif @flavor1 == 1 x1 = x1 - real(@h1 * @vn1(y1^real(@b1) + @vn2(real(@a1) * y1))) y1 = y1 + imag(@h1 * @vn3(xx1^imag(@b1) + @vn4(imag(@a1) * xx1))) elseif @flavor1 == 2 x1 = x1 - real(@h1 * @vn1(y1 + @vn2(real(@a1) * (y1 + @vn5(real(@a1) * y1))))) y1 = y1 + imag(@h1 * @vn3(xx1 + @vn4(imag(@a1) * (xx1 + @vn6(imag(@a1) * xx1))))) else float newx1 = y1 float newy1 = x1 int j = 0 while j < @flavor1 j = j + 1 newx1 = y1 + real(@vn7(real(@a1) * newx1)) newy1 = x1 + real(@vn8(imag(@a1) * newy1)) endwhile x1 = x1 - real(@h1 * @vn9(newx1)) y1 = y1 + imag(@h1 * @vn10(newy1)) endif elseif @formula1 == 3 ; Gnarl x1 = x1 - real(@h1 * @gn1(y1 + @gn2(real(@a1) * (y1 + @gn3(real(@b1) * y1))))) y1 = y1 + imag(@h1 * @gn4(xx1 + @gn5(imag(@a1) * (xx1 + @gn6(imag(@b1) * xx1))))) elseif @formula1 == 4 ; Dynamic x1 = x1 - real(@h1 * @dn1(y1 + real(@a1) * @dn2(real(@b1) * y1))) y1 = y1 + imag(@h1 * @dn3(xx1 + imag(@a1) * @dn4(imag(@b1) * xx1))) endif else if @formula2 == 0 ; Martin x1 = y1 - real(@mfn1(x1)) y1 = @d2 - xx1 elseif @formula2 == 1 ; Popcorn x1 = x1 - real(@h2 * @pfn1(y1 + @pfn2(real(@c2) * y1))) y1 = y1 - imag(@h2 * @pfn3(xx1 + @pfn4(imag(@c2) * xx1))) elseif @formula2 == 2 ; Vine if @flavor2 == 0 x1 = x1 - real(@h2 * @vfn1(y1 + @vfn2(real(@a2) * y1 ))) y1 = y1 + imag(@h2 * @vfn3(xx1 + @vfn4(imag(@a2) * xx1))) elseif @flavor2 == 1 x1 = x1 - real(@h2 * @vfn1(y1^real(@b2) + @vfn2(real(@a2) * y1))) y1 = y1 + imag(@h2 * @vfn3(xx1^imag(@b2) + @vfn4(imag(@a2) * xx1))) elseif @flavor2 == 2 x1 = x1 - real(@h2 * @vfn1(y1 + @vfn2(real(@a2) * (y1 + @vfn5(real(@a2) * y1))))) y1 = y1 + imag(@h2 * @vfn3(xx1 + @vfn4(imag(@a2) * (xx1 + @vfn6(imag(@a2) * xx1))))) else float newx1 = y1 float newy1 = x1 int k = 0 while k < @flavor2 k = k + 1 newx1 = y1 + real(@vfn7(real(@a2) * newx1)) newy1 = x1 + real(@vfn8(imag(@a2) * newy1)) endwhile x1 = x1 - real(@h2 * @vfn9(newx1)) y1 = y1 + imag(@h2 * @vfn10(newy1)) endif elseif @formula2 == 3 ; Gnarl x1 = x1 - real(@h2 * @gfn1(y1 + @gfn2(real(@a2) * (y1 + @gfn3(real(@b2) * y1))))) y1 = y1 + imag(@h2 * @gfn4(xx1 + @gfn5(imag(@a2) * (xx1 + @gfn6(imag(@b2) * xx1))))) elseif @formula2 == 4 ; Dynamic x1 = x1 - real(@h2 * @dfn1(y1 + real(@a2) * @dfn2(real(@b2) * y1))) y1 = y1 + imag(@h2 * @dfn3(xx1 + imag(@a2) * @dfn4(imag(@b2) * xx1))) endif endif z1 = x1 + flip(y1) if (@slope) if(scenario1 == true) if @formula1 == 0 ; Martin x2 = y2 - real(@mn1(x2)) x3 = y3 - real(@mn1(x3)) y2 = @d1 - xx2 y3 = @d1 - xx3 elseif @formula1 == 1 ; Popcorn x2 = x2 - real(@h1 * @pn1(y2 + @pn2(real(@c1) * y2))) x3 = x3 - real(@h1 * @pn1(y3 + @pn2(real(@c1) * y3))) y2 = y2 - imag(@h1 * @pn3(xx2 + @pn4(imag(@c1) * xx2))) y3 = y3 - imag(@h1 * @pn3(xx3 + @pn4(imag(@c1) * xx3))) elseif @formula1 == 2 ; Vine if @flavor1 == 0 x2 = x2 - real(@h1 * @vn1(y2 + @vn2(real(@a1) * y2 ))) x3 = x3 - real(@h1 * @vn1(y3 + @vn2(real(@a1) * y3 ))) y2 = y2 + imag(@h1 * @vn3(xx2 + @vn4(imag(@a1) * xx2))) y3 = y3 + imag(@h1 * @vn3(xx3 + @vn4(imag(@a1) * xx3))) elseif @flavor1 == 1 x2 = x2 - real(@h1 * @vn1(y2^real(@b1) + @vn2(real(@a1) * y2))) x3 = x3 - real(@h1 * @vn1(y3^real(@b1) + @vn2(real(@a1) * y3))) y2 = y2 + imag(@h1 * @vn3(xx2^imag(@b1) + @vn4(imag(@a1) * xx2))) y3 = y3 + imag(@h1 * @vn3(xx3^imag(@b1) + @vn4(imag(@a1) * xx3))) elseif @flavor1 == 2 x2 = x2 - real(@h1 * @vn1(y2 + @vn2(real(@a1) * (y2 + @vn5(real(@a1) * y2))))) x3 = x3 - real(@h1 * @vn1(y3 + @vn2(real(@a1) * (y3 + @vn5(real(@a1) * y3))))) y2 = y2 + imag(@h1 * @vn3(xx2 + @vn4(imag(@a1) * (xx2 + @vn6(imag(@a1) * xx2))))) y3 = y3 + imag(@h1 * @vn3(xx3 + @vn4(imag(@a1) * (xx3 + @vn6(imag(@a1) * xx3))))) else float newx2 = y2 float newx3 = y3 float newy2 = x2 float newy3 = x3 int j = 0 while j < @flavor1 j = j + 1 newx2 = y2 + real(@vn7(real(@a1) * newx2)) newx3 = y3 + real(@vn7(real(@a1) * newx3)) newy2 = x2 + real(@vn8(imag(@a1) * newy2)) newy3 = x3 + real(@vn8(imag(@a1) * newy3)) endwhile x2 = x2 - real(@h1 * @vn9(newx2)) x3 = x3 - real(@h1 * @vn9(newx3)) y2 = y2 + imag(@h1 * @vn10(newy2)) y3 = y3 + imag(@h1 * @vn10(newy3)) endif elseif @formula1 == 3 ; Gnarl x2 = x2 - real(@h1 * @gn1(y2 + @gn2(real(@a1) * (y2 + @gn3(real(@b1) * y2))))) x3 = x3 - real(@h1 * @gn1(y3 + @gn2(real(@a1) * (y3 + @gn3(real(@b1) * y3))))) y2 = y2 + imag(@h1 * @gn4(xx2 + @gn5(imag(@a1) * (xx2 + @gn6(imag(@b1) * xx2))))) y3 = y3 + imag(@h1 * @gn4(xx3 + @gn5(imag(@a1) * (xx3 + @gn6(imag(@b1) * xx3))))) elseif @formula1 == 4 ; Dynamic x2 = x2 - real(@h1 * @dn1(y2 + real(@a1) * @dn2(real(@b1) * y2))) x3 = x3 - real(@h1 * @dn1(y3 + real(@a1) * @dn2(real(@b1) * y3))) y2 = y2 + imag(@h1 * @dn3(xx2 + imag(@a1) * @dn4(imag(@b1) * xx2))) y3 = y3 + imag(@h1 * @dn3(xx3 + imag(@a1) * @dn4(imag(@b1) * xx3))) endif else if @formula2 == 0 ; Martin x2 = y2 - real(@mfn1(x2)) x3 = y3 - real(@mfn1(x3)) y2 = @d2 - xx2 y3 = @d2 - xx3 elseif @formula2 == 1 ; Popcorn x2 = x2 - real(@h2 * @pfn1(y2 + @pfn2(real(@c2) * y2))) x3 = x3 - real(@h2 * @pfn1(y3 + @pfn2(real(@c2) * y3))) y2 = y2 - imag(@h2 * @pfn3(xx2 + @pfn4(imag(@c2) * xx2))) y3 = y3 - imag(@h2 * @pfn3(xx3 + @pfn4(imag(@c2) * xx3))) elseif @formula2 == 2 ; Vine if @flavor2 == 0 x2 = x2 - real(@h2 * @vfn1(y2 + @vfn2(real(@a2) * y2 ))) x3 = x3 - real(@h2 * @vfn1(y3 + @vfn2(real(@a2) * y3 ))) y2 = y2 + imag(@h2 * @vfn3(xx2 + @vfn4(imag(@a2) * xx2))) y3 = y3 + imag(@h2 * @vfn3(xx3 + @vfn4(imag(@a2) * xx3))) elseif @flavor2 == 1 x2 = x2 - real(@h2 * @vfn1(y2^real(@b2) + @vfn2(real(@a2) * y2))) x3 = x3 - real(@h2 * @vfn1(y3^real(@b2) + @vfn2(real(@a2) * y3))) y2 = y2 + imag(@h2 * @vfn3(xx2^imag(@b2) + @vfn4(imag(@a2) * xx2))) y3 = y3 + imag(@h2 * @vfn3(xx3^imag(@b2) + @vfn4(imag(@a2) * xx3))) elseif @flavor2 == 2 x2 = x2 - real(@h2 * @vfn1(y2 + @vfn2(real(@a2) * (y2 + @vfn5(real(@a2) * y2))))) x3 = x3 - real(@h2 * @vfn1(y3 + @vfn2(real(@a2) * (y3 + @vfn5(real(@a2) * y3))))) y2 = y2 + imag(@h2 * @vfn3(xx2 + @vfn4(imag(@a2) * (xx2 + @vfn6(imag(@a2) * xx2))))) y3 = y3 + imag(@h2 * @vfn3(xx3 + @vfn4(imag(@a2) * (xx3 + @vfn6(imag(@a2) * xx3))))) else float newx2 = y2 float newx3 = y3 float newy2 = x2 float newy3 = x3 int k = 0 while k < @flavor2 k = k + 1 newx2 = y2 + real(@vfn7(real(@a2) * newx2)) newx3 = y3 + real(@vfn7(real(@a2) * newx3)) newy2 = x2 + real(@vfn8(imag(@a2) * newy2)) newy3 = x3 + real(@vfn8(imag(@a2) * newy3)) endwhile x2 = x2 - real(@h2 * @vfn9(newx2)) x3 = x3 - real(@h2 * @vfn9(newx3)) y2 = y2 + imag(@h2 * @vfn10(newy2)) y3 = y3 + imag(@h2 * @vfn10(newy3)) endif elseif @formula2 == 3 ; Gnarl x2 = x2 - real(@h2 * @gfn1(y2 + @gfn2(real(@a2) * (y2 + @gfn3(real(@b2) * y2))))) x3 = x3 - real(@h2 * @gfn1(y3 + @gfn2(real(@a2) * (y3 + @gfn3(real(@b2) * y3))))) y2 = y2 + imag(@h2 * @gfn4(xx2 + @gfn5(imag(@a2) * (xx2 + @gfn6(imag(@b2) * xx2))))) y3 = y3 + imag(@h2 * @gfn4(xx3 + @gfn5(imag(@a2) * (xx3 + @gfn6(imag(@b2) * xx3))))) elseif @formula2 == 4 ; Dynamic x2 = x2 - real(@h2 * @dfn1(y2 + real(@a2) * @dfn2(real(@b2) * y2))) x3 = x3 - real(@h2 * @dfn1(y3 + real(@a2) * @dfn2(real(@b2) * y3))) y2 = y2 + imag(@h2 * @dfn3(xx2 + imag(@a2) * @dfn4(imag(@b2) * xx2))) y3 = y3 + imag(@h2 * @dfn3(xx3 + imag(@a2) * @dfn4(imag(@b2) * xx3))) endif endif z2 = x2 + flip(y2) z3 = x3 + flip(y3) endif IF (@coloronly); only using fBm on coloring oz1 = z1 oz2 = z2 oz3 = z3 ENDIF if (@fBm == true) IF (@noiseskip == 0.0 || noise); adding noise this iteration complex pa = z1 * @scale * r1 + @noffset float suma = 0.0 float freq = 1.0 complex va = (0,0) int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxa = floor(real(pa)) float fya = floor(imag(pa)) float bx0a = fxa % 256 float by0a = fya % 256 IF (bx0a < 0) bx0a = bx0a + 256 ENDIF IF (by0a < 0) by0a = by0a + 256 ENDIF float bx1a = (bx0a + 1) % 256 float by1a = (by0a + 1) % 256 float rx0a = real(pa) - fxa float ry0a = imag(pa) - fya float rx1a = rx0a - 1 float ry1a = ry0a - 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 b00a = (bx0a^@npower % 65536 + by0a)^@npower % 65536 float b10a = (bx1a^@npower % 65536 + by0a)^@npower % 65536 float b01a = (bx0a^@npower % 65536 + by1a)^@npower % 65536 float b11a = (bx1a^@npower % 65536 + by1a)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0a = (b00a)^@npower*0.25 % 512 - 256 float g_b10_0a = (b10a)^@npower*0.25 % 512 - 256 float g_b01_0a = (b01a)^@npower*0.25 % 512 - 256 float g_b11_0a = (b11a)^@npower*0.25 % 512 - 256 float g_b00_1a = (b00a+1)^@npower*0.25 % 512 - 256 float g_b10_1a = (b10a+1)^@npower*0.25 % 512 - 256 float g_b01_1a = (b01a+1)^@npower*0.25 % 512 - 256 float g_b11_1a = (b11a+1)^@npower*0.25 % 512 - 256 ; normalize each vector float da = 0.0; da = 1 / sqrt(sqr(g_b00_0a) + sqr(g_b00_1a)) g_b00_0a = g_b00_0a * da g_b00_1a = g_b00_1a * da da = 1 / sqrt(sqr(g_b10_0a) + sqr(g_b10_1a)) g_b10_0a = g_b10_0a * da g_b10_1a = g_b10_1a * da da = 1 / sqrt(sqr(g_b01_0a) + sqr(g_b01_1a)) g_b01_0a = g_b01_0a * da g_b01_1a = g_b01_1a * da da = 1 / sqrt(sqr(g_b11_0a) + sqr(g_b11_1a)) g_b11_0a = g_b11_0a * da g_b11_1a = g_b11_1a * da ; produce colors for each corner float u1a = rx0a * g_b00_0a + ry0a * g_b00_1a float v1a = rx1a * g_b10_0a + ry0a * g_b10_1a float u2a = rx0a * g_b01_0a + ry1a * g_b01_1a float v2a = rx1a * g_b11_0a + ry1a * g_b11_1a ; interpolate between corners using ; bilinear filtering float sxa = sqr(rx0a) * (3 - rx0a*2) float sya = sqr(ry0a) * (3 - ry0a*2) float a1 = u1a + sxa*(v1a-u1a) float b1 = u2a + sxa*(v2a-u2a) suma = suma + real(@nfn1(a1 + sya*(b1-a1)))*freq freq = freq * @step pa = pa * r2 / @step i = i - 1 ENDWHILE IF (@style == 0); radial distortion va = (z1-c)/cabs(z1-c) * r3; use vector based on angle to distortion center ELSEIF (@style == 1); linear distortion va = r3; just use rotation vector ENDIF z1 = z1 + va * (suma+@coloroffset)*0.5*@distortion ENDIF if (@slope) IF (@noiseskip == 0.0 || noise); adding noise this iteration complex pb = z2 * @scale * r1 + @noffset complex pc = z3 * @scale * r1 + @noffset float sumb = 0.0 float sumc = 0.0 float freq = 1.0 complex vb = (0,0) complex vc = (0,0) int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxb = floor(real(pb)) float fyb = floor(imag(pb)) float bx0b = fxb % 256 float by0b = fyb % 256 IF (bx0b < 0) bx0b = bx0b + 256 ENDIF IF (by0b < 0) by0b = by0b + 256 ENDIF float bx1b = (bx0b + 1) % 256 float by1b = (by0b + 1) % 256 float rx0b = real(pb) - fxb float ry0b = imag(pb) - fyb float rx1b = rx0b - 1 float ry1b = ry0b - 1 float fxc = floor(real(pc)) float fyc = floor(imag(pc)) float bx0c = fxc % 256 float by0c = fyc % 256 IF (bx0c < 0) bx0c = bx0c + 256 ENDIF IF (by0c < 0) by0c = by0c + 256 ENDIF float bx1c = (bx0c + 1) % 256 float by1c = (by0c + 1) % 256 float rx0c = real(pc) - fxc float ry0c = imag(pc) - fyc float rx1c = rx0c - 1 float ry1c = ry0c - 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 b00b = (bx0b^@npower % 65536 + by0b)^@npower % 65536 float b10b = (bx1b^@npower % 65536 + by0b)^@npower % 65536 float b01b = (bx0b^@npower % 65536 + by1b)^@npower % 65536 float b11b = (bx1b^@npower % 65536 + by1b)^@npower % 65536 float b00c = (bx0c^@npower % 65536 + by0c)^@npower % 65536 float b10c = (bx1c^@npower % 65536 + by0c)^@npower % 65536 float b01c = (bx0c^@npower % 65536 + by1c)^@npower % 65536 float b11c = (bx1c^@npower % 65536 + by1c)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0b = (b00b)^@npower*0.25 % 512 - 256 float g_b10_0b = (b10b)^@npower*0.25 % 512 - 256 float g_b01_0b = (b01b)^@npower*0.25 % 512 - 256 float g_b11_0b = (b11b)^@npower*0.25 % 512 - 256 float g_b00_1b = (b00b+1)^@npower*0.25 % 512 - 256 float g_b10_1b = (b10b+1)^@npower*0.25 % 512 - 256 float g_b01_1b = (b01b+1)^@npower*0.25 % 512 - 256 float g_b11_1b = (b11b+1)^@npower*0.25 % 512 - 256 float g_b00_0c = (b00c)^@npower*0.25 % 512 - 256 float g_b10_0c = (b10c)^@npower*0.25 % 512 - 256 float g_b01_0c = (b01c)^@npower*0.25 % 512 - 256 float g_b11_0c = (b11c)^@npower*0.25 % 512 - 256 float g_b00_1c = (b00c+1)^@npower*0.25 % 512 - 256 float g_b10_1c = (b10c+1)^@npower*0.25 % 512 - 256 float g_b01_1c = (b01c+1)^@npower*0.25 % 512 - 256 float g_b11_1c = (b11c+1)^@npower*0.25 % 512 - 256 ; normalize each vector float db = 0.0 float dc = 0.0; db = 1 / sqrt(sqr(g_b00_0b) + sqr(g_b00_1b)) g_b00_0b = g_b00_0b * db g_b00_1b = g_b00_1b * db db = 1 / sqrt(sqr(g_b10_0b) + sqr(g_b10_1b)) g_b10_0b = g_b10_0b * db g_b10_1b = g_b10_1b * db db = 1 / sqrt(sqr(g_b01_0b) + sqr(g_b01_1b)) g_b01_0b = g_b01_0b * db g_b01_1b = g_b01_1b * db db = 1 / sqrt(sqr(g_b11_0b) + sqr(g_b11_1b)) g_b11_0b = g_b11_0b * db g_b11_1b = g_b11_1b * db dc = 1 / sqrt(sqr(g_b00_0c) + sqr(g_b00_1c)) g_b00_0c = g_b00_0c * dc g_b00_1c = g_b00_1c * dc dc = 1 / sqrt(sqr(g_b10_0c) + sqr(g_b10_1c)) g_b10_0c = g_b10_0c * dc g_b10_1c = g_b10_1c * dc dc = 1 / sqrt(sqr(g_b01_0c) + sqr(g_b01_1c)) g_b01_0c = g_b01_0c * dc g_b01_1c = g_b01_1c * dc dc = 1 / sqrt(sqr(g_b11_0c) + sqr(g_b11_1c)) g_b11_0c = g_b11_0c * dc g_b11_1c = g_b11_1c * dc ; produce colors for each corner float u1b = rx0b * g_b00_0b + ry0b * g_b00_1b float v1b = rx1b * g_b10_0b + ry0b * g_b10_1b float u2b = rx0b * g_b01_0b + ry1b * g_b01_1b float v2b = rx1b * g_b11_0b + ry1b * g_b11_1b float u1c = rx0c * g_b00_0c + ry0c * g_b00_1c float v1c = rx1c * g_b10_0c + ry0c * g_b10_1c float u2c = rx0c * g_b01_0c + ry1c * g_b01_1c float v2c = rx1c * g_b11_0c + ry1c * g_b11_1c ; interpolate between corners using ; bilinear filtering float sxb = sqr(rx0b) * (3 - rx0b*2) float syb = sqr(ry0b) * (3 - ry0b*2) float a2 = u1b + sxb*(v1b-u1b) float b2 = u2b + sxb*(v2b-u2b) float sxc = sqr(rx0c) * (3 - rx0c*2) float syc = sqr(ry0c) * (3 - ry0c*2) float a3 = u1c + sxc*(v1c-u1c) float b3 = u2c + sxc*(v2c-u2c) sumb = sumb + real(@nfn1(a2 + syb*(b2-a2)))*freq sumc = sumc + real(@nfn1(a3 + syc*(b3-a3)))*freq freq = freq * @step pb = pb * r2 / @step pc = pc * r2 / @step i = i - 1 ENDWHILE IF (@style == 0); radial distortion vb = (z2-c)/cabs(z2-c) * r3 vc = (z3-c)/cabs(z3-c) * r3 ELSEIF (@style == 1); linear distortion vb = r3 vc = r3 ENDIF z2 = z2 + vb * (sumb+@coloroffset)*0.5*@distortion z3 = z3 + vc * (sumc+@coloroffset)*0.5*@distortion ENDIF endif endif IF (@coloronly == false); not just using fBm on coloring oz1 = z1; value for bailout is fBm'ed z oz2 = z2 oz3 = z3 ENDIF if (@slope) IF (@zmode == 58) iterexp1 = iterexp1 + exp(-cabs(z1)) iterexp2 = iterexp2 + exp(-cabs(z2)) iterexp3 = iterexp3 + exp(-cabs(z3)) ELSEIF (@zmode == 59) sum1 = cabs(z1 - #pixel) sum2 = cabs(z2 - #pixel) sum3 = cabs(z3 - #pixel) ELSE sum1 = cabs(z1) sum2 = cabs(z2) sum3 = cabs(z3) ENDIF done = done + 1; increment iteration counter IF (@zmode == 0) ; 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 == 1) ; 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 == 2) ; 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 == 3) ; 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 == 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 |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 == 6) ; 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 == 7) ; smallest |function1(z)| d1 = abs(real(fn1(z1))) + abs(imag(fn1(z1))) ; get current distances d2 = abs(real(fn1(z2))) + abs(imag(fn1(z2))) d3 = abs(real(fn1(z3))) + abs(imag(fn1(z3))) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 8) ; smallest |function2(z)| d1 = cabs(fn1(z1)) ; get current distances d2 = cabs(fn1(z2)) d3 = cabs(fn1(z3)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 9) ; smallest Lemniscate Distance theta = atan(imag(#z)/real(#z)) r = 1.5*@a*(cos(2*theta))^0.5 polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 10) ; smallest Cardiod Distance theta = atan(imag(#z)/real(#z)) r = 5*@a*(1-cos(theta)) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 11) ; smallest Conchoid Distance theta = atan(imag(#z)/real(#z)) r = 0.2*(@a + @b*cos(theta))/cos(theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 12) ; smallest Cycloid Distance theta = atan(imag(#z)/real(#z)) r = 2*cabs(#z) polar = r*(theta-sin(theta)) + flip(r*(1-cos(theta))) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 13) ; smallest Archimedes Distance theta = atan(imag(#z)/real(#z)) r = 3.5*@a*theta polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 14) ; smallest Log Spiral Distance theta = atan(imag(#z)/real(#z)) r = exp(@a*theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 15) ; smallest Rose Distance theta = atan(imag(#z)/real(#z)) r = @a*cos(theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 16) ; smallest Bifolium Distance theta = atan(imag(#z)/real(#z)) r = 16*@a*sin(theta)^2*cos(theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 17) ; smallest Astroid Distance theta = atan(imag(#z)/real(#z)) af1 = @afn1(theta)^imag(@apwr) af2 = @afn2(theta)^imag(@apwr) polar = 1.75*@a*(af1 + flip(af2)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 18) ; smallest Cissoid of Diocles Distance theta = atan(imag(#z)/real(#z)) r = 2*@a*sin(theta)*tan(theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 19) ; smallest Cochleoid Distance theta = atan(imag(#z)/real(#z)) r = 1.25*@a*sin(theta)/theta polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 20) ; smallest Folium of Descartes Distance theta = atan(imag(#z)/real(#z)) r = @a*tan(theta)/(cos(theta)*(1+tan(theta)^3)) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 21) ; smallest Limacon of Pascal Distance theta = atan(imag(#z)/real(#z)) r = 0.03*@b + 1.5*@a*cos(theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 22) ; smallest Lituus Distance theta = atan(imag(#z)/real(#z)) r = 0.6*@a/theta^0.5 polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 23) ; smallest Nephroid Distance theta = atan(imag(#z)/real(#z)) af1 = 3*@afn1(theta) - @afn1(theta/3) af2 = 3*@afn2(theta) - @afn2(theta/3) polar = 0.75*@a*(af1 + flip(af2)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 24) ; smallest Strophoid Distance theta = atan(imag(#z)/real(#z)) r = 0.2*@b*sin(@a-2*theta)/sin(@a-theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 25) ; smallest Witch of Agnesi theta = atan(imag(#z)/real(#z)) af1 = 2*cotan(theta) af2 = 1-cos(2*theta) polar = 0.1*@a*(af1 + flip(af2)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 26) ; smallest Curtate Cycloid theta = atan(imag(#z)/real(#z)) af1 = 2*@a*theta - 0.1*@b*@afn2(theta) af2 = 2*@a - 0.1*@b*@afn1(theta) polar = af1 + flip(af2) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 27) ; smallest Epicycloid theta = atan(imag(#z)/real(#z)) af1 = (5*@a+@b)*@afn1(theta) - @b*@afn1((5*@a+@b)*theta/@b) af2 = (5*@a+@b)*@afn2(theta) - @b*@afn2((5*@a+@b)*theta/@b) polar = 0.5*(af1 + flip(af2)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 28) ; smallest Ellipse Evolute theta = atan(imag(#z)/real(#z)) af1 = (@a^2-(0.7*@b)^2)/@a*@afn1(theta)^(real(@apwr)) af2 = ((0.7*@b)^2-@a^2)/(0.7*@b)*@afn2(theta)^(imag(@apwr)) polar = 0.2*(af1 + flip(af2)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 29) ; smallest Tractrix theta = atan(imag(#z)/real(#z)) af1 = @a*(log(tan(theta/2))-@afn1(theta)) af2 = @a*@afn2(theta) polar = 0.25*(af1 + flip(af2)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 30) ; smallest Kampyle of Eudoxus Distance theta = atan(imag(#z)/real(#z)) r = @a/cos(theta)^2 polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 31) ; smallest Circle Catacaustic theta = atan(imag(#z)/real(#z)) af1 = 2*@b*(1-3*2*@b*cos(theta)+2*2*@b*cos(theta)^3)/(-(1+2*(2*@b)^2)+3*2*@b*cos(theta)) af2 = 2*(2*@b)^2*sin(theta)^3/(1+2*(2*@b)^2-3*@b*cos(theta)) polar = 1.5*@a*(af1 + flip(af2)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 32) ; smallest Deltoid Catacaustic theta = atan(imag(#z)/real(#z)) af1 = 3*@afn1(theta) + @afn1(3*theta+#pi/2*@b) - @afn1(#pi/2*@b) af2 = 3*@afn2(theta) + @afn2(3*theta+#pi/2*@b) - @afn2(#pi/2*@b) polar = 0.35*@a*(af1 + flip(af2)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 33) ; smallest Ellipse Catacaustic theta = atan(imag(#z)/real(#z)) af1 = 4*@a*(@a-@b)*(@a*@b)*sin(theta)^3/(@a^2+@b^2+(@b^2-@a^2)*cos(2*theta)) af2 = 4*@b*(@b^2-@a^2)*cos(theta)^3/(@a^2+@b^2+3*(@b^2-@a^2)*cos(2*theta)) polar = 0.25*(af1 + flip(af2)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 34) ; smallest Log Spiral Catacaustic theta = atan(imag(#z)/real(#z)) af1 = 2*@b*exp(2*@b*theta)*(2*@b*cos(theta)-sin(theta))/(1+(2*@b^2)) af2 = 2*@b*exp(2*@b*theta)*(2*@b*cos(theta)+sin(theta))/(1+(2*@b^2)) polar = @a*(af1 + flip(af2)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 35) ; smallest Butterfly Distance theta = atan(imag(#z)/real(#z)) r = 1.25*@a*(exp(sin(theta))-2*cos(4*theta)+sin(1/24*(2*theta-#pi))) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 36) ; smallest Gear Curve theta = atan(imag(#z)/real(#z)) af1 = (0.25*@a+1/@b*tanh(@b*sin(@pn*theta)))*cos(theta) af2 = (0.25*@a+1/@b*tanh(@b*sin(@pn*theta)))*sin(theta) polar = (af1 + flip(af2)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 37) ; smallest Arachnida 1 Distance theta = atan(imag(#z)/real(#z)) r = @a*sin(@pn*theta)/sin((@pn-1)*theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 38) ; smallest Arachnida 2 Distance theta = atan(imag(#z)/real(#z)) r = @a*sin(@pn*theta)/sin((@pn+1)*theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 39) ; smallest Cayley's Sextic Distance theta = atan(imag(#z)/real(#z)) r = 1.5*@a*cos(theta)^3 polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 40) ; smallest Cycloid of Seva Distance theta = atan(imag(#z)/real(#z)) r = 0.5*@a*(1+2*cos(2*theta)) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 41) ; smallest Devil's Curve Distance theta = atan(imag(#z)/real(#z)) r = (((0.5*@a*sin(theta))^2-(0.2*@b*cos(theta))^2)/(sin(theta)^2-cos(theta)^2))^0.5 polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 42) ; smallest Eight Curve Distance theta = atan(imag(#z)/real(#z)) r = @a*cos(theta)^(-2)*cos(2*theta)^0.5 polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 43) ; smallest Epispiral Distance theta = atan(imag(#z)/real(#z)) r = 0.25*@a/cos(@pn*theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 44) ; smallest Hipopede Distance theta = atan(imag(#z)/real(#z)) r = (0.5*@b*(0.5*@a-(0.5*@b)^2*cos(theta)))^0.5 polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 45) ; smallest Maltese Cross Distance theta = atan(imag(#z)/real(#z)) r = 0.5*@a/(cos(theta)*sin(theta)*(cos(theta)^2-sin(theta)^2))^0.5 polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 46) ; smallest Ophiuride Distance theta = atan(imag(#z)/real(#z)) r = (0.01*@b*sin(theta)-4.5*@a*cos(theta))*tan(theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 47) ; smallest Quadratrix of Hippias Distance theta = atan(imag(#z)/real(#z)) r = @a*theta/sin(theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 48) ; smallest Poinsot Spiral 1 Distance theta = atan(imag(#z)/real(#z)) r = 1.5*@a/cosh(@pn*theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 49) ; smallest Poinsot Spiral 2 Distance theta = atan(imag(#z)/real(#z)) r = @a/sinh(@pn*theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 50) ; smallest Quadrifolium Distance theta = atan(imag(#z)/real(#z)) r = 2.5*@a*sin(2*theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 51) ; smallest Scarabaeus Distance theta = atan(imag(#z)/real(#z)) r = 0.5*@b*cos(2*theta)-@a*cos(theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 52) ; smallest Semicubical Parabola Distance theta = atan(imag(#z)/real(#z)) r = 1.5*@a*(cos(3*@b*theta))^(1/(3*@b)) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 53) ; smallest Swastika Curve Distance theta = atan(imag(#z)/real(#z)) r = 2.25*@a*(sin(theta)*cos(theta)/(sin(theta)^4-cos(theta)^4))^0.5 polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 54) ; smallest Trifolium Distance theta = atan(imag(#z)/real(#z)) r = -2*@a*cos(3*theta) polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 55) ; smallest Tschirnhausen Cubic Distance theta = atan(imag(#z)/real(#z)) r = @a/cos(theta/3)^3 polar = r*cos(theta) + flip(r*sin(theta)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 56) ; smallest Bicorn theta = atan(imag(#z)/real(#z)) af1 = @a*sin(theta) af2 = @a*cos(theta)^2*(2+cos(theta))/(3+sin(theta)^2) polar = 1.5*(af1 + flip(af2)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 57) ; smallest Cruciform theta = atan(imag(#z)/real(#z)) af1 = 0.1*@a/cos(theta) af2 = 0.02*@b/sin(theta) polar = 1.5*(af1 + flip(af2)) d1 = abs(cabs(z1)-cabs(polar)) ; get current distances d2 = abs(cabs(z2)-cabs(polar)) d3 = abs(cabs(z3)-cabs(polar)) IF (d1 < s1) ; update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ENDIF endif modz = |oz1| if (@slope == true) IF (modz > @bailout ||\ @everyiter ||\ done == #maxit + 2); done, or every iteration, or last ; determine continuous iteration (height) for each point IF (@zmode >= 0 && @zmode <= 57) ; height based on smallest |z| e1 = s1 * @zscale e2 = s2 * @zscale e3 = s3 * @zscale ELSEIF (@zmode == 58) e1 = iterexp1 * @zscale e2 = iterexp2 * @zscale e3 = iterexp3 * @zscale ELSE e1 = sum1 * @zscale e2 = sum2 * @zscale e3 = sum3 * @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 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 else z = z1 endif IF (modz > @bailout); we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope Advanced Gnarly" maxiter = 20 periodicity = 0 method = multipass magn = 0.3 param version caption = "Version" default = 1.19 visible = false endparam heading caption = "Slope Advanced Gnarly" endheading heading caption = "Use Damien's Lighting Coloring" endheading heading caption = "Or Ron's 3D Texturizer Formulas" endheading heading caption = "Most other coloring formulas" endheading heading caption = "can also be used." endheading float param bailout caption = "Bailout Value" default = 1.0e20 endparam param tscale caption = "Gnarly Scale" default = 1.0 endparam int param seq enum = "Modulation" "First Scenario" "Second Scenario" "Random" default = 0 caption = "Scenario Sequence" endparam int param modBy default = 10 caption = "Mod By" hint = "Iteration Modulated by This" visible = @seq==0 endparam int param modCmp default = 5 caption = "Mod Compare" hint = "Modulated Iteration < this -> Scenario 1" visible = @seq==0 endparam int param randomseed caption = "Random Seed" default = 123456 visible = @seq==3 endparam float param prob1 caption = "Prob for Func 1" default = 0.5 min = 0.0 max = 1.0 visible = @seq==3 endparam heading caption = "Scenario 1" visible = @seq!=2 endheading param formula1 caption = "Formula" enum = "Martin" "Popcorn" "Vine" "Gnarl" "Dynamic" visible = @seq!=2 default = 3 endparam param h1 caption = "Step Size" default = (0.05, 0.05) visible = @formula1 == 1 || @formula1 == 2 || @formula1 == 3 || @formula1 == 4 && @seq!=2 endparam param a1 caption = "Alpha" default = (3.0, 3.0) visible = @formula1 == 2 || @formula1 == 3 || @formula1 == 4 && @seq!=2 endparam param b1 caption = "Beta" default = (2.0, 2.0) visible = @formula1 == 2 || @formula1 == 3 || @formula1 == 4 && @seq!=2 endparam param c1 caption = "Constant C" default = (3.0, 3.0) visible = @formula1 == 1 && @seq!=2 endparam float param d1 caption = "Martin Parameter" default = #pi visible = @formula1 == 0 && @seq!=2 endparam param flavor1 caption = "Vine flavor" hint = "This is the 'flavor' for the Vine formula." default = 2 min = 0 visible = @formula1 == 2 && @seq!=2 endparam func mn1 caption = "Martin function" default = sin() visible = @formula1 == 0 && @seq!=2 endfunc heading caption = "Popcorn functions" visible = @formula1 == 1 && @seq!=2 endheading func pn1 caption = "Popcorn #1" default = sin() visible = @formula1 == 1 && @seq!=2 endfunc func pn2 caption = "Popcorn #2" default = tan() visible = @formula1 == 1 && @seq!=2 endfunc func pn3 caption = "Popcorn #3" default = sin() visible = @formula1 == 1 && @seq!=2 endfunc func pn4 caption = "Popcorn #4" default = tan() visible = @formula1 == 1 && @seq!=2 endfunc heading caption = "Vine functions" visible = @formula1 == 2 && @seq!=2 endheading func vn1 caption = "Vine #1" default = sin() visible = @formula1 == 2 && @seq!=2 endfunc func vn2 caption = "Vine #2" default = sin() visible = @formula1 == 2 && @seq!=2 endfunc func vn3 caption = "Vine #3" default = sin() visible = @formula1 == 2 && @seq!=2 endfunc func vn4 caption = "Vine #4" default = sin() visible = @formula1 == 2 && @seq!=2 endfunc func vn5 caption = "Vine #5" default = sin() visible = @formula1 == 2 && @seq!=2 endfunc func vn6 caption = "Vine #6" default = sin() visible = @formula1 == 2 && @seq!=2 endfunc func vn7 caption = "Vine #7" default = sin() visible = @formula1 == 2 && @seq!=2 endfunc func vn8 caption = "Vine #8" default = sin() visible = @formula1 == 2 && @seq!=2 endfunc func vn9 caption = "Vine #9" default = sin() visible = @formula1 == 2 && @seq!=2 endfunc func vn10 caption = "Vine #10" default = sin() visible = @formula1 == 2 && @seq!=2 endfunc heading caption = "Gnarl functions" visible = @formula1 == 3 && @seq!=2 endheading func gn1 caption = "Gnarl #1" default = sin() visible = @formula1 == 3 && @seq!=2 endfunc func gn2 caption = "Gnarl #2" default = sin() visible = @formula1 == 3 && @seq!=2 endfunc func gn3 caption = "Gnarl #3" default = sin() visible = @formula1 == 3 && @seq!=2 endfunc func gn4 caption = "Gnarl #4" default = sin() visible = @formula1 == 3 && @seq!=2 endfunc func gn5 caption = "Gnarl #5" default = sin() visible = @formula1 == 3 && @seq!=2 endfunc func gn6 caption = "Gnarl #6" default = sin() visible = @formula1 == 3 && @seq!=2 endfunc heading caption = "Dynamic functions" visible = @formula1 == 4 && @seq!=2 endheading func dn1 caption = "Dynamic #1" default = sin() visible = @formula1 == 4 && @seq!=2 endfunc func dn2 caption = "Dynamic #2" default = tan() visible = @formula1 == 4 && @seq!=2 endfunc func dn3 caption = "Dynamic #3" default = sin() visible = @formula1 == 4 && @seq!=2 endfunc func dn4 caption = "Dynamic #4" default = tan() visible = @formula1 == 4 && @seq!=2 endfunc heading caption = "Scenario 2" visible = @seq!=1 endheading param formula2 caption = "Formula" enum = "Martin" "Popcorn" "Vine" "Gnarl" "Dynamic" visible = @seq!=1 default = 4 endparam param h2 caption = "Step Size" default = (0.05, 0.05) visible = @formula2 == 1 || @formula2 == 2 || @formula2 == 3 || @formula2 == 4 && @seq!=1 endparam param a2 caption = "Alpha" default = (3.0, 3.0) visible = @formula2 == 2 || @formula2 == 3 || @formula2 == 4 && @seq!=1 endparam param b2 caption = "Beta" default = (3.0, 3.0) visible = @formula2 == 2 || @formula2 == 3 || @formula2 == 4 && @seq!=1 endparam param c2 caption = "Constant C" default = (8.0, 8.0) visible = @formula2 == 1 && @seq!=1 endparam float param d2 caption = "Martin Parameter" default = #pi visible = @formula2 == 0 && @seq!=1 endparam param flavor2 caption = "Vine flavor" hint = "This is the 'flavor' for the Vine formula." default = 2 min = 0 visible = @formula2 == 2 && @seq!=1 endparam func mfn1 caption = "Martin function" default = cos() visible = @formula2 == 0 && @seq!=1 endfunc heading caption = "Popcorn functions" visible = @formula2 == 1 && @seq!=1 endheading func pfn1 caption = "Popcorn #1" default = sin() visible = @formula2 == 1 && @seq!=1 endfunc func pfn2 caption = "Popcorn #2" default = cos() visible = @formula2 == 1 && @seq!=1 endfunc func pfn3 caption = "Popcorn #3" default = sin() visible = @formula2 == 1 && @seq!=1 endfunc func pfn4 caption = "Popcorn #4" default = cos() visible = @formula2 == 1 && @seq!=1 endfunc heading caption = "Vine functions" visible = @formula2 == 2 && @seq!=1 endheading func vfn1 caption = "Vine #1" default = sin() visible = @formula2 == 2 && @seq!=1 endfunc func vfn2 caption = "Vine #2" default = cos() visible = @formula2 == 2 && @seq!=1 endfunc func vfn3 caption = "Vine #3" default = sin() visible = @formula2 == 2 && @seq!=1 endfunc func vfn4 caption = "Vine #4" default = cos() visible = @formula2 == 2 && @seq!=1 endfunc func vfn5 caption = "Vine #5" default = sin() visible = @formula2 == 2 && @seq!=1 endfunc func vfn6 caption = "Vine #6" default = sin() visible = @formula2 == 2 && @seq!=1 endfunc func vfn7 caption = "Vine #7" default = sin() visible = @formula2 == 2 && @seq!=1 endfunc func vfn8 caption = "Vine #8" default = sin() visible = @formula2 == 2 && @seq!=1 endfunc func vfn9 caption = "Vine #9" default = cos() visible = @formula2 == 2 && @seq!=1 endfunc func vfn10 caption = "Vine #10" default = cos() visible = @formula2 == 2 && @seq!=1 endfunc heading caption = "Gnarl functions" visible = @formula2 == 3 && @seq!=1 endheading func gfn1 caption = "Gnarl #1" default = cos() visible = @formula2 == 3 && @seq!=1 endfunc func gfn2 caption = "Gnarl #2" default = abs() visible = @formula2 == 3 && @seq!=1 endfunc func gfn3 caption = "Gnarl #3" default = cabs() visible = @formula2 == 3 && @seq!=1 endfunc func gfn4 caption = "Gnarl #4" default = cos() visible = @formula2 == 3 && @seq!=1 endfunc func gfn5 caption = "Gnarl #5" default = abs() visible = @formula2 == 3 && @seq!=1 endfunc func gfn6 caption = "Gnarl #6" default = cabs() visible = @formula2 == 3 && @seq!=1 endfunc heading caption = "Dynamic functions" visible = @formula2 == 4 && @seq!=1 endheading func dfn1 caption = "Dynamic #1" default = sin() visible = @formula2 == 4 && @seq!=1 endfunc func dfn2 caption = "Dynamic #2" default = sin() visible = @formula2 == 4 && @seq!=1 endfunc func dfn3 caption = "Dynamic #3" default = sin() visible = @formula2 == 4 && @seq!=1 endfunc func dfn4 caption = "Dynamic #4" default = sin() visible = @formula2 == 4 && @seq!=1 endfunc bool param fBm caption = "fBm texturing?" default = false endparam heading caption = "fBm Parameters" visible = @fBm==true endheading param distortion caption = "Distortion Strength" default = 1.0 hint = "This is the amount the noise distorts the image." visible = @fBm==true 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." visible = @fBm==true endparam param distangle caption = "Distortion Angle" default = 0.0 hint = "This is the angle to rotate the distortion." visible = @fBm==true 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." visible = @fBm==true 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." visible = @fBm==true endparam param coloroffset caption = "Coloring Offset" default = 0.0 hint = "Sets the coloring offset from zero. Increase this if you see \ large areas of solid color." visible = @fBm == true endparam param noffset 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." visible = @fBm==true endparam param scale caption = "Noise Scale" default = 1.0 hint = "This is the overall scale of the noise." visible = @fBm==true endparam param angle caption = "Noise Rotation" default = 0.0 hint = "This is the angle, in degrees, of the noise." visible = @fBm==true endparam param step caption = "Noise Scale Step" default = 0.5 hint = "This is the step in scale between noise iterations." visible = @fBm==true endparam param anglestep caption = "Noise Rotation Step" default = 37.0 hint = "This is the angle, in degrees, to rotate between noise \ iterations." visible = @fBm==true endparam param octaves caption = "Noise Octaves" default = 7 min = 1 hint = "This is the number of iterations of the noise formula." visible = @fBm==true endparam param npower caption = "Noise Exponent" default = 2.0 hint = "This is the exponent used to scramble numbers." visible = @fBm==true endparam param noisestart caption = "Start Iteration" default = 0.0 hint = "This is the iteration at which to start adding noise." visible = @fBm==true endparam param noiseiter caption = "Noise Iterations" default = 10000.0 hint = "This is the number of iterations to add noise to." visible = @fBm==true endparam param noiseskip caption = "Skip Iterations" default = 0.0 hint = "This is the number of iterations to skip adding noise \ before starting again." visible = @fBm==true endparam func nfn1 caption = "Noise Function" default = ident() visible = @fBm==true endfunc param coloronly caption = "Coloring Only" default = true 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." visible = @fBm==true endparam bool param slope caption = "Apply slope?" default = true endparam heading caption = "Slope Parameters" visible = @slope==true endheading param offset caption = "Orbit Separation" default = 0.001 hint = "Defines how far apart the simultaneous orbits are. Smaller \ distances will produce more accurate results." visible = @slope==true endparam param zmode caption = "Height Value" default = 58 enum = "smallest |z|" "smallest |real(z)|" "smallest |imag(z)|" \ "smallest |sum(z)|" "smallest |product(z)|" \ "|smallest quotient(z)|" "smallest |atan(z)|" \ "smallest |function1(z)|" "smallest |function2(z)|" \ "Lemniscate" "Cardiod" "Conchoid" "Cycloid" "Archimedes" \ "Log Spiral" "Rose" "Bifolium" "Astroid" "Cissoid of Diocles" \ "Cochleoid" "Folium of Descartes" "Limacon of Pascal" \ "Lituus" "Nephroid" "Strophoid" "Witch of Agnesi" \ "Curtate Cycloid" "Epicycloid" "Ellipse Evolute" "Tractrix" \ "Kampyle of Eudoxus" "Circle Catacaustic" "Deltoid Catacaustic" \ "Ellipse Catacaustic" "Log Spiral Catacaustic" "Butterfly" \ "Gear Curve" "Arachnida 1" "Arachnida 2" "Cayley's Sectic" \ "Cycloid of Seva" "Devil's Curve" "Eight Curve" "Epispiral" \ "Hipopede" "Maltese Cross" "Ophiuride" "Quadratrix of Hippias" \ "Poinsot Spiral 1" "Poinsot Spiral 2" "Quadrifolium" "Scarabaeus" \ "Semicubical Parabola" "Swastika Curve" "Trifolium" \ "Tschirnhausen Cubic" "Bicorn" "Cruciform" "smoothed iteration" \ "magnitude (z-pixel)" "magnitude (z)" hint = "Specifies what will be used to construct a height value." visible = @slope==true endparam func fn1 caption = "Transmute Function" default = sin() visible = @zmode==7 || @zmode ==8 && @slope==true endfunc param a caption = "Polar Parameter" default = 0.2 visible=@zmode==9 || @zmode==10 || @zmode==11 || @zmode==13 || @zmode==14 \ || @zmode==15 || @zmode==16 || @zmode==17 || @zmode==18 || @zmode==19 \ || @zmode==20 || @zmode==21 || @zmode==22 || @zmode==23 || @zmode==24 \ || @zmode==25 || @zmode==26 || @zmode==27 || @zmode==28 || @zmode==29 \ || @zmode==30 || @zmode==31 || @zmode==32 || @zmode==33 || @zmode==34 \ || @zmode==35 || @zmode==36 || @zmode==37 || @zmode==38 || @zmode==39 \ || @zmode==40 || @zmode==41 || @zmode==42 || @zmode==43 || @zmode==44 \ || @zmode==45 || @zmode==46 || @zmode==47 || @zmode==48 || @zmode==49 \ || @zmode==50 || @zmode==51 || @zmode==52 || @zmode==53 || @zmode==54 \ || @zmode==55 || @zmode==56 || @zmode==57 && @slope==true endparam param b caption = "2nd Polar Parameter" default = 1.0 visible=@zmode==11 || @zmode==21 || @zmode==24 || @zmode==26 || @zmode==27 \ || @zmode==28 || @zmode==31 || @zmode==32 || @zmode==33 || @zmode==34 \ || @zmode==36 || @zmode==41 || @zmode==44 || @zmode==46 || @zmode==51 \ || @zmode==52 || @zmode==57 && @slope==true endparam param pn caption = "Polar Integer" default = 3 visible=@zmode==36 || @zmode==37 || @zmode==38 || @zmode==43 || @zmode==48 \ || @zmode==49 && @slope==true endparam param apwr caption = "Polar Power" default = (3.0,3.0) visible = @zmode==17 || @zmode==28 && @slope==true endparam func afn1 caption = "Polar Fn 1" default = cos() visible = @zmode==17 || @zmode==23 || @zmode==26 || @zmode==27 || @zmode==28 \ || @zmode==29 || @zmode==32 && @slope==true endfunc func afn2 caption = "Polar Fn 2" default = sin() visible = @zmode==17 || @zmode==23 || @zmode==26 || @zmode==27 || @zmode==28 \ || @zmode==29 || @zmode==32 && @slope==true endfunc param xfer caption = "Height Transfer" default = 1 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." visible = @slope==true 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." visible = @slope==true endparam param zscale2 caption = "Height Post-Scale" default = 0.1 hint = "Specifies the ratio between height and distance; like \ Height Pre-Scale, except that this value is applied after \ the transfer function." visible = @slope==true 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." visible = @slope==true endparam } gnd-Slope_HypercomplexJ { ; based upon the slope (Julia) ; formula of Damien Jones ; Hypercomplex Julia formula ; compound with the models of slope formulas from Ron Barnett. ; version 1.15, December 2004 ; Gilles Nadeau, 29/12/2004 ; init: complex cz1 = (0.0, 0.0) complex cz2 = (0.0, 0.0) complex cz3 = (0.0, 0.0) complex cw1 = (0.0, 0.0) complex cw2 = (0.0, 0.0) complex cw3 = (0.0, 0.0) complex z1 = (0.0, 0.0) complex z2 = (0.0, 0.0) complex z3 = (0.0, 0.0) complex w1 = (0.0, 0.0) complex w2 = (0.0, 0.0) complex w3 = (0.0, 0.0) int done = 2 float rx1 = 0.0 float rx2 = 0.0 float rx3 = 0.0 float ry1 = 0.0 float ry2 = 0.0 float ry3 = 0.0 float rz1 = 0.0 float rz2 = 0.0 float rz3 = 0.0 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 iterexp1 = 0.0 float iterexp2 = 0.0 float iterexp3 = 0.0 if (@plane == 0) cz1 = @c1i cz2 = @c1i cz3 = @c1i cw1 = @cjk cw2 = @cjk cw3 = @cjk z1 = #pixel z2 = #pixel + @offset; horizontally offset point z3 = #pixel + flip(@offset); vertically offset point w1 = @zjk w2 = @zjk w3 = @zjk elseif (@plane == 1) cz1 = @cjk cz2 = @cjk cz3 = @cjk cw1 = @c1i cw2 = @c1i cw3 = @c1i z1 = @zjk z2 = @zjk z3 = @zjk w1 = #pixel w2 = #pixel + @offset; horizontally offset point w3 = #pixel + flip(@offset); vertically offset point elseif (@plane == 2) cz1 = real(@c1i) + flip(real(@cjk)) cz2 = real(@c1i) + flip(real(@cjk)) cz3 = real(@c1i) + flip(real(@cjk)) cw1 = imag(@cjk) + flip(imag(@c1i)) cw2 = imag(@cjk) + flip(imag(@c1i)) cw3 = imag(@cjk) + flip(imag(@c1i)) z1 = real(#pixel) + flip(real(@zjk)) z2 = real(#pixel + @offset) + flip(real(@zjk)) z3 = real(#pixel + flip(@offset)) + flip(real(@zjk)) w1 = imag(@zjk) + flip(imag(#pixel)) w2 = imag(@zjk) + flip(imag(#pixel + @offset)) w3 = imag(@zjk) + flip(imag(#pixel + flip(@offset))) elseif (@plane == 3) cz1 = real(@cjk) + flip(real(@c1i)) cz2 = real(@cjk) + flip(real(@c1i)) cz3 = real(@cjk) + flip(real(@c1i)) cw1 = imag(@c1i) + flip(imag(@cjk)) cw2 = imag(@c1i) + flip(imag(@cjk)) cw3 = imag(@c1i) + flip(imag(@cjk)) z1 = real(@zjk) + flip(real(#pixel)) z2 = real(@zjk) + flip(real(#pixel + @offset)) z3 = real(@zjk) + flip(real(#pixel + flip(@offset))) w1 = imag(#pixel) + flip(imag(@zjk)) w2 = imag(#pixel + @offset) + flip(imag(@zjk)) w3 = imag(#pixel + flip(@offset)) + flip(imag(@zjk)) elseif (@plane == 4) cz1 = real(@c1i) + flip(real(@cjk)) cz2 = real(@c1i) + flip(real(@cjk)) cz3 = real(@c1i) + flip(real(@cjk)) cw1 = imag(@c1i) + flip(imag(@cjk)) cw2 = imag(@c1i) + flip(imag(@cjk)) cw3 = imag(@c1i) + flip(imag(@cjk)) z1 = real(#pixel) + flip(real(@zjk)) z2 = real(#pixel + @offset) + flip(real(@zjk)) z3 = real(#pixel + flip(@offset)) + flip(real(@zjk)) w1 = imag(#pixel) + flip(imag(@zjk)) w2 = imag(#pixel + @offset) + flip(imag(@zjk)) w3 = imag(#pixel + flip(@offset)) + flip(imag(@zjk)) elseif (@plane == 5) cz1 = real(@cjk) + flip(real(@c1i)) cz2 = real(@cjk) + flip(real(@c1i)) cz3 = real(@cjk) + flip(real(@c1i)) cw1 = imag(@cjk) + flip(imag(@c1i)) cw2 = imag(@cjk) + flip(imag(@c1i)) cw3 = imag(@cjk) + flip(imag(@c1i)) z1 = real(@zjk) + flip(real(#pixel)) z2 = real(@zjk) + flip(real(#pixel + @offset)) z3 = real(@zjk) + flip(real(#pixel + flip(@offset))) w1 = imag(@zjk) + flip(imag(#pixel)) w2 = imag(@zjk) + flip(imag(#pixel + @offset)) w3 = imag(@zjk) + flip(imag(#pixel + flip(@offset))) endif ;(yz plane rotation) ry1 = imag(z1)*cos(#pi*@rotx/180.0) - real(w1)*sin(#pi*@rotx/180.0) rz1 = imag(z1)*sin(#pi*@rotx/180.0) + real(w1)*cos(#pi*@rotx/180.0) z1 = real(z1) + ry1*1i w1 = rz1 + imag(w1)*1i ry2 = imag(z2)*cos(#pi*@rotx/180.0) - real(w2)*sin(#pi*@rotx/180.0) rz2 = imag(z2)*sin(#pi*@rotx/180.0) + real(w2)*cos(#pi*@rotx/180.0) z2 = real(z2) + ry2*1i w2 = rz2 + imag(w2)*1i ry3 = imag(z3)*cos(#pi*@rotx/180.0) - real(w3)*sin(#pi*@rotx/180.0) rz3 = imag(z3)*sin(#pi*@rotx/180.0) + real(w3)*cos(#pi*@rotx/180.0) z3 = real(z3) + ry3*1i w3 = rz3 + imag(w3)*1i ry1 = imag(cz1)*cos(#pi*@rotx/180.0) - real(cw1)*sin(#pi*@rotx/180.0) rz1 = imag(cz1)*sin(#pi*@rotx/180.0) + real(cw1)*cos(#pi*@rotx/180.0) cz1 = real(cz1) + ry1*1i cw1 = rz1 + imag(cw1)*1i ry2 = imag(cz2)*cos(#pi*@rotx/180.0) - real(cw2)*sin(#pi*@rotx/180.0) rz2 = imag(cz2)*sin(#pi*@rotx/180.0) + real(cw2)*cos(#pi*@rotx/180.0) cz2 = real(cz2) + ry2*1i cw2 = rz2 + imag(cw2)*1i ry3 = imag(cz3)*cos(#pi*@rotx/180.0) - real(cw3)*sin(#pi*@rotx/180.0) rz3 = imag(cz3)*sin(#pi*@rotx/180.0) + real(cw3)*cos(#pi*@rotx/180.0) cz3 = real(cz3) + ry3*1i cw3 = rz3 + imag(cw3)*1i ;(xz plane rotation) rx1 = real(w1)*sin(#pi*@roty/180.0) + real(z1)*cos(#pi*@roty/180.0) rz1 = real(w1)*cos(#pi*@roty/180.0) - real(z1)*sin(#pi*@roty/180.0) z1 = rx1 + imag(z1)*1i w1 = rz1 + imag(w1)*1i rx2 = real(w2)*sin(#pi*@roty/180.0) + real(z2)*cos(#pi*@roty/180.0) rz2 = real(w2)*cos(#pi*@roty/180.0) - real(z2)*sin(#pi*@roty/180.0) z2 = rx2 + imag(z2)*1i w2 = rz2 + imag(w2)*1i rx3 = real(w3)*sin(#pi*@roty/180.0) + real(z3)*cos(#pi*@roty/180.0) rz3 = real(w3)*cos(#pi*@roty/180.0) - real(z3)*sin(#pi*@roty/180.0) z3 = rx3 + imag(z3)*1i w3 = rz3 + imag(w3)*1i rx1 = real(cw1)*sin(#pi*@roty/180.0) + real(cz1)*cos(#pi*@roty/180.0) rz1 = real(cw1)*cos(#pi*@roty/180.0) - real(cz1)*sin(#pi*@roty/180.0) cz1 = rx1 + imag(cz1)*1i cw1 = rz1 + imag(cw1)*1i rx2 = real(cw2)*sin(#pi*@roty/180.0) + real(cz2)*cos(#pi*@roty/180.0) rz2 = real(cw2)*cos(#pi*@roty/180.0) - real(cz2)*sin(#pi*@roty/180.0) cz2 = rx2 + imag(cz2)*1i cw2 = rz2 + imag(cw2)*1i rx3 = real(cw3)*sin(#pi*@roty/180.0) + real(cz3)*cos(#pi*@roty/180.0) rz3 = real(cw3)*cos(#pi*@roty/180.0) - real(cz3)*sin(#pi*@roty/180.0) cz3 = rx3 + imag(cz3)*1i cw3 = rz3 + imag(cw3)*1i ;(xy plane rotation) rx1 = real(z1)*cos(#pi*@rotz/180.0) - imag(z1)*sin(#pi*@rotz/180.0) ry1 = real(z1)*sin(#pi*@rotz/180.0) + imag(z1)*cos(#pi*@rotz/180.0) z1 = rx1 + ry1*1i rx2 = real(z2)*cos(#pi*@rotz/180.0) - imag(z2)*sin(#pi*@rotz/180.0) ry2 = real(z2)*sin(#pi*@rotz/180.0) + imag(z2)*cos(#pi*@rotz/180.0) z2 = rx2 + ry2*1i rx3 = real(z3)*cos(#pi*@rotz/180.0) - imag(z3)*sin(#pi*@rotz/180.0) ry3 = real(z3)*sin(#pi*@rotz/180.0) + imag(z3)*cos(#pi*@rotz/180.0) z3 = rx3 + ry3*1i rx1 = real(cz1)*cos(#pi*@rotz/180.0) - imag(cz1)*sin(#pi*@rotz/180.0) ry1 = real(cz1)*sin(#pi*@rotz/180.0) + imag(cz1)*cos(#pi*@rotz/180.0) cz1 = rx1 + ry1*1i rx2 = real(cz2)*cos(#pi*@rotz/180.0) - imag(cz2)*sin(#pi*@rotz/180.0) ry2 = real(cz2)*sin(#pi*@rotz/180.0) + imag(cz2)*cos(#pi*@rotz/180.0) cz2 = rx2 + ry2*1i rx3 = real(cz3)*cos(#pi*@rotz/180.0) - imag(cz3)*sin(#pi*@rotz/180.0) ry3 = real(cz3)*sin(#pi*@rotz/180.0) + imag(cz3)*cos(#pi*@rotz/180.0) cz3 = rx3 + ry3*1i loop: a = @fn1(z1 + w1 * 1i) ^ @power b = @fn1(z1 - w1 * 1i) ^ @power z1 = (a + b) / 2 + cz1 w1 = (b - a) * 1i / 2 + cw1 a = @fn1(z2 + w2 * 1i) ^ @power b = @fn1(z2 - w2 * 1i) ^ @power z2 = (a + b) / 2 + cz2 w2 = (b - a) * 1i / 2 + cw2 a = @fn1(z3 + w3 * 1i) ^ @power b = @fn1(z3 - w3 * 1i) ^ @power z3 = (a + b) / 2 + cz3 w3 = (b - a) * 1i / 2 + cw3 IF (@zmode == 5) iterexp1 = iterexp1 + exp(-cabs(z1)) iterexp2 = iterexp2 + exp(-cabs(z2)) iterexp3 = iterexp3 + exp(-cabs(z3)) ENDIF done = done + 1; increment iteration counter IF (@zmode == 0) ; 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 == 1) ; 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 == 2) ; 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 == 3) ; 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 == 4) ; 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 ENDIF IF (@bailout < |z1| + |w1| || \ @everyiter ||\ done == #maxit + 2); done, or every iteration, or last ; determine continuous iteration (height) for each point IF (@zmode >= 0 && @zmode <= 4) ; height based on smallest |z| e1 = s1 * @zscale e2 = s2 * @zscale e3 = s3 * @zscale ELSEIF (@zmode == 5) e1 = iterexp1 * @zscale e2 = iterexp2 * @zscale e3 = iterexp3 * @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 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 (@bailout < |z1| + |w1|) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope Hypercomplex Julia" center = (0.0,0.0) magn = 1.0 maxiter = 149 method = multipass periodicity = 0 param version caption = "Version" default = 1.15 visible = false endparam heading caption = "Slope Hypercomplex Julia" endheading heading caption = "Use Damien's Lighting Coloring" endheading heading caption = "Or Ron's 3D Texturizer Formulas" endheading heading caption = "Most other coloring formulas" endheading heading caption = "can also be used." endheading param plane caption = "H plane" enum = "1:(xy)" "2:(zw)" "3:(xw)" "4:(yz)" "5:(xz)" "6:(yw)" endparam param c1i caption = "(c1, ci)" default = (-0.745, 0.0) endparam param cjk caption = "(cj, ck)" default = (0.113, 0.05) endparam param zjk caption = "(zj, zk)" default = (0.0, 0.0) endparam param power caption = "Power" default = (1.0, 0.0) endparam param bailout caption = "Bailout Value" default = 10000.0 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam func fn1 caption = "Function" default = sqr() endfunc heading caption = "Rotations" endheading param rotx caption="x-rotation" hint="Rotates yz-plane." default=0.0 min=-360.0 max=360.0 endparam param roty caption="y-rotation" hint="Rotates zx-plane." default=0.0 min=-360.0 max=360.0 endparam param rotz caption="z-rotation" hint="Rotates xy-plane." default=0.0 min=-360.0 max=360.0 endparam heading caption = "Slope Parameters" endheading 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 = 5 enum = "smallest |z|" "smallest |real(z)|" \ "smallest |imag(z)|" "smallest summ(z)" "smallest |atan(z)|" \ "smoothed iteration" 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 = "gnd-Slope_Hypercomplex" version = @version cjk = @cjk plane = @plane power = @power bailout = @bailout rotx = @rotx roty = @roty rotz = @rotz fn1 = @fn1 offset = @offset zmode = @zmode xfer = @xfer zscale = @zscale zscale2 = @zscale2 everyiter = @everyiter } gnd-Slope_Hypercomplex { ; based upon the slope (Mandelbrot) ; formula of Damien Jones ; Hypercomplex Mandel formula ; compound with the models of slope formulas from Ron Barnett. ; version 1.15, December 2004 ; Gilles Nadeau, 29/12/2004 ; init: complex cz1 = (0.0, 0.0) complex cz2 = (0.0, 0.0) complex cz3 = (0.0, 0.0) complex cw1 = (0.0, 0.0) complex cw2 = (0.0, 0.0) complex cw3 = (0.0, 0.0) complex z1 = (0.0, 0.0) complex z2 = (0.0, 0.0) complex z3 = (0.0, 0.0) complex w1 = (0.0, 0.0) complex w2 = (0.0, 0.0) complex w3 = (0.0, 0.0) int done = 2 float rx1 = 0.0 float rx2 = 0.0 float rx3 = 0.0 float ry1 = 0.0 float ry2 = 0.0 float ry3 = 0.0 float rz1 = 0.0 float rz2 = 0.0 float rz3 = 0.0 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 iterexp1 = 0.0 float iterexp2 = 0.0 float iterexp3 = 0.0 if (@plane == 0) cz1 = #pixel cz2 = #pixel + @offset; horizontally offset point cz3 = #pixel + flip(@offset); vertically offset point cw1 = @cjk cw2 = @cjk cw3 = @cjk elseif (@plane == 1) cz1 = @cjk cz2 = @cjk cz3 = @cjk cw1 = #pixel cw2 = #pixel + @offset; horizontally offset point cw3 = #pixel + flip(@offset); vertically offset point elseif (@plane == 2) cz1 = real(#pixel) + flip(real(@cjk)) cz2 = real(#pixel + @offset) + flip(real(@cjk)) cz3 = real(#pixel + flip(@offset)) + flip(real(@cjk)) cw1 = imag(@cjk) + flip(imag(#pixel)) cw2 = imag(@cjk) + flip(imag(#pixel + @offset)) cw3 = imag(@cjk) + flip(imag(#pixel + flip(@offset))) elseif (@plane == 3) cz1 = real(@cjk) + flip(real(#pixel)) cz2 = real(@cjk) + flip(real(#pixel + @offset)) cz3 = real(@cjk) + flip(real(#pixel + flip(@offset))) cw1 = imag(#pixel) + flip(imag(@cjk)) cw2 = imag(#pixel + @offset) + flip(imag(@cjk)) cw3 = imag(#pixel + flip(@offset)) + flip(imag(@cjk)) elseif (@plane == 4) cz1 = real(#pixel) + flip(real(@cjk)) cz2 = real(#pixel + @offset) + flip(real(@cjk)) cz3 = real(#pixel + flip(@offset)) + flip(real(@cjk)) cw1 = imag(#pixel) + flip(imag(@cjk)) cw2 = imag(#pixel + @offset) + flip(imag(@cjk)) cw3 = imag(#pixel + flip(@offset)) + flip(imag(@cjk)) elseif (@plane == 5) cz1 = real(@cjk) + flip(real(#pixel)) cz2 = real(@cjk) + flip(real(#pixel + @offset)) cz3 = real(@cjk) + flip(real(#pixel + flip(@offset))) cw1 = imag(@cjk) + flip(imag(#pixel)) cw2 = imag(@cjk) + flip(imag(#pixel + @offset)) cw3 = imag(@cjk) + flip(imag(#pixel + flip(@offset))) endif ;(yz plane rotation) ry1 = imag(z1)*cos(#pi*@rotx/180.0) - real(w1)*sin(#pi*@rotx/180.0) rz1 = imag(z1)*sin(#pi*@rotx/180.0) + real(w1)*cos(#pi*@rotx/180.0) z1 = real(z1) + ry1*1i w1 = rz1 + imag(w1)*1i ry2 = imag(z2)*cos(#pi*@rotx/180.0) - real(w2)*sin(#pi*@rotx/180.0) rz2 = imag(z2)*sin(#pi*@rotx/180.0) + real(w2)*cos(#pi*@rotx/180.0) z2 = real(z2) + ry2*1i w2 = rz2 + imag(w2)*1i ry3 = imag(z3)*cos(#pi*@rotx/180.0) - real(w3)*sin(#pi*@rotx/180.0) rz3 = imag(z3)*sin(#pi*@rotx/180.0) + real(w3)*cos(#pi*@rotx/180.0) z3 = real(z3) + ry3*1i w3 = rz3 + imag(w3)*1i ry1 = imag(cz1)*cos(#pi*@rotx/180.0) - real(cw1)*sin(#pi*@rotx/180.0) rz1 = imag(cz1)*sin(#pi*@rotx/180.0) + real(cw1)*cos(#pi*@rotx/180.0) cz1 = real(cz1) + ry1*1i cw1 = rz1 + imag(cw1)*1i ry2 = imag(cz2)*cos(#pi*@rotx/180.0) - real(cw2)*sin(#pi*@rotx/180.0) rz2 = imag(cz2)*sin(#pi*@rotx/180.0) + real(cw2)*cos(#pi*@rotx/180.0) cz2 = real(cz2) + ry2*1i cw2 = rz2 + imag(cw2)*1i ry3 = imag(cz3)*cos(#pi*@rotx/180.0) - real(cw3)*sin(#pi*@rotx/180.0) rz3 = imag(cz3)*sin(#pi*@rotx/180.0) + real(cw3)*cos(#pi*@rotx/180.0) cz3 = real(cz3) + ry3*1i cw3 = rz3 + imag(cw3)*1i ;(xz plane rotation) rx1 = real(w1)*sin(#pi*@roty/180.0) + real(z1)*cos(#pi*@roty/180.0) rz1 = real(w1)*cos(#pi*@roty/180.0) - real(z1)*sin(#pi*@roty/180.0) z1 = rx1 + imag(z1)*1i w1 = rz1 + imag(w1)*1i rx2 = real(w2)*sin(#pi*@roty/180.0) + real(z2)*cos(#pi*@roty/180.0) rz2 = real(w2)*cos(#pi*@roty/180.0) - real(z2)*sin(#pi*@roty/180.0) z2 = rx2 + imag(z2)*1i w2 = rz2 + imag(w2)*1i rx3 = real(w3)*sin(#pi*@roty/180.0) + real(z3)*cos(#pi*@roty/180.0) rz3 = real(w3)*cos(#pi*@roty/180.0) - real(z3)*sin(#pi*@roty/180.0) z3 = rx3 + imag(z3)*1i w3 = rz3 + imag(w3)*1i rx1 = real(cw1)*sin(#pi*@roty/180.0) + real(cz1)*cos(#pi*@roty/180.0) rz1 = real(cw1)*cos(#pi*@roty/180.0) - real(cz1)*sin(#pi*@roty/180.0) cz1 = rx1 + imag(cz1)*1i cw1 = rz1 + imag(cw1)*1i rx2 = real(cw2)*sin(#pi*@roty/180.0) + real(cz2)*cos(#pi*@roty/180.0) rz2 = real(cw2)*cos(#pi*@roty/180.0) - real(cz2)*sin(#pi*@roty/180.0) cz2 = rx2 + imag(cz2)*1i cw2 = rz2 + imag(cw2)*1i rx3 = real(cw3)*sin(#pi*@roty/180.0) + real(cz3)*cos(#pi*@roty/180.0) rz3 = real(cw3)*cos(#pi*@roty/180.0) - real(cz3)*sin(#pi*@roty/180.0) cz3 = rx3 + imag(cz3)*1i cw3 = rz3 + imag(cw3)*1i ;(xy plane rotation) rx1 = real(z1)*cos(#pi*@rotz/180.0) - imag(z1)*sin(#pi*@rotz/180.0) ry1 = real(z1)*sin(#pi*@rotz/180.0) + imag(z1)*cos(#pi*@rotz/180.0) z1 = rx1 + ry1*1i rx2 = real(z2)*cos(#pi*@rotz/180.0) - imag(z2)*sin(#pi*@rotz/180.0) ry2 = real(z2)*sin(#pi*@rotz/180.0) + imag(z2)*cos(#pi*@rotz/180.0) z2 = rx2 + ry2*1i rx3 = real(z3)*cos(#pi*@rotz/180.0) - imag(z3)*sin(#pi*@rotz/180.0) ry3 = real(z3)*sin(#pi*@rotz/180.0) + imag(z3)*cos(#pi*@rotz/180.0) z3 = rx3 + ry3*1i rx1 = real(cz1)*cos(#pi*@rotz/180.0) - imag(cz1)*sin(#pi*@rotz/180.0) ry1 = real(cz1)*sin(#pi*@rotz/180.0) + imag(cz1)*cos(#pi*@rotz/180.0) cz1 = rx1 + ry1*1i rx2 = real(cz2)*cos(#pi*@rotz/180.0) - imag(cz2)*sin(#pi*@rotz/180.0) ry2 = real(cz2)*sin(#pi*@rotz/180.0) + imag(cz2)*cos(#pi*@rotz/180.0) cz2 = rx2 + ry2*1i rx3 = real(cz3)*cos(#pi*@rotz/180.0) - imag(cz3)*sin(#pi*@rotz/180.0) ry3 = real(cz3)*sin(#pi*@rotz/180.0) + imag(cz3)*cos(#pi*@rotz/180.0) cz3 = rx3 + ry3*1i loop: a = @fn1(z1 + w1 * 1i) ^ @power b = @fn1(z1 - w1 * 1i) ^ @power z1 = (a + b) / 2 + cz1 w1 = (b - a) * 1i / 2 + cw1 a = @fn1(z2 + w2 * 1i) ^ @power b = @fn1(z2 - w2 * 1i) ^ @power z2 = (a + b) / 2 + cz2 w2 = (b - a) * 1i / 2 + cw2 a = @fn1(z3 + w3 * 1i) ^ @power b = @fn1(z3 - w3 * 1i) ^ @power z3 = (a + b) / 2 + cz3 w3 = (b - a) * 1i / 2 + cw3 IF (@zmode == 5) iterexp1 = iterexp1 + exp(-cabs(z1)) iterexp2 = iterexp2 + exp(-cabs(z2)) iterexp3 = iterexp3 + exp(-cabs(z3)) ENDIF done = done + 1; increment iteration counter IF (@zmode == 0) ; 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 == 1) ; 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 == 2) ; 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 == 3) ; 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 == 4) ; 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 ENDIF IF (@bailout < |z1| + |w1| || \ @everyiter ||\ done == #maxit + 2); done, or every iteration, or last ; determine continuous iteration (height) for each point IF (@zmode >= 0 && @zmode <= 4) ; height based on smallest |z| e1 = s1 * @zscale e2 = s2 * @zscale e3 = s3 * @zscale ELSEIF (@zmode == 5) e1 = iterexp1 * @zscale e2 = iterexp2 * @zscale e3 = iterexp3 * @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 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 (@bailout < |z1| + |w1|) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope Hypercomplex Mandelbrot" center = (0.0,0.0) magn = 1.0 maxiter = 149 method = multipass periodicity = 0 param version caption = "Version" default = 1.15 visible = false endparam heading caption = "Slope Hypercomplex Mandelbrot" endheading heading caption = "Use Damien's Lighting Coloring" endheading heading caption = "Or Ron's 3D Texturizer Formulas" endheading heading caption = "Most other coloring formulas" endheading heading caption = "can also be used." endheading param plane caption = "H plane" enum = "1:(xy)" "2:(zw)" "3:(xw)" "4:(yz)" "5:(xz)" "6:(yw)" endparam param cjk caption = "(cj, ck)" default = (0.0, 0.0) endparam param power caption = "Power" default = (1.0, 0.0) endparam param bailout caption = "Bailout Value" default = 10000.0 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam func fn1 caption = "Function" default = sqr() endfunc heading caption = "Rotations" endheading param rotx caption="x-rotation" hint="Rotates yz-plane." default=0.0 min=-360.0 max=360.0 endparam param roty caption="y-rotation" hint="Rotates zx-plane." default=0.0 min=-360.0 max=360.0 endparam param rotz caption="z-rotation" hint="Rotates xy-plane." default=0.0 min=-360.0 max=360.0 endparam heading caption = "Slope Parameters" endheading 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 = 5 enum = "smallest |z|" "smallest |real(z)|" \ "smallest |imag(z)|" "smallest summ(z)" "smallest |atan(z)|" \ "smoothed iteration" 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 = "gnd-Slope_HypercomplexJ" version = @version c1i = #pixel cjk = @cjk plane = @plane power = @power rotx = @rotx roty = @roty rotz = @rotz bailout = @bailout fn1 = @fn1 offset = @offset zmode = @zmode xfer = @xfer zscale = @zscale zscale2 = @zscale2 everyiter = @everyiter } gnd-Slope_QuatJul { ; based upon the slope (Julia) ; formula of Damien Jones ; Quaternion Julia formula ; compound with the models of slope formulas from Ron Barnett. ; version 1.12, December 2004 ; Gilles Nadeau, 29/12/2004 ; init: complex z1 = #pixel complex z2 = #pixel + @offset; horizontally offset point complex z3 = #pixel + flip(@offset); vertically offset point complex w1 = @zjk complex w2 = @zjk complex w3 = @zjk complex cz1 = @c1i complex cz2 = @c1i complex cz3 = @c1i complex cw1 = @cjk complex cw2 = @cjk complex cw3 = @cjk float ax1 = float bx1 = float aa1 = real(z1) float ax2 = float bx2 = float aa2 = real(z2) float ax3 = float bx3 = float aa3 = real(z3) float ay1 = float by1 = float bb1 = imag(z1) float ay2 = float by2 = float bb2 = imag(z2) float ay3 = float by3 = float bb3 = imag(z3) float az1 = float bz1 = float cc1 = real(w1) float az2 = float bz2 = float cc2 = real(w2) float az3 = float bz3 = float cc3 = real(w3) float aw1 = float bw1 = float dd1 = imag(w1) float aw2 = float bw2 = float dd2 = imag(w2) float aw3 = float bw3 = float dd3 = imag(w3) 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 iterexp1 = 0.0 float iterexp2 = 0.0 float iterexp3 = 0.0 int n = 1 int done = 2 loop: ax1 = aa1 = real(z1) ax2 = aa2 = real(z2) ax3 = aa3 = real(z3) ay1 = bb1 = imag(z1) ay2 = bb2 = imag(z2) ay3 = bb3 = imag(z3) az1 = cc1 = real(w1) az2 = cc2 = real(w2) az3 = cc3 = real(w3) aw1 = dd1 = imag(w1) aw2 = dd2 = imag(w2) aw3 = dd3 = imag(w3) n = 1 while n < @power n = n + 1 bx1 = aa1 bx2 = aa2 bx3 = aa3 by1 = bb1 by2 = bb2 by3 = bb3 bz1 = cc1 bz2 = cc2 bz3 = cc3 bw1 = dd1 bw2 = dd2 bw3 = dd3 aa1 = ax1*bx1 - ay1*by1 - az1*bz1 - aw1*bw1 aa2 = ax2*bx2 - ay2*by2 - az2*bz2 - aw2*bw2 aa3 = ax3*bx3 - ay3*by3 - az3*bz3 - aw3*bw3 bb1 = ay1*bx1 + ax1*by1 bb2 = ay2*bx2 + ax2*by2 bb3 = ay3*bx3 + ax3*by3 cc1 = az1*bx1 + ax1*bz1 cc2 = az2*bx2 + ax2*bz2 cc3 = az3*bx3 + ax3*bz3 dd1 = aw1*bx1 + ax1*bw1 dd2 = aw2*bx2 + ax2*bw2 dd3 = aw3*bx3 + ax3*bw3 endwhile z1 = aa1 + flip(bb1) + cz1 z2 = aa2 + flip(bb2) + cz2 z3 = aa3 + flip(bb3) + cz3 w1 = cc1 + flip(dd1) + cw1 w2 = cc2 + flip(dd2) + cw2 w3 = cc3 + flip(dd3) + cw3 IF (@zmode == 5) iterexp1 = iterexp1 + exp(-cabs(z1)) iterexp2 = iterexp2 + exp(-cabs(z2)) iterexp3 = iterexp3 + exp(-cabs(z3)) ENDIF done = done + 1; increment iteration counter IF (@zmode == 0) ; 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 == 1) ; 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 == 2) ; 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 == 3) ; 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 == 4) ; 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 ENDIF IF (@bailout < |z1| + |w1| || \ @everyiter ||\ done == #maxit + 2); done, or every iteration, or last ; determine continuous iteration (height) for each point IF (@zmode >= 0 && @zmode <= 4) ; height based on smallest |z| e1 = s1 * @zscale e2 = s2 * @zscale e3 = s3 * @zscale ELSEIF (@zmode == 5) e1 = iterexp1 * @zscale e2 = iterexp2 * @zscale e3 = iterexp3 * @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 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 (@bailout < |z1| + |w1|) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope Quaternion Julia" center = (0.0,0.0) magn = 1.0 maxiter = 500 method = multipass periodicity = 0 param version caption = "Version" default = 1.12 visible = false endparam heading caption = "Slope Quaternion Julia" endheading heading caption = "Use Damien's Lighting Coloring" endheading heading caption = "Or Ron's 3D Texturizer Formulas" endheading heading caption = "Most other coloring formulas" endheading heading caption = "can also be used." endheading param c1i caption = "(c1, ci)" default = (-0.745, 0.0) endparam param cjk caption = "(cj, ck)" default = (0.113, 0.05) endparam param zjk caption = "(zj, zk)" default = (0.0, 0.0) endparam int param power caption = "Power" default = 2 endparam param bailout caption = "Bailout Value" default = 10000.0 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam heading caption = "Slope Parameters" endheading 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 = 5 enum = "smallest |z|" "smallest |real(z)|" \ "smallest |imag(z)|" "smallest summ(z)" "smallest |atan(z)|" \ "smoothed iteration" 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 = "gnd-Slope_Quat" version = @version cjk = @cjk power = @power bailout = @bailout offset = @offset zmode = @zmode xfer = @xfer zscale = @zscale zscale2 = @zscale2 everyiter = @everyiter } gnd-Slope_Quat { ; based upon the slope (Mandelbrot) ; formula of Damien Jones ; Quaternion Mandel formula ; compound with the models of slope formulas from Ron Barnett. ; version 1.12, December 2004 ; Gilles Nadeau, 29/12/2004 ; init: complex cz1 = #pixel complex cz2 = #pixel + @offset; horizontally offset point complex cz3 = #pixel + flip(@offset); vertically offset point complex cw1 = @cjk complex cw2 = @cjk complex cw3 = @cjk complex z1 = (0.0, 0.0) complex z2 = (0.0, 0.0) complex z3 = (0.0, 0.0) complex w1 = (0.0, 0.0) complex w2 = (0.0, 0.0) complex w3 = (0.0, 0.0) float ax1 = float bx1 = float aa1 = real(z1) float ax2 = float bx2 = float aa2 = real(z2) float ax3 = float bx3 = float aa3 = real(z3) float ay1 = float by1 = float bb1 = imag(z1) float ay2 = float by2 = float bb2 = imag(z2) float ay3 = float by3 = float bb3 = imag(z3) float az1 = float bz1 = float cc1 = real(w1) float az2 = float bz2 = float cc2 = real(w2) float az3 = float bz3 = float cc3 = real(w3) float aw1 = float bw1 = float dd1 = imag(w1) float aw2 = float bw2 = float dd2 = imag(w2) float aw3 = float bw3 = float dd3 = imag(w3) 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 iterexp1 = 0.0 float iterexp2 = 0.0 float iterexp3 = 0.0 int n = 1 int done = 2 loop: ax1 = aa1 = real(z1) ax2 = aa2 = real(z2) ax3 = aa3 = real(z3) ay1 = bb1 = imag(z1) ay2 = bb2 = imag(z2) ay3 = bb3 = imag(z3) az1 = cc1 = real(w1) az2 = cc2 = real(w2) az3 = cc3 = real(w3) aw1 = dd1 = imag(w1) aw2 = dd2 = imag(w2) aw3 = dd3 = imag(w3) n = 1 while n < @power n = n + 1 bx1 = aa1 bx2 = aa2 bx3 = aa3 by1 = bb1 by2 = bb2 by3 = bb3 bz1 = cc1 bz2 = cc2 bz3 = cc3 bw1 = dd1 bw2 = dd2 bw3 = dd3 aa1 = ax1*bx1 - ay1*by1 - az1*bz1 - aw1*bw1 aa2 = ax2*bx2 - ay2*by2 - az2*bz2 - aw2*bw2 aa3 = ax3*bx3 - ay3*by3 - az3*bz3 - aw3*bw3 bb1 = ay1*bx1 + ax1*by1 bb2 = ay2*bx2 + ax2*by2 bb3 = ay3*bx3 + ax3*by3 cc1 = az1*bx1 + ax1*bz1 cc2 = az2*bx2 + ax2*bz2 cc3 = az3*bx3 + ax3*bz3 dd1 = aw1*bx1 + ax1*bw1 dd2 = aw2*bx2 + ax2*bw2 dd3 = aw3*bx3 + ax3*bw3 endwhile z1 = aa1 + flip(bb1) + cz1 z2 = aa2 + flip(bb2) + cz2 z3 = aa3 + flip(bb3) + cz3 w1 = cc1 + flip(dd1) + cw1 w2 = cc2 + flip(dd2) + cw2 w3 = cc3 + flip(dd3) + cw3 IF (@zmode == 5) iterexp1 = iterexp1 + exp(-cabs(z1)) iterexp2 = iterexp2 + exp(-cabs(z2)) iterexp3 = iterexp3 + exp(-cabs(z3)) ENDIF done = done + 1; increment iteration counter IF (@zmode == 0) ; 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 == 1) ; 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 == 2) ; 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 == 3) ; 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 == 4) ; 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 ENDIF IF (@bailout < |z1| + |w1| || \ @everyiter ||\ done == #maxit + 2); done, or every iteration, or last ; determine continuous iteration (height) for each point IF (@zmode >= 0 && @zmode <= 4) ; height based on smallest |z| e1 = s1 * @zscale e2 = s2 * @zscale e3 = s3 * @zscale ELSEIF (@zmode == 5) e1 = iterexp1 * @zscale e2 = iterexp2 * @zscale e3 = iterexp3 * @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 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 (@bailout < |z1| + |w1|) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope Quaternion Mandelbrot" center = (0.0,0.0) magn = 1.0 maxiter = 500 method = multipass periodicity = 0 param version caption = "Version" default = 1.12 visible = false endparam heading caption = "Slope Quaternion Mandelbrot" endheading heading caption = "Use Damien's Lighting Coloring" endheading heading caption = "Or Ron's 3D Texturizer Formulas" endheading heading caption = "Most other coloring formulas" endheading heading caption = "can also be used." endheading param cjk caption = "(cj, ck)" default = (0.0, 0.0) endparam int param power caption = "Power" default = 2 endparam param bailout caption = "Bailout Value" default = 10000.0 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam heading caption = "Slope Parameters" endheading 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 = 5 enum = "smallest |z|" "smallest |real(z)|" \ "smallest |imag(z)|" "smallest summ(z)" "smallest |atan(z)|" \ "smoothed iteration" 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 = "gnd-Slope_QuatJul" version = @version c1i = #pixel cjk = @cjk power = @power bailout = @bailout offset = @offset zmode = @zmode xfer = @xfer zscale = @zscale zscale2 = @zscale2 everyiter = @everyiter } gnd-Slope-T_Jul { ; based upon the slope (Julia) ; formula of Damien Jones ; Triternion Julia formula ; compound with the models of slope formulas from Ron Barnett. ; ; Based on formula by Russell Walsmith ; http://www.fibonacci-arrays.com/Triternions.pdf ; version 1.12, February 2005 ; Gilles Nadeau, 04/02/2005 ; init: z1 = #pixel z2 = #pixel + @offset; horizontally offset point z3 = #pixel + flip(@offset); vertically offset point t1 = @zt t2 = @zt t3 = @zt cz1 = @cz cz2 = @cz cz3 = @cz ct1 = @ct ct2 = @ct ct3 = @ct ax1 = (0.0, 0.0) ax2 = (0.0, 0.0) ax3 = (0.0, 0.0) ay1 = (0.0, 0.0) ay2 = (0.0, 0.0) ay3 = (0.0, 0.0) cx1 = (0.0, 0.0) cx2 = (0.0, 0.0) cx3 = (0.0, 0.0) cy1 = (0.0, 0.0) cy2 = (0.0, 0.0) cy3 = (0.0, 0.0) 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 iterexp1 = 0.0 float iterexp2 = 0.0 float iterexp3 = 0.0 int done = 2 if (@var == 0) ax1 = real(z1) ax2 = real(z2) ax3 = real(z3) ay1 = imag(z1) ay2 = imag(z2) ay3 = imag(z3) cx1 = real(cz1) cx2 = real(cz2) cx3 = real(cz3) cy1 = imag(cz1) cy2 = imag(cz2) cy3 = imag(cz3) elseif (@var == 1) ax1 = flip(real(z1)) ax2 = flip(real(z2)) ax3 = flip(real(z3)) ay1 = flip(imag(z1)) ay2 = flip(imag(z2)) ay3 = flip(imag(z3)) cx1 = flip(real(cz1)) cx2 = flip(real(cz2)) cx3 = flip(real(cz3)) cy1 = flip(imag(cz1)) cy2 = flip(imag(cz2)) cy3 = flip(imag(cz3)) elseif (@var == 2) ax1 = real(z1) ax2 = real(z2) ax3 = real(z3) ay1 = flip(imag(z1)) ay2 = flip(imag(z2)) ay3 = flip(imag(z3)) cx1 = real(cz1) cx2 = real(cz2) cx3 = real(cz3) cy1 = flip(imag(cz1)) cy2 = flip(imag(cz2)) cy3 = flip(imag(cz3)) elseif (@var == 3) ax1 = flip(real(z1)) ax2 = flip(real(z2)) ax3 = flip(real(z3)) ay1 = imag(z1) ay2 = imag(z2) ay3 = imag(z3) cx1 = flip(real(cz1)) cx2 = flip(real(cz2)) cx3 = flip(real(cz3)) cy1 = imag(cz1) cy2 = imag(cz2) cy3 = imag(cz3) endif at1 = t1 at2 = t2 at3 = t3 bx1 = ax1 bx2 = ax2 bx3 = ax3 by1 = ay1 by2 = ay2 by3 = ay3 bt1 = at1 bt2 = at2 bt3 = at3 aa1 = ax1 aa2 = ax2 aa3 = ax3 bb1 = ay1 bb2 = ay2 bb3 = ay3 cc1 = at1 cc2 = at2 cc3 = at3 loop: int n = 1 ax1 = aa1 ax2 = aa2 ax3 = aa3 ay1 = bb1 ay2 = bb2 ay3 = bb3 at1 = cc1 at2 = cc2 at3 = cc3 while n < @power n = n + 1 bx1 = aa1 bx2 = aa2 bx3 = aa3 by1 = bb1 by2 = bb2 by3 = bb3 bt1 = cc1 bt2 = cc2 bt3 = cc3 aa1 = ax1*bx1 + at1*by1 + ay1*bt1 aa2 = ax2*bx2 + at2*by2 + ay2*bt2 aa3 = ax3*bx3 + at3*by3 + ay3*bt3 bb1 = ay1*bx1 + ax1*by1 + at1*bt1 bb2 = ay2*bx2 + ax2*by2 + at2*bt2 bb3 = ay3*bx3 + ax3*by3 + at3*bt3 cc1 = at1*bx1 + ay1*by1 + ax1*bt1 cc2 = at2*bx2 + ay2*by2 + ax2*bt2 cc3 = at3*bx3 + ay3*by3 + ax3*bt3 endwhile aa1 = aa1 + cx1 aa2 = aa2 + cx2 aa3 = aa3 + cx3 bb1 = bb1 + cy1 bb2 = bb2 + cy2 bb3 = bb3 + cy3 cc1 = cc1 + ct1 cc2 = cc2 + ct2 cc3 = cc3 + ct3 if (@flavor == 0) z1 = aa1 + flip(bb1) z2 = aa2 + flip(bb2) z3 = aa3 + flip(bb3) elseif (@flavor == 1) z1 = aa1 + bb1 z2 = aa2 + bb2 z3 = aa3 + bb3 endif t1 = cc1 t2 = cc2 t3 = cc3 IF (@zmode == 5) iterexp1 = iterexp1 + exp(-cabs(z1)) iterexp2 = iterexp2 + exp(-cabs(z2)) iterexp3 = iterexp3 + exp(-cabs(z3)) ENDIF done = done + 1; increment iteration counter IF (@zmode == 0) ; 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 == 1) ; 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 == 2) ; 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 == 3) ; 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 == 4) ; 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 ENDIF IF (@bailout < |aa1| + |bb1| + |cc1| || \ @everyiter ||\ done == #maxit + 2); done, or every iteration, or last ; determine continuous iteration (height) for each point IF (@zmode >= 0 && @zmode <= 4) ; height based on smallest |z| e1 = s1 * @zscale e2 = s2 * @zscale e3 = s3 * @zscale ELSEIF (@zmode == 5) e1 = iterexp1 * @zscale e2 = iterexp2 * @zscale e3 = iterexp3 * @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 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 (@bailout < |aa1| + |bb1| + |cc1|) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope Triternion Julia" maxiter = 500 periodicity = 0 method = multipass float param version default = 1.12 visible = false endparam heading caption = "Slope Triternion Julia" endheading heading caption = "Use Damien's Lighting Coloring" endheading heading caption = "Or Ron's 3D Texturizer Formulas" endheading heading caption = "Most other coloring formulas" endheading heading caption = "can also be used." endheading param var caption = "Variation" enum = "1""2""3""4" default = 0 endparam param cz caption = "cz" default = (0.0, 0.0) endparam param ct caption = "ct" default = (0.0, 0.0) endparam param zt caption = "zt" default = (0.0, 0.0) endparam param power caption = "Power" default = 2 endparam param flavor caption = "Combine flavor" enum = "1:(z=x+flip(y))" "2:(z=x+y)" endparam param bailout caption = "Bailout Value" default = 10000.0 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam heading caption = "Slope Parameters" endheading 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 = 5 enum = "smallest |z|" "smallest |real(z)|" \ "smallest |imag(z)|" "smallest summ(z)" "smallest |atan(z)|" \ "smoothed iteration" 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 = "gnd-Slope-T_Man" version = @version ct = @ct var = @var power = @power bailout = @bailout flavor = @flavor offset = @offset zmode = @zmode xfer = @xfer zscale = @zscale zscale2 = @zscale2 everyiter = @everyiter } gnd-Slope-T_Man { ; based upon the slope (Mandelbrot) ; formula of Damien Jones ; Triternion Mandel formula ; compound with the models of slope formulas from Ron Barnett. ; ; Original formula MrT by Russell Walsmith ; http://www.fibonacci-arrays.com/Triternions.pdf ; version 1.12, February 2005 ; Gilles Nadeau, 04/02/2005 ; init: cz1 = #pixel cz2 = #pixel + @offset; horizontally offset point cz3 = #pixel + flip(@offset); vertically offset point ct1 = @ct ct2 = @ct ct3 = @ct z1 = (0.0, 0.0) z2 = (0.0, 0.0) z3 = (0.0, 0.0) t1 = (0.0, 0.0) t2 = (0.0, 0.0) t3 = (0.0, 0.0) ax1 = (0.0, 0.0) ax2 = (0.0, 0.0) ax3 = (0.0, 0.0) ay1 = (0.0, 0.0) ay2 = (0.0, 0.0) ay3 = (0.0, 0.0) cx1 = (0.0, 0.0) cx2 = (0.0, 0.0) cx3 = (0.0, 0.0) cy1 = (0.0, 0.0) cy2 = (0.0, 0.0) cy3 = (0.0, 0.0) 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 iterexp1 = 0.0 float iterexp2 = 0.0 float iterexp3 = 0.0 int done = 2 if (@var == 0) ax1 = real(z1) ax2 = real(z2) ax3 = real(z3) ay1 = imag(z1) ay2 = imag(z2) ay3 = imag(z3) cx1 = real(cz1) cx2 = real(cz2) cx3 = real(cz3) cy1 = imag(cz1) cy2 = imag(cz2) cy3 = imag(cz3) elseif (@var == 1) ax1 = flip(real(z1)) ax2 = flip(real(z2)) ax3 = flip(real(z3)) ay1 = flip(imag(z1)) ay2 = flip(imag(z2)) ay3 = flip(imag(z3)) cx1 = flip(real(cz1)) cx2 = flip(real(cz2)) cx3 = flip(real(cz3)) cy1 = flip(imag(cz1)) cy2 = flip(imag(cz2)) cy3 = flip(imag(cz3)) elseif (@var == 2) ax1 = real(z1) ax2 = real(z2) ax3 = real(z3) ay1 = flip(imag(z1)) ay2 = flip(imag(z2)) ay3 = flip(imag(z3)) cx1 = real(cz1) cx2 = real(cz2) cx3 = real(cz3) cy1 = flip(imag(cz1)) cy2 = flip(imag(cz2)) cy3 = flip(imag(cz3)) elseif (@var == 3) ax1 = flip(real(z1)) ax2 = flip(real(z2)) ax3 = flip(real(z3)) ay1 = imag(z1) ay2 = imag(z2) ay3 = imag(z3) cx1 = flip(real(cz1)) cx2 = flip(real(cz2)) cx3 = flip(real(cz3)) cy1 = imag(cz1) cy2 = imag(cz2) cy3 = imag(cz3) endif at1 = t1 at2 = t2 at3 = t3 bx1 = ax1 bx2 = ax2 bx3 = ax3 by1 = ay1 by2 = ay2 by3 = ay3 bt1 = at1 bt2 = at2 bt3 = at3 aa1 = ax1 aa2 = ax2 aa3 = ax3 bb1 = ay1 bb2 = ay2 bb3 = ay3 cc1 = at1 cc2 = at2 cc3 = at3 loop: int n = 1 ax1 = aa1 ax2 = aa2 ax3 = aa3 ay1 = bb1 ay2 = bb2 ay3 = bb3 at1 = cc1 at2 = cc2 at3 = cc3 while n < @power n = n + 1 bx1 = aa1 bx2 = aa2 bx3 = aa3 by1 = bb1 by2 = bb2 by3 = bb3 bt1 = cc1 bt2 = cc2 bt3 = cc3 aa1 = ax1*bx1 + at1*by1 + ay1*bt1 aa2 = ax2*bx2 + at2*by2 + ay2*bt2 aa3 = ax3*bx3 + at3*by3 + ay3*bt3 bb1 = ay1*bx1 + ax1*by1 + at1*bt1 bb2 = ay2*bx2 + ax2*by2 + at2*bt2 bb3 = ay3*bx3 + ax3*by3 + at3*bt3 cc1 = at1*bx1 + ay1*by1 + ax1*bt1 cc2 = at2*bx2 + ay2*by2 + ax2*bt2 cc3 = at3*bx3 + ay3*by3 + ax3*bt3 endwhile aa1 = aa1 + cx1 aa2 = aa2 + cx2 aa3 = aa3 + cx3 bb1 = bb1 + cy1 bb2 = bb2 + cy2 bb3 = bb3 + cy3 cc1 = cc1 + ct1 cc2 = cc2 + ct2 cc3 = cc3 + ct3 if (@flavor == 0) z1 = aa1 + flip(bb1) z2 = aa2 + flip(bb2) z3 = aa3 + flip(bb3) elseif (@flavor == 1) z1 = aa1 + bb1 z2 = aa2 + bb2 z3 = aa3 + bb3 endif t1 = cc1 t2 = cc2 t3 = cc3 IF (@zmode == 5) iterexp1 = iterexp1 + exp(-cabs(z1)) iterexp2 = iterexp2 + exp(-cabs(z2)) iterexp3 = iterexp3 + exp(-cabs(z3)) ENDIF done = done + 1; increment iteration counter IF (@zmode == 0) ; 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 == 1) ; 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 == 2) ; 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 == 3) ; 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 == 4) ; 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 ENDIF IF (@bailout < |aa1| + |bb1| + |cc1| || \ @everyiter ||\ done == #maxit + 2); done, or every iteration, or last ; determine continuous iteration (height) for each point IF (@zmode >= 0 && @zmode <= 4) ; height based on smallest |z| e1 = s1 * @zscale e2 = s2 * @zscale e3 = s3 * @zscale ELSEIF (@zmode == 5) e1 = iterexp1 * @zscale e2 = iterexp2 * @zscale e3 = iterexp3 * @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 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 (@bailout < |aa1| + |bb1| + |cc1|) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope Triternion Mandelbrot" maxiter = 500 periodicity = 0 method = multipass float param version default = 1.12 visible = false endparam heading caption = "Slope Triternion Mandelbrot" endheading heading caption = "Use Damien's Lighting Coloring" endheading heading caption = "Or Ron's 3D Texturizer Formulas" endheading heading caption = "Most other coloring formulas" endheading heading caption = "can also be used." endheading param var caption = "Variation" enum = "1""2""3""4" default = 0 endparam param ct caption = "ct" default = (0.0, 0.0) endparam param power caption = "Power" default = 2 endparam param flavor caption = "Combine flavor" enum = "1:(z=x+flip(y))" "2:(z=x+y)" endparam param bailout caption = "Bailout Value" default = 10000.0 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam heading caption = "Slope Parameters" endheading 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 = 5 enum = "smallest |z|" "smallest |real(z)|" \ "smallest |imag(z)|" "smallest summ(z)" "smallest |atan(z)|" \ "smoothed iteration" 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 = "gnd-Slope-T_Jul" version = @version cz = #pixel ct = @ct var = @var power = @power flavor = @flavor bailout = @bailout offset = @offset zmode = @zmode xfer = @xfer zscale = @zscale zscale2 = @zscale2 everyiter = @everyiter } gnd-Slope-3D_J-set { ; based upon the slope (Julia) ; formula of Damien Jones ; Triternion Julia formula ; compound with the models of slope formulas from Ron Barnett. ; ; Based on formula by Russell Walsmith ; http://www.fibonacci-arrays.com/Triternions.pdf ; version 1.12, February 2005 ; Gilles Nadeau, 04/02/2005 ; init: z1 = #pixel z2 = #pixel + @offset; horizontally offset point z3 = #pixel + flip(@offset); vertically offset point t1 = @zt t2 = @zt t3 = @zt cz1 = @cz cz2 = @cz cz3 = @cz ct1 = @ct ct2 = @ct ct3 = @ct ax1 = (0.0, 0.0) ax2 = (0.0, 0.0) ax3 = (0.0, 0.0) ar1 = (0.0, 0.0) ar2 = (0.0, 0.0) ar3 = (0.0, 0.0) ay1 = (0.0, 0.0) ay2 = (0.0, 0.0) ay3 = (0.0, 0.0) ai1 = (0.0, 0.0) ai2 = (0.0, 0.0) ai3 = (0.0, 0.0) cx1 = (0.0, 0.0) cx2 = (0.0, 0.0) cx3 = (0.0, 0.0) cy1 = (0.0, 0.0) cy2 = (0.0, 0.0) cy3 = (0.0, 0.0) 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 iterexp1 = 0.0 float iterexp2 = 0.0 float iterexp3 = 0.0 int done = 2 if (@var == 0) ax1 = real(z1) ax2 = real(z2) ax3 = real(z3) ar1 = -real(z1) ar2 = -real(z2) ar3 = -real(z3) ay1 = imag(z1) ay2 = imag(z2) ay3 = imag(z3) ai1 = -imag(z1) ai2 = -imag(z2) ai3 = -imag(z3) cx1 = real(cz1) cx2 = real(cz2) cx3 = real(cz3) cy1 = imag(cz1) cy2 = imag(cz2) cy3 = imag(cz3) elseif (@var == 1) ax1 = flip(real(z1)) ax2 = flip(real(z2)) ax3 = flip(real(z3)) ar1 = -flip(real(z1)) ar2 = -flip(real(z2)) ar3 = -flip(real(z3)) ay1 = flip(imag(z1)) ay2 = flip(imag(z2)) ay3 = flip(imag(z3)) ai1 = -flip(imag(z1)) ai2 = -flip(imag(z2)) ai3 = -flip(imag(z3)) cx1 = flip(real(cz1)) cx2 = flip(real(cz2)) cx3 = flip(real(cz3)) cy1 = flip(imag(cz1)) cy2 = flip(imag(cz2)) cy3 = flip(imag(cz3)) elseif (@var == 2) ax1 = real(z1) ax2 = real(z2) ax3 = real(z3) ar1 = -real(z1) ar2 = -real(z2) ar3 = -real(z3) ay1 = flip(imag(z1)) ay2 = flip(imag(z2)) ay3 = flip(imag(z3)) ai1 = -flip(imag(z1)) ai2 = -flip(imag(z2)) ai3 = -flip(imag(z3)) cx1 = real(cz1) cx2 = real(cz2) cx3 = real(cz3) cy1 = flip(imag(cz1)) cy2 = flip(imag(cz2)) cy3 = flip(imag(cz3)) elseif (@var == 3) ax1 = flip(real(z1)) ax2 = flip(real(z2)) ax3 = flip(real(z3)) ar1 = -flip(real(z1)) ar2 = -flip(real(z2)) ar3 = -flip(real(z3)) ay1 = imag(z1) ay2 = imag(z2) ay3 = imag(z3) ai1 = -imag(z1) ai2 = -imag(z2) ai3 = -imag(z3) cx1 = flip(real(cz1)) cx2 = flip(real(cz2)) cx3 = flip(real(cz3)) cy1 = imag(cz1) cy2 = imag(cz2) cy3 = imag(cz3) endif at1 = t1 at2 = t2 at3 = t3 au1 = -t1 au2 = -t2 au3 = -t3 bx1 = ax1 bx2 = ax2 bx3 = ax3 br1 = ar1 br2 = ar2 br3 = ar3 by1 = ay1 by2 = ay2 by3 = ay3 bi1 = ai1 bi2 = ai2 bi3 = ai3 bt1 = at1 bt2 = at2 bt3 = at3 bu1 = au1 bu2 = au2 bu3 = au3 aa1 = ax1 aa2 = ax2 aa3 = ax3 ab1 = ar1 ab2 = ar2 ab3 = ar3 ba1 = ay1 ba2 = ay2 ba3 = ay3 bb1 = ai1 bb2 = ai2 bb3 = ai3 ca1 = at1 ca2 = at2 ca3 = at3 cb1 = au1 cb2 = au2 cb3 = au3 loop: int n = 1 ax1 = aa1 ax2 = aa2 ax3 = aa3 ar1 = ab1 ar2 = ab2 ar3 = ab3 ay1 = ba1 ay2 = ba2 ay3 = ba3 ai1 = bb1 ai2 = bb2 ai3 = bb3 at1 = ca1 at2 = ca2 at3 = ca3 au1 = cb1 au2 = cb2 au3 = cb3 while n < @power n = n + 1 bx1 = aa1 bx2 = aa2 bx3 = aa3 br1 = ab1 br2 = ab2 br3 = ab3 by1 = ba1 by2 = ba2 by3 = ba3 bi1 = bb1 bi2 = bb2 bi3 = bb3 bt1 = ca1 bt2 = ca2 bt3 = ca3 bu1 = cb1 bu2 = cb2 bu3 = cb3 aa1 = ax1*bx1 + ar1*br1 + ay1*bi1 + ai1*by1 + at1*bu1 + au1*bt1 aa2 = ax2*bx2 + ar2*br2 + ay2*bi2 + ai2*by2 + at2*bu2 + au2*bt2 aa3 = ax3*bx3 + ar3*br3 + ay3*bi3 + ai3*by3 + at3*bu3 + au3*bt3 ab1 = ax1*br1 + ar1*bx1 + ay1*bu1 + au1*by1 + ai1*bt1 + at1*bi1 ab2 = ax2*br2 + ar2*bx2 + ay2*bu2 + au2*by2 + ai2*bt2 + at2*bi2 ab3 = ax3*br3 + ar3*bx3 + ay3*bu3 + au3*by3 + ai3*bt3 + at3*bi3 ba1 = ai1*bi1 + au1*bu1 + ax1*by1 + ay1*bx1 + ar1*bt1 + at1*br1 ba2 = ai2*bi2 + au2*bu2 + ax2*by2 + ay2*bx2 + ar2*bt2 + at2*br2 ba3 = ai3*bi3 + au3*bu3 + ax3*by3 + ay3*bx3 + ar3*bt3 + at3*br3 bb1 = ay1*by1 + at1*bt1 + ax1*bi1 + ai1*bx1 + ar1*bu1 + au1*br1 bb2 = ay2*by2 + at2*bt2 + ax2*bi2 + ai2*bx2 + ar2*bu2 + au2*br2 bb3 = ay3*by3 + at3*bt3 + ax3*bi3 + ai3*bx3 + ar3*bu3 + au3*br3 ca1 = ax1*bt1 + at1*bx1 + ar1*by1 + ay1*br1 + ai1*bu1 + au1*bi1 ca2 = ax2*bt2 + at2*bx2 + ar2*by2 + ay2*br2 + ai2*bu2 + au2*bi2 ca3 = ax3*bt3 + at3*bx3 + ar3*by3 + ay3*br3 + ai3*bu3 + au3*bi3 cb1 = ax1*bu1 + au1*bx1 + ar1*bi1 + ai1*br1 + ay1*bt1 + at1*by1 cb2 = ax2*bu2 + au2*bx2 + ar2*bi2 + ai2*br2 + ay2*bt2 + at2*by2 cb3 = ax3*bu3 + au3*bx3 + ar3*bi3 + ai3*br3 + ay3*bt3 + at3*by3 endwhile aa1 = aa1 + cx1 aa2 = aa2 + cx2 aa3 = aa3 + cx3 ab1 = ab1 - cx1 ab2 = ab2 - cx2 ab3 = ab3 - cx3 ba1 = ba1 + cy1 ba2 = ba2 + cy2 ba3 = ba3 + cy3 bb1 = bb1 - cy1 bb2 = bb2 - cy2 bb3 = bb3 - cy3 ca1 = ca1 + ct1 ca2 = ca2 + ct2 ca3 = ca3 + ct3 cb1 = cb1 - ct1 cb2 = cb2 - ct2 cb3 = cb3 - ct3 if (@flavor == 0) z1 = aa1 - ab1 + flip(ba1 - bb1) z2 = aa2 - ab2 + flip(ba2 - bb2) z3 = aa3 - ab3 + flip(ba3 - bb3) elseif (@flavor == 1) z1 = aa1 - ab1 + ba1 - bb1 z2 = aa2 - ab2 + ba2 - bb2 z3 = aa3 - ab3 + ba3 - bb3 endif t1 = ca1 - cb1 t2 = ca2 - cb2 t3 = ca3 - cb3 IF (@zmode == 5) iterexp1 = iterexp1 + exp(-cabs(z1)) iterexp2 = iterexp2 + exp(-cabs(z2)) iterexp3 = iterexp3 + exp(-cabs(z3)) ENDIF done = done + 1; increment iteration counter IF (@zmode == 0) ; 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 == 1) ; 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 == 2) ; 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 == 3) ; 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 == 4) ; 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 ENDIF IF (@bailout < |aa1| + |ab1| + |ba1| + |bb1| + |ca1| + |cb1| || \ @everyiter ||\ done == #maxit + 2); done, or every iteration, or last ; determine continuous iteration (height) for each point IF (@zmode >= 0 && @zmode <= 4) ; height based on smallest |z| e1 = s1 * @zscale e2 = s2 * @zscale e3 = s3 * @zscale ELSEIF (@zmode == 5) e1 = iterexp1 * @zscale e2 = iterexp2 * @zscale e3 = iterexp3 * @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 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 (@bailout < |aa1| + |ab1| + |ba1| + |bb1| + |ca1| + |cb1|) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope Triternion 3D J Set" magn = 1.5 maxiter = 500 periodicity = 0 method = multipass float param version default = 1.12 visible = false endparam heading caption = "Slope Triternion 3D J Set" endheading heading caption = "Use Damien's Lighting Coloring" endheading heading caption = "Or Ron's 3D Texturizer Formulas" endheading heading caption = "Most other coloring formulas" endheading heading caption = "can also be used." endheading param var caption = "Variation" enum = "1""2""3""4" default = 0 endparam param cz caption = "cz" default = (-0.4, 0.11) endparam param ct caption = "ct" default = (0.0, 0.0) endparam param zt caption = "zt" default = (0.0, 0.0) endparam param power caption = "Power" default = 2 endparam param flavor caption = "Combine flavor" enum = "1:(z=x+flip(y))" "2:(z=x+y)" endparam param bailout caption = "Bailout Value" default = 10000.0 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam heading caption = "Slope Parameters" endheading 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 = 5 enum = "smallest |z|" "smallest |real(z)|" \ "smallest |imag(z)|" "smallest summ(z)" "smallest |atan(z)|" \ "smoothed iteration" 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 = "gnd-Slope-3D_M-set" version = @version ct = @ct var = @var power = @power bailout = @bailout flavor = @flavor offset = @offset zmode = @zmode xfer = @xfer zscale = @zscale zscale2 = @zscale2 everyiter = @everyiter } gnd-Slope-3D_M-set { ; based upon the slope (Mandelbrot) ; formula of Damien Jones ; Triternion Mandel formula ; compound with the models of slope formulas from Ron Barnett. ; ; Original formula 3D_Mset by Russell Walsmith ; http://www.fibonacci-arrays.com/Triternions.pdf ; version 1.12, February 2005 ; Gilles Nadeau, 04/02/2005 ; init: cz1 = #pixel cz2 = #pixel + @offset; horizontally offset point cz3 = #pixel + flip(@offset); vertically offset point ct1 = @ct ct2 = @ct ct3 = @ct z1 = (0.0, 0.0) z2 = (0.0, 0.0) z3 = (0.0, 0.0) t1 = (0.0, 0.0) t2 = (0.0, 0.0) t3 = (0.0, 0.0) ax1 = (0.0, 0.0) ax2 = (0.0, 0.0) ax3 = (0.0, 0.0) ar1 = (0.0, 0.0) ar2 = (0.0, 0.0) ar3 = (0.0, 0.0) ay1 = (0.0, 0.0) ay2 = (0.0, 0.0) ay3 = (0.0, 0.0) ai1 = (0.0, 0.0) ai2 = (0.0, 0.0) ai3 = (0.0, 0.0) cx1 = (0.0, 0.0) cx2 = (0.0, 0.0) cx3 = (0.0, 0.0) cy1 = (0.0, 0.0) cy2 = (0.0, 0.0) cy3 = (0.0, 0.0) 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 iterexp1 = 0.0 float iterexp2 = 0.0 float iterexp3 = 0.0 int done = 2 if (@var == 0) ax1 = real(z1) ax2 = real(z2) ax3 = real(z3) ar1 = -real(z1) ar2 = -real(z2) ar3 = -real(z3) ay1 = imag(z1) ay2 = imag(z2) ay3 = imag(z3) ai1 = -imag(z1) ai2 = -imag(z2) ai3 = -imag(z3) cx1 = real(cz1) cx2 = real(cz2) cx3 = real(cz3) cy1 = imag(cz1) cy2 = imag(cz2) cy3 = imag(cz3) elseif (@var == 1) ax1 = flip(real(z1)) ax2 = flip(real(z2)) ax3 = flip(real(z3)) ar1 = -flip(real(z1)) ar2 = -flip(real(z2)) ar3 = -flip(real(z3)) ay1 = flip(imag(z1)) ay2 = flip(imag(z2)) ay3 = flip(imag(z3)) ai1 = -flip(imag(z1)) ai2 = -flip(imag(z2)) ai3 = -flip(imag(z3)) cx1 = flip(real(cz1)) cx2 = flip(real(cz2)) cx3 = flip(real(cz3)) cy1 = flip(imag(cz1)) cy2 = flip(imag(cz2)) cy3 = flip(imag(cz3)) elseif (@var == 2) ax1 = real(z1) ax2 = real(z2) ax3 = real(z3) ar1 = -real(z1) ar2 = -real(z2) ar3 = -real(z3) ay1 = flip(imag(z1)) ay2 = flip(imag(z2)) ay3 = flip(imag(z3)) ai1 = -flip(imag(z1)) ai2 = -flip(imag(z2)) ai3 = -flip(imag(z3)) cx1 = real(cz1) cx2 = real(cz2) cx3 = real(cz3) cy1 = flip(imag(cz1)) cy2 = flip(imag(cz2)) cy3 = flip(imag(cz3)) elseif (@var == 3) ax1 = flip(real(z1)) ax2 = flip(real(z2)) ax3 = flip(real(z3)) ar1 = -flip(real(z1)) ar2 = -flip(real(z2)) ar3 = -flip(real(z3)) ay1 = imag(z1) ay2 = imag(z2) ay3 = imag(z3) ai1 = -imag(z1) ai2 = -imag(z2) ai3 = -imag(z3) cx1 = flip(real(cz1)) cx2 = flip(real(cz2)) cx3 = flip(real(cz3)) cy1 = imag(cz1) cy2 = imag(cz2) cy3 = imag(cz3) endif at1 = t1 at2 = t2 at3 = t3 au1 = -t1 au2 = -t2 au3 = -t3 bx1 = ax1 bx2 = ax2 bx3 = ax3 br1 = ar1 br2 = ar2 br3 = ar3 by1 = ay1 by2 = ay2 by3 = ay3 bi1 = ai1 bi2 = ai2 bi3 = ai3 bt1 = at1 bt2 = at2 bt3 = at3 bu1 = au1 bu2 = au2 bu3 = au3 aa1 = ax1 aa2 = ax2 aa3 = ax3 ab1 = ar1 ab2 = ar2 ab3 = ar3 ba1 = ay1 ba2 = ay2 ba3 = ay3 bb1 = ai1 bb2 = ai2 bb3 = ai3 ca1 = at1 ca2 = at2 ca3 = at3 cb1 = au1 cb2 = au2 cb3 = au3 loop: int n = 1 ax1 = aa1 ax2 = aa2 ax3 = aa3 ar1 = ab1 ar2 = ab2 ar3 = ab3 ay1 = ba1 ay2 = ba2 ay3 = ba3 ai1 = bb1 ai2 = bb2 ai3 = bb3 at1 = ca1 at2 = ca2 at3 = ca3 au1 = cb1 au2 = cb2 au3 = cb3 while n < @power n = n + 1 bx1 = aa1 bx2 = aa2 bx3 = aa3 br1 = ab1 br2 = ab2 br3 = ab3 by1 = ba1 by2 = ba2 by3 = ba3 bi1 = bb1 bi2 = bb2 bi3 = bb3 bt1 = ca1 bt2 = ca2 bt3 = ca3 bu1 = cb1 bu2 = cb2 bu3 = cb3 aa1 = ax1*bx1 + ar1*br1 + ay1*bi1 + ai1*by1 + at1*bu1 + au1*bt1 aa2 = ax2*bx2 + ar2*br2 + ay2*bi2 + ai2*by2 + at2*bu2 + au2*bt2 aa3 = ax3*bx3 + ar3*br3 + ay3*bi3 + ai3*by3 + at3*bu3 + au3*bt3 ab1 = ax1*br1 + ar1*bx1 + ay1*bu1 + au1*by1 + ai1*bt1 + at1*bi1 ab2 = ax2*br2 + ar2*bx2 + ay2*bu2 + au2*by2 + ai2*bt2 + at2*bi2 ab3 = ax3*br3 + ar3*bx3 + ay3*bu3 + au3*by3 + ai3*bt3 + at3*bi3 ba1 = ai1*bi1 + au1*bu1 + ax1*by1 + ay1*bx1 + ar1*bt1 + at1*br1 ba2 = ai2*bi2 + au2*bu2 + ax2*by2 + ay2*bx2 + ar2*bt2 + at2*br2 ba3 = ai3*bi3 + au3*bu3 + ax3*by3 + ay3*bx3 + ar3*bt3 + at3*br3 bb1 = ay1*by1 + at1*bt1 + ax1*bi1 + ai1*bx1 + ar1*bu1 + au1*br1 bb2 = ay2*by2 + at2*bt2 + ax2*bi2 + ai2*bx2 + ar2*bu2 + au2*br2 bb3 = ay3*by3 + at3*bt3 + ax3*bi3 + ai3*bx3 + ar3*bu3 + au3*br3 ca1 = ax1*bt1 + at1*bx1 + ar1*by1 + ay1*br1 + ai1*bu1 + au1*bi1 ca2 = ax2*bt2 + at2*bx2 + ar2*by2 + ay2*br2 + ai2*bu2 + au2*bi2 ca3 = ax3*bt3 + at3*bx3 + ar3*by3 + ay3*br3 + ai3*bu3 + au3*bi3 cb1 = ax1*bu1 + au1*bx1 + ar1*bi1 + ai1*br1 + ay1*bt1 + at1*by1 cb2 = ax2*bu2 + au2*bx2 + ar2*bi2 + ai2*br2 + ay2*bt2 + at2*by2 cb3 = ax3*bu3 + au3*bx3 + ar3*bi3 + ai3*br3 + ay3*bt3 + at3*by3 endwhile aa1 = aa1 + cx1 aa2 = aa2 + cx2 aa3 = aa3 + cx3 ab1 = ab1 - cx1 ab2 = ab2 - cx2 ab3 = ab3 - cx3 ba1 = ba1 + cy1 ba2 = ba2 + cy2 ba3 = ba3 + cy3 bb1 = bb1 - cy1 bb2 = bb2 - cy2 bb3 = bb3 - cy3 ca1 = ca1 + ct1 ca2 = ca2 + ct2 ca3 = ca3 + ct3 cb1 = cb1 - ct1 cb2 = cb2 - ct2 cb3 = cb3 - ct3 if (@flavor == 0) z1 = aa1 - ab1 + flip(ba1 - bb1) z2 = aa2 - ab2 + flip(ba2 - bb2) z3 = aa3 - ab3 + flip(ba3 - bb3) elseif (@flavor == 1) z1 = aa1 - ab1 + ba1 - bb1 z2 = aa2 - ab2 + ba2 - bb2 z3 = aa3 - ab3 + ba3 - bb3 endif t1 = ca1 - cb1 t2 = ca2 - cb2 t3 = ca3 - cb3 IF (@zmode == 5) iterexp1 = iterexp1 + exp(-cabs(z1)) iterexp2 = iterexp2 + exp(-cabs(z2)) iterexp3 = iterexp3 + exp(-cabs(z3)) ENDIF done = done + 1; increment iteration counter IF (@zmode == 0) ; 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 == 1) ; 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 == 2) ; 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 == 3) ; 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 == 4) ; 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 ENDIF IF (@bailout < |aa1| + |ab1| + |ba1| + |bb1| + |ca1| + |cb1| || \ @everyiter ||\ done == #maxit + 2); done, or every iteration, or last ; determine continuous iteration (height) for each point IF (@zmode >= 0 && @zmode <= 4) ; height based on smallest |z| e1 = s1 * @zscale e2 = s2 * @zscale e3 = s3 * @zscale ELSEIF (@zmode == 5) e1 = iterexp1 * @zscale e2 = iterexp2 * @zscale e3 = iterexp3 * @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 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 (@bailout < |aa1| + |ab1| + |ba1| + |bb1| + |ca1| + |cb1|) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope Triternion 3D M Set" magn = 1.5 maxiter = 500 periodicity = 0 method = multipass float param version default = 1.12 visible = false endparam heading caption = "Slope Triternion 3D M Set" endheading heading caption = "Use Damien's Lighting Coloring" endheading heading caption = "Or Ron's 3D Texturizer Formulas" endheading heading caption = "Most other coloring formulas" endheading heading caption = "can also be used." endheading param var caption = "Variation" enum = "1""2""3""4" default = 0 endparam param ct caption = "ct" default = (0.0, 0.0) endparam param power caption = "Power" default = 2 endparam param flavor caption = "Combine flavor" enum = "1:(z=x+flip(y))" "2:(z=x+y)" endparam param bailout caption = "Bailout Value" default = 10000.0 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam heading caption = "Slope Parameters" endheading 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 = 5 enum = "smallest |z|" "smallest |real(z)|" \ "smallest |imag(z)|" "smallest summ(z)" "smallest |atan(z)|" \ "smoothed iteration" 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 = "gnd-Slope-3D_J-set" version = @version cz = #pixel ct = @ct var = @var power = @power flavor = @flavor bailout = @bailout offset = @offset zmode = @zmode xfer = @xfer zscale = @zscale zscale2 = @zscale2 everyiter = @everyiter } gnd-Slope_H-FractalFenderC-J { ; based upon the slope (Julia) ; formula of Damien Jones ; Hypercomplex Fractal Fender C Julia formula ; compound with the models of slope formulas from Ron Barnett. ; version 1.13, January 2005 ; Gilles Nadeau, 02/01/2005 ; init: complex cz1 = (0.0, 0.0) complex cz2 = (0.0, 0.0) complex cz3 = (0.0, 0.0) complex cw1 = (0.0, 0.0) complex cw2 = (0.0, 0.0) complex cw3 = (0.0, 0.0) complex z1 = (0.0, 0.0) complex z2 = (0.0, 0.0) complex z3 = (0.0, 0.0) complex w1 = (0.0, 0.0) complex w2 = (0.0, 0.0) complex w3 = (0.0, 0.0) int done = 2 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 iterexp1 = 0.0 float iterexp2 = 0.0 float iterexp3 = 0.0 if (@plane == 0) cz1 = @c1i cz2 = @c1i cz3 = @c1i cw1 = @cjk cw2 = @cjk cw3 = @cjk z1 = #pixel z2 = #pixel + @offset; horizontally offset point z3 = #pixel + flip(@offset); vertically offset point w1 = @zjk w2 = @zjk w3 = @zjk elseif (@plane == 1) cz1 = @cjk cz2 = @cjk cz3 = @cjk cw1 = @c1i cw2 = @c1i cw3 = @c1i z1 = @zjk z2 = @zjk z3 = @zjk w1 = #pixel w2 = #pixel + @offset; horizontally offset point w3 = #pixel + flip(@offset); vertically offset point elseif (@plane == 2) cz1 = real(@c1i) + flip(real(@cjk)) cz2 = real(@c1i) + flip(real(@cjk)) cz3 = real(@c1i) + flip(real(@cjk)) cw1 = imag(@cjk) + flip(imag(@c1i)) cw2 = imag(@cjk) + flip(imag(@c1i)) cw3 = imag(@cjk) + flip(imag(@c1i)) z1 = real(#pixel) + flip(real(@zjk)) z2 = real(#pixel + @offset) + flip(real(@zjk)) z3 = real(#pixel + flip(@offset)) + flip(real(@zjk)) w1 = imag(@zjk) + flip(imag(#pixel)) w2 = imag(@zjk) + flip(imag(#pixel + @offset)) w3 = imag(@zjk) + flip(imag(#pixel + flip(@offset))) elseif (@plane == 3) cz1 = real(@cjk) + flip(real(@c1i)) cz2 = real(@cjk) + flip(real(@c1i)) cz3 = real(@cjk) + flip(real(@c1i)) cw1 = imag(@c1i) + flip(imag(@cjk)) cw2 = imag(@c1i) + flip(imag(@cjk)) cw3 = imag(@c1i) + flip(imag(@cjk)) z1 = real(@zjk) + flip(real(#pixel)) z2 = real(@zjk) + flip(real(#pixel + @offset)) z3 = real(@zjk) + flip(real(#pixel + flip(@offset))) w1 = imag(#pixel) + flip(imag(@zjk)) w2 = imag(#pixel + @offset) + flip(imag(@zjk)) w3 = imag(#pixel + flip(@offset)) + flip(imag(@zjk)) elseif (@plane == 4) cz1 = real(@c1i) + flip(real(@cjk)) cz2 = real(@c1i) + flip(real(@cjk)) cz3 = real(@c1i) + flip(real(@cjk)) cw1 = imag(@c1i) + flip(imag(@cjk)) cw2 = imag(@c1i) + flip(imag(@cjk)) cw3 = imag(@c1i) + flip(imag(@cjk)) z1 = real(#pixel) + flip(real(@zjk)) z2 = real(#pixel + @offset) + flip(real(@zjk)) z3 = real(#pixel + flip(@offset)) + flip(real(@zjk)) w1 = imag(#pixel) + flip(imag(@zjk)) w2 = imag(#pixel + @offset) + flip(imag(@zjk)) w3 = imag(#pixel + flip(@offset)) + flip(imag(@zjk)) elseif (@plane == 5) cz1 = real(@cjk) + flip(real(@c1i)) cz2 = real(@cjk) + flip(real(@c1i)) cz3 = real(@cjk) + flip(real(@c1i)) cw1 = imag(@cjk) + flip(imag(@c1i)) cw2 = imag(@cjk) + flip(imag(@c1i)) cw3 = imag(@cjk) + flip(imag(@c1i)) z1 = real(@zjk) + flip(real(#pixel)) z2 = real(@zjk) + flip(real(#pixel + @offset)) z3 = real(@zjk) + flip(real(#pixel + flip(@offset))) w1 = imag(@zjk) + flip(imag(#pixel)) w2 = imag(@zjk) + flip(imag(#pixel + @offset)) w3 = imag(@zjk) + flip(imag(#pixel + flip(@offset))) endif loop: if (@var == 0) if (1 < (|z1| + |w1|)) a = @fn1(z1 + w1 * 1i) b = @fn1(z1 - w1 * 1i) z1 = (a + b) / 2 + cz1 w1 = (b - a) * 1i / 2 + cw1 a = @fn1(z2 + w2 * 1i) b = @fn1(z2 - w2 * 1i) z2 = (a + b) / 2 + cz2 w2 = (b - a) * 1i / 2 + cw2 a = @fn1(z3 + w3 * 1i) b = @fn1(z3 - w3 * 1i) z3 = (a + b) / 2 + cz3 w3 = (b - a) * 1i / 2 + cw3 endif a = @fn2(z1 + w1 * 1i) b = @fn2(z1 - w1 * 1i) z1 = (a + b) / 2 + cz1 w1 = (b - a) * 1i / 2 + cw1 a = @fn2(z2 + w2 * 1i) b = @fn2(z2 - w2 * 1i) z2 = (a + b) / 2 + cz2 w2 = (b - a) * 1i / 2 + cw2 a = @fn2(z3 + w3 * 1i) b = @fn2(z3 - w3 * 1i) z3 = (a + b) / 2 + cz3 w3 = (b - a) * 1i / 2 + cw3 elseif (@var == 1) a = z1 + w1 * 1i b = z1 - w1 * 1i ca = cz1 + cw1 * 1i cb = cz1 - cw1 * 1i if (1 < |a|) a = @fn1(a) + ca endif a = @fn2(a) + ca if (1 < |b|) b = @fn1(b) + cb endif b = @fn2(b) + cb z1 = (a + b) / 2 w1 = (b - a) * 1i / 2 a = z2 + w2 * 1i b = z2 - w2 * 1i ca = cz2 + cw2 * 1i cb = cz2 - cw2 * 1i if (1 < |a|) a = @fn1(a) + ca endif a = @fn2(a) + ca if (1 < |b|) b = @fn1(b) + cb endif b = @fn2(b) + cb z2 = (a + b) / 2 w2 = (b - a) * 1i / 2 a = z3 + w3 * 1i b = z3 - w3 * 1i ca = cz3 + cw3 * 1i cb = cz3 - cw3 * 1i if (1 < |a|) a = @fn1(a) + ca endif a = @fn2(a) + ca if (1 < |b|) b = @fn1(b) + cb endif b = @fn2(b) + cb z3 = (a + b) / 2 w3 = (b - a) * 1i / 2 endif IF (@zmode == 5) iterexp1 = iterexp1 + exp(-cabs(z1)) iterexp2 = iterexp2 + exp(-cabs(z2)) iterexp3 = iterexp3 + exp(-cabs(z3)) ENDIF done = done + 1; increment iteration counter IF (@zmode == 0) ; 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 == 1) ; 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 == 2) ; 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 == 3) ; 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 == 4) ; 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 ENDIF IF (@bailout < |z1| + |w1| || \ @everyiter ||\ done == #maxit + 2); done, or every iteration, or last ; determine continuous iteration (height) for each point IF (@zmode >= 0 && @zmode <= 4) ; height based on smallest |z| e1 = s1 * @zscale e2 = s2 * @zscale e3 = s3 * @zscale ELSEIF (@zmode == 5) e1 = iterexp1 * @zscale e2 = iterexp2 * @zscale e3 = iterexp3 * @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 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 (@bailout < |z1| + |w1|) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope Hyper Fractal Fender C Julia" center = (0.0,0.0) magn = 1.0 maxiter = 500 method = multipass periodicity = 0 param version caption = "Version" default = 1.13 visible = false endparam heading caption = "Slope Hyper Fractal Fender C Julia" endheading heading caption = "Use Damien's Lighting Coloring" endheading heading caption = "Or Ron's 3D Texturizer Formulas" endheading heading caption = "Most other coloring formulas" endheading heading caption = "can also be used." endheading param var caption = "Variation" enum = "First" "Second" endparam param plane caption = "H plane" enum = "1:(xy)" "2:(zw)" "3:(xw)" "4:(yz)" "5:(xz)" "6:(yw)" endparam param c1i caption = "(c1, ci)" default = (-0.72, 0.025) endparam param cjk caption = "(cj, ck)" default = (0.113, 0.05) endparam param zjk caption = "(zj, zk)" default = (0.0, 0.0) endparam param bailout caption = "Bailout Value" default = 10000.0 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam func fn1 caption = "First Function" default = cosh() endfunc func fn2 caption = "Second Function" default = sqr() endfunc heading caption = "Slope Parameters" endheading 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 = 5 enum = "smallest |z|" "smallest |real(z)|" \ "smallest |imag(z)|" "smallest summ(z)" "smallest |atan(z)|" \ "smoothed iteration" 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 = "gnd-Slope_H-FractalFenderC" version = @version cjk = @cjk var = @var plane = @plane bailout = @bailout fn1 = @fn1 fn2 = @fn2 offset = @offset zmode = @zmode xfer = @xfer zscale = @zscale zscale2 = @zscale2 everyiter = @everyiter } gnd-Slope_H-FractalFenderC { ; based upon the slope (Mandelbrot) ; formula of Damien Jones ; Hypercomplex Fractal Fender C Mandel formula ; compound with the models of slope formulas from Ron Barnett. ; Original formula by Jon Osuch ; source: fract196.frm ; version 1.13, January 2005 ; Gilles Nadeau, 02/01/2005 ; init: complex cz1 = (0.0, 0.0) complex cz2 = (0.0, 0.0) complex cz3 = (0.0, 0.0) complex cw1 = (0.0, 0.0) complex cw2 = (0.0, 0.0) complex cw3 = (0.0, 0.0) complex z1 = (0.0, 0.0) complex z2 = (0.0, 0.0) complex z3 = (0.0, 0.0) complex w1 = (0.0, 0.0) complex w2 = (0.0, 0.0) complex w3 = (0.0, 0.0) int done = 2 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 iterexp1 = 0.0 float iterexp2 = 0.0 float iterexp3 = 0.0 if (@plane == 0) cz1 = #pixel cz2 = #pixel + @offset; horizontally offset point cz3 = #pixel + flip(@offset); vertically offset point cw1 = @cjk cw2 = @cjk cw3 = @cjk elseif (@plane == 1) cz1 = @cjk cz2 = @cjk cz3 = @cjk cw1 = #pixel cw2 = #pixel + @offset; horizontally offset point cw3 = #pixel + flip(@offset); vertically offset point elseif (@plane == 2) cz1 = real(#pixel) + flip(real(@cjk)) cz2 = real(#pixel + @offset) + flip(real(@cjk)) cz3 = real(#pixel + flip(@offset)) + flip(real(@cjk)) cw1 = imag(@cjk) + flip(imag(#pixel)) cw2 = imag(@cjk) + flip(imag(#pixel + @offset)) cw3 = imag(@cjk) + flip(imag(#pixel + flip(@offset))) elseif (@plane == 3) cz1 = real(@cjk) + flip(real(#pixel)) cz2 = real(@cjk) + flip(real(#pixel + @offset)) cz3 = real(@cjk) + flip(real(#pixel + flip(@offset))) cw1 = imag(#pixel) + flip(imag(@cjk)) cw2 = imag(#pixel + @offset) + flip(imag(@cjk)) cw3 = imag(#pixel + flip(@offset)) + flip(imag(@cjk)) elseif (@plane == 4) cz1 = real(#pixel) + flip(real(@cjk)) cz2 = real(#pixel + @offset) + flip(real(@cjk)) cz3 = real(#pixel + flip(@offset)) + flip(real(@cjk)) cw1 = imag(#pixel) + flip(imag(@cjk)) cw2 = imag(#pixel + @offset) + flip(imag(@cjk)) cw3 = imag(#pixel + flip(@offset)) + flip(imag(@cjk)) elseif (@plane == 5) cz1 = real(@cjk) + flip(real(#pixel)) cz2 = real(@cjk) + flip(real(#pixel + @offset)) cz3 = real(@cjk) + flip(real(#pixel + flip(@offset))) cw1 = imag(@cjk) + flip(imag(#pixel)) cw2 = imag(@cjk) + flip(imag(#pixel + @offset)) cw3 = imag(@cjk) + flip(imag(#pixel + flip(@offset))) endif loop: if (@var == 0) if (1 < (|z1| + |w1|)) a = @fn1(z1 + w1 * 1i) b = @fn1(z1 - w1 * 1i) z1 = (a + b) / 2 + cz1 w1 = (b - a) * 1i / 2 + cw1 a = @fn1(z2 + w2 * 1i) b = @fn1(z2 - w2 * 1i) z2 = (a + b) / 2 + cz2 w2 = (b - a) * 1i / 2 + cw2 a = @fn1(z3 + w3 * 1i) b = @fn1(z3 - w3 * 1i) z3 = (a + b) / 2 + cz3 w3 = (b - a) * 1i / 2 + cw3 endif a = @fn2(z1 + w1 * 1i) b = @fn2(z1 - w1 * 1i) z1 = (a + b) / 2 + cz1 w1 = (b - a) * 1i / 2 + cw1 a = @fn2(z2 + w2 * 1i) b = @fn2(z2 - w2 * 1i) z2 = (a + b) / 2 + cz2 w2 = (b - a) * 1i / 2 + cw2 a = @fn2(z3 + w3 * 1i) b = @fn2(z3 - w3 * 1i) z3 = (a + b) / 2 + cz3 w3 = (b - a) * 1i / 2 + cw3 elseif (@var == 1) a = z1 + w1 * 1i b = z1 - w1 * 1i ca = cz1 + cw1 * 1i cb = cz1 - cw1 * 1i if (1 < |a|) a = @fn1(a) + ca endif a = @fn2(a) + ca if (1 < |b|) b = @fn1(b) + cb endif b = @fn2(b) + cb z1 = (a + b) / 2 w1 = (b - a) * 1i / 2 a = z2 + w2 * 1i b = z2 - w2 * 1i ca = cz2 + cw2 * 1i cb = cz2 - cw2 * 1i if (1 < |a|) a = @fn1(a) + ca endif a = @fn2(a) + ca if (1 < |b|) b = @fn1(b) + cb endif b = @fn2(b) + cb z2 = (a + b) / 2 w2 = (b - a) * 1i / 2 a = z3 + w3 * 1i b = z3 - w3 * 1i ca = cz3 + cw3 * 1i cb = cz3 - cw3 * 1i if (1 < |a|) a = @fn1(a) + ca endif a = @fn2(a) + ca if (1 < |b|) b = @fn1(b) + cb endif b = @fn2(b) + cb z3 = (a + b) / 2 w3 = (b - a) * 1i / 2 endif IF (@zmode == 5) iterexp1 = iterexp1 + exp(-cabs(z1)) iterexp2 = iterexp2 + exp(-cabs(z2)) iterexp3 = iterexp3 + exp(-cabs(z3)) ENDIF done = done + 1; increment iteration counter IF (@zmode == 0) ; 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 == 1) ; 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 == 2) ; 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 == 3) ; 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 == 4) ; 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 ENDIF IF (@bailout < |z1| + |w1| || \ @everyiter ||\ done == #maxit + 2); done, or every iteration, or last ; determine continuous iteration (height) for each point IF (@zmode >= 0 && @zmode <= 4) ; height based on smallest |z| e1 = s1 * @zscale e2 = s2 * @zscale e3 = s3 * @zscale ELSEIF (@zmode == 5) e1 = iterexp1 * @zscale e2 = iterexp2 * @zscale e3 = iterexp3 * @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 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 (@bailout < |z1| + |w1|) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope Hyper Fractal Fender C" center = (0.0,0.0) magn = 1.0 maxiter = 500 method = multipass periodicity = 0 param version caption = "Version" default = 1.13 visible = false endparam heading caption = "Slope Hyper Fractal Fender C" endheading heading caption = "Use Damien's Lighting Coloring" endheading heading caption = "Or Ron's 3D Texturizer Formulas" endheading heading caption = "Most other coloring formulas" endheading heading caption = "can also be used." endheading param var caption = "Variation" enum = "First" "Second" endparam param plane caption = "H plane" enum = "1:(xy)" "2:(zw)" "3:(xw)" "4:(yz)" "5:(xz)" "6:(yw)" endparam param cjk caption = "(cj, ck)" default = (0.0, 0.0) endparam param bailout caption = "Bailout Value" default = 10000.0 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam func fn1 caption = "First Function" default = cosh() endfunc func fn2 caption = "Second Function" default = sqr() endfunc heading caption = "Slope Parameters" endheading 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 = 5 enum = "smallest |z|" "smallest |real(z)|" \ "smallest |imag(z)|" "smallest summ(z)" "smallest |atan(z)|" \ "smoothed iteration" 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 = "gnd-Slope_H-FractalFenderC-J" version = @version c1i = #pixel cjk = @cjk var = @var plane = @plane bailout = @bailout fn1 = @fn1 fn2 = @fn2 offset = @offset zmode = @zmode xfer = @xfer zscale = @zscale zscale2 = @zscale2 everyiter = @everyiter } gnd-Slope_Hyper-Lambda-fn { ; based upon the slope (Julia) ; formula of Damien Jones ; Hypercomplex Lambda-fn formula ; compound with the models of slope formulas from Ron Barnett. ; version 1.14, April 2005 ; Gilles Nadeau, 06/04/2005 ; init: complex z1 = #pixel complex z2 = #pixel + @offset; horizontally offset point complex z3 = #pixel + flip(@offset); vertically offset point complex w1 = @zjk complex w2 = @zjk complex w3 = @zjk complex cz1 = @c1i complex cz2 = @c1i complex cz3 = @c1i complex cw1 = @cjk complex cw2 = @cjk complex cw3 = @cjk complex a = (0.0, 0.0) complex b = (0.0, 0.0) complex c = (0.0, 0.0) complex d = (0.0, 0.0) complex ca1 = (0.0, 0.0) complex ca2 = (0.0, 0.0) complex ca3 = (0.0, 0.0) complex cb1 = (0.0, 0.0) complex cb2 = (0.0, 0.0) complex cb3 = (0.0, 0.0) float z1r = 0.0 float z1i = 0.0 float z1j = 0.0 float z1k = 0.0 float z2r = 0.0 float z2i = 0.0 float z2j = 0.0 float z2k = 0.0 float z3r = 0.0 float z3i = 0.0 float z3j = 0.0 float z3k = 0.0 float c1r = 0.0 float c1i = 0.0 float c1j = 0.0 float c1k = 0.0 float c2r = 0.0 float c2i = 0.0 float c2j = 0.0 float c2k = 0.0 float c3r = 0.0 float c3i = 0.0 float c3j = 0.0 float c3k = 0.0 float rx = 0.0 float ry = 0.0 float rz = 0.0 int done = 2 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 iterexp1 = 0.0 float iterexp2 = 0.0 float iterexp3 = 0.0 ; (yz plane rotation) ry = imag(z1)*cos(#pi*@rotx/180) - real(w1)*sin(#pi*@rotx/180) rz = imag(z1)*sin(#pi*@rotx/180) + real(w1)*cos(#pi*@rotx/180) z1 = real(z1) + ry*1i w1 = rz + imag(w1)*1i ry = imag(z2)*cos(#pi*@rotx/180) - real(w2)*sin(#pi*@rotx/180) rz = imag(z2)*sin(#pi*@rotx/180) + real(w2)*cos(#pi*@rotx/180) z2 = real(z2) + ry*1i w2 = rz + imag(w2)*1i ry = imag(z3)*cos(#pi*@rotx/180) - real(w3)*sin(#pi*@rotx/180) rz = imag(z3)*sin(#pi*@rotx/180) + real(w3)*cos(#pi*@rotx/180) z3 = real(z3) + ry*1i w3 = rz + imag(w3)*1i ry = imag(cz1)*cos(#pi*@rotx/180) - real(cw1)*sin(#pi*@rotx/180) rz = imag(cz1)*sin(#pi*@rotx/180) + real(cw1)*cos(#pi*@rotx/180) cz1 = real(cz1) + ry*1i cw1 = rz + imag(cw1)*1i ry = imag(cz2)*cos(#pi*@rotx/180) - real(cw2)*sin(#pi*@rotx/180) rz = imag(cz2)*sin(#pi*@rotx/180) + real(cw2)*cos(#pi*@rotx/180) cz2 = real(cz2) + ry*1i cw2 = rz + imag(cw2)*1i ry = imag(cz3)*cos(#pi*@rotx/180) - real(cw3)*sin(#pi*@rotx/180) rz = imag(cz3)*sin(#pi*@rotx/180) + real(cw3)*cos(#pi*@rotx/180) cz3 = real(cz3) + ry*1i cw3 = rz + imag(cw3)*1i ; (xz plane rotation) rx = real(w1)*sin(#pi*@roty/180) + real(z1)*cos(#pi*@roty/180) rz = real(w1)*cos(#pi*@roty/180) - real(z1)*sin(#pi*@roty/180) z1 = rx + imag(z1)*1i w1 = rz + imag(w1)*1i rx = real(w2)*sin(#pi*@roty/180) + real(z2)*cos(#pi*@roty/180) rz = real(w2)*cos(#pi*@roty/180) - real(z2)*sin(#pi*@roty/180) z2 = rx + imag(z2)*1i w2 = rz + imag(w2)*1i rx = real(w3)*sin(#pi*@roty/180) + real(z3)*cos(#pi*@roty/180) rz = real(w3)*cos(#pi*@roty/180) - real(z3)*sin(#pi*@roty/180) z3 = rx + imag(z3)*1i w3 = rz + imag(w3)*1i rx = real(cw1)*sin(#pi*@roty/180) + real(cz1)*cos(#pi*@roty/180) rz = real(cw1)*cos(#pi*@roty/180) - real(cz1)*sin(#pi*@roty/180) cz1 = rx + imag(cz1)*1i cw1 = rz + imag(cw1)*1i rx = real(cw2)*sin(#pi*@roty/180) + real(cz2)*cos(#pi*@roty/180) rz = real(cw2)*cos(#pi*@roty/180) - real(cz2)*sin(#pi*@roty/180) cz2 = rx + imag(cz2)*1i cw2 = rz + imag(cw2)*1i rx = real(cw3)*sin(#pi*@roty/180) + real(cz3)*cos(#pi*@roty/180) rz = real(cw3)*cos(#pi*@roty/180) - real(cz3)*sin(#pi*@roty/180) cz3 = rx + imag(cz3)*1i cw3 = rz + imag(cw3)*1i ; (xy plane rotation) rx = real(z1)*cos(#pi*@rotz/180) - imag(z1)*sin(#pi*@rotz/180) ry = real(z1)*sin(#pi*@rotz/180) + imag(z1)*cos(#pi*@rotz/180) z1 = rx + ry*1i rx = real(z2)*cos(#pi*@rotz/180) - imag(z2)*sin(#pi*@rotz/180) ry = real(z2)*sin(#pi*@rotz/180) + imag(z2)*cos(#pi*@rotz/180) z2 = rx + ry*1i rx = real(z3)*cos(#pi*@rotz/180) - imag(z3)*sin(#pi*@rotz/180) ry = real(z3)*sin(#pi*@rotz/180) + imag(z3)*cos(#pi*@rotz/180) z3 = rx + ry*1i rx = real(cz1)*cos(#pi*@rotz/180) - imag(cz1)*sin(#pi*@rotz/180) ry = real(cz1)*sin(#pi*@rotz/180) + imag(cz1)*cos(#pi*@rotz/180) cz1 = rx + ry*1i rx = real(cz2)*cos(#pi*@rotz/180) - imag(cz2)*sin(#pi*@rotz/180) ry = real(cz2)*sin(#pi*@rotz/180) + imag(cz2)*cos(#pi*@rotz/180) cz2 = rx + ry*1i rx = real(cz3)*cos(#pi*@rotz/180) - imag(cz3)*sin(#pi*@rotz/180) ry = real(cz3)*sin(#pi*@rotz/180) + imag(cz3)*cos(#pi*@rotz/180) cz3 = rx + ry*1i if @fourthdim == 3 z1r = real(z1) z1i = imag(z1) z1j = real(w1) z1k = imag(w1) z2r = real(z2) z2i = imag(z2) z2j = real(w2) z2k = imag(w2) z3r = real(z3) z3i = imag(z3) z3j = real(w3) z3k = imag(w3) c1r = real(cz1) c1i = imag(cz1) c1j = real(cw1) c1k = imag(cw1) c2r = real(cz2) c2i = imag(cz2) c2j = real(cw2) c2k = imag(cw2) c3r = real(cz3) c3i = imag(cz3) c3j = real(cw3) c3k = imag(cw3) elseif @fourthdim == 2 z1r = real(z1) z1i = imag(z1) z1j = imag(w1) z1k = real(w1) z2r = real(z2) z2i = imag(z2) z2j = imag(w2) z2k = real(w2) z3r = real(z3) z3i = imag(z3) z3j = imag(w3) z3k = real(w3) c1r = real(cz1) c1i = imag(cz1) c1j = imag(cw1) c1k = real(cw1) c2r = real(cz2) c2i = imag(cz2) c2j = imag(cw2) c2k = real(cw2) c3r = real(cz3) c3i = imag(cz3) c3j = imag(cw3) c3k = real(cw3) elseif @fourthdim == 1 z1r = real(w1) z1i = imag(w1) z1j = real(z1) z1k = imag(z1) z2r = real(w2) z2i = imag(w2) z2j = real(z2) z2k = imag(z2) z3r = real(w3) z3i = imag(w3) z3j = real(z3) z3k = imag(z3) c1r = real(cw1) c1i = imag(cw1) c1j = real(cz1) c1k = imag(cz1) c2r = real(cw2) c2i = imag(cw2) c2j = real(cz2) c2k = imag(cz2) c3r = real(cw3) c3i = imag(cw3) c3j = real(cz3) c3k = imag(cz3) else z1r = imag(w1) z1i = real(w1) z1j = real(z1) z1k = imag(z1) z2r = imag(w2) z2i = real(w2) z2j = real(z2) z2k = imag(z2) z3r = imag(w3) z3i = real(w3) z3j = real(z3) z3k = imag(z3) c1r = imag(cw1) c1i = real(cw1) c1j = real(cz1) c1k = imag(cz1) c2r = imag(cw2) c2i = real(cw2) c2j = real(cz2) c2k = imag(cz2) c3r = imag(cw3) c3i = real(cw3) c3j = real(cz3) c3k = imag(cz3) endif ca1 = c1r - c1k + flip(c1i + c1j) ca2 = c2r - c2k + flip(c2i + c2j) ca3 = c3r - c3k + flip(c3i + c3j) cb1 = c1r + c1k + flip(c1i - c1j) cb2 = c2r + c2k + flip(c2i - c2j) cb3 = c3r + c3k + flip(c3i - c3j) loop: a = z1r - z1k + flip(z1i + z1j) b = z1r + z1k + flip(z1i - z1j) c = ca1 * @fn1(a) d = cb1 * @fn1(b) z1r = (real(c) + real(d)) / 2 z1i = (imag(c) + imag(d)) / 2 z1j = (imag(c) - imag(d)) / 2 z1k = (real(d) - real(c)) / 2 z1 = z1r + flip(z1i) w1 = z1j + flip(z1k) if (@slope == true) a = z2r - z2k + flip(z2i + z2j) b = z2r + z2k + flip(z2i - z2j) c = ca2 * @fn1(a) d = cb2 * @fn1(b) z2r = (real(c) + real(d)) / 2 z2i = (imag(c) + imag(d)) / 2 z2j = (imag(c) - imag(d)) / 2 z2k = (real(d) - real(c)) / 2 a = z3r - z3k + flip(z3i + z3j) b = z3r + z3k + flip(z3i - z3j) c = ca3 * @fn1(a) d = cb3 * @fn1(b) z3r = (real(c) + real(d)) / 2 z3i = (imag(c) + imag(d)) / 2 z3j = (imag(c) - imag(d)) / 2 z3k = (real(d) - real(c)) / 2 z2 = z2r + flip(z2i) z3 = z3r + flip(z3i) w2 = z2j + flip(z2k) w3 = z3j + flip(z3k) IF (@zmode == 5) iterexp1 = iterexp1 + exp(-cabs(z1)) iterexp2 = iterexp2 + exp(-cabs(z2)) iterexp3 = iterexp3 + exp(-cabs(z3)) ENDIF done = done + 1; increment iteration counter IF (@zmode == 0) ; 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 == 1) ; 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 == 2) ; 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 == 3) ; 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 == 4) ; 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 ENDIF IF (@bailout < |z1| + |w1| || \ @everyiter ||\ done == #maxit + 2); done, or every iteration, or last ; determine continuous iteration (height) for each point IF (@zmode >= 0 && @zmode <= 4) ; height based on smallest |z| e1 = s1 * @zscale e2 = s2 * @zscale e3 = s3 * @zscale ELSEIF (@zmode == 5) e1 = iterexp1 * @zscale e2 = iterexp2 * @zscale e3 = iterexp3 * @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 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 else z = z1 endif IF (@bailout < |z1| + |w1|) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope Hypercomplex Lambda-fn" center = (0.0,0.0) magn = 0.7 maxiter = 500 method = multipass periodicity = 0 param version caption = "Version" default = 1.14 visible = false endparam heading caption = "Slope Hypercomplex Lambda-fn" endheading heading caption = "Use Damien's Lighting Coloring" endheading heading caption = "Or Ron's 3D Texturizer Formulas" endheading heading caption = "Most other coloring formulas" endheading heading caption = "can also be used." endheading param fourthdim caption = "Fourth dimension" enum = "z1" "zi" "zj" "zk" default = 3 endparam param c1i caption = "(c1, ci)" default = (-1.045, -0.05) endparam param cjk caption = "(cj, ck)" default = (0.113, 0.05) endparam param zjk caption = "(zj, zk)" default = (0.0, 0.0) endparam param rotx caption="x-rotation" hint="Rotates yz-plane." default=0.0 min=-360.0 max=360.0 endparam param roty caption="y-rotation" hint="Rotates zx-plane." default=0.0 min=-360.0 max=360.0 endparam param rotz caption="z-rotation" hint="Rotates xy-plane." default=0.0 min=-360.0 max=360.0 endparam param bailout caption = "Bailout Value" default = 10000.0 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam func fn1 caption = "First Function" default = sin() endfunc bool param slope caption = "Apply slope?" default = true endparam heading caption = "Slope Parameters" visible = @slope==true endheading param offset caption = "Orbit Separation" default = 0.00000001 hint = "Defines how far apart the simultaneous orbits are. Smaller \ distances will produce more accurate results." visible = @slope==true endparam param zmode caption = "Height Value" default = 5 enum = "smallest |z|" "smallest |real(z)|" \ "smallest |imag(z)|" "smallest summ(z)" "smallest |atan(z)|" \ "smoothed iteration" hint = "Specifies what will be used to construct a height value." visible = @slope==true 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." visible = @slope==true 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." visible = @slope==true 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." visible = @slope==true 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." visible = @slope==true endparam switch: type = "gnd-Slope_Hyper-Mandel-fn" version = @version fourthdim = @fourthdim cjk = @cjk rotx = @rotx roty = @roty rotz = @rotz bailout = @bailout fn1 = @fn1 slope = @slope offset = @offset zmode = @zmode xfer = @xfer zscale = @zscale zscale2 = @zscale2 everyiter = @everyiter } gnd-Slope_Hyper-Mandel-fn { ; based upon the slope (Mandelbrot) ; formula of Damien Jones ; Hypercomplex Mandel-fn formula ; compound with the models of slope formulas from Ron Barnett. ; version 1.14, April 2005 ; Gilles Nadeau, 06/04/2005 ; init: complex cz1 = #pixel complex cz2 = #pixel + @offset; horizontally offset point complex cz3 = #pixel + flip(@offset); vertically offset point complex cw1 = @cjk complex cw2 = @cjk complex cw3 = @cjk complex z1 = (0.0, 0.0) + cz1 complex z2 = (0.0, 0.0) + cz2 complex z3 = (0.0, 0.0) + cz3 complex w1 = (0.0, 0.0) + cw1 complex w2 = (0.0, 0.0) + cw2 complex w3 = (0.0, 0.0) + cw3 complex a = (0.0, 0.0) complex b = (0.0, 0.0) complex c = (0.0, 0.0) complex d = (0.0, 0.0) complex ca1 = (0.0, 0.0) complex ca2 = (0.0, 0.0) complex ca3 = (0.0, 0.0) complex cb1 = (0.0, 0.0) complex cb2 = (0.0, 0.0) complex cb3 = (0.0, 0.0) float z1r = 0.0 float z1i = 0.0 float z1j = 0.0 float z1k = 0.0 float z2r = 0.0 float z2i = 0.0 float z2j = 0.0 float z2k = 0.0 float z3r = 0.0 float z3i = 0.0 float z3j = 0.0 float z3k = 0.0 float c1r = 0.0 float c1i = 0.0 float c1j = 0.0 float c1k = 0.0 float c2r = 0.0 float c2i = 0.0 float c2j = 0.0 float c2k = 0.0 float c3r = 0.0 float c3i = 0.0 float c3j = 0.0 float c3k = 0.0 float rx = 0.0 float ry = 0.0 float rz = 0.0 int done = 2 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 iterexp1 = 0.0 float iterexp2 = 0.0 float iterexp3 = 0.0 ; (yz plane rotation) ry = imag(z1)*cos(#pi*@rotx/180) - real(w1)*sin(#pi*@rotx/180) rz = imag(z1)*sin(#pi*@rotx/180) + real(w1)*cos(#pi*@rotx/180) z1 = real(z1) + ry*1i w1 = rz + imag(w1)*1i ry = imag(z2)*cos(#pi*@rotx/180) - real(w2)*sin(#pi*@rotx/180) rz = imag(z2)*sin(#pi*@rotx/180) + real(w2)*cos(#pi*@rotx/180) z2 = real(z2) + ry*1i w2 = rz + imag(w2)*1i ry = imag(z3)*cos(#pi*@rotx/180) - real(w3)*sin(#pi*@rotx/180) rz = imag(z3)*sin(#pi*@rotx/180) + real(w3)*cos(#pi*@rotx/180) z3 = real(z3) + ry*1i w3 = rz + imag(w3)*1i ry = imag(cz1)*cos(#pi*@rotx/180) - real(cw1)*sin(#pi*@rotx/180) rz = imag(cz1)*sin(#pi*@rotx/180) + real(cw1)*cos(#pi*@rotx/180) cz1 = real(cz1) + ry*1i cw1 = rz + imag(cw1)*1i ry = imag(cz2)*cos(#pi*@rotx/180) - real(cw2)*sin(#pi*@rotx/180) rz = imag(cz2)*sin(#pi*@rotx/180) + real(cw2)*cos(#pi*@rotx/180) cz2 = real(cz2) + ry*1i cw2 = rz + imag(cw2)*1i ry = imag(cz3)*cos(#pi*@rotx/180) - real(cw3)*sin(#pi*@rotx/180) rz = imag(cz3)*sin(#pi*@rotx/180) + real(cw3)*cos(#pi*@rotx/180) cz3 = real(cz3) + ry*1i cw3 = rz + imag(cw3)*1i ; (xz plane rotation) rx = real(w1)*sin(#pi*@roty/180) + real(z1)*cos(#pi*@roty/180) rz = real(w1)*cos(#pi*@roty/180) - real(z1)*sin(#pi*@roty/180) z1 = rx + imag(z1)*1i w1 = rz + imag(w1)*1i rx = real(w2)*sin(#pi*@roty/180) + real(z2)*cos(#pi*@roty/180) rz = real(w2)*cos(#pi*@roty/180) - real(z2)*sin(#pi*@roty/180) z2 = rx + imag(z2)*1i w2 = rz + imag(w2)*1i rx = real(w3)*sin(#pi*@roty/180) + real(z3)*cos(#pi*@roty/180) rz = real(w3)*cos(#pi*@roty/180) - real(z3)*sin(#pi*@roty/180) z3 = rx + imag(z3)*1i w3 = rz + imag(w3)*1i rx = real(cw1)*sin(#pi*@roty/180) + real(cz1)*cos(#pi*@roty/180) rz = real(cw1)*cos(#pi*@roty/180) - real(cz1)*sin(#pi*@roty/180) cz1 = rx + imag(cz1)*1i cw1 = rz + imag(cw1)*1i rx = real(cw2)*sin(#pi*@roty/180) + real(cz2)*cos(#pi*@roty/180) rz = real(cw2)*cos(#pi*@roty/180) - real(cz2)*sin(#pi*@roty/180) cz2 = rx + imag(cz2)*1i cw2 = rz + imag(cw2)*1i rx = real(cw3)*sin(#pi*@roty/180) + real(cz3)*cos(#pi*@roty/180) rz = real(cw3)*cos(#pi*@roty/180) - real(cz3)*sin(#pi*@roty/180) cz3 = rx + imag(cz3)*1i cw3 = rz + imag(cw3)*1i ; (xy plane rotation) rx = real(z1)*cos(#pi*@rotz/180) - imag(z1)*sin(#pi*@rotz/180) ry = real(z1)*sin(#pi*@rotz/180) + imag(z1)*cos(#pi*@rotz/180) z1 = rx + ry*1i rx = real(z2)*cos(#pi*@rotz/180) - imag(z2)*sin(#pi*@rotz/180) ry = real(z2)*sin(#pi*@rotz/180) + imag(z2)*cos(#pi*@rotz/180) z2 = rx + ry*1i rx = real(z3)*cos(#pi*@rotz/180) - imag(z3)*sin(#pi*@rotz/180) ry = real(z3)*sin(#pi*@rotz/180) + imag(z3)*cos(#pi*@rotz/180) z3 = rx + ry*1i rx = real(cz1)*cos(#pi*@rotz/180) - imag(cz1)*sin(#pi*@rotz/180) ry = real(cz1)*sin(#pi*@rotz/180) + imag(cz1)*cos(#pi*@rotz/180) cz1 = rx + ry*1i rx = real(cz2)*cos(#pi*@rotz/180) - imag(cz2)*sin(#pi*@rotz/180) ry = real(cz2)*sin(#pi*@rotz/180) + imag(cz2)*cos(#pi*@rotz/180) cz2 = rx + ry*1i rx = real(cz3)*cos(#pi*@rotz/180) - imag(cz3)*sin(#pi*@rotz/180) ry = real(cz3)*sin(#pi*@rotz/180) + imag(cz3)*cos(#pi*@rotz/180) cz3 = rx + ry*1i if @fourthdim == 3 z1r = real(z1) z1i = imag(z1) z1j = real(w1) z1k = imag(w1) z2r = real(z2) z2i = imag(z2) z2j = real(w2) z2k = imag(w2) z3r = real(z3) z3i = imag(z3) z3j = real(w3) z3k = imag(w3) c1r = real(cz1) c1i = imag(cz1) c1j = real(cw1) c1k = imag(cw1) c2r = real(cz2) c2i = imag(cz2) c2j = real(cw2) c2k = imag(cw2) c3r = real(cz3) c3i = imag(cz3) c3j = real(cw3) c3k = imag(cw3) elseif @fourthdim == 2 z1r = real(z1) z1i = imag(z1) z1j = imag(w1) z1k = real(w1) z2r = real(z2) z2i = imag(z2) z2j = imag(w2) z2k = real(w2) z3r = real(z3) z3i = imag(z3) z3j = imag(w3) z3k = real(w3) c1r = real(cz1) c1i = imag(cz1) c1j = imag(cw1) c1k = real(cw1) c2r = real(cz2) c2i = imag(cz2) c2j = imag(cw2) c2k = real(cw2) c3r = real(cz3) c3i = imag(cz3) c3j = imag(cw3) c3k = real(cw3) elseif @fourthdim == 1 z1r = real(w1) z1i = imag(w1) z1j = real(z1) z1k = imag(z1) z2r = real(w2) z2i = imag(w2) z2j = real(z2) z2k = imag(z2) z3r = real(w3) z3i = imag(w3) z3j = real(z3) z3k = imag(z3) c1r = real(cw1) c1i = imag(cw1) c1j = real(cz1) c1k = imag(cz1) c2r = real(cw2) c2i = imag(cw2) c2j = real(cz2) c2k = imag(cz2) c3r = real(cw3) c3i = imag(cw3) c3j = real(cz3) c3k = imag(cz3) else z1r = imag(w1) z1i = real(w1) z1j = real(z1) z1k = imag(z1) z2r = imag(w2) z2i = real(w2) z2j = real(z2) z2k = imag(z2) z3r = imag(w3) z3i = real(w3) z3j = real(z3) z3k = imag(z3) c1r = imag(cw1) c1i = real(cw1) c1j = real(cz1) c1k = imag(cz1) c2r = imag(cw2) c2i = real(cw2) c2j = real(cz2) c2k = imag(cz2) c3r = imag(cw3) c3i = real(cw3) c3j = real(cz3) c3k = imag(cz3) endif ca1 = c1r - c1k + flip(c1i + c1j) ca2 = c2r - c2k + flip(c2i + c2j) ca3 = c3r - c3k + flip(c3i + c3j) cb1 = c1r + c1k + flip(c1i - c1j) cb2 = c2r + c2k + flip(c2i - c2j) cb3 = c3r + c3k + flip(c3i - c3j) loop: a = z1r - z1k + flip(z1i + z1j) b = z1r + z1k + flip(z1i - z1j) c = ca1 * @fn1(a) d = cb1 * @fn1(b) z1r = (real(c) + real(d)) / 2 z1i = (imag(c) + imag(d)) / 2 z1j = (imag(c) - imag(d)) / 2 z1k = (real(d) - real(c)) / 2 z1 = z1r + flip(z1i) w1 = z1j + flip(z1k) if (@slope == true) a = z2r - z2k + flip(z2i + z2j) b = z2r + z2k + flip(z2i - z2j) c = ca2 * @fn1(a) d = cb2 * @fn1(b) z2r = (real(c) + real(d)) / 2 z2i = (imag(c) + imag(d)) / 2 z2j = (imag(c) - imag(d)) / 2 z2k = (real(d) - real(c)) / 2 a = z3r - z3k + flip(z3i + z3j) b = z3r + z3k + flip(z3i - z3j) c = ca3 * @fn1(a) d = cb3 * @fn1(b) z3r = (real(c) + real(d)) / 2 z3i = (imag(c) + imag(d)) / 2 z3j = (imag(c) - imag(d)) / 2 z3k = (real(d) - real(c)) / 2 z2 = z2r + flip(z2i) z3 = z3r + flip(z3i) w2 = z2j + flip(z2k) w3 = z3j + flip(z3k) IF (@zmode == 5) iterexp1 = iterexp1 + exp(-cabs(z1)) iterexp2 = iterexp2 + exp(-cabs(z2)) iterexp3 = iterexp3 + exp(-cabs(z3)) ENDIF done = done + 1; increment iteration counter IF (@zmode == 0) ; 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 == 1) ; 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 == 2) ; 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 == 3) ; 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 == 4) ; 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 ENDIF IF (@bailout < |z1| + |w1| || \ @everyiter ||\ done == #maxit + 2); done, or every iteration, or last ; determine continuous iteration (height) for each point IF (@zmode >= 0 && @zmode <= 4) ; height based on smallest |z| e1 = s1 * @zscale e2 = s2 * @zscale e3 = s3 * @zscale ELSEIF (@zmode == 5) e1 = iterexp1 * @zscale e2 = iterexp2 * @zscale e3 = iterexp3 * @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 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 else z = z1 endif IF (@bailout < |z1| + |w1|) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope Hypercomplex Mandel-fn" center = (0.0,0.0) magn = 0.7 maxiter = 500 method = multipass periodicity = 0 param version caption = "Version" default = 1.14 visible = false endparam heading caption = "Slope Hypercomplex Mandel-fn" endheading heading caption = "Use Damien's Lighting Coloring" endheading heading caption = "Or Ron's 3D Texturizer Formulas" endheading heading caption = "Most other coloring formulas" endheading heading caption = "can also be used." endheading param fourthdim caption = "Fourth dimension" enum = "z1" "zi" "zj" "zk" default = 3 endparam param cjk caption = "(cj, ck)" default = (0.0, 0.0) endparam param rotx caption="x-rotation" hint="Rotates yz-plane." default=0.0 min=-360.0 max=360.0 endparam param roty caption="y-rotation" hint="Rotates zx-plane." default=0.0 min=-360.0 max=360.0 endparam param rotz caption="z-rotation" hint="Rotates xy-plane." default=0.0 min=-360.0 max=360.0 endparam param bailout caption = "Bailout Value" default = 10000.0 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam func fn1 caption = "First Function" default = sin() endfunc bool param slope caption = "Apply slope?" default = true endparam heading caption = "Slope Parameters" visible = @slope==true endheading param offset caption = "Orbit Separation" default = 0.00000001 hint = "Defines how far apart the simultaneous orbits are. Smaller \ distances will produce more accurate results." visible = @slope==true endparam param zmode caption = "Height Value" default = 5 enum = "smallest |z|" "smallest |real(z)|" \ "smallest |imag(z)|" "smallest summ(z)" "smallest |atan(z)|" \ "smoothed iteration" hint = "Specifies what will be used to construct a height value." visible = @slope==true 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." visible = @slope==true 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." visible = @slope==true 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." visible = @slope==true 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." visible = @slope==true endparam switch: type = "gnd-Slope_Hyper-Lambda-fn" version = @version fourthdim = @fourthdim c1i = #pixel cjk = @cjk rotx = @rotx roty = @roty rotz = @rotz bailout = @bailout fn1 = @fn1 slope = @slope offset = @offset zmode = @zmode xfer = @xfer zscale = @zscale zscale2 = @zscale2 everyiter = @everyiter } gnd-hypermandelfn { ; Gilles Nadeau, April, 2005 ; init: complex z = (0.0, 0.0) + #pixel complex w = (0.0, 0.0) + @cjk complex cz = #pixel complex cw = @cjk complex a = (0.0, 0.0) complex b = (0.0, 0.0) complex c = (0.0, 0.0) complex d = (0.0, 0.0) complex ca = (0.0, 0.0) complex cb = (0.0, 0.0) float z1 = 0.0 float zi = 0.0 float zj = 0.0 float zk = 0.0 float c1 = 0.0 float ci = 0.0 float cj = 0.0 float ck = 0.0 float rx = 0.0 float ry = 0.0 float rz = 0.0 ; (yz plane rotation) ry = imag(z)*cos(#pi*@rotx/180) - real(w)*sin(#pi*@rotx/180) rz = imag(z)*sin(#pi*@rotx/180) + real(w)*cos(#pi*@rotx/180) z = real(z) + ry*1i w = rz + imag(w)*1i ry = imag(cz)*cos(#pi*@rotx/180) - real(cw)*sin(#pi*@rotx/180) rz = imag(cz)*sin(#pi*@rotx/180) + real(cw)*cos(#pi*@rotx/180) cz = real(cz) + ry*1i cw = rz + imag(cw)*1i ; (xz plane rotation) rx = real(w)*sin(#pi*@roty/180) + real(z)*cos(#pi*@roty/180) rz = real(w)*cos(#pi*@roty/180) - real(z)*sin(#pi*@roty/180) z = rx + imag(z)*1i w = rz + imag(w)*1i rx = real(cw)*sin(#pi*@roty/180) + real(cz)*cos(#pi*@roty/180) rz = real(cw)*cos(#pi*@roty/180) - real(cz)*sin(#pi*@roty/180) cz = rx + imag(cz)*1i cw = rz + imag(cw)*1i ; (xy plane rotation) rx = real(z)*cos(#pi*@rotz/180) - imag(z)*sin(#pi*@rotz/180) ry = real(z)*sin(#pi*@rotz/180) + imag(z)*cos(#pi*@rotz/180) z = rx + ry*1i rx = real(cz)*cos(#pi*@rotz/180) - imag(cz)*sin(#pi*@rotz/180) ry = real(cz)*sin(#pi*@rotz/180) + imag(cz)*cos(#pi*@rotz/180) cz = rx + ry*1i if @fourthdim == 3 z1 = real(z) zi = imag(z) zj = real(w) zk = imag(w) c1 = real(cz) ci = imag(cz) cj = real(cw) ck = imag(cw) elseif @fourthdim == 2 z1 = real(z) zi = imag(z) zj = imag(w) zk = real(w) c1 = real(cz) ci = imag(cz) cj = imag(cw) ck = real(cw) elseif @fourthdim == 1 z1 = real(w) zi = imag(w) zj = real(z) zk = imag(z) c1 = real(cw) ci = imag(cw) cj = real(cz) ck = imag(cz) else z1 = imag(w) zi = real(w) zj = real(z) zk = imag(z) c1 = imag(cw) ci = real(cw) cj = real(cz) ck = imag(cz) endif ca = c1 - ck + flip(ci + cj) cb = c1 + ck + flip(ci - cj) loop: a = z1 - zk + flip(zi + zj) b = z1 + zk + flip(zi - zj) c = ca * @fn1(a) d = cb * @fn1(b) z1 = (real(c) + real(d)) / 2 zi = (imag(c) + imag(d)) / 2 zj = (imag(c) - imag(d)) / 2 zk = (real(d) - real(c)) / 2 z = z1 + flip(zi) w = zj + flip(zk) bailout: |z| + |w| <= @bailout default: title = "Mandel-fn (hypercomplex)" maxiter = 500 periodicity = 0 method = multipass float param version default = 1.13 visible = false endparam param fourthdim caption = "Fourth dimension" enum = "z1" "zi" "zj" "zk" default = 3 endparam param cjk caption = "(cj, ck)" default = (0.0, 0.0) endparam param rotx caption="x-rotation" hint="Rotates yz-plane." default=0.0 min=-360.0 max=360.0 endparam param roty caption="y-rotation" hint="Rotates zx-plane." default=0.0 min=-360.0 max=360.0 endparam param rotz caption="z-rotation" hint="Rotates xy-plane." default=0.0 min=-360.0 max=360.0 endparam param bailout caption = "Bailout value" default = 64.0 min = 1 endparam func fn1 caption = "First Function" default = sin() endfunc switch: type = "gnd-hyperlambdafn" version = @version fourthdim = @fourthdim c1i = #pixel cjk = @cjk rotx = @rotx roty = @roty rotz = @rotz bailout = @bailout fn1 = @fn1 } gnd-hyperlambdafn { ; Gilles Nadeau, April, 2005 ; init: complex z = #pixel complex w = @zjk complex cz = @c1i complex cw = @cjk complex a = (0.0, 0.0) complex b = (0.0, 0.0) complex c = (0.0, 0.0) complex d = (0.0, 0.0) complex ca = (0.0, 0.0) complex cb = (0.0, 0.0) float z1 = 0.0 float zi = 0.0 float zj = 0.0 float zk = 0.0 float c1 = 0.0 float ci = 0.0 float cj = 0.0 float ck = 0.0 float rx = 0.0 float ry = 0.0 float rz = 0.0 ; (yz plane rotation) ry = imag(z)*cos(#pi*@rotx/180) - real(w)*sin(#pi*@rotx/180) rz = imag(z)*sin(#pi*@rotx/180) + real(w)*cos(#pi*@rotx/180) z = real(z) + ry*1i w = rz + imag(w)*1i ry = imag(cz)*cos(#pi*@rotx/180) - real(cw)*sin(#pi*@rotx/180) rz = imag(cz)*sin(#pi*@rotx/180) + real(cw)*cos(#pi*@rotx/180) cz = real(cz) + ry*1i cw = rz + imag(cw)*1i ; (xz plane rotation) rx = real(w)*sin(#pi*@roty/180) + real(z)*cos(#pi*@roty/180) rz = real(w)*cos(#pi*@roty/180) - real(z)*sin(#pi*@roty/180) z = rx + imag(z)*1i w = rz + imag(w)*1i rx = real(cw)*sin(#pi*@roty/180) + real(cz)*cos(#pi*@roty/180) rz = real(cw)*cos(#pi*@roty/180) - real(cz)*sin(#pi*@roty/180) cz = rx + imag(cz)*1i cw = rz + imag(cw)*1i ; (xy plane rotation) rx = real(z)*cos(#pi*@rotz/180) - imag(z)*sin(#pi*@rotz/180) ry = real(z)*sin(#pi*@rotz/180) + imag(z)*cos(#pi*@rotz/180) z = rx + ry*1i rx = real(cz)*cos(#pi*@rotz/180) - imag(cz)*sin(#pi*@rotz/180) ry = real(cz)*sin(#pi*@rotz/180) + imag(cz)*cos(#pi*@rotz/180) cz = rx + ry*1i if @fourthdim == 3 z1 = real(z) zi = imag(z) zj = real(w) zk = imag(w) c1 = real(cz) ci = imag(cz) cj = real(cw) ck = imag(cw) elseif @fourthdim == 2 z1 = real(z) zi = imag(z) zj = imag(w) zk = real(w) c1 = real(cz) ci = imag(cz) cj = imag(cw) ck = real(cw) elseif @fourthdim == 1 z1 = real(w) zi = imag(w) zj = real(z) zk = imag(z) c1 = real(cw) ci = imag(cw) cj = real(cz) ck = imag(cz) else z1 = imag(w) zi = real(w) zj = real(z) zk = imag(z) c1 = imag(cw) ci = real(cw) cj = real(cz) ck = imag(cz) endif ca = c1 - ck + flip(ci + cj) cb = c1 + ck + flip(ci - cj) loop: a = z1 - zk + flip(zi + zj) b = z1 + zk + flip(zi - zj) c = ca * @fn1(a) d = cb * @fn1(b) z1 = (real(c) + real(d)) / 2 zi = (imag(c) + imag(d)) / 2 zj = (imag(c) - imag(d)) / 2 zk = (real(d) - real(c)) / 2 z = z1 + flip(zi) w = zj + flip(zk) bailout: |z| + |w| <= @bailout default: title = "Lambda-fn (hypercomplex)" maxiter = 500 periodicity = 0 method = multipass float param version default = 1.13 visible = false endparam param fourthdim caption = "Fourth dimension" enum = "z1" "zi" "zj" "zk" default = 3 endparam param c1i caption = "(c1, ci)" default = (-1.045, -0.05) endparam param cjk caption = "(cj, ck)" default = (0.113, 0.05) endparam param zjk caption = "(zj, zk)" default = (0.0, 0.0) endparam param rotx caption="x-rotation" hint="Rotates yz-plane." default=0.0 min=-360.0 max=360.0 endparam param roty caption="y-rotation" hint="Rotates zx-plane." default=0.0 min=-360.0 max=360.0 endparam param rotz caption="z-rotation" hint="Rotates xy-plane." default=0.0 min=-360.0 max=360.0 endparam param bailout caption = "Bailout value" default = 64.0 min = 1 endparam func fn1 caption = "First Function" default = sin() endfunc switch: type = "gnd-hypermandelfn" version = @version fourthdim = @fourthdim cjk = @cjk rotx = @rotx roty = @roty rotz = @rotz bailout = @bailout fn1 = @fn1 } gnd-Slope_HypercomplexNewton { ; based upon the slope (Julia) ; formula of Damien Jones ; Hypercomplex Newton formula ; compound with the models of slope formulas from Ron Barnett. ; 4-dimensional F.B.M. added October, 2005 ; based on original code from Damien M. Jones. ; version 1.26, March 2005 ; Gilles Nadeau, 18/03/2005 ; init: complex z1 = #pixel complex z2 = #pixel + @offset; horizontally offset point complex z3 = #pixel + flip(@offset); vertically offset point complex w1 = @ct complex w2 = @ct complex w3 = @ct complex cz1 = @c1i complex cz2 = @c1i complex cz3 = @c1i complex cw1 = @cjk complex cw2 = @cjk complex cw3 = @cjk complex nz1 = z1 complex nz2 = z2 complex nz3 = z3 complex nw1 = w1 complex nw2 = w2 complex nw3 = w3 complex z1old = z1 complex z2old = z2 complex z3old = z3 complex w1old = w1 complex a = (0.0, 0.0) complex b = (0.0, 0.0) complex ca = (0.0, 0.0) complex cb = (0.0, 0.0) complex a1 = (0.0, 0.0) complex a2 = (0.0, 0.0) complex a3 = (0.0, 0.0) complex b1 = (0.0, 0.0) complex b2 = (0.0, 0.0) complex b3 = (0.0, 0.0) complex ha = (0.0, 0.0) complex hb = (0.0, 0.0) complex ca1 = (0.0, 0.0) complex ca2 = (0.0, 0.0) complex ca3 = (0.0, 0.0) complex cb1 = (0.0, 0.0) complex cb2 = (0.0, 0.0) complex cb3 = (0.0, 0.0) float rx = 0.0 float ry = 0.0 float rz = 0.0 int done = 2 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 iterexp1 = 0.0 float iterexp2 = 0.0 float iterexp3 = 0.0 complex c = @distcenter IF (@centermove) c = #center ENDIF complex r1 = (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 ; (yz plane rotation) ry = imag(z1)*cos(#pi*@rotx/180) - real(w1)*sin(#pi*@rotx/180) rz = imag(z1)*sin(#pi*@rotx/180) + real(w1)*cos(#pi*@rotx/180) z1 = real(z1) + ry*1i w1 = rz + imag(w1)*1i ry = imag(z2)*cos(#pi*@rotx/180) - real(w2)*sin(#pi*@rotx/180) rz = imag(z2)*sin(#pi*@rotx/180) + real(w2)*cos(#pi*@rotx/180) z2 = real(z2) + ry*1i w2 = rz + imag(w2)*1i ry = imag(z3)*cos(#pi*@rotx/180) - real(w3)*sin(#pi*@rotx/180) rz = imag(z3)*sin(#pi*@rotx/180) + real(w3)*cos(#pi*@rotx/180) z3 = real(z3) + ry*1i w3 = rz + imag(w3)*1i ry = imag(cz1)*cos(#pi*@rotx/180) - real(cw1)*sin(#pi*@rotx/180) rz = imag(cz1)*sin(#pi*@rotx/180) + real(cw1)*cos(#pi*@rotx/180) cz1 = real(cz1) + ry*1i cw1 = rz + imag(cw1)*1i ry = imag(cz2)*cos(#pi*@rotx/180) - real(cw2)*sin(#pi*@rotx/180) rz = imag(cz2)*sin(#pi*@rotx/180) + real(cw2)*cos(#pi*@rotx/180) cz2 = real(cz2) + ry*1i cw2 = rz + imag(cw2)*1i ry = imag(cz3)*cos(#pi*@rotx/180) - real(cw3)*sin(#pi*@rotx/180) rz = imag(cz3)*sin(#pi*@rotx/180) + real(cw3)*cos(#pi*@rotx/180) cz3 = real(cz3) + ry*1i cw3 = rz + imag(cw3)*1i ; (xz plane rotation) rx = real(w1)*sin(#pi*@roty/180) + real(z1)*cos(#pi*@roty/180) rz = real(w1)*cos(#pi*@roty/180) - real(z1)*sin(#pi*@roty/180) z1 = rx + imag(z1)*1i w1 = rz + imag(w1)*1i rx = real(w2)*sin(#pi*@roty/180) + real(z2)*cos(#pi*@roty/180) rz = real(w2)*cos(#pi*@roty/180) - real(z2)*sin(#pi*@roty/180) z2 = rx + imag(z2)*1i w2 = rz + imag(w2)*1i rx = real(w3)*sin(#pi*@roty/180) + real(z3)*cos(#pi*@roty/180) rz = real(w3)*cos(#pi*@roty/180) - real(z3)*sin(#pi*@roty/180) z3 = rx + imag(z3)*1i w3 = rz + imag(w3)*1i rx = real(cw1)*sin(#pi*@roty/180) + real(cz1)*cos(#pi*@roty/180) rz = real(cw1)*cos(#pi*@roty/180) - real(cz1)*sin(#pi*@roty/180) cz1 = rx + imag(cz1)*1i cw1 = rz + imag(cw1)*1i rx = real(cw2)*sin(#pi*@roty/180) + real(cz2)*cos(#pi*@roty/180) rz = real(cw2)*cos(#pi*@roty/180) - real(cz2)*sin(#pi*@roty/180) cz2 = rx + imag(cz2)*1i cw2 = rz + imag(cw2)*1i rx = real(cw3)*sin(#pi*@roty/180) + real(cz3)*cos(#pi*@roty/180) rz = real(cw3)*cos(#pi*@roty/180) - real(cz3)*sin(#pi*@roty/180) cz3 = rx + imag(cz3)*1i cw3 = rz + imag(cw3)*1i ; (xy plane rotation) rx = real(z1)*cos(#pi*@rotz/180) - imag(z1)*sin(#pi*@rotz/180) ry = real(z1)*sin(#pi*@rotz/180) + imag(z1)*cos(#pi*@rotz/180) z1 = rx + ry*1i rx = real(z2)*cos(#pi*@rotz/180) - imag(z2)*sin(#pi*@rotz/180) ry = real(z2)*sin(#pi*@rotz/180) + imag(z2)*cos(#pi*@rotz/180) z2 = rx + ry*1i rx = real(z3)*cos(#pi*@rotz/180) - imag(z3)*sin(#pi*@rotz/180) ry = real(z3)*sin(#pi*@rotz/180) + imag(z3)*cos(#pi*@rotz/180) z3 = rx + ry*1i rx = real(cz1)*cos(#pi*@rotz/180) - imag(cz1)*sin(#pi*@rotz/180) ry = real(cz1)*sin(#pi*@rotz/180) + imag(cz1)*cos(#pi*@rotz/180) cz1 = rx + ry*1i rx = real(cz2)*cos(#pi*@rotz/180) - imag(cz2)*sin(#pi*@rotz/180) ry = real(cz2)*sin(#pi*@rotz/180) + imag(cz2)*cos(#pi*@rotz/180) cz2 = rx + ry*1i rx = real(cz3)*cos(#pi*@rotz/180) - imag(cz3)*sin(#pi*@rotz/180) ry = real(cz3)*sin(#pi*@rotz/180) + imag(cz3)*cos(#pi*@rotz/180) cz3 = rx + ry*1i if @fourthdim == 3 a1 = z1 a2 = z2 a3 = z3 b1 = w1 b2 = w2 b3 = w3 ca1 = cz1 ca2 = cz2 ca3 = cz3 cb1 = cw1 cb2 = cw2 cb3 = cw3 elseif @fourthdim == 2 a1 = z1 a2 = z2 a3 = z3 b1 = flip(w1) b2 = flip(w2) b3 = flip(w3) ca1 = cz1 ca2 = cz2 ca3 = cz3 cb1 = flip(cw1) cb2 = flip(cw2) cb3 = flip(cw3) elseif @fourthdim == 1 a1 = w1 a2 = w2 a3 = w3 b1 = z1 b2 = z2 b3 = z3 ca1 = cw1 ca2 = cw2 ca3 = cw3 cb1 = cz1 cb2 = cz2 cb3 = cz3 else a1 = flip(w1) a2 = flip(w2) a3 = flip(w3) b1 = z1 b2 = z2 b3 = z3 ca1 = flip(cw1) ca2 = flip(cw2) ca3 = flip(cw3) cb1 = cz1 cb2 = cz2 cb3 = cz3 endif loop: if (@fBm) 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 endif z1old = a1 z2old = a2 z3old = a3 w1old = b1 a = a1 + b1*1i b = a1 - b1*1i ca = ca1 + cb1*1i cb = ca1 - cb1*1i if @method == 0 ha = ((@p - 1) * (a ^ @p + ca) + @r) / (@p * a ^ (@p - 1) + ca) hb = ((@p - 1) * (b ^ @p + cb) + @r) / (@p * b ^ (@p - 1) + cb) else ha = ((@p - 1) * (a ^ @p) + @r + ca) / (@p * a ^ (@p - 1) + ca) hb = ((@p - 1) * (b ^ @p) + @r + cb) / (@p * b ^ (@p - 1) + cb) endif a1 = (ha + hb) / 2 b1 = (hb - ha) / 2*1i if @fourthdim == 3 z1 = a1 w1 = b1 elseif @fourthdim == 2 z1 = a1 w1 = flip(b1) elseif @fourthdim == 1 z1 = b1 w1 = a1 else z1 = b1 w1 = flip(a1) endif if (@fBm == true) IF (@noiseskip == 0.0 || noise); adding noise this iteration complex pa = ha * @scale * r1 + @noffset complex pb = hb * @scale * r1 + @noffset float suma = 0.0 float sumb = 0.0 float freq = 1.0 complex va = (0,0) complex vb = (0,0) int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxa = floor(real(pa)) float fya = floor(imag(pa)) float bx0a = fxa % 256 float by0a = fya % 256 IF (bx0a < 0) bx0a = bx0a + 256 ENDIF IF (by0a < 0) by0a = by0a + 256 ENDIF float bx1a = (bx0a + 1) % 256 float by1a = (by0a + 1) % 256 float rx0a = real(pa) - fxa float ry0a = imag(pa) - fya float rx1a = rx0a - 1 float ry1a = ry0a - 1 float fxb = floor(real(pb)) float fyb = floor(imag(pb)) float bx0b = fxb % 256 float by0b = fyb % 256 IF (bx0b < 0) bx0b = bx0b + 256 ENDIF IF (by0b < 0) by0b = by0b + 256 ENDIF float bx1b = (bx0b + 1) % 256 float by1b = (by0b + 1) % 256 float rx0b = real(pb) - fxb float ry0b = imag(pb) - fyb float rx1b = rx0b - 1 float ry1b = ry0b - 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 b00a = (bx0a^@npower % 65536 + by0a)^@npower % 65536 float b10a = (bx1a^@npower % 65536 + by0a)^@npower % 65536 float b01a = (bx0a^@npower % 65536 + by1a)^@npower % 65536 float b11a = (bx1a^@npower % 65536 + by1a)^@npower % 65536 float b00b = (bx0b^@npower % 65536 + by0b)^@npower % 65536 float b10b = (bx1b^@npower % 65536 + by0b)^@npower % 65536 float b01b = (bx0b^@npower % 65536 + by1b)^@npower % 65536 float b11b = (bx1b^@npower % 65536 + by1b)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0a = (b00a)^@npower*0.25 % 512 - 256 float g_b10_0a = (b10a)^@npower*0.25 % 512 - 256 float g_b01_0a = (b01a)^@npower*0.25 % 512 - 256 float g_b11_0a = (b11a)^@npower*0.25 % 512 - 256 float g_b00_1a = (b00a+1)^@npower*0.25 % 512 - 256 float g_b10_1a = (b10a+1)^@npower*0.25 % 512 - 256 float g_b01_1a = (b01a+1)^@npower*0.25 % 512 - 256 float g_b11_1a = (b11a+1)^@npower*0.25 % 512 - 256 float g_b00_0b = (b00b)^@npower*0.25 % 512 - 256 float g_b10_0b = (b10b)^@npower*0.25 % 512 - 256 float g_b01_0b = (b01b)^@npower*0.25 % 512 - 256 float g_b11_0b = (b11b)^@npower*0.25 % 512 - 256 float g_b00_1b = (b00b+1)^@npower*0.25 % 512 - 256 float g_b10_1b = (b10b+1)^@npower*0.25 % 512 - 256 float g_b01_1b = (b01b+1)^@npower*0.25 % 512 - 256 float g_b11_1b = (b11b+1)^@npower*0.25 % 512 - 256 ; normalize each vector float da = 0.0 float db = 0.0; da = 1 / sqrt(sqr(g_b00_0a) + sqr(g_b00_1a)) g_b00_0a = g_b00_0a * da g_b00_1a = g_b00_1a * da da = 1 / sqrt(sqr(g_b10_0a) + sqr(g_b10_1a)) g_b10_0a = g_b10_0a * da g_b10_1a = g_b10_1a * da da = 1 / sqrt(sqr(g_b01_0a) + sqr(g_b01_1a)) g_b01_0a = g_b01_0a * da g_b01_1a = g_b01_1a * da da = 1 / sqrt(sqr(g_b11_0a) + sqr(g_b11_1a)) g_b11_0a = g_b11_0a * da g_b11_1a = g_b11_1a * da db = 1 / sqrt(sqr(g_b00_0b) + sqr(g_b00_1b)) g_b00_0b = g_b00_0b * db g_b00_1b = g_b00_1b * db db = 1 / sqrt(sqr(g_b10_0b) + sqr(g_b10_1b)) g_b10_0b = g_b10_0b * db g_b10_1b = g_b10_1b * db db = 1 / sqrt(sqr(g_b01_0b) + sqr(g_b01_1b)) g_b01_0b = g_b01_0b * db g_b01_1b = g_b01_1b * db db = 1 / sqrt(sqr(g_b11_0b) + sqr(g_b11_1b)) g_b11_0b = g_b11_0b * db g_b11_1b = g_b11_1b * db ; produce colors for each corner float u1a = rx0a * g_b00_0a + ry0a * g_b00_1a float v1a = rx1a * g_b10_0a + ry0a * g_b10_1a float u2a = rx0a * g_b01_0a + ry1a * g_b01_1a float v2a = rx1a * g_b11_0a + ry1a * g_b11_1a float u1b = rx0b * g_b00_0b + ry0b * g_b00_1b float v1b = rx1b * g_b10_0b + ry0b * g_b10_1b float u2b = rx0b * g_b01_0b + ry1b * g_b01_1b float v2b = rx1b * g_b11_0b + ry1b * g_b11_1b ; interpolate between corners using ; bilinear filtering float sxa = sqr(rx0a) * (3 - rx0a*2) float sya = sqr(ry0a) * (3 - ry0a*2) float sxb = sqr(rx0b) * (3 - rx0b*2) float syb = sqr(ry0b) * (3 - ry0b*2) float aa = u1a + sxa*(v1a-u1a) float ba = u2a + sxa*(v2a-u2a) float ab = u1b + sxb*(v1b-u1b) float bb = u2b + sxb*(v2b-u2b) suma = suma + real(@nfn1(aa + sya*(ba-aa)))*freq sumb = sumb + real(@nfn1(ab + syb*(bb-ab)))*freq freq = freq * @step pa = pa * r2 / @step pb = pb * r2 / @step i = i - 1 ENDWHILE IF (@style == 0); radial distortion va = (ha-c)/cabs(ha-c) * r3; use vector based on angle to distortion center vb = (hb-c)/cabs(hb-c) * r3 ELSEIF (@style == 1); linear distortion va = r3; just use rotation vector vb = r3 ENDIF ha = ha + va * (suma + @coloroffset) * 0.5 * @distortion hb = hb + vb * (sumb + @coloroffset) * 0.5 * @distortion nz1 = (ha + hb) / 2 nw1 = (hb - ha) / 2*1i if @fourthdim == 3 z1 = nz1 w1 = nw1 elseif @fourthdim == 2 z1 = nz1 w1 = flip(nw1) elseif @fourthdim == 1 z1 = nw1 w1 = nz1 else z1 = nw1 w1 = flip(nz1) endif ENDIF endif if (@slope == true) a = a2 + b2*1i b = a2 - b2*1i ca = ca2 + cb2*1i cb = ca2 - cb2*1i if @method == 0 ha = ((@p - 1) * (a ^ @p + ca) + @r) / (@p * a ^ (@p - 1) + ca) hb = ((@p - 1) * (b ^ @p + cb) + @r) / (@p * b ^ (@p - 1) + cb) else ha = ((@p - 1) * (a ^ @p) + @r + ca) / (@p * a ^ (@p - 1) + ca) hb = ((@p - 1) * (b ^ @p) + @r + cb) / (@p * b ^ (@p - 1) + cb) endif a2 = (ha + hb) / 2 b2 = (hb - ha) / 2*1i if @fourthdim == 3 z2 = a2 w2 = b2 elseif @fourthdim == 2 z2 = a2 w2 = flip(b2) elseif @fourthdim == 1 z2 = b2 w2 = a2 else z2 = b2 w2 = flip(a2) endif if (@fBm == true) IF (@noiseskip == 0.0 || noise); adding noise this iteration complex pa = ha * @scale * r1 + @noffset complex pb = hb * @scale * r1 + @noffset float suma = 0.0 float sumb = 0.0 float freq = 1.0 complex va = (0,0) complex vb = (0,0) int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxa = floor(real(pa)) float fya = floor(imag(pa)) float bx0a = fxa % 256 float by0a = fya % 256 IF (bx0a < 0) bx0a = bx0a + 256 ENDIF IF (by0a < 0) by0a = by0a + 256 ENDIF float bx1a = (bx0a + 1) % 256 float by1a = (by0a + 1) % 256 float rx0a = real(pa) - fxa float ry0a = imag(pa) - fya float rx1a = rx0a - 1 float ry1a = ry0a - 1 float fxb = floor(real(pb)) float fyb = floor(imag(pb)) float bx0b = fxb % 256 float by0b = fyb % 256 IF (bx0b < 0) bx0b = bx0b + 256 ENDIF IF (by0b < 0) by0b = by0b + 256 ENDIF float bx1b = (bx0b + 1) % 256 float by1b = (by0b + 1) % 256 float rx0b = real(pb) - fxb float ry0b = imag(pb) - fyb float rx1b = rx0b - 1 float ry1b = ry0b - 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 b00a = (bx0a^@npower % 65536 + by0a)^@npower % 65536 float b10a = (bx1a^@npower % 65536 + by0a)^@npower % 65536 float b01a = (bx0a^@npower % 65536 + by1a)^@npower % 65536 float b11a = (bx1a^@npower % 65536 + by1a)^@npower % 65536 float b00b = (bx0b^@npower % 65536 + by0b)^@npower % 65536 float b10b = (bx1b^@npower % 65536 + by0b)^@npower % 65536 float b01b = (bx0b^@npower % 65536 + by1b)^@npower % 65536 float b11b = (bx1b^@npower % 65536 + by1b)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0a = (b00a)^@npower*0.25 % 512 - 256 float g_b10_0a = (b10a)^@npower*0.25 % 512 - 256 float g_b01_0a = (b01a)^@npower*0.25 % 512 - 256 float g_b11_0a = (b11a)^@npower*0.25 % 512 - 256 float g_b00_1a = (b00a+1)^@npower*0.25 % 512 - 256 float g_b10_1a = (b10a+1)^@npower*0.25 % 512 - 256 float g_b01_1a = (b01a+1)^@npower*0.25 % 512 - 256 float g_b11_1a = (b11a+1)^@npower*0.25 % 512 - 256 float g_b00_0b = (b00b)^@npower*0.25 % 512 - 256 float g_b10_0b = (b10b)^@npower*0.25 % 512 - 256 float g_b01_0b = (b01b)^@npower*0.25 % 512 - 256 float g_b11_0b = (b11b)^@npower*0.25 % 512 - 256 float g_b00_1b = (b00b+1)^@npower*0.25 % 512 - 256 float g_b10_1b = (b10b+1)^@npower*0.25 % 512 - 256 float g_b01_1b = (b01b+1)^@npower*0.25 % 512 - 256 float g_b11_1b = (b11b+1)^@npower*0.25 % 512 - 256 ; normalize each vector float da = 0.0 float db = 0.0; da = 1 / sqrt(sqr(g_b00_0a) + sqr(g_b00_1a)) g_b00_0a = g_b00_0a * da g_b00_1a = g_b00_1a * da da = 1 / sqrt(sqr(g_b10_0a) + sqr(g_b10_1a)) g_b10_0a = g_b10_0a * da g_b10_1a = g_b10_1a * da da = 1 / sqrt(sqr(g_b01_0a) + sqr(g_b01_1a)) g_b01_0a = g_b01_0a * da g_b01_1a = g_b01_1a * da da = 1 / sqrt(sqr(g_b11_0a) + sqr(g_b11_1a)) g_b11_0a = g_b11_0a * da g_b11_1a = g_b11_1a * da db = 1 / sqrt(sqr(g_b00_0b) + sqr(g_b00_1b)) g_b00_0b = g_b00_0b * db g_b00_1b = g_b00_1b * db db = 1 / sqrt(sqr(g_b10_0b) + sqr(g_b10_1b)) g_b10_0b = g_b10_0b * db g_b10_1b = g_b10_1b * db db = 1 / sqrt(sqr(g_b01_0b) + sqr(g_b01_1b)) g_b01_0b = g_b01_0b * db g_b01_1b = g_b01_1b * db db = 1 / sqrt(sqr(g_b11_0b) + sqr(g_b11_1b)) g_b11_0b = g_b11_0b * db g_b11_1b = g_b11_1b * db ; produce colors for each corner float u1a = rx0a * g_b00_0a + ry0a * g_b00_1a float v1a = rx1a * g_b10_0a + ry0a * g_b10_1a float u2a = rx0a * g_b01_0a + ry1a * g_b01_1a float v2a = rx1a * g_b11_0a + ry1a * g_b11_1a float u1b = rx0b * g_b00_0b + ry0b * g_b00_1b float v1b = rx1b * g_b10_0b + ry0b * g_b10_1b float u2b = rx0b * g_b01_0b + ry1b * g_b01_1b float v2b = rx1b * g_b11_0b + ry1b * g_b11_1b ; interpolate between corners using ; bilinear filtering float sxa = sqr(rx0a) * (3 - rx0a*2) float sya = sqr(ry0a) * (3 - ry0a*2) float sxb = sqr(rx0b) * (3 - rx0b*2) float syb = sqr(ry0b) * (3 - ry0b*2) float aa = u1a + sxa*(v1a-u1a) float ba = u2a + sxa*(v2a-u2a) float ab = u1b + sxb*(v1b-u1b) float bb = u2b + sxb*(v2b-u2b) suma = suma + real(@nfn1(aa + sya*(ba-aa)))*freq sumb = sumb + real(@nfn1(ab + syb*(bb-ab)))*freq freq = freq * @step pa = pa * r2 / @step pb = pb * r2 / @step i = i - 1 ENDWHILE IF (@style == 0); radial distortion va = (ha-c)/cabs(ha-c) * r3; use vector based on angle to distortion center vb = (hb-c)/cabs(hb-c) * r3 ELSEIF (@style == 1); linear distortion va = r3; just use rotation vector vb = r3 ENDIF ha = ha + va * (suma + @coloroffset) * 0.5 * @distortion hb = hb + vb * (sumb + @coloroffset) * 0.5 * @distortion nz2 = (ha + hb) / 2 nw2 = (hb - ha) / 2*1i if @fourthdim == 3 z2 = nz2 w2 = nw2 elseif @fourthdim == 2 z2 = nz2 w2 = flip(nw2) elseif @fourthdim == 1 z2 = nw2 w2 = nz2 else z2 = nw2 w2 = flip(nz2) endif ENDIF endif a = a3 + b3*1i b = a3 - b3*1i ca = ca3 + cb3*1i cb = ca3 - cb3*1i if @method == 0 ha = ((@p - 1) * (a ^ @p + ca) + @r) / (@p * a ^ (@p - 1) + ca) hb = ((@p - 1) * (b ^ @p + cb) + @r) / (@p * b ^ (@p - 1) + cb) else ha = ((@p - 1) * (a ^ @p) + @r + ca) / (@p * a ^ (@p - 1) + ca) hb = ((@p - 1) * (b ^ @p) + @r + cb) / (@p * b ^ (@p - 1) + cb) endif a3 = (ha + hb) / 2 b3 = (hb - ha) / 2*1i if @fourthdim == 3 z3 = a3 w3 = b3 elseif @fourthdim == 2 z3 = a3 w3 = flip(b3) elseif @fourthdim == 1 z3 = b3 w3 = a3 else z3 = b3 w3 = flip(a3) endif if (@fBm == true) IF (@noiseskip == 0.0 || noise); adding noise this iteration complex pa = ha * @scale * r1 + @noffset complex pb = hb * @scale * r1 + @noffset float suma = 0.0 float sumb = 0.0 float freq = 1.0 complex va = (0,0) complex vb = (0,0) int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxa = floor(real(pa)) float fya = floor(imag(pa)) float bx0a = fxa % 256 float by0a = fya % 256 IF (bx0a < 0) bx0a = bx0a + 256 ENDIF IF (by0a < 0) by0a = by0a + 256 ENDIF float bx1a = (bx0a + 1) % 256 float by1a = (by0a + 1) % 256 float rx0a = real(pa) - fxa float ry0a = imag(pa) - fya float rx1a = rx0a - 1 float ry1a = ry0a - 1 float fxb = floor(real(pb)) float fyb = floor(imag(pb)) float bx0b = fxb % 256 float by0b = fyb % 256 IF (bx0b < 0) bx0b = bx0b + 256 ENDIF IF (by0b < 0) by0b = by0b + 256 ENDIF float bx1b = (bx0b + 1) % 256 float by1b = (by0b + 1) % 256 float rx0b = real(pb) - fxb float ry0b = imag(pb) - fyb float rx1b = rx0b - 1 float ry1b = ry0b - 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 b00a = (bx0a^@npower % 65536 + by0a)^@npower % 65536 float b10a = (bx1a^@npower % 65536 + by0a)^@npower % 65536 float b01a = (bx0a^@npower % 65536 + by1a)^@npower % 65536 float b11a = (bx1a^@npower % 65536 + by1a)^@npower % 65536 float b00b = (bx0b^@npower % 65536 + by0b)^@npower % 65536 float b10b = (bx1b^@npower % 65536 + by0b)^@npower % 65536 float b01b = (bx0b^@npower % 65536 + by1b)^@npower % 65536 float b11b = (bx1b^@npower % 65536 + by1b)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0a = (b00a)^@npower*0.25 % 512 - 256 float g_b10_0a = (b10a)^@npower*0.25 % 512 - 256 float g_b01_0a = (b01a)^@npower*0.25 % 512 - 256 float g_b11_0a = (b11a)^@npower*0.25 % 512 - 256 float g_b00_1a = (b00a+1)^@npower*0.25 % 512 - 256 float g_b10_1a = (b10a+1)^@npower*0.25 % 512 - 256 float g_b01_1a = (b01a+1)^@npower*0.25 % 512 - 256 float g_b11_1a = (b11a+1)^@npower*0.25 % 512 - 256 float g_b00_0b = (b00b)^@npower*0.25 % 512 - 256 float g_b10_0b = (b10b)^@npower*0.25 % 512 - 256 float g_b01_0b = (b01b)^@npower*0.25 % 512 - 256 float g_b11_0b = (b11b)^@npower*0.25 % 512 - 256 float g_b00_1b = (b00b+1)^@npower*0.25 % 512 - 256 float g_b10_1b = (b10b+1)^@npower*0.25 % 512 - 256 float g_b01_1b = (b01b+1)^@npower*0.25 % 512 - 256 float g_b11_1b = (b11b+1)^@npower*0.25 % 512 - 256 ; normalize each vector float da = 0.0 float db = 0.0; da = 1 / sqrt(sqr(g_b00_0a) + sqr(g_b00_1a)) g_b00_0a = g_b00_0a * da g_b00_1a = g_b00_1a * da da = 1 / sqrt(sqr(g_b10_0a) + sqr(g_b10_1a)) g_b10_0a = g_b10_0a * da g_b10_1a = g_b10_1a * da da = 1 / sqrt(sqr(g_b01_0a) + sqr(g_b01_1a)) g_b01_0a = g_b01_0a * da g_b01_1a = g_b01_1a * da da = 1 / sqrt(sqr(g_b11_0a) + sqr(g_b11_1a)) g_b11_0a = g_b11_0a * da g_b11_1a = g_b11_1a * da db = 1 / sqrt(sqr(g_b00_0b) + sqr(g_b00_1b)) g_b00_0b = g_b00_0b * db g_b00_1b = g_b00_1b * db db = 1 / sqrt(sqr(g_b10_0b) + sqr(g_b10_1b)) g_b10_0b = g_b10_0b * db g_b10_1b = g_b10_1b * db db = 1 / sqrt(sqr(g_b01_0b) + sqr(g_b01_1b)) g_b01_0b = g_b01_0b * db g_b01_1b = g_b01_1b * db db = 1 / sqrt(sqr(g_b11_0b) + sqr(g_b11_1b)) g_b11_0b = g_b11_0b * db g_b11_1b = g_b11_1b * db ; produce colors for each corner float u1a = rx0a * g_b00_0a + ry0a * g_b00_1a float v1a = rx1a * g_b10_0a + ry0a * g_b10_1a float u2a = rx0a * g_b01_0a + ry1a * g_b01_1a float v2a = rx1a * g_b11_0a + ry1a * g_b11_1a float u1b = rx0b * g_b00_0b + ry0b * g_b00_1b float v1b = rx1b * g_b10_0b + ry0b * g_b10_1b float u2b = rx0b * g_b01_0b + ry1b * g_b01_1b float v2b = rx1b * g_b11_0b + ry1b * g_b11_1b ; interpolate between corners using ; bilinear filtering float sxa = sqr(rx0a) * (3 - rx0a*2) float sya = sqr(ry0a) * (3 - ry0a*2) float sxb = sqr(rx0b) * (3 - rx0b*2) float syb = sqr(ry0b) * (3 - ry0b*2) float aa = u1a + sxa*(v1a-u1a) float ba = u2a + sxa*(v2a-u2a) float ab = u1b + sxb*(v1b-u1b) float bb = u2b + sxb*(v2b-u2b) suma = suma + real(@nfn1(aa + sya*(ba-aa)))*freq sumb = sumb + real(@nfn1(ab + syb*(bb-ab)))*freq freq = freq * @step pa = pa * r2 / @step pb = pb * r2 / @step i = i - 1 ENDWHILE IF (@style == 0); radial distortion va = (ha-c)/cabs(ha-c) * r3; use vector based on angle to distortion center vb = (hb-c)/cabs(hb-c) * r3 ELSEIF (@style == 1); linear distortion va = r3; just use rotation vector vb = r3 ENDIF ha = ha + va * (suma + @coloroffset) * 0.5 * @distortion hb = hb + vb * (sumb + @coloroffset) * 0.5 * @distortion nz3 = (ha + hb) / 2 nw3 = (hb - ha) / 2*1i if @fourthdim == 3 z3 = nz3 w3 = nw3 elseif @fourthdim == 2 z3 = nz3 w3 = flip(nw3) elseif @fourthdim == 1 z3 = nw3 w3 = nz3 else z3 = nw3 w3 = flip(nz3) endif ENDIF endif IF (@zmode == 5) iterexp1 = iterexp1 + exp(-1/(cabs(z1old - z1))) iterexp2 = iterexp2 + exp(-1/(cabs(z2old - z2))) iterexp3 = iterexp3 + exp(-1/(cabs(z3old - z3))) ENDIF done = done + 1; increment iteration counter IF (@zmode == 0) ; 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 == 1) ; 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 == 2) ; 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 == 3) ; 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 == 4) ; 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 ENDIF IF (@bailout > (|a1-z1old| + |b1-w1old|) || \ @everyiter ||\ done == #maxit + 2); done, or every iteration, or last ; determine continuous iteration (height) for each point IF (@zmode >= 0 && @zmode <= 4) ; height based on smallest |z| e1 = s1 * @zscale e2 = s2 * @zscale e3 = s3 * @zscale ELSEIF (@zmode == 5) e1 = iterexp1 * @zscale e2 = iterexp2 * @zscale e3 = iterexp3 * @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 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 else z = z1 endif IF (@bailout > (|a1-z1old| + |b1-w1old|)) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope Newton (hypercomplex)" center = (0.0,0.0) magn = 1.0 maxiter = 149 method = multipass periodicity = 0 param version caption = "Version" default = 1.26 visible = false endparam heading caption = "Slope Newton (hypercomplex)" endheading heading caption = "Use Damien's Lighting Coloring" endheading heading caption = "Or Ron's 3D Texturizer Formulas" endheading heading caption = "Most other coloring formulas" endheading heading caption = "can also be used." endheading param fourthdim caption = "Fourth dimension" enum = "z1" "zi" "zj" "zk" default = 3 endparam param method caption = "Method" enum = "(h^exp + c) + r" \ "(h^exp) + r + c" default = 0 endparam param c1i caption = "(c1, ci)" default = (0.0, 0.0) endparam param cjk caption = "(cj, ck)" default = (0.0, 0.0) endparam param ct caption = "(zj, zk)" default = (0.0, 0.0) endparam param p caption = "Exponent" default = (3.0, 0.0) endparam param r caption = "Root" default = (1.0, 0.0) endparam param rotx caption="x-rotation" hint="Rotates yz-plane." default=0.0 min=-360.0 max=360.0 endparam param roty caption="y-rotation" hint="Rotates zx-plane." default=0.0 min=-360.0 max=360.0 endparam param rotz caption="z-rotation" hint="Rotates xy-plane." default=0.0 min=-360.0 max=360.0 endparam param bailout caption = "Bailout Value" default = 0.00001 max = 0.1 endparam bool param slope caption = "Apply slope?" default = true endparam heading caption = "Slope Parameters" visible = @slope==true endheading param offset caption = "Orbit Separation" default = 0.00000001 hint = "Defines how far apart the simultaneous orbits are. Smaller \ distances will produce more accurate results." visible = @slope==true endparam param zmode caption = "Height Value" default = 5 enum = "smallest |z|" "smallest |real(z)|" \ "smallest |imag(z)|" "smallest summ(z)" "smallest |atan(z)|" \ "smoothed iteration" hint = "Specifies what will be used to construct a height value." visible = @slope==true 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." visible = @slope==true 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." visible = @slope==true 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." visible = @slope==true 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." visible = @slope==true endparam bool param fBm caption = "fBm texturing?" default = false endparam heading caption = "fBm Parameters" visible = @fBm == true endheading param distortion caption = "Distortion Strength" default = 1.0 hint = "This is the amount the noise distorts the image." visible = @fBm == true endparam param style caption = "Distortion Style" default = 1 enum = "radial" "linear" hint = "This selects whether the distortion will be focused \ around a single point, or directed along a line." visible = @fBm == true endparam param distangle caption = "Distortion Angle" default = 0.0 hint = "This is the angle to rotate the distortion." visible = @fBm == true endparam param distcenter caption = "Distortion Center" default = (0.0, 0.0) hint = "Sets the center of distortion. If Use Screen \ Center is set, this item is ignored." visible = @fBm == true 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." visible = @fBm == true endparam param coloroffset caption = "Coloring Offset" default = 1.0 hint = "Sets the coloring offset from zero. Increase this if you see \ large areas of solid color." visible = @fBm == true endparam param noffset 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." visible = @fBm == true endparam param scale caption = "Noise Scale" default = 1.0 hint = "This is the overall scale of the noise." visible = @fBm == true endparam param angle caption = "Noise Rotation" default = 0.0 hint = "This is the angle, in degrees, of the noise." visible = @fBm == true endparam param step caption = "Noise Scale Step" default = 0.5 hint = "This is the step in scale between noise iterations." visible = @fBm == true endparam param anglestep caption = "Noise Rotation Step" default = 37.0 hint = "This is the angle, in degrees, to rotate between noise \ iterations." visible = @fBm == true endparam param octaves caption = "Noise Octaves" default = 7 min = 1 hint = "This is the number of iterations of the noise formula." visible = @fBm == true endparam param npower caption = "Noise Exponent" default = 2.0 hint = "This is the exponent used to scramble numbers." visible = @fBm == true endparam param noisestart caption = "Start Iteration" default = 0.0 hint = "This is the iteration at which to start adding noise." visible = @fBm == true endparam param noiseiter caption = "Noise Iterations" default = 10000.0 hint = "This is the number of iterations to add noise to." visible = @fBm == true endparam param noiseskip caption = "Skip Iterations" default = 0.0 hint = "This is the number of iterations to skip adding noise \ before starting again." visible = @fBm == true endparam func nfn1 caption = "Noise Function" default = ident() visible = @fBm == true endfunc switch: type = "gnd-Slope_HypercomplexNewton_Mset" version = @version fourthdim = @fourthdim method = @method cjk = @cjk p = @p r = @r rotx = @rotx roty = @roty rotz = @rotz bailout = @bailout fBm = @fBm distortion = @distortion style = @style distangle = @distangle distcenter = @distcenter centermove = @centermove coloroffset = @coloroffset noffset = @noffset scale = @scale angle = @angle step = @step anglestep = @anglestep octaves = @octaves npower = @npower noisestart = @noisestart noiseiter = @noiseiter noiseskip = @noiseskip slope = @slope offset = @offset zmode = @zmode xfer = @xfer zscale = @zscale zscale2 = @zscale2 everyiter = @everyiter nfn1 = @nfn1 } gnd-Slope_HypercomplexNewton_Mset { ; based upon the slope (Mandelbrot) ; formula of Damien Jones ; Hypercomplex Newton Mandel formula ; compound with the models of slope formulas from Ron Barnett. ; 4-dimensional F.B.M. added October, 2005 ; based on original code from Damien M. Jones. ; version 1.26, October 2005 ; Gilles Nadeau, 24/10/2005 ; init: complex cz1 = #pixel complex cz2 = #pixel + @offset; horizontally offset point complex cz3 = #pixel + flip(@offset); vertically offset point complex cw1 = @cjk complex cw2 = @cjk complex cw3 = @cjk complex z1 = (0.0, 0.0) complex z2 = (0.0, 0.0) complex z3 = (0.0, 0.0) complex w1 = (0.0, 0.0) complex w2 = (0.0, 0.0) complex w3 = (0.0, 0.0) complex nz1 = z1 complex nz2 = z2 complex nz3 = z3 complex nw1 = w1 complex nw2 = w2 complex nw3 = w3 complex z1old = z1 complex z2old = z2 complex z3old = z3 complex w1old = w1 complex a = (0.0, 0.0) complex b = (0.0, 0.0) complex ca = (0.0, 0.0) complex cb = (0.0, 0.0) complex a1 = (0.0, 0.0) complex a2 = (0.0, 0.0) complex a3 = (0.0, 0.0) complex b1 = (0.0, 0.0) complex b2 = (0.0, 0.0) complex b3 = (0.0, 0.0) complex ha = (0.0, 0.0) complex hb = (0.0, 0.0) complex ca1 = (0.0, 0.0) complex ca2 = (0.0, 0.0) complex ca3 = (0.0, 0.0) complex cb1 = (0.0, 0.0) complex cb2 = (0.0, 0.0) complex cb3 = (0.0, 0.0) float rx = 0.0 float ry = 0.0 float rz = 0.0 int done = 2 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 iterexp1 = 0.0 float iterexp2 = 0.0 float iterexp3 = 0.0 complex c = @distcenter IF (@centermove) c = #center ENDIF complex r1 = (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 ; (yz plane rotation) ry = imag(z1)*cos(#pi*@rotx/180) - real(w1)*sin(#pi*@rotx/180) rz = imag(z1)*sin(#pi*@rotx/180) + real(w1)*cos(#pi*@rotx/180) z1 = real(z1) + ry*1i w1 = rz + imag(w1)*1i ry = imag(z2)*cos(#pi*@rotx/180) - real(w2)*sin(#pi*@rotx/180) rz = imag(z2)*sin(#pi*@rotx/180) + real(w2)*cos(#pi*@rotx/180) z2 = real(z2) + ry*1i w2 = rz + imag(w2)*1i ry = imag(z3)*cos(#pi*@rotx/180) - real(w3)*sin(#pi*@rotx/180) rz = imag(z3)*sin(#pi*@rotx/180) + real(w3)*cos(#pi*@rotx/180) z3 = real(z3) + ry*1i w3 = rz + imag(w3)*1i ry = imag(cz1)*cos(#pi*@rotx/180) - real(cw1)*sin(#pi*@rotx/180) rz = imag(cz1)*sin(#pi*@rotx/180) + real(cw1)*cos(#pi*@rotx/180) cz1 = real(cz1) + ry*1i cw1 = rz + imag(cw1)*1i ry = imag(cz2)*cos(#pi*@rotx/180) - real(cw2)*sin(#pi*@rotx/180) rz = imag(cz2)*sin(#pi*@rotx/180) + real(cw2)*cos(#pi*@rotx/180) cz2 = real(cz2) + ry*1i cw2 = rz + imag(cw2)*1i ry = imag(cz3)*cos(#pi*@rotx/180) - real(cw3)*sin(#pi*@rotx/180) rz = imag(cz3)*sin(#pi*@rotx/180) + real(cw3)*cos(#pi*@rotx/180) cz3 = real(cz3) + ry*1i cw3 = rz + imag(cw3)*1i ; (xz plane rotation) rx = real(w1)*sin(#pi*@roty/180) + real(z1)*cos(#pi*@roty/180) rz = real(w1)*cos(#pi*@roty/180) - real(z1)*sin(#pi*@roty/180) z1 = rx + imag(z1)*1i w1 = rz + imag(w1)*1i rx = real(w2)*sin(#pi*@roty/180) + real(z2)*cos(#pi*@roty/180) rz = real(w2)*cos(#pi*@roty/180) - real(z2)*sin(#pi*@roty/180) z2 = rx + imag(z2)*1i w2 = rz + imag(w2)*1i rx = real(w3)*sin(#pi*@roty/180) + real(z3)*cos(#pi*@roty/180) rz = real(w3)*cos(#pi*@roty/180) - real(z3)*sin(#pi*@roty/180) z3 = rx + imag(z3)*1i w3 = rz + imag(w3)*1i rx = real(cw1)*sin(#pi*@roty/180) + real(cz1)*cos(#pi*@roty/180) rz = real(cw1)*cos(#pi*@roty/180) - real(cz1)*sin(#pi*@roty/180) cz1 = rx + imag(cz1)*1i cw1 = rz + imag(cw1)*1i rx = real(cw2)*sin(#pi*@roty/180) + real(cz2)*cos(#pi*@roty/180) rz = real(cw2)*cos(#pi*@roty/180) - real(cz2)*sin(#pi*@roty/180) cz2 = rx + imag(cz2)*1i cw2 = rz + imag(cw2)*1i rx = real(cw3)*sin(#pi*@roty/180) + real(cz3)*cos(#pi*@roty/180) rz = real(cw3)*cos(#pi*@roty/180) - real(cz3)*sin(#pi*@roty/180) cz3 = rx + imag(cz3)*1i cw3 = rz + imag(cw3)*1i ; (xy plane rotation) rx = real(z1)*cos(#pi*@rotz/180) - imag(z1)*sin(#pi*@rotz/180) ry = real(z1)*sin(#pi*@rotz/180) + imag(z1)*cos(#pi*@rotz/180) z1 = rx + ry*1i rx = real(z2)*cos(#pi*@rotz/180) - imag(z2)*sin(#pi*@rotz/180) ry = real(z2)*sin(#pi*@rotz/180) + imag(z2)*cos(#pi*@rotz/180) z2 = rx + ry*1i rx = real(z3)*cos(#pi*@rotz/180) - imag(z3)*sin(#pi*@rotz/180) ry = real(z3)*sin(#pi*@rotz/180) + imag(z3)*cos(#pi*@rotz/180) z3 = rx + ry*1i rx = real(cz1)*cos(#pi*@rotz/180) - imag(cz1)*sin(#pi*@rotz/180) ry = real(cz1)*sin(#pi*@rotz/180) + imag(cz1)*cos(#pi*@rotz/180) cz1 = rx + ry*1i rx = real(cz2)*cos(#pi*@rotz/180) - imag(cz2)*sin(#pi*@rotz/180) ry = real(cz2)*sin(#pi*@rotz/180) + imag(cz2)*cos(#pi*@rotz/180) cz2 = rx + ry*1i rx = real(cz3)*cos(#pi*@rotz/180) - imag(cz3)*sin(#pi*@rotz/180) ry = real(cz3)*sin(#pi*@rotz/180) + imag(cz3)*cos(#pi*@rotz/180) cz3 = rx + ry*1i if @fourthdim == 3 a1 = z1 a2 = z2 a3 = z3 b1 = w1 b2 = w2 b3 = w3 ca1 = cz1 ca2 = cz2 ca3 = cz3 cb1 = cw1 cb2 = cw2 cb3 = cw3 elseif @fourthdim == 2 a1 = z1 a2 = z2 a3 = z3 b1 = flip(w1) b2 = flip(w2) b3 = flip(w3) ca1 = cz1 ca2 = cz2 ca3 = cz3 cb1 = flip(cw1) cb2 = flip(cw2) cb3 = flip(cw3) elseif @fourthdim == 1 a1 = w1 a2 = w2 a3 = w3 b1 = z1 b2 = z2 b3 = z3 ca1 = cw1 ca2 = cw2 ca3 = cw3 cb1 = cz1 cb2 = cz2 cb3 = cz3 else a1 = flip(w1) a2 = flip(w2) a3 = flip(w3) b1 = z1 b2 = z2 b3 = z3 ca1 = flip(cw1) ca2 = flip(cw2) ca3 = flip(cw3) cb1 = cz1 cb2 = cz2 cb3 = cz3 endif loop: if (@fBm) 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 endif z1old = a1 z2old = a2 z3old = a3 w1old = b1 a = a1 + b1*1i b = a1 - b1*1i ca = ca1 + cb1*1i cb = ca1 - cb1*1i if @method == 0 ha = ((@p - 1) * (a ^ @p + ca) + @r) / (@p * a ^ (@p - 1) + ca) hb = ((@p - 1) * (b ^ @p + cb) + @r) / (@p * b ^ (@p - 1) + cb) else ha = ((@p - 1) * (a ^ @p) + @r + ca) / (@p * a ^ (@p - 1) + ca) hb = ((@p - 1) * (b ^ @p) + @r + cb) / (@p * b ^ (@p - 1) + cb) endif a1 = (ha + hb) / 2 b1 = (hb - ha) / 2*1i if @fourthdim == 3 z1 = a1 w1 = b1 elseif @fourthdim == 2 z1 = a1 w1 = flip(b1) elseif @fourthdim == 1 z1 = b1 w1 = a1 else z1 = b1 w1 = flip(a1) endif if (@fBm == true) IF (@noiseskip == 0.0 || noise); adding noise this iteration complex pa = ha * @scale * r1 + @noffset complex pb = hb * @scale * r1 + @noffset float suma = 0.0 float sumb = 0.0 float freq = 1.0 complex va = (0,0) complex vb = (0,0) int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxa = floor(real(pa)) float fya = floor(imag(pa)) float bx0a = fxa % 256 float by0a = fya % 256 IF (bx0a < 0) bx0a = bx0a + 256 ENDIF IF (by0a < 0) by0a = by0a + 256 ENDIF float bx1a = (bx0a + 1) % 256 float by1a = (by0a + 1) % 256 float rx0a = real(pa) - fxa float ry0a = imag(pa) - fya float rx1a = rx0a - 1 float ry1a = ry0a - 1 float fxb = floor(real(pb)) float fyb = floor(imag(pb)) float bx0b = fxb % 256 float by0b = fyb % 256 IF (bx0b < 0) bx0b = bx0b + 256 ENDIF IF (by0b < 0) by0b = by0b + 256 ENDIF float bx1b = (bx0b + 1) % 256 float by1b = (by0b + 1) % 256 float rx0b = real(pb) - fxb float ry0b = imag(pb) - fyb float rx1b = rx0b - 1 float ry1b = ry0b - 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 b00a = (bx0a^@npower % 65536 + by0a)^@npower % 65536 float b10a = (bx1a^@npower % 65536 + by0a)^@npower % 65536 float b01a = (bx0a^@npower % 65536 + by1a)^@npower % 65536 float b11a = (bx1a^@npower % 65536 + by1a)^@npower % 65536 float b00b = (bx0b^@npower % 65536 + by0b)^@npower % 65536 float b10b = (bx1b^@npower % 65536 + by0b)^@npower % 65536 float b01b = (bx0b^@npower % 65536 + by1b)^@npower % 65536 float b11b = (bx1b^@npower % 65536 + by1b)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0a = (b00a)^@npower*0.25 % 512 - 256 float g_b10_0a = (b10a)^@npower*0.25 % 512 - 256 float g_b01_0a = (b01a)^@npower*0.25 % 512 - 256 float g_b11_0a = (b11a)^@npower*0.25 % 512 - 256 float g_b00_1a = (b00a+1)^@npower*0.25 % 512 - 256 float g_b10_1a = (b10a+1)^@npower*0.25 % 512 - 256 float g_b01_1a = (b01a+1)^@npower*0.25 % 512 - 256 float g_b11_1a = (b11a+1)^@npower*0.25 % 512 - 256 float g_b00_0b = (b00b)^@npower*0.25 % 512 - 256 float g_b10_0b = (b10b)^@npower*0.25 % 512 - 256 float g_b01_0b = (b01b)^@npower*0.25 % 512 - 256 float g_b11_0b = (b11b)^@npower*0.25 % 512 - 256 float g_b00_1b = (b00b+1)^@npower*0.25 % 512 - 256 float g_b10_1b = (b10b+1)^@npower*0.25 % 512 - 256 float g_b01_1b = (b01b+1)^@npower*0.25 % 512 - 256 float g_b11_1b = (b11b+1)^@npower*0.25 % 512 - 256 ; normalize each vector float da = 0.0 float db = 0.0; da = 1 / sqrt(sqr(g_b00_0a) + sqr(g_b00_1a)) g_b00_0a = g_b00_0a * da g_b00_1a = g_b00_1a * da da = 1 / sqrt(sqr(g_b10_0a) + sqr(g_b10_1a)) g_b10_0a = g_b10_0a * da g_b10_1a = g_b10_1a * da da = 1 / sqrt(sqr(g_b01_0a) + sqr(g_b01_1a)) g_b01_0a = g_b01_0a * da g_b01_1a = g_b01_1a * da da = 1 / sqrt(sqr(g_b11_0a) + sqr(g_b11_1a)) g_b11_0a = g_b11_0a * da g_b11_1a = g_b11_1a * da db = 1 / sqrt(sqr(g_b00_0b) + sqr(g_b00_1b)) g_b00_0b = g_b00_0b * db g_b00_1b = g_b00_1b * db db = 1 / sqrt(sqr(g_b10_0b) + sqr(g_b10_1b)) g_b10_0b = g_b10_0b * db g_b10_1b = g_b10_1b * db db = 1 / sqrt(sqr(g_b01_0b) + sqr(g_b01_1b)) g_b01_0b = g_b01_0b * db g_b01_1b = g_b01_1b * db db = 1 / sqrt(sqr(g_b11_0b) + sqr(g_b11_1b)) g_b11_0b = g_b11_0b * db g_b11_1b = g_b11_1b * db ; produce colors for each corner float u1a = rx0a * g_b00_0a + ry0a * g_b00_1a float v1a = rx1a * g_b10_0a + ry0a * g_b10_1a float u2a = rx0a * g_b01_0a + ry1a * g_b01_1a float v2a = rx1a * g_b11_0a + ry1a * g_b11_1a float u1b = rx0b * g_b00_0b + ry0b * g_b00_1b float v1b = rx1b * g_b10_0b + ry0b * g_b10_1b float u2b = rx0b * g_b01_0b + ry1b * g_b01_1b float v2b = rx1b * g_b11_0b + ry1b * g_b11_1b ; interpolate between corners using ; bilinear filtering float sxa = sqr(rx0a) * (3 - rx0a*2) float sya = sqr(ry0a) * (3 - ry0a*2) float sxb = sqr(rx0b) * (3 - rx0b*2) float syb = sqr(ry0b) * (3 - ry0b*2) float aa = u1a + sxa*(v1a-u1a) float ba = u2a + sxa*(v2a-u2a) float ab = u1b + sxb*(v1b-u1b) float bb = u2b + sxb*(v2b-u2b) suma = suma + real(@nfn1(aa + sya*(ba-aa)))*freq sumb = sumb + real(@nfn1(ab + syb*(bb-ab)))*freq freq = freq * @step pa = pa * r2 / @step pb = pb * r2 / @step i = i - 1 ENDWHILE IF (@style == 0); radial distortion va = (ha-c)/cabs(ha-c) * r3; use vector based on angle to distortion center vb = (hb-c)/cabs(hb-c) * r3 ELSEIF (@style == 1); linear distortion va = r3; just use rotation vector vb = r3 ENDIF ha = ha + va * (suma + @coloroffset) * 0.5 * @distortion hb = hb + vb * (sumb + @coloroffset) * 0.5 * @distortion nz1 = (ha + hb) / 2 nw1 = (hb - ha) / 2*1i if @fourthdim == 3 z1 = nz1 w1 = nw1 elseif @fourthdim == 2 z1 = nz1 w1 = flip(nw1) elseif @fourthdim == 1 z1 = nw1 w1 = nz1 else z1 = nw1 w1 = flip(nz1) endif ENDIF endif if (@slope == true) a = a2 + b2*1i b = a2 - b2*1i ca = ca2 + cb2*1i cb = ca2 - cb2*1i if @method == 0 ha = ((@p - 1) * (a ^ @p + ca) + @r) / (@p * a ^ (@p - 1) + ca) hb = ((@p - 1) * (b ^ @p + cb) + @r) / (@p * b ^ (@p - 1) + cb) else ha = ((@p - 1) * (a ^ @p) + @r + ca) / (@p * a ^ (@p - 1) + ca) hb = ((@p - 1) * (b ^ @p) + @r + cb) / (@p * b ^ (@p - 1) + cb) endif a2 = (ha + hb) / 2 b2 = (hb - ha) / 2*1i if @fourthdim == 3 z2 = a2 w2 = b2 elseif @fourthdim == 2 z2 = a2 w2 = flip(b2) elseif @fourthdim == 1 z2 = b2 w2 = a2 else z2 = b2 w2 = flip(a2) endif if (@fBm == true) IF (@noiseskip == 0.0 || noise); adding noise this iteration complex pa = ha * @scale * r1 + @noffset complex pb = hb * @scale * r1 + @noffset float suma = 0.0 float sumb = 0.0 float freq = 1.0 complex va = (0,0) complex vb = (0,0) int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxa = floor(real(pa)) float fya = floor(imag(pa)) float bx0a = fxa % 256 float by0a = fya % 256 IF (bx0a < 0) bx0a = bx0a + 256 ENDIF IF (by0a < 0) by0a = by0a + 256 ENDIF float bx1a = (bx0a + 1) % 256 float by1a = (by0a + 1) % 256 float rx0a = real(pa) - fxa float ry0a = imag(pa) - fya float rx1a = rx0a - 1 float ry1a = ry0a - 1 float fxb = floor(real(pb)) float fyb = floor(imag(pb)) float bx0b = fxb % 256 float by0b = fyb % 256 IF (bx0b < 0) bx0b = bx0b + 256 ENDIF IF (by0b < 0) by0b = by0b + 256 ENDIF float bx1b = (bx0b + 1) % 256 float by1b = (by0b + 1) % 256 float rx0b = real(pb) - fxb float ry0b = imag(pb) - fyb float rx1b = rx0b - 1 float ry1b = ry0b - 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 b00a = (bx0a^@npower % 65536 + by0a)^@npower % 65536 float b10a = (bx1a^@npower % 65536 + by0a)^@npower % 65536 float b01a = (bx0a^@npower % 65536 + by1a)^@npower % 65536 float b11a = (bx1a^@npower % 65536 + by1a)^@npower % 65536 float b00b = (bx0b^@npower % 65536 + by0b)^@npower % 65536 float b10b = (bx1b^@npower % 65536 + by0b)^@npower % 65536 float b01b = (bx0b^@npower % 65536 + by1b)^@npower % 65536 float b11b = (bx1b^@npower % 65536 + by1b)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0a = (b00a)^@npower*0.25 % 512 - 256 float g_b10_0a = (b10a)^@npower*0.25 % 512 - 256 float g_b01_0a = (b01a)^@npower*0.25 % 512 - 256 float g_b11_0a = (b11a)^@npower*0.25 % 512 - 256 float g_b00_1a = (b00a+1)^@npower*0.25 % 512 - 256 float g_b10_1a = (b10a+1)^@npower*0.25 % 512 - 256 float g_b01_1a = (b01a+1)^@npower*0.25 % 512 - 256 float g_b11_1a = (b11a+1)^@npower*0.25 % 512 - 256 float g_b00_0b = (b00b)^@npower*0.25 % 512 - 256 float g_b10_0b = (b10b)^@npower*0.25 % 512 - 256 float g_b01_0b = (b01b)^@npower*0.25 % 512 - 256 float g_b11_0b = (b11b)^@npower*0.25 % 512 - 256 float g_b00_1b = (b00b+1)^@npower*0.25 % 512 - 256 float g_b10_1b = (b10b+1)^@npower*0.25 % 512 - 256 float g_b01_1b = (b01b+1)^@npower*0.25 % 512 - 256 float g_b11_1b = (b11b+1)^@npower*0.25 % 512 - 256 ; normalize each vector float da = 0.0 float db = 0.0; da = 1 / sqrt(sqr(g_b00_0a) + sqr(g_b00_1a)) g_b00_0a = g_b00_0a * da g_b00_1a = g_b00_1a * da da = 1 / sqrt(sqr(g_b10_0a) + sqr(g_b10_1a)) g_b10_0a = g_b10_0a * da g_b10_1a = g_b10_1a * da da = 1 / sqrt(sqr(g_b01_0a) + sqr(g_b01_1a)) g_b01_0a = g_b01_0a * da g_b01_1a = g_b01_1a * da da = 1 / sqrt(sqr(g_b11_0a) + sqr(g_b11_1a)) g_b11_0a = g_b11_0a * da g_b11_1a = g_b11_1a * da db = 1 / sqrt(sqr(g_b00_0b) + sqr(g_b00_1b)) g_b00_0b = g_b00_0b * db g_b00_1b = g_b00_1b * db db = 1 / sqrt(sqr(g_b10_0b) + sqr(g_b10_1b)) g_b10_0b = g_b10_0b * db g_b10_1b = g_b10_1b * db db = 1 / sqrt(sqr(g_b01_0b) + sqr(g_b01_1b)) g_b01_0b = g_b01_0b * db g_b01_1b = g_b01_1b * db db = 1 / sqrt(sqr(g_b11_0b) + sqr(g_b11_1b)) g_b11_0b = g_b11_0b * db g_b11_1b = g_b11_1b * db ; produce colors for each corner float u1a = rx0a * g_b00_0a + ry0a * g_b00_1a float v1a = rx1a * g_b10_0a + ry0a * g_b10_1a float u2a = rx0a * g_b01_0a + ry1a * g_b01_1a float v2a = rx1a * g_b11_0a + ry1a * g_b11_1a float u1b = rx0b * g_b00_0b + ry0b * g_b00_1b float v1b = rx1b * g_b10_0b + ry0b * g_b10_1b float u2b = rx0b * g_b01_0b + ry1b * g_b01_1b float v2b = rx1b * g_b11_0b + ry1b * g_b11_1b ; interpolate between corners using ; bilinear filtering float sxa = sqr(rx0a) * (3 - rx0a*2) float sya = sqr(ry0a) * (3 - ry0a*2) float sxb = sqr(rx0b) * (3 - rx0b*2) float syb = sqr(ry0b) * (3 - ry0b*2) float aa = u1a + sxa*(v1a-u1a) float ba = u2a + sxa*(v2a-u2a) float ab = u1b + sxb*(v1b-u1b) float bb = u2b + sxb*(v2b-u2b) suma = suma + real(@nfn1(aa + sya*(ba-aa)))*freq sumb = sumb + real(@nfn1(ab + syb*(bb-ab)))*freq freq = freq * @step pa = pa * r2 / @step pb = pb * r2 / @step i = i - 1 ENDWHILE IF (@style == 0); radial distortion va = (ha-c)/cabs(ha-c) * r3; use vector based on angle to distortion center vb = (hb-c)/cabs(hb-c) * r3 ELSEIF (@style == 1); linear distortion va = r3; just use rotation vector vb = r3 ENDIF ha = ha + va * (suma + @coloroffset) * 0.5 * @distortion hb = hb + vb * (sumb + @coloroffset) * 0.5 * @distortion nz2 = (ha + hb) / 2 nw2 = (hb - ha) / 2*1i if @fourthdim == 3 z2 = nz2 w2 = nw2 elseif @fourthdim == 2 z2 = nz2 w2 = flip(nw2) elseif @fourthdim == 1 z2 = nw2 w2 = nz2 else z2 = nw2 w2 = flip(nz2) endif ENDIF endif a = a3 + b3*1i b = a3 - b3*1i ca = ca3 + cb3*1i cb = ca3 - cb3*1i if @method == 0 ha = ((@p - 1) * (a ^ @p + ca) + @r) / (@p * a ^ (@p - 1) + ca) hb = ((@p - 1) * (b ^ @p + cb) + @r) / (@p * b ^ (@p - 1) + cb) else ha = ((@p - 1) * (a ^ @p) + @r + ca) / (@p * a ^ (@p - 1) + ca) hb = ((@p - 1) * (b ^ @p) + @r + cb) / (@p * b ^ (@p - 1) + cb) endif a3 = (ha + hb) / 2 b3 = (hb - ha) / 2*1i if @fourthdim == 3 z3 = a3 w3 = b3 elseif @fourthdim == 2 z3 = a3 w3 = flip(b3) elseif @fourthdim == 1 z3 = b3 w3 = a3 else z3 = b3 w3 = flip(a3) endif if (@fBm == true) IF (@noiseskip == 0.0 || noise); adding noise this iteration complex pa = ha * @scale * r1 + @noffset complex pb = hb * @scale * r1 + @noffset float suma = 0.0 float sumb = 0.0 float freq = 1.0 complex va = (0,0) complex vb = (0,0) int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxa = floor(real(pa)) float fya = floor(imag(pa)) float bx0a = fxa % 256 float by0a = fya % 256 IF (bx0a < 0) bx0a = bx0a + 256 ENDIF IF (by0a < 0) by0a = by0a + 256 ENDIF float bx1a = (bx0a + 1) % 256 float by1a = (by0a + 1) % 256 float rx0a = real(pa) - fxa float ry0a = imag(pa) - fya float rx1a = rx0a - 1 float ry1a = ry0a - 1 float fxb = floor(real(pb)) float fyb = floor(imag(pb)) float bx0b = fxb % 256 float by0b = fyb % 256 IF (bx0b < 0) bx0b = bx0b + 256 ENDIF IF (by0b < 0) by0b = by0b + 256 ENDIF float bx1b = (bx0b + 1) % 256 float by1b = (by0b + 1) % 256 float rx0b = real(pb) - fxb float ry0b = imag(pb) - fyb float rx1b = rx0b - 1 float ry1b = ry0b - 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 b00a = (bx0a^@npower % 65536 + by0a)^@npower % 65536 float b10a = (bx1a^@npower % 65536 + by0a)^@npower % 65536 float b01a = (bx0a^@npower % 65536 + by1a)^@npower % 65536 float b11a = (bx1a^@npower % 65536 + by1a)^@npower % 65536 float b00b = (bx0b^@npower % 65536 + by0b)^@npower % 65536 float b10b = (bx1b^@npower % 65536 + by0b)^@npower % 65536 float b01b = (bx0b^@npower % 65536 + by1b)^@npower % 65536 float b11b = (bx1b^@npower % 65536 + by1b)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0a = (b00a)^@npower*0.25 % 512 - 256 float g_b10_0a = (b10a)^@npower*0.25 % 512 - 256 float g_b01_0a = (b01a)^@npower*0.25 % 512 - 256 float g_b11_0a = (b11a)^@npower*0.25 % 512 - 256 float g_b00_1a = (b00a+1)^@npower*0.25 % 512 - 256 float g_b10_1a = (b10a+1)^@npower*0.25 % 512 - 256 float g_b01_1a = (b01a+1)^@npower*0.25 % 512 - 256 float g_b11_1a = (b11a+1)^@npower*0.25 % 512 - 256 float g_b00_0b = (b00b)^@npower*0.25 % 512 - 256 float g_b10_0b = (b10b)^@npower*0.25 % 512 - 256 float g_b01_0b = (b01b)^@npower*0.25 % 512 - 256 float g_b11_0b = (b11b)^@npower*0.25 % 512 - 256 float g_b00_1b = (b00b+1)^@npower*0.25 % 512 - 256 float g_b10_1b = (b10b+1)^@npower*0.25 % 512 - 256 float g_b01_1b = (b01b+1)^@npower*0.25 % 512 - 256 float g_b11_1b = (b11b+1)^@npower*0.25 % 512 - 256 ; normalize each vector float da = 0.0 float db = 0.0; da = 1 / sqrt(sqr(g_b00_0a) + sqr(g_b00_1a)) g_b00_0a = g_b00_0a * da g_b00_1a = g_b00_1a * da da = 1 / sqrt(sqr(g_b10_0a) + sqr(g_b10_1a)) g_b10_0a = g_b10_0a * da g_b10_1a = g_b10_1a * da da = 1 / sqrt(sqr(g_b01_0a) + sqr(g_b01_1a)) g_b01_0a = g_b01_0a * da g_b01_1a = g_b01_1a * da da = 1 / sqrt(sqr(g_b11_0a) + sqr(g_b11_1a)) g_b11_0a = g_b11_0a * da g_b11_1a = g_b11_1a * da db = 1 / sqrt(sqr(g_b00_0b) + sqr(g_b00_1b)) g_b00_0b = g_b00_0b * db g_b00_1b = g_b00_1b * db db = 1 / sqrt(sqr(g_b10_0b) + sqr(g_b10_1b)) g_b10_0b = g_b10_0b * db g_b10_1b = g_b10_1b * db db = 1 / sqrt(sqr(g_b01_0b) + sqr(g_b01_1b)) g_b01_0b = g_b01_0b * db g_b01_1b = g_b01_1b * db db = 1 / sqrt(sqr(g_b11_0b) + sqr(g_b11_1b)) g_b11_0b = g_b11_0b * db g_b11_1b = g_b11_1b * db ; produce colors for each corner float u1a = rx0a * g_b00_0a + ry0a * g_b00_1a float v1a = rx1a * g_b10_0a + ry0a * g_b10_1a float u2a = rx0a * g_b01_0a + ry1a * g_b01_1a float v2a = rx1a * g_b11_0a + ry1a * g_b11_1a float u1b = rx0b * g_b00_0b + ry0b * g_b00_1b float v1b = rx1b * g_b10_0b + ry0b * g_b10_1b float u2b = rx0b * g_b01_0b + ry1b * g_b01_1b float v2b = rx1b * g_b11_0b + ry1b * g_b11_1b ; interpolate between corners using ; bilinear filtering float sxa = sqr(rx0a) * (3 - rx0a*2) float sya = sqr(ry0a) * (3 - ry0a*2) float sxb = sqr(rx0b) * (3 - rx0b*2) float syb = sqr(ry0b) * (3 - ry0b*2) float aa = u1a + sxa*(v1a-u1a) float ba = u2a + sxa*(v2a-u2a) float ab = u1b + sxb*(v1b-u1b) float bb = u2b + sxb*(v2b-u2b) suma = suma + real(@nfn1(aa + sya*(ba-aa)))*freq sumb = sumb + real(@nfn1(ab + syb*(bb-ab)))*freq freq = freq * @step pa = pa * r2 / @step pb = pb * r2 / @step i = i - 1 ENDWHILE IF (@style == 0); radial distortion va = (ha-c)/cabs(ha-c) * r3; use vector based on angle to distortion center vb = (hb-c)/cabs(hb-c) * r3 ELSEIF (@style == 1); linear distortion va = r3; just use rotation vector vb = r3 ENDIF ha = ha + va * (suma + @coloroffset) * 0.5 * @distortion hb = hb + vb * (sumb + @coloroffset) * 0.5 * @distortion nz3 = (ha + hb) / 2 nw3 = (hb - ha) / 2*1i if @fourthdim == 3 z3 = nz3 w3 = nw3 elseif @fourthdim == 2 z3 = nz3 w3 = flip(nw3) elseif @fourthdim == 1 z3 = nw3 w3 = nz3 else z3 = nw3 w3 = flip(nz3) endif ENDIF endif IF (@zmode == 5) iterexp1 = iterexp1 + exp(-1/(cabs(z1old - z1))) iterexp2 = iterexp2 + exp(-1/(cabs(z2old - z2))) iterexp3 = iterexp3 + exp(-1/(cabs(z3old - z3))) ENDIF done = done + 1; increment iteration counter IF (@zmode == 0) ; 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 == 1) ; 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 == 2) ; 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 == 3) ; 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 == 4) ; 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 ENDIF IF (@bailout > (|a1-z1old| + |b1-w1old|) || \ @everyiter ||\ done == #maxit + 2); done, or every iteration, or last ; determine continuous iteration (height) for each point IF (@zmode >= 0 && @zmode <= 4) ; height based on smallest |z| e1 = s1 * @zscale e2 = s2 * @zscale e3 = s3 * @zscale ELSEIF (@zmode == 5) e1 = iterexp1 * @zscale e2 = iterexp2 * @zscale e3 = iterexp3 * @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 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 else z = z1 endif IF (@bailout > (|a1-z1old| + |b1-w1old|)) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope Newton M Set (hypercomplex)" center = (0.0,0.0) magn = 1.0 maxiter = 149 method = multipass periodicity = 0 param version caption = "Version" default = 1.26 visible = false endparam heading caption = "Slope Newton M Set (hypercomplex)" endheading heading caption = "Use Damien's Lighting Coloring" endheading heading caption = "Or Ron's 3D Texturizer Formulas" endheading heading caption = "Most other coloring formulas" endheading heading caption = "can also be used." endheading param fourthdim caption = "Fourth dimension" enum = "z1" "zi" "zj" "zk" default = 3 endparam param method caption = "Method" enum = "(h^exp + c) + r" \ "(h^exp) + r + c" default = 0 endparam param cjk caption = "(cj, ck)" default = (0.0, 0.0) endparam param p caption = "Exponent" default = (3.0, 0.0) endparam param r caption = "Root" default = (1.0, 0.0) endparam param rotx caption="x-rotation" hint="Rotates yz-plane." default=0.0 min=-360.0 max=360.0 endparam param roty caption="y-rotation" hint="Rotates zx-plane." default=0.0 min=-360.0 max=360.0 endparam param rotz caption="z-rotation" hint="Rotates xy-plane." default=0.0 min=-360.0 max=360.0 endparam param bailout caption = "Bailout Value" default = 0.00001 max = 0.1 endparam bool param slope caption = "Apply slope?" default = true endparam heading caption = "Slope Parameters" visible = @slope==true endheading param offset caption = "Orbit Separation" default = 0.00000001 hint = "Defines how far apart the simultaneous orbits are. Smaller \ distances will produce more accurate results." visible = @slope==true endparam param zmode caption = "Height Value" default = 5 enum = "smallest |z|" "smallest |real(z)|" \ "smallest |imag(z)|" "smallest summ(z)" "smallest |atan(z)|" \ "smoothed iteration" hint = "Specifies what will be used to construct a height value." visible = @slope==true 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." visible = @slope==true 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." visible = @slope==true 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." visible = @slope==true 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." visible = @slope==true endparam bool param fBm caption = "fBm texturing?" default = false endparam heading caption = "fBm Parameters" visible = @fBm == true endheading param distortion caption = "Distortion Strength" default = 1.0 hint = "This is the amount the noise distorts the image." visible = @fBm == true endparam param style caption = "Distortion Style" default = 1 enum = "radial" "linear" hint = "This selects whether the distortion will be focused \ around a single point, or directed along a line." visible = @fBm == true endparam param distangle caption = "Distortion Angle" default = 0.0 hint = "This is the angle to rotate the distortion." visible = @fBm == true endparam param distcenter caption = "Distortion Center" default = (0.0, 0.0) hint = "Sets the center of distortion. If Use Screen \ Center is set, this item is ignored." visible = @fBm == true 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." visible = @fBm == true endparam param coloroffset caption = "Coloring Offset" default = 1.0 hint = "Sets the coloring offset from zero. Increase this if you see \ large areas of solid color." visible = @fBm == true endparam param noffset 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." visible = @fBm == true endparam param scale caption = "Noise Scale" default = 1.0 hint = "This is the overall scale of the noise." visible = @fBm == true endparam param angle caption = "Noise Rotation" default = 0.0 hint = "This is the angle, in degrees, of the noise." visible = @fBm == true endparam param step caption = "Noise Scale Step" default = 0.5 hint = "This is the step in scale between noise iterations." visible = @fBm == true endparam param anglestep caption = "Noise Rotation Step" default = 37.0 hint = "This is the angle, in degrees, to rotate between noise \ iterations." visible = @fBm == true endparam param octaves caption = "Noise Octaves" default = 7 min = 1 hint = "This is the number of iterations of the noise formula." visible = @fBm == true endparam param npower caption = "Noise Exponent" default = 2.0 hint = "This is the exponent used to scramble numbers." visible = @fBm == true endparam param noisestart caption = "Start Iteration" default = 0.0 hint = "This is the iteration at which to start adding noise." visible = @fBm == true endparam param noiseiter caption = "Noise Iterations" default = 10000.0 hint = "This is the number of iterations to add noise to." visible = @fBm == true endparam param noiseskip caption = "Skip Iterations" default = 0.0 hint = "This is the number of iterations to skip adding noise \ before starting again." visible = @fBm == true endparam func nfn1 caption = "Noise Function" default = ident() visible = @fBm == true endfunc switch: type = "gnd-Slope_HypercomplexNewton" version = @version fourthdim = @fourthdim method = @method c1i = #pixel cjk = @cjk p = @p r = @r rotx = @rotx roty = @roty rotz = @rotz bailout = @bailout fBm = @fBm distortion = @distortion style = @style distangle = @distangle distcenter = @distcenter centermove = @centermove coloroffset = @coloroffset noffset = @noffset scale = @scale angle = @angle step = @step anglestep = @anglestep octaves = @octaves npower = @npower noisestart = @noisestart noiseiter = @noiseiter noiseskip = @noiseskip slope = @slope offset = @offset zmode = @zmode xfer = @xfer zscale = @zscale zscale2 = @zscale2 everyiter = @everyiter nfn1 = @nfn1 } gnd-Slope_Hyper-PopcornJul { ; based upon the slope (Julia) ; formula of Damien Jones ; Hypercomplex Popcorn Julia formula ; compound with the models of slope formulas from Ron Barnett. ; version 1.22, April 2005 ; Gilles Nadeau, 06/04/2005 ; init: complex z1 = #pixel complex z2 = #pixel + @offset; horizontally offset point complex z3 = #pixel + flip(@offset); vertically offset point complex w1 = @zjk complex w2 = @zjk complex w3 = @zjk complex ca = @c1i+@cjk*1i complex cb = @c1i-@cjk*1i complex a = (0.0, 0.0) complex b = (0.0, 0.0) float z1r = 0.0 float z1i = 0.0 float z1j = 0.0 float z1k = 0.0 float z2r = 0.0 float z2i = 0.0 float z2j = 0.0 float z2k = 0.0 float z3r = 0.0 float z3i = 0.0 float z3j = 0.0 float z3k = 0.0 float rx = 0.0 float ry = 0.0 float rz = 0.0 float xa = 0.0 float ya = 0.0 float xb = 0.0 float yb = 0.0 int done = 2 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 iterexp1 = 0.0 float iterexp2 = 0.0 float iterexp3 = 0.0 ; (yz plane rotation) ry = imag(z1)*cos(#pi*@rotx/180) - real(w1)*sin(#pi*@rotx/180) rz = imag(z1)*sin(#pi*@rotx/180) + real(w1)*cos(#pi*@rotx/180) z1 = real(z1) + ry*1i w1 = rz + imag(w1)*1i ry = imag(z2)*cos(#pi*@rotx/180) - real(w2)*sin(#pi*@rotx/180) rz = imag(z2)*sin(#pi*@rotx/180) + real(w2)*cos(#pi*@rotx/180) z2 = real(z2) + ry*1i w2 = rz + imag(w2)*1i ry = imag(z3)*cos(#pi*@rotx/180) - real(w3)*sin(#pi*@rotx/180) rz = imag(z3)*sin(#pi*@rotx/180) + real(w3)*cos(#pi*@rotx/180) z3 = real(z3) + ry*1i w3 = rz + imag(w3)*1i ; (xz plane rotation) rx = real(w1)*sin(#pi*@roty/180) + real(z1)*cos(#pi*@roty/180) rz = real(w1)*cos(#pi*@roty/180) - real(z1)*sin(#pi*@roty/180) z1 = rx + imag(z1)*1i w1 = rz + imag(w1)*1i rx = real(w2)*sin(#pi*@roty/180) + real(z2)*cos(#pi*@roty/180) rz = real(w2)*cos(#pi*@roty/180) - real(z2)*sin(#pi*@roty/180) z2 = rx + imag(z2)*1i w2 = rz + imag(w2)*1i rx = real(w3)*sin(#pi*@roty/180) + real(z3)*cos(#pi*@roty/180) rz = real(w3)*cos(#pi*@roty/180) - real(z3)*sin(#pi*@roty/180) z3 = rx + imag(z3)*1i w3 = rz + imag(w3)*1i ; (xy plane rotation) rx = real(z1)*cos(#pi*@rotz/180) - imag(z1)*sin(#pi*@rotz/180) ry = real(z1)*sin(#pi*@rotz/180) + imag(z1)*cos(#pi*@rotz/180) z1 = rx + ry*1i rx = real(z2)*cos(#pi*@rotz/180) - imag(z2)*sin(#pi*@rotz/180) ry = real(z2)*sin(#pi*@rotz/180) + imag(z2)*cos(#pi*@rotz/180) z2 = rx + ry*1i rx = real(z3)*cos(#pi*@rotz/180) - imag(z3)*sin(#pi*@rotz/180) ry = real(z3)*sin(#pi*@rotz/180) + imag(z3)*cos(#pi*@rotz/180) z3 = rx + ry*1i if @fourthdim == 3 z1r = real(z1) z1i = imag(z1) z1j = real(w1) z1k = imag(w1) z2r = real(z2) z2i = imag(z2) z2j = real(w2) z2k = imag(w2) z3r = real(z3) z3i = imag(z3) z3j = real(w3) z3k = imag(w3) elseif @fourthdim == 2 z1r = real(z1) z1i = imag(z1) z1j = imag(w1) z1k = real(w1) z2r = real(z2) z2i = imag(z2) z2j = imag(w2) z2k = real(w2) z3r = real(z3) z3i = imag(z3) z3j = imag(w3) z3k = real(w3) elseif @fourthdim == 1 z1r = real(w1) z1i = imag(w1) z1j = real(z1) z1k = imag(z1) z2r = real(w2) z2i = imag(w2) z2j = real(z2) z2k = imag(z2) z3r = real(w3) z3i = imag(w3) z3j = real(z3) z3k = imag(z3) else z1r = imag(w1) z1i = real(w1) z1j = real(z1) z1k = imag(z1) z2r = imag(w2) z2i = real(w2) z2j = real(z2) z2k = imag(z2) z3r = imag(w3) z3i = real(w3) z3j = real(z3) z3k = imag(z3) endif loop: xa = z1r - z1k ya = z1i + z1j xb = z1r + z1k yb = z1i - z1j a = xa - @h * @fn1(ya + @fn2(ca * ya)) \ +flip(ya - @h * @fn3(xa + @fn4(ca * xa))) b = xb - @h * @fn1(yb + @fn2(cb * yb)) \ +flip(yb - @h * @fn3(xb + @fn4(cb * xb))) z1r = (real(a) + real(b)) / 2 z1i = (imag(a) + imag(b)) / 2 z1j = (imag(a) - imag(b)) / 2 z1k = (real(b) - real(a)) / 2 if @fourthdim == 3 z1 = z1r + flip(z1i) w1 = z1j + flip(z1k) elseif @fourthdim == 2 z1 = z1r + flip(z1i) w1 = z1k + flip(z1j) elseif @fourthdim == 1 z1 = z1j + flip(z1k) w1 = z1r + flip(z1i) else z1 = z1j + flip(z1k) w1 = z1i + flip(z1r) endif if (@slope == true) xa = z2r - z2k ya = z2i + z2j xb = z2r + z2k yb = z2i - z2j a = xa - @h * @fn1(ya + @fn2(ca * ya)) \ +flip(ya - @h * @fn3(xa + @fn4(ca * xa))) b = xb - @h * @fn1(yb + @fn2(cb * yb)) \ +flip(yb - @h * @fn3(xb + @fn4(cb * xb))) z2r = (real(a) + real(b)) / 2 z2i = (imag(a) + imag(b)) / 2 z2j = (imag(a) - imag(b)) / 2 z2k = (real(b) - real(a)) / 2 if @fourthdim == 3 z2 = z2r + flip(z2i) w2 = z2j + flip(z2k) elseif @fourthdim == 2 z2 = z2r + flip(z2i) w2 = z2k + flip(z2j) elseif @fourthdim == 1 z2 = z2j + flip(z2k) w2 = z2r + flip(z2i) else z2 = z2j + flip(z2k) w2 = z2i + flip(z2r) endif xa = z3r - z3k ya = z3i + z3j xb = z3r + z3k yb = z3i - z3j a = xa - @h * @fn1(ya + @fn2(ca * ya)) \ +flip(ya - @h * @fn3(xa + @fn4(ca * xa))) b = xb - @h * @fn1(yb + @fn2(cb * yb)) \ +flip(yb - @h * @fn3(xb + @fn4(cb * xb))) z3r = (real(a) + real(b)) / 2 z3i = (imag(a) + imag(b)) / 2 z3j = (imag(a) - imag(b)) / 2 z3k = (real(b) - real(a)) / 2 if @fourthdim == 3 z3 = z3r + flip(z3i) w3 = z3j + flip(z3k) elseif @fourthdim == 2 z3 = z3r + flip(z3i) w3 = z3k + flip(z3j) elseif @fourthdim == 1 z3 = z3j + flip(z3k) w3 = z3r + flip(z3i) else z3 = z3j + flip(z3k) w3 = z3i + flip(z3r) endif IF (@zmode == 5) iterexp1 = iterexp1 + exp(-cabs(z1)) iterexp2 = iterexp2 + exp(-cabs(z2)) iterexp3 = iterexp3 + exp(-cabs(z3)) ENDIF done = done + 1; increment iteration counter IF (@zmode == 0) ; 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 == 1) ; 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 == 2) ; 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 == 3) ; 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 == 4) ; 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 ENDIF IF (@bailout < |z1| + |w1| || \ @everyiter ||\ done == #maxit + 2); done, or every iteration, or last ; determine continuous iteration (height) for each point IF (@zmode >= 0 && @zmode <= 4) ; height based on smallest |z| e1 = s1 * @zscale e2 = s2 * @zscale e3 = s3 * @zscale ELSEIF (@zmode == 5) e1 = iterexp1 * @zscale e2 = iterexp2 * @zscale e3 = iterexp3 * @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 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 else z = z1 endif IF (@bailout < |z1| + |w1|) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope Hypercomplex Popcorn Julia" center = (0.0,0.0) magn = 0.7 maxiter = 149 method = multipass periodicity = 0 param version caption = "Version" default = 1.22 visible = false endparam heading caption = "Slope Hypercomplex Popcorn Julia" endheading heading caption = "Use Damien's Lighting Coloring" endheading heading caption = "Or Ron's 3D Texturizer Formulas" endheading heading caption = "Most other coloring formulas" endheading heading caption = "can also be used." endheading param fourthdim caption = "Fourth dimension" enum = "z1" "zi" "zj" "zk" default = 3 endparam param h caption = "Step size" default = (0.05, 0.0) endparam param c1i caption = "Constant C" default = (3.0, 0.0) endparam param cjk caption = "Constant D" default = (0.0, 0.0) endparam param zjk caption = "(zj, zk)" default = (0.0, 0.0) endparam param rotx caption = "x-rotation" hint = "Rotates yz-plane." default = 0.0 min = -360.0 max = 360.0 endparam param roty caption = "y-rotation" hint = "Rotates zx-plane." default = 0.0 min = -360.0 max = 360.0 endparam param rotz caption = "z-rotation" hint = "Rotates xy-plane." default = 0.0 min = -360.0 max = 360.0 endparam func fn1 caption = "First Function" default = sin() endfunc func fn2 caption = "Second Function" default = tan() endfunc func fn3 caption = "Third Function" default = sin() endfunc func fn4 caption = "Fourth Function" default = tan() endfunc param bailout caption = "Bailout Value" default = 4.0 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam bool param slope caption = "Apply slope?" default = true endparam heading caption = "Slope Parameters" visible = @slope==true endheading param offset caption = "Orbit Separation" default = 0.00000001 hint = "Defines how far apart the simultaneous orbits are. Smaller \ distances will produce more accurate results." visible = @slope==true endparam param zmode caption = "Height Value" default = 5 enum = "smallest |z|" "smallest |real(z)|" \ "smallest |imag(z)|" "smallest summ(z)" "smallest |atan(z)|" \ "smoothed iteration" hint = "Specifies what will be used to construct a height value." visible = @slope==true 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." visible = @slope==true 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." visible = @slope==true 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." visible = @slope==true 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." visible = @slope==true endparam } gnd-Slope_Hyper-fBmPopcorn { ; based upon the slope (Julia) ; formula of Damien Jones ; Hypercomplex fBm Popcorn formula ; compound with the models of slope formulas from Ron Barnett. ; 4-dimensional Fractional Brownian Motion ; Based on original code from Damien M. Jones. ; version 1.14, October 2005 ; Gilles Nadeau, 17/10/2005 ; init: complex z1 = #pixel complex z2 = z1 + @offset; horizontally offset point complex z3 = z1 + flip(@offset); vertically offset point complex w1 = @zjk complex w2 = w1 complex w3 = w1 complex ca = @c1i+@cjk*1i complex cb = @c1i-@cjk*1i complex a = (0.0, 0.0) complex b = (0.0, 0.0) complex nz1 = z1 complex nz2 = z2 complex nz3 = z3 complex nw1 = w1 complex nw2 = w2 complex nw3 = w3 float z1r = 0.0 float z1i = 0.0 float z1j = 0.0 float z1k = 0.0 float z2r = 0.0 float z2i = 0.0 float z2j = 0.0 float z2k = 0.0 float z3r = 0.0 float z3i = 0.0 float z3j = 0.0 float z3k = 0.0 float rx = 0.0 float ry = 0.0 float rz = 0.0 float xa = 0.0 float ya = 0.0 float xb = 0.0 float yb = 0.0 int done = 2 int iter = 0 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 iterexp1 = 0.0 float iterexp2 = 0.0 float iterexp3 = 0.0 complex c = @distcenter IF (@centermove) c = #center ENDIF complex r1 = (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 ; (yz plane rotation) ry = imag(z1)*cos(#pi*@rotx/180) - real(w1)*sin(#pi*@rotx/180) rz = imag(z1)*sin(#pi*@rotx/180) + real(w1)*cos(#pi*@rotx/180) z1 = real(z1) + ry*1i w1 = rz + imag(w1)*1i ry = imag(z2)*cos(#pi*@rotx/180) - real(w2)*sin(#pi*@rotx/180) rz = imag(z2)*sin(#pi*@rotx/180) + real(w2)*cos(#pi*@rotx/180) z2 = real(z2) + ry*1i w2 = rz + imag(w2)*1i ry = imag(z3)*cos(#pi*@rotx/180) - real(w3)*sin(#pi*@rotx/180) rz = imag(z3)*sin(#pi*@rotx/180) + real(w3)*cos(#pi*@rotx/180) z3 = real(z3) + ry*1i w3 = rz + imag(w3)*1i ; (xz plane rotation) rx = real(w1)*sin(#pi*@roty/180) + real(z1)*cos(#pi*@roty/180) rz = real(w1)*cos(#pi*@roty/180) - real(z1)*sin(#pi*@roty/180) z1 = rx + imag(z1)*1i w1 = rz + imag(w1)*1i rx = real(w2)*sin(#pi*@roty/180) + real(z2)*cos(#pi*@roty/180) rz = real(w2)*cos(#pi*@roty/180) - real(z2)*sin(#pi*@roty/180) z2 = rx + imag(z2)*1i w2 = rz + imag(w2)*1i rx = real(w3)*sin(#pi*@roty/180) + real(z3)*cos(#pi*@roty/180) rz = real(w3)*cos(#pi*@roty/180) - real(z3)*sin(#pi*@roty/180) z3 = rx + imag(z3)*1i w3 = rz + imag(w3)*1i ; (xy plane rotation) rx = real(z1)*cos(#pi*@rotz/180) - imag(z1)*sin(#pi*@rotz/180) ry = real(z1)*sin(#pi*@rotz/180) + imag(z1)*cos(#pi*@rotz/180) z1 = rx + ry*1i rx = real(z2)*cos(#pi*@rotz/180) - imag(z2)*sin(#pi*@rotz/180) ry = real(z2)*sin(#pi*@rotz/180) + imag(z2)*cos(#pi*@rotz/180) z2 = rx + ry*1i rx = real(z3)*cos(#pi*@rotz/180) - imag(z3)*sin(#pi*@rotz/180) ry = real(z3)*sin(#pi*@rotz/180) + imag(z3)*cos(#pi*@rotz/180) z3 = rx + ry*1i if @fourthdim == 3 z1r = real(z1) z1i = imag(z1) z1j = real(w1) z1k = imag(w1) z2r = real(z2) z2i = imag(z2) z2j = real(w2) z2k = imag(w2) z3r = real(z3) z3i = imag(z3) z3j = real(w3) z3k = imag(w3) elseif @fourthdim == 2 z1r = real(z1) z1i = imag(z1) z1j = imag(w1) z1k = real(w1) z2r = real(z2) z2i = imag(z2) z2j = imag(w2) z2k = real(w2) z3r = real(z3) z3i = imag(z3) z3j = imag(w3) z3k = real(w3) elseif @fourthdim == 1 z1r = real(w1) z1i = imag(w1) z1j = real(z1) z1k = imag(z1) z2r = real(w2) z2i = imag(w2) z2j = real(z2) z2k = imag(z2) z3r = real(w3) z3i = imag(w3) z3j = real(z3) z3k = imag(z3) else z1r = imag(w1) z1i = real(w1) z1j = real(z1) z1k = imag(z1) z2r = imag(w2) z2i = real(w2) z2j = real(z2) z2k = imag(z2) z3r = imag(w3) z3i = real(w3) z3j = real(z3) z3k = imag(z3) endif loop: iter = iter + 1 if (@fBm) 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 endif xa = z1r - z1k ya = z1i + z1j xb = z1r + z1k yb = z1i - z1j a = xa - @h * @fn1(ya + @fn2(ca * ya)) \ +flip(ya - @h * @fn3(xa + @fn4(ca * xa))) b = xb - @h * @fn1(yb + @fn2(cb * yb)) \ +flip(yb - @h * @fn3(xb + @fn4(cb * xb))) z1r = (real(a) + real(b)) / 2 z1i = (imag(a) + imag(b)) / 2 z1j = (imag(a) - imag(b)) / 2 z1k = (real(b) - real(a)) / 2 if @fourthdim == 3 z1 = z1r + flip(z1i) w1 = z1j + flip(z1k) elseif @fourthdim == 2 z1 = z1r + flip(z1i) w1 = z1k + flip(z1j) elseif @fourthdim == 1 z1 = z1j + flip(z1k) w1 = z1r + flip(z1i) else z1 = z1j + flip(z1k) w1 = z1i + flip(z1r) endif if (@fBm == true) IF (@noiseskip == 0.0 || noise); adding noise this iteration complex pa = a * @scale * r1 + @noffset complex pb = b * @scale * r1 + @noffset float suma = 0.0 float sumb = 0.0 float freq = 1.0 complex va = (0,0) complex vb = (0,0) int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxa = floor(real(pa)) float fya = floor(imag(pa)) float bx0a = fxa % 256 float by0a = fya % 256 IF (bx0a < 0) bx0a = bx0a + 256 ENDIF IF (by0a < 0) by0a = by0a + 256 ENDIF float bx1a = (bx0a + 1) % 256 float by1a = (by0a + 1) % 256 float rx0a = real(pa) - fxa float ry0a = imag(pa) - fya float rx1a = rx0a - 1 float ry1a = ry0a - 1 float fxb = floor(real(pb)) float fyb = floor(imag(pb)) float bx0b = fxb % 256 float by0b = fyb % 256 IF (bx0b < 0) bx0b = bx0b + 256 ENDIF IF (by0b < 0) by0b = by0b + 256 ENDIF float bx1b = (bx0b + 1) % 256 float by1b = (by0b + 1) % 256 float rx0b = real(pb) - fxb float ry0b = imag(pb) - fyb float rx1b = rx0b - 1 float ry1b = ry0b - 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 b00a = (bx0a^@npower % 65536 + by0a)^@npower % 65536 float b10a = (bx1a^@npower % 65536 + by0a)^@npower % 65536 float b01a = (bx0a^@npower % 65536 + by1a)^@npower % 65536 float b11a = (bx1a^@npower % 65536 + by1a)^@npower % 65536 float b00b = (bx0b^@npower % 65536 + by0b)^@npower % 65536 float b10b = (bx1b^@npower % 65536 + by0b)^@npower % 65536 float b01b = (bx0b^@npower % 65536 + by1b)^@npower % 65536 float b11b = (bx1b^@npower % 65536 + by1b)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0a = (b00a)^@npower*0.25 % 512 - 256 float g_b10_0a = (b10a)^@npower*0.25 % 512 - 256 float g_b01_0a = (b01a)^@npower*0.25 % 512 - 256 float g_b11_0a = (b11a)^@npower*0.25 % 512 - 256 float g_b00_1a = (b00a+1)^@npower*0.25 % 512 - 256 float g_b10_1a = (b10a+1)^@npower*0.25 % 512 - 256 float g_b01_1a = (b01a+1)^@npower*0.25 % 512 - 256 float g_b11_1a = (b11a+1)^@npower*0.25 % 512 - 256 float g_b00_0b = (b00b)^@npower*0.25 % 512 - 256 float g_b10_0b = (b10b)^@npower*0.25 % 512 - 256 float g_b01_0b = (b01b)^@npower*0.25 % 512 - 256 float g_b11_0b = (b11b)^@npower*0.25 % 512 - 256 float g_b00_1b = (b00b+1)^@npower*0.25 % 512 - 256 float g_b10_1b = (b10b+1)^@npower*0.25 % 512 - 256 float g_b01_1b = (b01b+1)^@npower*0.25 % 512 - 256 float g_b11_1b = (b11b+1)^@npower*0.25 % 512 - 256 ; normalize each vector float da = 0.0 float db = 0.0; da = 1 / sqrt(sqr(g_b00_0a) + sqr(g_b00_1a)) g_b00_0a = g_b00_0a * da g_b00_1a = g_b00_1a * da da = 1 / sqrt(sqr(g_b10_0a) + sqr(g_b10_1a)) g_b10_0a = g_b10_0a * da g_b10_1a = g_b10_1a * da da = 1 / sqrt(sqr(g_b01_0a) + sqr(g_b01_1a)) g_b01_0a = g_b01_0a * da g_b01_1a = g_b01_1a * da da = 1 / sqrt(sqr(g_b11_0a) + sqr(g_b11_1a)) g_b11_0a = g_b11_0a * da g_b11_1a = g_b11_1a * da db = 1 / sqrt(sqr(g_b00_0b) + sqr(g_b00_1b)) g_b00_0b = g_b00_0b * db g_b00_1b = g_b00_1b * db db = 1 / sqrt(sqr(g_b10_0b) + sqr(g_b10_1b)) g_b10_0b = g_b10_0b * db g_b10_1b = g_b10_1b * db db = 1 / sqrt(sqr(g_b01_0b) + sqr(g_b01_1b)) g_b01_0b = g_b01_0b * db g_b01_1b = g_b01_1b * db db = 1 / sqrt(sqr(g_b11_0b) + sqr(g_b11_1b)) g_b11_0b = g_b11_0b * db g_b11_1b = g_b11_1b * db ; produce colors for each corner float u1a = rx0a * g_b00_0a + ry0a * g_b00_1a float v1a = rx1a * g_b10_0a + ry0a * g_b10_1a float u2a = rx0a * g_b01_0a + ry1a * g_b01_1a float v2a = rx1a * g_b11_0a + ry1a * g_b11_1a float u1b = rx0b * g_b00_0b + ry0b * g_b00_1b float v1b = rx1b * g_b10_0b + ry0b * g_b10_1b float u2b = rx0b * g_b01_0b + ry1b * g_b01_1b float v2b = rx1b * g_b11_0b + ry1b * g_b11_1b ; interpolate between corners using ; bilinear filtering float sxa = sqr(rx0a) * (3 - rx0a*2) float sya = sqr(ry0a) * (3 - ry0a*2) float sxb = sqr(rx0b) * (3 - rx0b*2) float syb = sqr(ry0b) * (3 - ry0b*2) float aa = u1a + sxa*(v1a-u1a) float ba = u2a + sxa*(v2a-u2a) float ab = u1b + sxb*(v1b-u1b) float bb = u2b + sxb*(v2b-u2b) suma = suma + real(@nfn1(aa + sya*(ba-aa)))*freq sumb = sumb + real(@nfn1(ab + syb*(bb-ab)))*freq freq = freq * @step pa = pa * r2 / @step pb = pb * r2 / @step i = i - 1 ENDWHILE IF (@style == 0); radial distortion va = (a-c)/cabs(a-c) * r3; use vector based on angle to distortion center vb = (b-c)/cabs(b-c) * r3 ELSEIF (@style == 1); linear distortion va = r3; just use rotation vector vb = r3 ENDIF a = a + va * (suma + @coloroffset) * 0.5 * @distortion b = b + vb * (sumb + @coloroffset) * 0.5 * @distortion nz1 = (a + b) / 2 nw1 = (b - a) / 2*1i if @fourthdim == 3 z1 = nz1 w1 = nw1 elseif @fourthdim == 2 z1 = nz1 w1 = flip(nw1) elseif @fourthdim == 1 z1 = nw1 w1 = nz1 else z1 = nw1 w1 = flip(nz1) endif ENDIF endif if (@slope == true) xa = z2r - z2k ya = z2i + z2j xb = z2r + z2k yb = z2i - z2j a = xa - @h * @fn1(ya + @fn2(ca * ya)) \ +flip(ya - @h * @fn3(xa + @fn4(ca * xa))) b = xb - @h * @fn1(yb + @fn2(cb * yb)) \ +flip(yb - @h * @fn3(xb + @fn4(cb * xb))) z2r = (real(a) + real(b)) / 2 z2i = (imag(a) + imag(b)) / 2 z2j = (imag(a) - imag(b)) / 2 z2k = (real(b) - real(a)) / 2 if @fourthdim == 3 z2 = z2r + flip(z2i) w2 = z2j + flip(z2k) elseif @fourthdim == 2 z2 = z2r + flip(z2i) w2 = z2k + flip(z2j) elseif @fourthdim == 1 z2 = z2j + flip(z2k) w2 = z2r + flip(z2i) else z2 = z2j + flip(z2k) w2 = z2i + flip(z2r) endif if (@fBm == true) IF (@noiseskip == 0.0 || noise); adding noise this iteration complex pa = a * @scale * r1 + @noffset complex pb = b * @scale * r1 + @noffset float suma = 0.0 float sumb = 0.0 float freq = 1.0 complex va = (0,0) complex vb = (0,0) int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxa = floor(real(pa)) float fya = floor(imag(pa)) float bx0a = fxa % 256 float by0a = fya % 256 IF (bx0a < 0) bx0a = bx0a + 256 ENDIF IF (by0a < 0) by0a = by0a + 256 ENDIF float bx1a = (bx0a + 1) % 256 float by1a = (by0a + 1) % 256 float rx0a = real(pa) - fxa float ry0a = imag(pa) - fya float rx1a = rx0a - 1 float ry1a = ry0a - 1 float fxb = floor(real(pb)) float fyb = floor(imag(pb)) float bx0b = fxb % 256 float by0b = fyb % 256 IF (bx0b < 0) bx0b = bx0b + 256 ENDIF IF (by0b < 0) by0b = by0b + 256 ENDIF float bx1b = (bx0b + 1) % 256 float by1b = (by0b + 1) % 256 float rx0b = real(pb) - fxb float ry0b = imag(pb) - fyb float rx1b = rx0b - 1 float ry1b = ry0b - 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 b00a = (bx0a^@npower % 65536 + by0a)^@npower % 65536 float b10a = (bx1a^@npower % 65536 + by0a)^@npower % 65536 float b01a = (bx0a^@npower % 65536 + by1a)^@npower % 65536 float b11a = (bx1a^@npower % 65536 + by1a)^@npower % 65536 float b00b = (bx0b^@npower % 65536 + by0b)^@npower % 65536 float b10b = (bx1b^@npower % 65536 + by0b)^@npower % 65536 float b01b = (bx0b^@npower % 65536 + by1b)^@npower % 65536 float b11b = (bx1b^@npower % 65536 + by1b)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0a = (b00a)^@npower*0.25 % 512 - 256 float g_b10_0a = (b10a)^@npower*0.25 % 512 - 256 float g_b01_0a = (b01a)^@npower*0.25 % 512 - 256 float g_b11_0a = (b11a)^@npower*0.25 % 512 - 256 float g_b00_1a = (b00a+1)^@npower*0.25 % 512 - 256 float g_b10_1a = (b10a+1)^@npower*0.25 % 512 - 256 float g_b01_1a = (b01a+1)^@npower*0.25 % 512 - 256 float g_b11_1a = (b11a+1)^@npower*0.25 % 512 - 256 float g_b00_0b = (b00b)^@npower*0.25 % 512 - 256 float g_b10_0b = (b10b)^@npower*0.25 % 512 - 256 float g_b01_0b = (b01b)^@npower*0.25 % 512 - 256 float g_b11_0b = (b11b)^@npower*0.25 % 512 - 256 float g_b00_1b = (b00b+1)^@npower*0.25 % 512 - 256 float g_b10_1b = (b10b+1)^@npower*0.25 % 512 - 256 float g_b01_1b = (b01b+1)^@npower*0.25 % 512 - 256 float g_b11_1b = (b11b+1)^@npower*0.25 % 512 - 256 ; normalize each vector float da = 0.0 float db = 0.0; da = 1 / sqrt(sqr(g_b00_0a) + sqr(g_b00_1a)) g_b00_0a = g_b00_0a * da g_b00_1a = g_b00_1a * da da = 1 / sqrt(sqr(g_b10_0a) + sqr(g_b10_1a)) g_b10_0a = g_b10_0a * da g_b10_1a = g_b10_1a * da da = 1 / sqrt(sqr(g_b01_0a) + sqr(g_b01_1a)) g_b01_0a = g_b01_0a * da g_b01_1a = g_b01_1a * da da = 1 / sqrt(sqr(g_b11_0a) + sqr(g_b11_1a)) g_b11_0a = g_b11_0a * da g_b11_1a = g_b11_1a * da db = 1 / sqrt(sqr(g_b00_0b) + sqr(g_b00_1b)) g_b00_0b = g_b00_0b * db g_b00_1b = g_b00_1b * db db = 1 / sqrt(sqr(g_b10_0b) + sqr(g_b10_1b)) g_b10_0b = g_b10_0b * db g_b10_1b = g_b10_1b * db db = 1 / sqrt(sqr(g_b01_0b) + sqr(g_b01_1b)) g_b01_0b = g_b01_0b * db g_b01_1b = g_b01_1b * db db = 1 / sqrt(sqr(g_b11_0b) + sqr(g_b11_1b)) g_b11_0b = g_b11_0b * db g_b11_1b = g_b11_1b * db ; produce colors for each corner float u1a = rx0a * g_b00_0a + ry0a * g_b00_1a float v1a = rx1a * g_b10_0a + ry0a * g_b10_1a float u2a = rx0a * g_b01_0a + ry1a * g_b01_1a float v2a = rx1a * g_b11_0a + ry1a * g_b11_1a float u1b = rx0b * g_b00_0b + ry0b * g_b00_1b float v1b = rx1b * g_b10_0b + ry0b * g_b10_1b float u2b = rx0b * g_b01_0b + ry1b * g_b01_1b float v2b = rx1b * g_b11_0b + ry1b * g_b11_1b ; interpolate between corners using ; bilinear filtering float sxa = sqr(rx0a) * (3 - rx0a*2) float sya = sqr(ry0a) * (3 - ry0a*2) float sxb = sqr(rx0b) * (3 - rx0b*2) float syb = sqr(ry0b) * (3 - ry0b*2) float aa = u1a + sxa*(v1a-u1a) float ba = u2a + sxa*(v2a-u2a) float ab = u1b + sxb*(v1b-u1b) float bb = u2b + sxb*(v2b-u2b) suma = suma + real(@nfn1(aa + sya*(ba-aa)))*freq sumb = sumb + real(@nfn1(ab + syb*(bb-ab)))*freq freq = freq * @step pa = pa * r2 / @step pb = pb * r2 / @step i = i - 1 ENDWHILE IF (@style == 0); radial distortion va = (a-c)/cabs(a-c) * r3; use vector based on angle to distortion center vb = (b-c)/cabs(b-c) * r3 ELSEIF (@style == 1); linear distortion va = r3; just use rotation vector vb = r3 ENDIF a = a + va * (suma + @coloroffset) * 0.5 * @distortion b = b + vb * (sumb + @coloroffset) * 0.5 * @distortion nz2 = (a + b) / 2 nw2 = (b - a) / 2*1i if @fourthdim == 3 z2 = nz2 w2 = nw2 elseif @fourthdim == 2 z2 = nz2 w2 = flip(nw2) elseif @fourthdim == 1 z2 = nw2 w2 = nz2 else z2 = nw2 w2 = flip(nz2) endif ENDIF endif xa = z3r - z3k ya = z3i + z3j xb = z3r + z3k yb = z3i - z3j a = xa - @h * @fn1(ya + @fn2(ca * ya)) \ +flip(ya - @h * @fn3(xa + @fn4(ca * xa))) b = xb - @h * @fn1(yb + @fn2(cb * yb)) \ +flip(yb - @h * @fn3(xb + @fn4(cb * xb))) z3r = (real(a) + real(b)) / 2 z3i = (imag(a) + imag(b)) / 2 z3j = (imag(a) - imag(b)) / 2 z3k = (real(b) - real(a)) / 2 if @fourthdim == 3 z3 = z3r + flip(z3i) w3 = z3j + flip(z3k) elseif @fourthdim == 2 z3 = z3r + flip(z3i) w3 = z3k + flip(z3j) elseif @fourthdim == 1 z3 = z3j + flip(z3k) w3 = z3r + flip(z3i) else z3 = z3j + flip(z3k) w3 = z3i + flip(z3r) endif if (@fBm == true) IF (@noiseskip == 0.0 || noise); adding noise this iteration complex pa = a * @scale * r1 + @noffset complex pb = b * @scale * r1 + @noffset float suma = 0.0 float sumb = 0.0 float freq = 1.0 complex va = (0,0) complex vb = (0,0) int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxa = floor(real(pa)) float fya = floor(imag(pa)) float bx0a = fxa % 256 float by0a = fya % 256 IF (bx0a < 0) bx0a = bx0a + 256 ENDIF IF (by0a < 0) by0a = by0a + 256 ENDIF float bx1a = (bx0a + 1) % 256 float by1a = (by0a + 1) % 256 float rx0a = real(pa) - fxa float ry0a = imag(pa) - fya float rx1a = rx0a - 1 float ry1a = ry0a - 1 float fxb = floor(real(pb)) float fyb = floor(imag(pb)) float bx0b = fxb % 256 float by0b = fyb % 256 IF (bx0b < 0) bx0b = bx0b + 256 ENDIF IF (by0b < 0) by0b = by0b + 256 ENDIF float bx1b = (bx0b + 1) % 256 float by1b = (by0b + 1) % 256 float rx0b = real(pb) - fxb float ry0b = imag(pb) - fyb float rx1b = rx0b - 1 float ry1b = ry0b - 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 b00a = (bx0a^@npower % 65536 + by0a)^@npower % 65536 float b10a = (bx1a^@npower % 65536 + by0a)^@npower % 65536 float b01a = (bx0a^@npower % 65536 + by1a)^@npower % 65536 float b11a = (bx1a^@npower % 65536 + by1a)^@npower % 65536 float b00b = (bx0b^@npower % 65536 + by0b)^@npower % 65536 float b10b = (bx1b^@npower % 65536 + by0b)^@npower % 65536 float b01b = (bx0b^@npower % 65536 + by1b)^@npower % 65536 float b11b = (bx1b^@npower % 65536 + by1b)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0a = (b00a)^@npower*0.25 % 512 - 256 float g_b10_0a = (b10a)^@npower*0.25 % 512 - 256 float g_b01_0a = (b01a)^@npower*0.25 % 512 - 256 float g_b11_0a = (b11a)^@npower*0.25 % 512 - 256 float g_b00_1a = (b00a+1)^@npower*0.25 % 512 - 256 float g_b10_1a = (b10a+1)^@npower*0.25 % 512 - 256 float g_b01_1a = (b01a+1)^@npower*0.25 % 512 - 256 float g_b11_1a = (b11a+1)^@npower*0.25 % 512 - 256 float g_b00_0b = (b00b)^@npower*0.25 % 512 - 256 float g_b10_0b = (b10b)^@npower*0.25 % 512 - 256 float g_b01_0b = (b01b)^@npower*0.25 % 512 - 256 float g_b11_0b = (b11b)^@npower*0.25 % 512 - 256 float g_b00_1b = (b00b+1)^@npower*0.25 % 512 - 256 float g_b10_1b = (b10b+1)^@npower*0.25 % 512 - 256 float g_b01_1b = (b01b+1)^@npower*0.25 % 512 - 256 float g_b11_1b = (b11b+1)^@npower*0.25 % 512 - 256 ; normalize each vector float da = 0.0 float db = 0.0; da = 1 / sqrt(sqr(g_b00_0a) + sqr(g_b00_1a)) g_b00_0a = g_b00_0a * da g_b00_1a = g_b00_1a * da da = 1 / sqrt(sqr(g_b10_0a) + sqr(g_b10_1a)) g_b10_0a = g_b10_0a * da g_b10_1a = g_b10_1a * da da = 1 / sqrt(sqr(g_b01_0a) + sqr(g_b01_1a)) g_b01_0a = g_b01_0a * da g_b01_1a = g_b01_1a * da da = 1 / sqrt(sqr(g_b11_0a) + sqr(g_b11_1a)) g_b11_0a = g_b11_0a * da g_b11_1a = g_b11_1a * da db = 1 / sqrt(sqr(g_b00_0b) + sqr(g_b00_1b)) g_b00_0b = g_b00_0b * db g_b00_1b = g_b00_1b * db db = 1 / sqrt(sqr(g_b10_0b) + sqr(g_b10_1b)) g_b10_0b = g_b10_0b * db g_b10_1b = g_b10_1b * db db = 1 / sqrt(sqr(g_b01_0b) + sqr(g_b01_1b)) g_b01_0b = g_b01_0b * db g_b01_1b = g_b01_1b * db db = 1 / sqrt(sqr(g_b11_0b) + sqr(g_b11_1b)) g_b11_0b = g_b11_0b * db g_b11_1b = g_b11_1b * db ; produce colors for each corner float u1a = rx0a * g_b00_0a + ry0a * g_b00_1a float v1a = rx1a * g_b10_0a + ry0a * g_b10_1a float u2a = rx0a * g_b01_0a + ry1a * g_b01_1a float v2a = rx1a * g_b11_0a + ry1a * g_b11_1a float u1b = rx0b * g_b00_0b + ry0b * g_b00_1b float v1b = rx1b * g_b10_0b + ry0b * g_b10_1b float u2b = rx0b * g_b01_0b + ry1b * g_b01_1b float v2b = rx1b * g_b11_0b + ry1b * g_b11_1b ; interpolate between corners using ; bilinear filtering float sxa = sqr(rx0a) * (3 - rx0a*2) float sya = sqr(ry0a) * (3 - ry0a*2) float sxb = sqr(rx0b) * (3 - rx0b*2) float syb = sqr(ry0b) * (3 - ry0b*2) float aa = u1a + sxa*(v1a-u1a) float ba = u2a + sxa*(v2a-u2a) float ab = u1b + sxb*(v1b-u1b) float bb = u2b + sxb*(v2b-u2b) suma = suma + real(@nfn1(aa + sya*(ba-aa)))*freq sumb = sumb + real(@nfn1(ab + syb*(bb-ab)))*freq freq = freq * @step pa = pa * r2 / @step pb = pb * r2 / @step i = i - 1 ENDWHILE IF (@style == 0); radial distortion va = (a-c)/cabs(a-c) * r3; use vector based on angle to distortion center vb = (b-c)/cabs(b-c) * r3 ELSEIF (@style == 1); linear distortion va = r3; just use rotation vector vb = r3 ENDIF a = a + va * (suma + @coloroffset) * 0.5 * @distortion b = b + vb * (sumb + @coloroffset) * 0.5 * @distortion nz3 = (a + b) / 2 nw3 = (b - a) / 2*1i if @fourthdim == 3 z3 = nz3 w3 = nw3 elseif @fourthdim == 2 z3 = nz3 w3 = flip(nw3) elseif @fourthdim == 1 z3 = nw3 w3 = nz3 else z3 = nw3 w3 = flip(nz3) endif ENDIF endif IF (@zmode == 5) iterexp1 = iterexp1 + exp(-cabs(z1)) iterexp2 = iterexp2 + exp(-cabs(z2)) iterexp3 = iterexp3 + exp(-cabs(z3)) ENDIF done = done + 1; increment iteration counter IF (@zmode == 0) ; 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 == 1) ; 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 == 2) ; 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 == 3) ; 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 == 4) ; 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 ENDIF IF (#maxiter - 1 < iter || \ @everyiter ||\ done == #maxiter + 2); done, or every iteration, or last ; determine continuous iteration (height) for each point IF (@zmode >= 0 && @zmode <= 4) ; height based on smallest |z| e1 = s1 * @zscale e2 = s2 * @zscale e3 = s3 * @zscale ELSEIF (@zmode == 5) e1 = iterexp1 * @zscale e2 = iterexp2 * @zscale e3 = iterexp3 * @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 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 else z = z1 endif IF (#maxiter - 1 < iter) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope Hypercomplex fBm Popcorn" center = (0.0,0.0) magn = 0.7 maxiter = 6 method = multipass periodicity = 0 param version caption = "Version" default = 1.14 visible = false endparam heading caption = "Slope Hypercomplex fBm Popcorn" endheading heading caption = "Use Damien's Lighting Coloring" endheading heading caption = "Or Ron's 3D Texturizer Formulas" endheading heading caption = "Most other coloring formulas" endheading heading caption = "can also be used." endheading param fourthdim caption = "Fourth dimension" enum = "z1" "zi" "zj" "zk" default = 3 endparam param h caption = "Step size" default = (0.05, 0.0) endparam param c1i caption = "Constant C" default = (3.0, 0.0) endparam param cjk caption = "Constant D" default = (0.0, 0.0) endparam param zjk caption = "(zj, zk)" default = (0.0, 0.0) endparam param rotx caption = "x-rotation" hint = "Rotates yz-plane." default = 0.0 min = -360.0 max = 360.0 endparam param roty caption = "y-rotation" hint = "Rotates zx-plane." default = 0.0 min = -360.0 max = 360.0 endparam param rotz caption = "z-rotation" hint = "Rotates xy-plane." default = 0.0 min = -360.0 max = 360.0 endparam func fn1 caption = "First Function" default = sin() endfunc func fn2 caption = "Second Function" default = tan() endfunc func fn3 caption = "Third Function" default = sin() endfunc func fn4 caption = "Fourth Function" default = tan() endfunc bool param fBm caption = "fBm texturing?" default = true endparam heading caption = "fBm Parameters" visible = @fBm == true endheading param distortion caption = "Distortion Strength" default = 5.0 hint = "This is the amount the noise distorts the image." visible = @fBm == true endparam param style caption = "Distortion Style" default = 1 enum = "radial" "linear" hint = "This selects whether the distortion will be focused \ around a single point, or directed along a line." visible = @fBm == true endparam param distangle caption = "Distortion Angle" default = 0.0 hint = "This is the angle to rotate the distortion." visible = @fBm == true endparam param distcenter caption = "Distortion Center" default = (0.0, 0.0) hint = "Sets the center of distortion. If Use Screen \ Center is set, this item is ignored." visible = @fBm == true 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." visible = @fBm == true endparam param coloroffset caption = "Coloring Offset" default = 1.0 hint = "Sets the coloring offset from zero. Increase this if you see \ large areas of solid color." visible = @fBm == true endparam param noffset 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." visible = @fBm == true endparam param scale caption = "Noise Scale" default = 1.0 hint = "This is the overall scale of the noise." visible = @fBm == true endparam param angle caption = "Noise Rotation" default = 0.0 hint = "This is the angle, in degrees, of the noise." visible = @fBm == true endparam param step caption = "Noise Scale Step" default = 0.5 hint = "This is the step in scale between noise iterations." visible = @fBm == true endparam param anglestep caption = "Noise Rotation Step" default = 37.0 hint = "This is the angle, in degrees, to rotate between noise \ iterations." visible = @fBm == true endparam param octaves caption = "Noise Octaves" default = 7 min = 1 hint = "This is the number of iterations of the noise formula." visible = @fBm == true endparam param npower caption = "Noise Exponent" default = 2.0 hint = "This is the exponent used to scramble numbers." visible = @fBm == true endparam param noisestart caption = "Start Iteration" default = 0.0 hint = "This is the iteration at which to start adding noise." visible = @fBm == true endparam param noiseiter caption = "Noise Iterations" default = 10000.0 hint = "This is the number of iterations to add noise to." visible = @fBm == true endparam param noiseskip caption = "Skip Iterations" default = 0.0 hint = "This is the number of iterations to skip adding noise \ before starting again." visible = @fBm == true endparam func nfn1 caption = "Noise Function" default = ident() visible = @fBm == true endfunc bool param slope caption = "Apply slope?" default = true endparam heading caption = "Slope Parameters" visible = @slope==true endheading param offset caption = "Orbit Separation" default = 0.01 hint = "Defines how far apart the simultaneous orbits are. Smaller \ distances will produce more accurate results." visible = @slope==true endparam param zmode caption = "Height Value" default = 5 enum = "smallest |z|" "smallest |real(z)|" \ "smallest |imag(z)|" "smallest summ(z)" "smallest |atan(z)|" \ "smoothed iteration" hint = "Specifies what will be used to construct a height value." visible = @slope==true endparam param xfer caption = "Height Transfer" default = 1 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." visible = @slope==true 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." visible = @slope==true endparam param zscale2 caption = "Height Post-Scale" default = 0.1 hint = "Specifies the ratio between height and distance; like \ Height Pre-Scale, except that this value is applied after \ the transfer function." visible = @slope==true 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." visible = @slope==true endparam } gnd-Slope-T_Ikenaga_Jset { ; based upon the slope (Julia) ; formula of Damien Jones ; Triternion Ikenaga Julia formula ; compound with the models of slope formulas from Ron Barnett. ; ; version 1.0, May 2005 ; Gilles Nadeau, 22/05/2005 ; init: z1 = #pixel z2 = #pixel + @offset; horizontally offset point z3 = #pixel + flip(@offset); vertically offset point cz1 = @cz cz2 = @cz cz3 = @cz a1 = (0.0, 0.0) a2 = (0.0, 0.0) a3 = (0.0, 0.0) b1 = (0.0, 0.0) b2 = (0.0, 0.0) b3 = (0.0, 0.0) c1 = @ct c2 = @ct c3 = @ct ca1 = (0.0, 0.0) ca2 = (0.0, 0.0) ca3 = (0.0, 0.0) cb1 = (0.0, 0.0) cb2 = (0.0, 0.0) cb3 = (0.0, 0.0) cc1 = @cs cc2 = @cs cc3 = @cs 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 iterexp1 = 0.0 float iterexp2 = 0.0 float iterexp3 = 0.0 int done = 2 if (@var == 0) a1 = real(z1) a2 = real(z2) a3 = real(z3) b1 = imag(z1) b2 = imag(z2) b3 = imag(z3) ca1 = real(cz1) ca2 = real(cz2) ca3 = real(cz3) cb1 = imag(cz1) cb2 = imag(cz2) cb3 = imag(cz3) elseif (@var == 1) a1 = flip(real(z1)) a2 = flip(real(z2)) a3 = flip(real(z3)) b1 = flip(imag(z1)) b2 = flip(imag(z2)) b3 = flip(imag(z3)) ca1 = flip(real(cz1)) ca2 = flip(real(cz2)) ca3 = flip(real(cz3)) cb1 = flip(imag(cz1)) cb2 = flip(imag(cz2)) cb3 = flip(imag(cz3)) elseif (@var == 2) a1 = real(z1) a2 = real(z2) a3 = real(z3) b1 = flip(imag(z1)) b2 = flip(imag(z2)) b3 = flip(imag(z3)) ca1 = real(cz1) ca2 = real(cz2) ca3 = real(cz3) cb1 = flip(imag(cz1)) cb2 = flip(imag(cz2)) cb3 = flip(imag(cz3)) elseif (@var == 3) a1 = flip(real(z1)) a2 = flip(real(z2)) a3 = flip(real(z3)) b1 = imag(z1) b2 = imag(z2) b3 = imag(z3) ca1 = flip(real(cz1)) ca2 = flip(real(cz2)) ca3 = flip(real(cz3)) cb1 = imag(cz1) cb2 = imag(cz2) cb3 = imag(cz3) endif loop: r1 = sqr(a1) r2 = sqr(a2) r3 = sqr(a3) i1 = sqr(b1) i2 = sqr(b2) i3 = sqr(b3) l1 = sqr(c1) l2 = sqr(c2) l3 = sqr(c3) na1 = a1*r1 + b1*i1 + c1*l1 + 6*a1*b1*c1 nb1 = 3*(b1*r1 + c1*i1 + a1*l1) nc1 = 3*(c1*r1 + a1*i1 + b1*l1) cr1 = a1*ca1 + c1*cb1 + b1*cc1 ci1 = b1*ca1 + a1*cb1 + c1*cc1 ct1 = c1*ca1 + b1*cb1 + a1*cc1 a1 = cr1 + na1 - a1 - ca1 b1 = ci1 + nb1 - b1 - cb1 c1 = ct1 + nc1 - c1 - cc1 na2 = a2*r2 + b2*i2 + c2*l2 + 6*a2*b2*c2 nb2 = 3*(b2*r2 + c2*i2 + a2*l2) nc2 = 3*(c2*r2 + a2*i2 + b2*l2) cr2 = a2*ca2 + c2*cb2 + b2*cc2 ci2 = b2*ca2 + a2*cb2 + c2*cc2 ct2 = c2*ca2 + b2*cb2 + a2*cc2 a2 = cr2 + na2 - a2 - ca2 b2 = ci2 + nb2 - b2 - cb2 c2 = ct2 + nc2 - c2 - cc2 na3 = a3*r3 + b3*i3 + c3*l3 + 6*a3*b3*c3 nb3 = 3*(b3*r3 + c3*i3 + a3*l3) nc3 = 3*(c3*r3 + a3*i3 + b3*l3) cr3 = a3*ca3 + c3*cb3 + b3*cc3 ci3 = b3*ca3 + a3*cb3 + c3*cc3 ct3 = c3*ca3 + b3*cb3 + a3*cc3 a3 = cr3 + na3 - a3 - ca3 b3 = ci3 + nb3 - b3 - cb3 c3 = ct3 + nc3 - c3 - cc3 if (@flavor == 0) z1 = a1 + flip(b1) z2 = a2 + flip(b2) z3 = a3 + flip(b3) elseif (@flavor == 1) z1 = a1 + b1 z2 = a2 + b2 z3 = a3 + b3 endif IF (@zmode == 5) iterexp1 = iterexp1 + exp(-cabs(z1)) iterexp2 = iterexp2 + exp(-cabs(z2)) iterexp3 = iterexp3 + exp(-cabs(z3)) ENDIF done = done + 1; increment iteration counter IF (@zmode == 0) ; 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 == 1) ; 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 == 2) ; 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 == 3) ; 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 == 4) ; 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 ENDIF IF (@bailout < |a1| + |b1| + |c1| || \ @everyiter ||\ done == #maxit + 2); done, or every iteration, or last ; determine continuous iteration (height) for each point IF (@zmode >= 0 && @zmode <= 4) ; height based on smallest |z| e1 = s1 * @zscale e2 = s2 * @zscale e3 = s3 * @zscale ELSEIF (@zmode == 5) e1 = iterexp1 * @zscale e2 = iterexp2 * @zscale e3 = iterexp3 * @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 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 (@bailout < |a1| + |b1| + |c1|) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope Triternion Ikenaga J Set" maxiter = 500 periodicity = 0 method = multipass float param version default = 1.0 visible = false endparam heading caption = "Slope Triternion Ikenaga J Set" endheading heading caption = "Use Damien's Lighting Coloring" endheading heading caption = "Or Ron's 3D Texturizer Formulas" endheading heading caption = "Most other coloring formulas" endheading heading caption = "can also be used." endheading param var caption = "Variation" enum = "1""2""3""4" default = 0 endparam param cz caption = "c0" default = (0.1, 0.195) endparam param cs caption = "c1" default = (0.0, 0.0) endparam param ct caption = "c2" default = (0.0, 0.0) endparam param flavor caption = "Combine flavor" enum = "1:(z=x+flip(y))" "2:(z=x+y)" endparam param bailout caption = "Bailout Value" default = 64.0 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam heading caption = "Slope Parameters" endheading 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 = 5 enum = "smallest |z|" "smallest |real(z)|" \ "smallest |imag(z)|" "smallest summ(z)" "smallest |atan(z)|" \ "smoothed iteration" 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 = "gnd-Slope-T_Ikenaga_Mset" version = @version cs = @cs var = @var bailout = @bailout flavor = @flavor offset = @offset zmode = @zmode xfer = @xfer zscale = @zscale zscale2 = @zscale2 everyiter = @everyiter } gnd-Slope-T_Ikenaga_Mset { ; based upon the slope (Mandelbrot) ; formula of Damien Jones ; Triternion Ikenaga Mandel formula ; compound with the models of slope formulas from Ron Barnett. ; ; version 1.0, May 2005 ; Gilles Nadeau, 22/05/2005 ; init: cz1 = #pixel cz2 = #pixel + @offset; horizontally offset point cz3 = #pixel + flip(@offset); vertically offset point z1 = (0.0, 0.0) z2 = (0.0, 0.0) z3 = (0.0, 0.0) a1 = (0.0, 0.0) a2 = (0.0, 0.0) a3 = (0.0, 0.0) b1 = (0.0, 0.0) b2 = (0.0, 0.0) b3 = (0.0, 0.0) c1 = (0.0, 0.0) c2 = (0.0, 0.0) c3 = (0.0, 0.0) ca1 = (0.0, 0.0) ca2 = (0.0, 0.0) ca3 = (0.0, 0.0) cb1 = (0.0, 0.0) cb2 = (0.0, 0.0) cb3 = (0.0, 0.0) cc1 = @cs cc2 = @cs cc3 = @cs 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 iterexp1 = 0.0 float iterexp2 = 0.0 float iterexp3 = 0.0 int done = 2 if (@var == 0) a1 = real(z1) a2 = real(z2) a3 = real(z3) b1 = imag(z1) b2 = imag(z2) b3 = imag(z3) ca1 = real(cz1) ca2 = real(cz2) ca3 = real(cz3) cb1 = imag(cz1) cb2 = imag(cz2) cb3 = imag(cz3) elseif (@var == 1) a1 = flip(real(z1)) a2 = flip(real(z2)) a3 = flip(real(z3)) b1 = flip(imag(z1)) b2 = flip(imag(z2)) b3 = flip(imag(z3)) ca1 = flip(real(cz1)) ca2 = flip(real(cz2)) ca3 = flip(real(cz3)) cb1 = flip(imag(cz1)) cb2 = flip(imag(cz2)) cb3 = flip(imag(cz3)) elseif (@var == 2) a1 = real(z1) a2 = real(z2) a3 = real(z3) b1 = flip(imag(z1)) b2 = flip(imag(z2)) b3 = flip(imag(z3)) ca1 = real(cz1) ca2 = real(cz2) ca3 = real(cz3) cb1 = flip(imag(cz1)) cb2 = flip(imag(cz2)) cb3 = flip(imag(cz3)) elseif (@var == 3) a1 = flip(real(z1)) a2 = flip(real(z2)) a3 = flip(real(z3)) b1 = imag(z1) b2 = imag(z2) b3 = imag(z3) ca1 = flip(real(cz1)) ca2 = flip(real(cz2)) ca3 = flip(real(cz3)) cb1 = imag(cz1) cb2 = imag(cz2) cb3 = imag(cz3) endif loop: r1 = sqr(a1) r2 = sqr(a2) r3 = sqr(a3) i1 = sqr(b1) i2 = sqr(b2) i3 = sqr(b3) l1 = sqr(c1) l2 = sqr(c2) l3 = sqr(c3) na1 = a1*r1 + b1*i1 + c1*l1 + 6*a1*b1*c1 nb1 = 3*(b1*r1 + c1*i1 + a1*l1) nc1 = 3*(c1*r1 + a1*i1 + b1*l1) cr1 = a1*ca1 + c1*cb1 + b1*cc1 ci1 = b1*ca1 + a1*cb1 + c1*cc1 ct1 = c1*ca1 + b1*cb1 + a1*cc1 a1 = cr1 + na1 - a1 - ca1 b1 = ci1 + nb1 - b1 - cb1 c1 = ct1 + nc1 - c1 - cc1 na2 = a2*r2 + b2*i2 + c2*l2 + 6*a2*b2*c2 nb2 = 3*(b2*r2 + c2*i2 + a2*l2) nc2 = 3*(c2*r2 + a2*i2 + b2*l2) cr2 = a2*ca2 + c2*cb2 + b2*cc2 ci2 = b2*ca2 + a2*cb2 + c2*cc2 ct2 = c2*ca2 + b2*cb2 + a2*cc2 a2 = cr2 + na2 - a2 - ca2 b2 = ci2 + nb2 - b2 - cb2 c2 = ct2 + nc2 - c2 - cc2 na3 = a3*r3 + b3*i3 + c3*l3 + 6*a3*b3*c3 nb3 = 3*(b3*r3 + c3*i3 + a3*l3) nc3 = 3*(c3*r3 + a3*i3 + b3*l3) cr3 = a3*ca3 + c3*cb3 + b3*cc3 ci3 = b3*ca3 + a3*cb3 + c3*cc3 ct3 = c3*ca3 + b3*cb3 + a3*cc3 a3 = cr3 + na3 - a3 - ca3 b3 = ci3 + nb3 - b3 - cb3 c3 = ct3 + nc3 - c3 - cc3 if (@flavor == 0) z1 = a1 + flip(b1) z2 = a2 + flip(b2) z3 = a3 + flip(b3) elseif (@flavor == 1) z1 = a1 + b1 z2 = a2 + b2 z3 = a3 + b3 endif IF (@zmode == 5) iterexp1 = iterexp1 + exp(-cabs(z1)) iterexp2 = iterexp2 + exp(-cabs(z2)) iterexp3 = iterexp3 + exp(-cabs(z3)) ENDIF done = done + 1; increment iteration counter IF (@zmode == 0) ; 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 == 1) ; 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 == 2) ; 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 == 3) ; 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 == 4) ; 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 ENDIF IF (@bailout < |a1| + |b1| + |c1| || \ @everyiter ||\ done == #maxit + 2); done, or every iteration, or last ; determine continuous iteration (height) for each point IF (@zmode >= 0 && @zmode <= 4) ; height based on smallest |z| e1 = s1 * @zscale e2 = s2 * @zscale e3 = s3 * @zscale ELSEIF (@zmode == 5) e1 = iterexp1 * @zscale e2 = iterexp2 * @zscale e3 = iterexp3 * @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 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 (@bailout < |a1| + |b1| + |c1|) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope Triternion Ikenaga M Set" maxiter = 500 periodicity = 0 method = multipass float param version default = 1.0 visible = false endparam heading caption = "Slope Triternion Ikenaga M Set" endheading heading caption = "Use Damien's Lighting Coloring" endheading heading caption = "Or Ron's 3D Texturizer Formulas" endheading heading caption = "Most other coloring formulas" endheading heading caption = "can also be used." endheading param var caption = "Variation" enum = "1""2""3""4" default = 0 endparam param cs caption = "c1" default = (0.0, 0.0) endparam param flavor caption = "Combine flavor" enum = "1:(z=x+flip(y))" "2:(z=x+y)" endparam param bailout caption = "Bailout Value" default = 64.0 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam heading caption = "Slope Parameters" endheading 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 = 5 enum = "smallest |z|" "smallest |real(z)|" \ "smallest |imag(z)|" "smallest summ(z)" "smallest |atan(z)|" \ "smoothed iteration" 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 = "gnd-Slope-T_Ikenaga_Jset" version = @version cz = #pixel cs = @cs var = @var flavor = @flavor bailout = @bailout offset = @offset zmode = @zmode xfer = @xfer zscale = @zscale zscale2 = @zscale2 everyiter = @everyiter } gnd-SlopeMartSam1 { ; based upon the slope (Mandelbrot) ; formula of Damien Jones ; modified MartSam1 formula from Samuel Monnier, 1999 ; Inspired from the Martin formula (by ; Mark Townsend) ; compound with the models of slope formulas from Ron Barnett. ; These slopes formulas are dedicated to the memory of Carol Walske, (1955, 2004). ; version 1.1, January 2005 ; Gilles Nadeau, 23/01/2005 ; Slope Optional, v1.1 by Susan Chambless, Mar, 2005. ; ; Damien's fBm added September, 2005 ; version 1.22, ; Gilles, 17/09/2005 ; Use inside colouring. ; By decreasing the number of iteration, ; you will get a smoother image. init: z1 = #pixel ; primary iterated point z2 = #pixel + @offset ; horizontally offset point z3 = #pixel + flip(@offset) ; vertically offset point x1 = real(z1) x2 = real(z2) x3 = real(z3) y1 = imag(z1) y2 = imag(z2) y3 = imag(z3) xx1 = @fr1(x1) xx2 = @fr1(x2) xx3 = @fr1(x3) yy1 = @fi1(y1) yy2 = @fi1(y2) yy3 = @fi1(y3) int done = 2 float modz = 0.0 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 sum1 = 0.0 float sum2 = 0.0 float sum3 = 0.0 if @ab1 a1 = @a/sqrt(|@a|) * @c b1 = @b/sqrt(|@b|) * @c else a1 = @a b1 = @b endif complex r = (0,1) ^ (@angle / 90.0) complex r2 = (0,1) ^ (@anglestep / 90.0) loop: if @mode == 0 x1 = real(a1) * sin(x1+y1) + imag(a1) * cos(x1-y1) + xx1 y1 = real(b1) * cos(x1-y1) + imag(b1) * sin(x1+y1) + yy1 elseif @mode == 1 x1 = real(a1) * sin(x1+y1) + imag(a1) * cos(x1-y1) + yy1 y1 = real(b1) * cos(x1-y1) + imag(b1) * sin(x1+y1) + xx1 elseif @mode == 2 x1 = real(a1) * sin(x1+y1) + imag(a1) * cos(x1-y1) + xx1 + yy1 y1 = real(b1) * cos(x1-y1) + imag(b1) * sin(x1+y1) + xx1 - yy1 else x1 = real(a1) * sin(x1+y1) + imag(a1) * cos(x1-y1) + xx1 + y1 y1 = real(b1) * cos(x1-y1) + imag(b1) * sin(x1+y1) + yy1 - x1 endif z1 = x1 + flip(y1) IF (@fbm == true) complex pa = z1 * @scale * r + @noffset float suma = 0.0 float freq = 1.0 int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxa = floor(real(pa)) float fya = floor(imag(pa)) float bx0a = fxa % 256 float by0a = fya % 256 IF (bx0a < 0) bx0a = bx0a + 256 ENDIF IF (by0a < 0) by0a = by0a + 256 ENDIF float bx1a = (bx0a + 1) % 256 float by1a = (by0a + 1) % 256 float rx0a = real(pa) - fxa float ry0a = imag(pa) - fya float rx1a = rx0a - 1 float ry1a = ry0a - 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 b00a = (bx0a^@npower % 65536 + by0a)^@npower % 65536 float b10a = (bx1a^@npower % 65536 + by0a)^@npower % 65536 float b01a = (bx0a^@npower % 65536 + by1a)^@npower % 65536 float b11a = (bx1a^@npower % 65536 + by1a)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0a = (b00a)^@npower*0.25 % 512 - 256 float g_b10_0a = (b10a)^@npower*0.25 % 512 - 256 float g_b01_0a = (b01a)^@npower*0.25 % 512 - 256 float g_b11_0a = (b11a)^@npower*0.25 % 512 - 256 float g_b00_1a = (b00a+1)^@npower*0.25 % 512 - 256 float g_b10_1a = (b10a+1)^@npower*0.25 % 512 - 256 float g_b01_1a = (b01a+1)^@npower*0.25 % 512 - 256 float g_b11_1a = (b11a+1)^@npower*0.25 % 512 - 256 ; normalize each vector float da = 0.0; da = 1 / sqrt(sqr(g_b00_0a) + sqr(g_b00_1a)) g_b00_0a = g_b00_0a * da g_b00_1a = g_b00_1a * da da = 1 / sqrt(sqr(g_b10_0a) + sqr(g_b10_1a)) g_b10_0a = g_b10_0a * da g_b10_1a = g_b10_1a * da da = 1 / sqrt(sqr(g_b01_0a) + sqr(g_b01_1a)) g_b01_0a = g_b01_0a * da g_b01_1a = g_b01_1a * da da = 1 / sqrt(sqr(g_b11_0a) + sqr(g_b11_1a)) g_b11_0a = g_b11_0a * da g_b11_1a = g_b11_1a * da ; produce colors for each corner float u1a = rx0a * g_b00_0a + ry0a * g_b00_1a float v1a = rx1a * g_b10_0a + ry0a * g_b10_1a float u2a = rx0a * g_b01_0a + ry1a * g_b01_1a float v2a = rx1a * g_b11_0a + ry1a * g_b11_1a ; interpolate between corners using ; bilinear filtering float sxa = sqr(rx0a) * (3 - rx0a*2) float sya = sqr(ry0a) * (3 - ry0a*2) float na1 = u1a + sxa*(v1a-u1a) float nb1 = u2a + sxa*(v2a-u2a) suma = suma + real(@nfn1(na1 + sya*(nb1-na1)))*freq freq = freq * @step pa = pa * r2 / @step i = i - 1 ENDWHILE z1 = z1 + (suma+@coloroffset)*0.5*@distortion ENDIF if (@slope) if @mode == 0 x2 = real(a1) * sin(x2+y2) + imag(a1) * cos(x2-y2) + xx2 x3 = real(a1) * sin(x3+y3) + imag(a1) * cos(x3-y3) + xx3 y2 = real(b1) * cos(x2-y2) + imag(b1) * sin(x2+y2) + yy2 y3 = real(b1) * cos(x3-y3) + imag(b1) * sin(x3+y3) + yy3 elseif @mode == 1 x2 = real(a1) * sin(x2+y2) + imag(a1) * cos(x2-y2) + yy2 x3 = real(a1) * sin(x3+y3) + imag(a1) * cos(x3-y3) + yy3 y2 = real(b1) * cos(x2-y2) + imag(b1) * sin(x2+y2) + xx2 y3 = real(b1) * cos(x3-y3) + imag(b1) * sin(x3+y3) + xx3 elseif @mode == 2 x2 = real(a1) * sin(x2+y2) + imag(a1) * cos(x2-y2) + xx2 + yy2 x3 = real(a1) * sin(x3+y3) + imag(a1) * cos(x3-y3) + xx3 + yy3 y2 = real(b1) * cos(x2-y2) + imag(b1) * sin(x2+y2) + xx2 - yy2 y3 = real(b1) * cos(x3-y3) + imag(b1) * sin(x3+y3) + xx3 - yy3 else x2 = real(a1) * sin(x2+y2) + imag(a1) * cos(x2-y2) + xx2 + y2 x3 = real(a1) * sin(x3+y3) + imag(a1) * cos(x3-y3) + xx3 + y3 y2 = real(b1) * cos(x2-y2) + imag(b1) * sin(x2+y2) + yy2 - x2 y3 = real(b1) * cos(x3-y3) + imag(b1) * sin(x3+y3) + yy3 - x3 endif z2 = x2 + flip(y2) z3 = x3 + flip(y3) IF (@fbm == true) complex pb = z2 * @scale * r + @noffset complex pc = z3 * @scale * r + @noffset float sumb = 0.0 float sumc = 0.0 float freq = 1.0 int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxb = floor(real(pb)) float fyb = floor(imag(pb)) float bx0b = fxb % 256 float by0b = fyb % 256 IF (bx0b < 0) bx0b = bx0b + 256 ENDIF IF (by0b < 0) by0b = by0b + 256 ENDIF float bx1b = (bx0b + 1) % 256 float by1b = (by0b + 1) % 256 float rx0b = real(pb) - fxb float ry0b = imag(pb) - fyb float rx1b = rx0b - 1 float ry1b = ry0b - 1 float fxc = floor(real(pc)) float fyc = floor(imag(pc)) float bx0c = fxc % 256 float by0c = fyc % 256 IF (bx0c < 0) bx0c = bx0c + 256 ENDIF IF (by0c < 0) by0c = by0c + 256 ENDIF float bx1c = (bx0c + 1) % 256 float by1c = (by0c + 1) % 256 float rx0c = real(pc) - fxc float ry0c = imag(pc) - fyc float rx1c = rx0c - 1 float ry1c = ry0c - 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 b00b = (bx0b^@npower % 65536 + by0b)^@npower % 65536 float b10b = (bx1b^@npower % 65536 + by0b)^@npower % 65536 float b01b = (bx0b^@npower % 65536 + by1b)^@npower % 65536 float b11b = (bx1b^@npower % 65536 + by1b)^@npower % 65536 float b00c = (bx0c^@npower % 65536 + by0c)^@npower % 65536 float b10c = (bx1c^@npower % 65536 + by0c)^@npower % 65536 float b01c = (bx0c^@npower % 65536 + by1c)^@npower % 65536 float b11c = (bx1c^@npower % 65536 + by1c)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0b = (b00b)^@npower*0.25 % 512 - 256 float g_b10_0b = (b10b)^@npower*0.25 % 512 - 256 float g_b01_0b = (b01b)^@npower*0.25 % 512 - 256 float g_b11_0b = (b11b)^@npower*0.25 % 512 - 256 float g_b00_1b = (b00b+1)^@npower*0.25 % 512 - 256 float g_b10_1b = (b10b+1)^@npower*0.25 % 512 - 256 float g_b01_1b = (b01b+1)^@npower*0.25 % 512 - 256 float g_b11_1b = (b11b+1)^@npower*0.25 % 512 - 256 float g_b00_0c = (b00c)^@npower*0.25 % 512 - 256 float g_b10_0c = (b10c)^@npower*0.25 % 512 - 256 float g_b01_0c = (b01c)^@npower*0.25 % 512 - 256 float g_b11_0c = (b11c)^@npower*0.25 % 512 - 256 float g_b00_1c = (b00c+1)^@npower*0.25 % 512 - 256 float g_b10_1c = (b10c+1)^@npower*0.25 % 512 - 256 float g_b01_1c = (b01c+1)^@npower*0.25 % 512 - 256 float g_b11_1c = (b11c+1)^@npower*0.25 % 512 - 256 ; normalize each vector float db = 0.0 float dc = 0.0; db = 1 / sqrt(sqr(g_b00_0b) + sqr(g_b00_1b)) g_b00_0b = g_b00_0b * db g_b00_1b = g_b00_1b * db db = 1 / sqrt(sqr(g_b10_0b) + sqr(g_b10_1b)) g_b10_0b = g_b10_0b * db g_b10_1b = g_b10_1b * db db = 1 / sqrt(sqr(g_b01_0b) + sqr(g_b01_1b)) g_b01_0b = g_b01_0b * db g_b01_1b = g_b01_1b * db db = 1 / sqrt(sqr(g_b11_0b) + sqr(g_b11_1b)) g_b11_0b = g_b11_0b * db g_b11_1b = g_b11_1b * db dc = 1 / sqrt(sqr(g_b00_0c) + sqr(g_b00_1c)) g_b00_0c = g_b00_0c * dc g_b00_1c = g_b00_1c * dc dc = 1 / sqrt(sqr(g_b10_0c) + sqr(g_b10_1c)) g_b10_0c = g_b10_0c * dc g_b10_1c = g_b10_1c * dc dc = 1 / sqrt(sqr(g_b01_0c) + sqr(g_b01_1c)) g_b01_0c = g_b01_0c * dc g_b01_1c = g_b01_1c * dc dc = 1 / sqrt(sqr(g_b11_0c) + sqr(g_b11_1c)) g_b11_0c = g_b11_0c * dc g_b11_1c = g_b11_1c * dc ; produce colors for each corner float u1b = rx0b * g_b00_0b + ry0b * g_b00_1b float v1b = rx1b * g_b10_0b + ry0b * g_b10_1b float u2b = rx0b * g_b01_0b + ry1b * g_b01_1b float v2b = rx1b * g_b11_0b + ry1b * g_b11_1b float u1c = rx0c * g_b00_0c + ry0c * g_b00_1c float v1c = rx1c * g_b10_0c + ry0c * g_b10_1c float u2c = rx0c * g_b01_0c + ry1c * g_b01_1c float v2c = rx1c * g_b11_0c + ry1c * g_b11_1c ; interpolate between corners using ; bilinear filtering float sxb = sqr(rx0b) * (3 - rx0b*2) float syb = sqr(ry0b) * (3 - ry0b*2) float na2 = u1b + sxb*(v1b-u1b) float nb2 = u2b + sxb*(v2b-u2b) float sxc = sqr(rx0c) * (3 - rx0c*2) float syc = sqr(ry0c) * (3 - ry0c*2) float na3 = u1c + sxc*(v1c-u1c) float nb3 = u2c + sxc*(v2c-u2c) sumb = sumb + real(@nfn1(na2 + syb*(nb2-na2)))*freq sumc = sumc + real(@nfn1(na3 + syc*(nb3-na3)))*freq freq = freq * @step pb = pb * r2 / @step pc = pc * r2 / @step i = i - 1 ENDWHILE z2 = z2 + (sumb+@coloroffset)*0.5*@distortion z3 = z3 + (sumc+@coloroffset)*0.5*@distortion endif ENDIF modz = |z1| if (@slope == true) if (@zmode == 0) sum1 = sum1 + exp(-cabs(z1)) sum2 = sum2 + exp(-cabs(z2)) sum3 = sum3 + exp(-cabs(z3)) elseif (@zmode == 1) sum1 = cabs(z1 - #pixel) sum2 = cabs(z2 - #pixel) sum3 = cabs(z3 - #pixel) else sum1 = cabs(z1) sum2 = cabs(z2) sum3 = cabs(z3) endif done = done + 1 ; increment iteration counter IF (modz > @bailout || \ @everyiter || \ done == #maxit + 2) ; done, or every iteration, or last ; determine continuous iteration (height) for each point e1 = sum1 * @zscale e2 = sum2 * @zscale e3 = sum3 * @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 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 else z = z1 endif IF (modz > @bailout) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope MartSam 1" maxiter = 5 magn = .2 param version caption = "Version" default = 1.22 visible = false endparam param mode caption = "Mode" default = 0 enum = "x1 ; y1" "y1 ; x1" "x1 + y1 ; x1 - y1" \ "x1 + y ; y1 - x" endparam param a caption = "a" default = (1,-1) endparam param b caption = "b" default = (1,1) endparam param c caption = "c" default = 1.0 endparam param ab1 caption = "|a| = |b| = c ?" default = false hint = "Useful to get images of the same \ complexity. Choose a nice c value and \ play with a and b." endparam func fr1 caption = "Real Func 1" default = ident() endfunc func fi1 caption = "Imag Func 1" default = ident() endfunc param bailout caption = "Bailout Value" default = 1.0e20 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam bool param fbm caption = "fBm texturing?" default = false endparam heading caption = "fBm Parameters" visible = @fbm == true endheading param distortion caption = "Noise Strength" default = 1.0 visible = @fbm == true endparam param coloroffset caption = "Coloring Offset" default = 0.0 hint = "Sets the coloring offset from zero. Increase this if you see \ large areas of solid color." visible = @fbm == true endparam param noffset 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." visible = @fbm == true endparam param scale caption = "Noise Scale" default = 1.0 hint = "This is the overall scale of the noise." visible = @fbm == true endparam param angle caption = "Noise Rotation" default = 0.0 hint = "This is the angle, in degrees, of the noise." visible = @fbm == true endparam param step caption = "Noise Scale Step" default = 0.5 hint = "This is the step in scale between noise iterations." visible = @fbm == true endparam param anglestep caption = "Noise Rotation Step" default = 37.0 hint = "This is the angle, in degrees, to rotate between noise \ iterations." visible = @fbm == true endparam param octaves caption = "Noise Octaves" default = 7 min = 1 hint = "This is the number of iterations of the noise formula." visible = @fbm == true endparam param npower caption = "Noise Exponent" default = 2.0 hint = "This is the exponent used to scramble numbers." visible = @fbm == true endparam func nfn1 caption = "Noise Function" default = ident() visible = @fbm == true endfunc bool param slope caption = "Apply slope?" default = true endparam heading caption = "Slope Parameters" visible = @slope == true endheading param offset caption = "Orbit Separation" default = 0.01 hint = "Defines how far apart the simultaneous orbits are.\ Smaller distances will produce more accurate results." visible = @slope == true endparam param zmode caption = "Height Value" enum = "smoothed iteration" "magnitude (z-pixel)" "magnitude (z)" default = 0 visible = @slope==true endparam param xfer caption = "Height Transfer" default = 1 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." visible = @slope == true 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." visible = @slope == true endparam param zscale2 caption = "Height Post-Scale" default = 1.0 hint = "Specifies the ratio between height and distance; like \ Height Pre-Scale, except that this value is applied after \ the transfer function." visible = @slope == true 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." visible = @slope == true endparam } gnd-SlopeMartSam2 { ; based upon the slope (Mandelbrot) ; formula of Damien Jones ; modified MartSam2 formula from Samuel Monnier, 1999 ; Inspired from the Martin formula (by ; Mark Townsend) ; compound with the models of slope formulas from Ron Barnett. ; These slopes formulas are dedicated to the memory of Carol Walske, (1955, 2004). ; version 1.1, January 2005 ; Gilles Nadeau, 23/01/2005 ; Slope Optional, v1.1 by Susan Chambless, Mar, 2005. ; ; Damien's fBm added September, 2005 ; version 1.22, ; Gilles, 17/09/2005 ; Use inside colouring. ; Modifying the iteration number will change ; the image. ; With this one, you will get better result ; if you set a slow increasing transfer ; function like cubereoot or Atan.. init: z1 = #pixel ; primary iterated point z2 = #pixel + @offset ; horizontally offset point z3 = #pixel + flip(@offset) ; vertically offset point x1 = real(z1) x2 = real(z2) x3 = real(z3) y1 = imag(z1) y2 = imag(z2) y3 = imag(z3) xx1 = @fr1(x1) xx2 = @fr1(x2) xx3 = @fr1(x3) yy1 = @fi1(y1) yy2 = @fi1(y2) yy3 = @fi1(y3) int done = 2 float modz = 0.0 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 sum1 = 0.0 float sum2 = 0.0 float sum3 = 0.0 if @ab1 a1 = @a/sqrt(|@a|) * @c b1 = @b/sqrt(|@b|) * @c else a1 = @a b1 = @b endif complex r = (0,1) ^ (@angle / 90.0) complex r2 = (0,1) ^ (@anglestep / 90.0) loop: if @mode == 0 x1 = real(a1) * sin(x1) - imag(a1) * cos(x1) * y1 + xx1 y1 = real(b1) * sin(y1) - imag(b1) * cos(y1) * x1 + yy1 elseif @mode == 1 x1 = real(a1) * sin(x1) - imag(a1) * cos(x1) * y1 + yy1 y1 = real(b1) * sin(y1) - imag(b1) * cos(y1) * x1 + xx1 elseif @mode == 2 x1 = real(a1) * sin(x1) - imag(a1) * cos(x1) * y1 + xx1 + yy1 y1 = real(b1) * sin(y1) - imag(b1) * cos(y1) * x1 + xx1 - yy1 else x1 = real(a1) * sin(x1) - imag(a1) * cos(x1) * y1 + xx1 + y1 y1 = real(b1) * sin(y1) - imag(b1) * cos(y1) * x1 + yy1 - x1 endif z1 = x1 + flip(y1) IF (@fbm == true) complex pa = z1 * @scale * r + @noffset float suma = 0.0 float freq = 1.0 int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxa = floor(real(pa)) float fya = floor(imag(pa)) float bx0a = fxa % 256 float by0a = fya % 256 IF (bx0a < 0) bx0a = bx0a + 256 ENDIF IF (by0a < 0) by0a = by0a + 256 ENDIF float bx1a = (bx0a + 1) % 256 float by1a = (by0a + 1) % 256 float rx0a = real(pa) - fxa float ry0a = imag(pa) - fya float rx1a = rx0a - 1 float ry1a = ry0a - 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 b00a = (bx0a^@npower % 65536 + by0a)^@npower % 65536 float b10a = (bx1a^@npower % 65536 + by0a)^@npower % 65536 float b01a = (bx0a^@npower % 65536 + by1a)^@npower % 65536 float b11a = (bx1a^@npower % 65536 + by1a)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0a = (b00a)^@npower*0.25 % 512 - 256 float g_b10_0a = (b10a)^@npower*0.25 % 512 - 256 float g_b01_0a = (b01a)^@npower*0.25 % 512 - 256 float g_b11_0a = (b11a)^@npower*0.25 % 512 - 256 float g_b00_1a = (b00a+1)^@npower*0.25 % 512 - 256 float g_b10_1a = (b10a+1)^@npower*0.25 % 512 - 256 float g_b01_1a = (b01a+1)^@npower*0.25 % 512 - 256 float g_b11_1a = (b11a+1)^@npower*0.25 % 512 - 256 ; normalize each vector float da = 0.0; da = 1 / sqrt(sqr(g_b00_0a) + sqr(g_b00_1a)) g_b00_0a = g_b00_0a * da g_b00_1a = g_b00_1a * da da = 1 / sqrt(sqr(g_b10_0a) + sqr(g_b10_1a)) g_b10_0a = g_b10_0a * da g_b10_1a = g_b10_1a * da da = 1 / sqrt(sqr(g_b01_0a) + sqr(g_b01_1a)) g_b01_0a = g_b01_0a * da g_b01_1a = g_b01_1a * da da = 1 / sqrt(sqr(g_b11_0a) + sqr(g_b11_1a)) g_b11_0a = g_b11_0a * da g_b11_1a = g_b11_1a * da ; produce colors for each corner float u1a = rx0a * g_b00_0a + ry0a * g_b00_1a float v1a = rx1a * g_b10_0a + ry0a * g_b10_1a float u2a = rx0a * g_b01_0a + ry1a * g_b01_1a float v2a = rx1a * g_b11_0a + ry1a * g_b11_1a ; interpolate between corners using ; bilinear filtering float sxa = sqr(rx0a) * (3 - rx0a*2) float sya = sqr(ry0a) * (3 - ry0a*2) float na1 = u1a + sxa*(v1a-u1a) float nb1 = u2a + sxa*(v2a-u2a) suma = suma + real(@nfn1(na1 + sya*(nb1-na1)))*freq freq = freq * @step pa = pa * r2 / @step i = i - 1 ENDWHILE z1 = z1 + (suma+@coloroffset)*0.5*@distortion ENDIF if (@slope) if @mode == 0 x2 = real(a1) * sin(x2) - imag(a1) * cos(x2) * y2 + xx2 x3 = real(a1) * sin(x3) - imag(a1) * cos(x3) * y3 + xx3 y2 = real(b1) * sin(y2) - imag(b1) * cos(y2) * x2 + yy2 y3 = real(b1) * sin(y3) - imag(b1) * cos(y3) * x3 + yy3 elseif @mode == 1 x2 = real(a1) * sin(x2) - imag(a1) * cos(x2) * y2 + yy2 x3 = real(a1) * sin(x3) - imag(a1) * cos(x3) * y3 + yy3 y2 = real(b1) * sin(y2) - imag(b1) * cos(y2) * x2 + xx2 y3 = real(b1) * sin(y3) - imag(b1) * cos(y3) * x3 + xx3 elseif @mode == 2 x2 = real(a1) * sin(x2) - imag(a1) * cos(x2) * y2 + xx2 + yy2 x3 = real(a1) * sin(x3) - imag(a1) * cos(x3) * y3 + xx3 + yy3 y2 = real(b1) * sin(y2) - imag(b1) * cos(y2) * x2 + xx2 - yy2 y3 = real(b1) * sin(y3) - imag(b1) * cos(y3) * x3 + xx3 - yy3 else x2 = real(a1) * sin(x2) - imag(a1) * cos(x2) * y2 + xx2 + y2 x3 = real(a1) * sin(x3) - imag(a1) * cos(x3) * y3 + xx3 + y3 y2 = real(b1) * sin(y2) - imag(b1) * cos(y2) * x2 + yy2 - x2 y3 = real(b1) * sin(y3) - imag(b1) * cos(y3) * x3 + yy3 - x3 endif z2 = x2 + flip(y2) z3 = x3 + flip(y3) IF (@fbm == true) complex pb = z2 * @scale * r + @noffset complex pc = z3 * @scale * r + @noffset float sumb = 0.0 float sumc = 0.0 float freq = 1.0 int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxb = floor(real(pb)) float fyb = floor(imag(pb)) float bx0b = fxb % 256 float by0b = fyb % 256 IF (bx0b < 0) bx0b = bx0b + 256 ENDIF IF (by0b < 0) by0b = by0b + 256 ENDIF float bx1b = (bx0b + 1) % 256 float by1b = (by0b + 1) % 256 float rx0b = real(pb) - fxb float ry0b = imag(pb) - fyb float rx1b = rx0b - 1 float ry1b = ry0b - 1 float fxc = floor(real(pc)) float fyc = floor(imag(pc)) float bx0c = fxc % 256 float by0c = fyc % 256 IF (bx0c < 0) bx0c = bx0c + 256 ENDIF IF (by0c < 0) by0c = by0c + 256 ENDIF float bx1c = (bx0c + 1) % 256 float by1c = (by0c + 1) % 256 float rx0c = real(pc) - fxc float ry0c = imag(pc) - fyc float rx1c = rx0c - 1 float ry1c = ry0c - 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 b00b = (bx0b^@npower % 65536 + by0b)^@npower % 65536 float b10b = (bx1b^@npower % 65536 + by0b)^@npower % 65536 float b01b = (bx0b^@npower % 65536 + by1b)^@npower % 65536 float b11b = (bx1b^@npower % 65536 + by1b)^@npower % 65536 float b00c = (bx0c^@npower % 65536 + by0c)^@npower % 65536 float b10c = (bx1c^@npower % 65536 + by0c)^@npower % 65536 float b01c = (bx0c^@npower % 65536 + by1c)^@npower % 65536 float b11c = (bx1c^@npower % 65536 + by1c)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0b = (b00b)^@npower*0.25 % 512 - 256 float g_b10_0b = (b10b)^@npower*0.25 % 512 - 256 float g_b01_0b = (b01b)^@npower*0.25 % 512 - 256 float g_b11_0b = (b11b)^@npower*0.25 % 512 - 256 float g_b00_1b = (b00b+1)^@npower*0.25 % 512 - 256 float g_b10_1b = (b10b+1)^@npower*0.25 % 512 - 256 float g_b01_1b = (b01b+1)^@npower*0.25 % 512 - 256 float g_b11_1b = (b11b+1)^@npower*0.25 % 512 - 256 float g_b00_0c = (b00c)^@npower*0.25 % 512 - 256 float g_b10_0c = (b10c)^@npower*0.25 % 512 - 256 float g_b01_0c = (b01c)^@npower*0.25 % 512 - 256 float g_b11_0c = (b11c)^@npower*0.25 % 512 - 256 float g_b00_1c = (b00c+1)^@npower*0.25 % 512 - 256 float g_b10_1c = (b10c+1)^@npower*0.25 % 512 - 256 float g_b01_1c = (b01c+1)^@npower*0.25 % 512 - 256 float g_b11_1c = (b11c+1)^@npower*0.25 % 512 - 256 ; normalize each vector float db = 0.0 float dc = 0.0; db = 1 / sqrt(sqr(g_b00_0b) + sqr(g_b00_1b)) g_b00_0b = g_b00_0b * db g_b00_1b = g_b00_1b * db db = 1 / sqrt(sqr(g_b10_0b) + sqr(g_b10_1b)) g_b10_0b = g_b10_0b * db g_b10_1b = g_b10_1b * db db = 1 / sqrt(sqr(g_b01_0b) + sqr(g_b01_1b)) g_b01_0b = g_b01_0b * db g_b01_1b = g_b01_1b * db db = 1 / sqrt(sqr(g_b11_0b) + sqr(g_b11_1b)) g_b11_0b = g_b11_0b * db g_b11_1b = g_b11_1b * db dc = 1 / sqrt(sqr(g_b00_0c) + sqr(g_b00_1c)) g_b00_0c = g_b00_0c * dc g_b00_1c = g_b00_1c * dc dc = 1 / sqrt(sqr(g_b10_0c) + sqr(g_b10_1c)) g_b10_0c = g_b10_0c * dc g_b10_1c = g_b10_1c * dc dc = 1 / sqrt(sqr(g_b01_0c) + sqr(g_b01_1c)) g_b01_0c = g_b01_0c * dc g_b01_1c = g_b01_1c * dc dc = 1 / sqrt(sqr(g_b11_0c) + sqr(g_b11_1c)) g_b11_0c = g_b11_0c * dc g_b11_1c = g_b11_1c * dc ; produce colors for each corner float u1b = rx0b * g_b00_0b + ry0b * g_b00_1b float v1b = rx1b * g_b10_0b + ry0b * g_b10_1b float u2b = rx0b * g_b01_0b + ry1b * g_b01_1b float v2b = rx1b * g_b11_0b + ry1b * g_b11_1b float u1c = rx0c * g_b00_0c + ry0c * g_b00_1c float v1c = rx1c * g_b10_0c + ry0c * g_b10_1c float u2c = rx0c * g_b01_0c + ry1c * g_b01_1c float v2c = rx1c * g_b11_0c + ry1c * g_b11_1c ; interpolate between corners using ; bilinear filtering float sxb = sqr(rx0b) * (3 - rx0b*2) float syb = sqr(ry0b) * (3 - ry0b*2) float na2 = u1b + sxb*(v1b-u1b) float nb2 = u2b + sxb*(v2b-u2b) float sxc = sqr(rx0c) * (3 - rx0c*2) float syc = sqr(ry0c) * (3 - ry0c*2) float na3 = u1c + sxc*(v1c-u1c) float nb3 = u2c + sxc*(v2c-u2c) sumb = sumb + real(@nfn1(na2 + syb*(nb2-na2)))*freq sumc = sumc + real(@nfn1(na3 + syc*(nb3-na3)))*freq freq = freq * @step pb = pb * r2 / @step pc = pc * r2 / @step i = i - 1 ENDWHILE z2 = z2 + (sumb+@coloroffset)*0.5*@distortion z3 = z3 + (sumc+@coloroffset)*0.5*@distortion endif ENDIF modz = |z1| if (@slope == true) if (@zmode == 0) sum1 = sum1 + exp(-cabs(z1)) sum2 = sum2 + exp(-cabs(z2)) sum3 = sum3 + exp(-cabs(z3)) elseif (@zmode == 1) sum1 = cabs(z1 - #pixel) sum2 = cabs(z2 - #pixel) sum3 = cabs(z3 - #pixel) else sum1 = cabs(z1) sum2 = cabs(z2) sum3 = cabs(z3) endif done = done + 1 ; increment iteration counter IF (modz > @bailout || \ @everyiter || \ done == #maxit + 2) ; done, or every iteration, or last ; determine continuous iteration (height) for each point e1 = sum1 * @zscale e2 = sum2 * @zscale e3 = sum3 * @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 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 else z = z1 endif IF (modz > @bailout) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope MartSam 2" maxiter = 3 magn = .05 param version caption = "Version" default = 1.22 visible = false endparam param mode caption = "Mode" default = 0 enum = "x1 ; y1" "y1 ; x1" "x1 + y1 ; x1 - y1" \ "x1 + y ; y1 - x" endparam param a caption = "a" default = (1,.5) endparam param b caption = "b" default = (1,.5) endparam param c caption = "c" default = 1.0 endparam param ab1 caption = "|a| = |b| = c ?" default = false hint = "Useful to get images of the same \ complexity. Choose a nice c value and \ play with a and b." endparam func fr1 caption = "Real Func 1" default = ident() endfunc func fi1 caption = "Imag Func 1" default = ident() endfunc param bailout caption = "Bailout Value" default = 1.0e20 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam bool param fbm caption = "fBm texturing?" default = false endparam heading caption = "fBm Parameters" visible = @fbm == true endheading param distortion caption = "Noise Strength" default = 1.0 visible = @fbm == true endparam param coloroffset caption = "Coloring Offset" default = 0.0 hint = "Sets the coloring offset from zero. Increase this if you see \ large areas of solid color." visible = @fbm == true endparam param noffset 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." visible = @fbm == true endparam param scale caption = "Noise Scale" default = 1.0 hint = "This is the overall scale of the noise." visible = @fbm == true endparam param angle caption = "Noise Rotation" default = 0.0 hint = "This is the angle, in degrees, of the noise." visible = @fbm == true endparam param step caption = "Noise Scale Step" default = 0.5 hint = "This is the step in scale between noise iterations." visible = @fbm == true endparam param anglestep caption = "Noise Rotation Step" default = 37.0 hint = "This is the angle, in degrees, to rotate between noise \ iterations." visible = @fbm == true endparam param octaves caption = "Noise Octaves" default = 7 min = 1 hint = "This is the number of iterations of the noise formula." visible = @fbm == true endparam param npower caption = "Noise Exponent" default = 2.0 hint = "This is the exponent used to scramble numbers." visible = @fbm == true endparam func nfn1 caption = "Noise Function" default = ident() visible = @fbm == true endfunc bool param slope caption = "Apply slope?" default = true endparam heading caption = "Slope Parameters" visible = @slope == true endheading param offset caption = "Orbit Separation" default = 0.01 hint = "Defines how far apart the simultaneous orbits are.\ Smaller distances will produce more accurate results." visible = @slope == true endparam param zmode caption = "Height Value" enum = "smoothed iteration" "magnitude (z-pixel)" "magnitude (z)" default = 0 visible = @slope==true endparam param xfer caption = "Height Transfer" default = 1 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." visible = @slope == true 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." visible = @slope == true endparam param zscale2 caption = "Height Post-Scale" default = 1.0 hint = "Specifies the ratio between height and distance; like \ Height Pre-Scale, except that this value is applied after \ the transfer function." visible = @slope == true 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." visible = @slope == true endparam } gnd-SlopeMartSam3 { ; based upon the slope (Mandelbrot) ; formula of Damien Jones ; modified MartSam3 formula from Samuel Monnier, 1999 ; Inspired from the Martin formula (by ; Mark Townsend) ; compound with the models of slope formulas from Ron Barnett. ; These slopes formulas are dedicated to the memory of Carol Walske, (1955, 2004). ; version 1.1, January 2005 ; Gilles Nadeau, 23/01/2005 ; Slope Optional, v1.1 by Susan Chambless, Mar, 2005. ; ; Damien's fBm added September, 2005 ; version 1.22, ; Gilles, 17/09/2005 ; Use inside colouring. ; A strange formula, as it uses only ; one iteration. But as I found it ; rather nice, I decided to release ; it. init: z1 = #pixel ; primary iterated point z2 = #pixel + @offset ; horizontally offset point z3 = #pixel + flip(@offset) ; vertically offset point x1 = real(z1) x2 = real(z2) x3 = real(z3) y1 = imag(z1) y2 = imag(z2) y3 = imag(z3) xx1 = @fr1(x1) xx2 = @fr1(x2) xx3 = @fr1(x3) yy1 = @fi1(y1) yy2 = @fi1(y2) yy3 = @fi1(y3) int done = 2 float modz = 0.0 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 sum1 = 0.0 float sum2 = 0.0 float sum3 = 0.0 if @ab1 a1 = @a/sqrt(|@a|) * @c b1 = @b/sqrt(|@b|) * @c else a1 = @a b1 = @b endif complex r = (0,1) ^ (@angle / 90.0) complex r2 = (0,1) ^ (@anglestep / 90.0) loop: if @mode == 0 x1 = real(a1) * tan(y1 - x1) - imag(a1) * cos(y1) * x1 + xx1 y1 = real(b1) * tan(x1 - y1) + imag(b1) * sin(x1) * y1 + yy1 elseif @mode == 1 x1 = real(a1) * tan(y1 - x1) - imag(a1) * cos(y1) * x1 + yy1 y1 = real(b1) * tan(x1 - y1) + imag(b1) * sin(x1) * y1 + xx1 elseif @mode == 2 x1 = real(a1) * tan(y1 - x1) - imag(a1) * cos(y1) * x1 + xx1 + yy1 y1 = real(b1) * tan(x1 - y1) + imag(b1) * sin(x1) * y1 + xx1 - yy1 else x1 = real(a1) * tan(y1 - x1) - imag(a1) * cos(y1) * x1 + xx1 + y1 y1 = real(b1) * tan(x1 - y1) + imag(b1) * sin(x1) * y1 + yy1 - x1 endif z1 = x1 + flip(y1) IF (@fbm == true) complex pa = z1 * @scale * r + @noffset float suma = 0.0 float freq = 1.0 int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxa = floor(real(pa)) float fya = floor(imag(pa)) float bx0a = fxa % 256 float by0a = fya % 256 IF (bx0a < 0) bx0a = bx0a + 256 ENDIF IF (by0a < 0) by0a = by0a + 256 ENDIF float bx1a = (bx0a + 1) % 256 float by1a = (by0a + 1) % 256 float rx0a = real(pa) - fxa float ry0a = imag(pa) - fya float rx1a = rx0a - 1 float ry1a = ry0a - 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 b00a = (bx0a^@npower % 65536 + by0a)^@npower % 65536 float b10a = (bx1a^@npower % 65536 + by0a)^@npower % 65536 float b01a = (bx0a^@npower % 65536 + by1a)^@npower % 65536 float b11a = (bx1a^@npower % 65536 + by1a)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0a = (b00a)^@npower*0.25 % 512 - 256 float g_b10_0a = (b10a)^@npower*0.25 % 512 - 256 float g_b01_0a = (b01a)^@npower*0.25 % 512 - 256 float g_b11_0a = (b11a)^@npower*0.25 % 512 - 256 float g_b00_1a = (b00a+1)^@npower*0.25 % 512 - 256 float g_b10_1a = (b10a+1)^@npower*0.25 % 512 - 256 float g_b01_1a = (b01a+1)^@npower*0.25 % 512 - 256 float g_b11_1a = (b11a+1)^@npower*0.25 % 512 - 256 ; normalize each vector float da = 0.0; da = 1 / sqrt(sqr(g_b00_0a) + sqr(g_b00_1a)) g_b00_0a = g_b00_0a * da g_b00_1a = g_b00_1a * da da = 1 / sqrt(sqr(g_b10_0a) + sqr(g_b10_1a)) g_b10_0a = g_b10_0a * da g_b10_1a = g_b10_1a * da da = 1 / sqrt(sqr(g_b01_0a) + sqr(g_b01_1a)) g_b01_0a = g_b01_0a * da g_b01_1a = g_b01_1a * da da = 1 / sqrt(sqr(g_b11_0a) + sqr(g_b11_1a)) g_b11_0a = g_b11_0a * da g_b11_1a = g_b11_1a * da ; produce colors for each corner float u1a = rx0a * g_b00_0a + ry0a * g_b00_1a float v1a = rx1a * g_b10_0a + ry0a * g_b10_1a float u2a = rx0a * g_b01_0a + ry1a * g_b01_1a float v2a = rx1a * g_b11_0a + ry1a * g_b11_1a ; interpolate between corners using ; bilinear filtering float sxa = sqr(rx0a) * (3 - rx0a*2) float sya = sqr(ry0a) * (3 - ry0a*2) float na1 = u1a + sxa*(v1a-u1a) float nb1 = u2a + sxa*(v2a-u2a) suma = suma + real(@nfn1(na1 + sya*(nb1-na1)))*freq freq = freq * @step pa = pa * r2 / @step i = i - 1 ENDWHILE z1 = z1 + (suma+@coloroffset)*0.5*@distortion ENDIF if (@slope) if @mode == 0 x2 = real(a1) * tan(y2 - x2) - imag(a1) * cos(y2) * x2 + xx2 x3 = real(a1) * tan(y3 - x3) - imag(a1) * cos(y3) * x3 + xx3 y2 = real(b1) * tan(x2 - y2) + imag(b1) * sin(x2) * y2 + yy2 y3 = real(b1) * tan(x3 - y3) + imag(b1) * sin(x3) * y3 + yy3 elseif @mode == 1 x2 = real(a1) * tan(y2 - x2) - imag(a1) * cos(y2) * x2 + yy2 x3 = real(a1) * tan(y3 - x3) - imag(a1) * cos(y3) * x3 + yy3 y2 = real(b1) * tan(x2 - y2) + imag(b1) * sin(x2) * y2 + xx2 y3 = real(b1) * tan(x3 - y3) + imag(b1) * sin(x3) * y3 + xx3 elseif @mode == 2 x2 = real(a1) * tan(y2 - x2) - imag(a1) * cos(y2) * x2 + xx2 + yy2 x3 = real(a1) * tan(y3 - x3) - imag(a1) * cos(y3) * x3 + xx3 + yy3 y2 = real(b1) * tan(x2 - y2) + imag(b1) * sin(x2) * y2 + xx2 - yy2 y3 = real(b1) * tan(x3 - y3) + imag(b1) * sin(x3) * y3 + xx3 - yy3 else x2 = real(a1) * tan(y2 - x2) - imag(a1) * cos(y2) * x2 + xx2 + y2 x3 = real(a1) * tan(y3 - x3) - imag(a1) * cos(y3) * x3 + xx3 + y3 y2 = real(b1) * tan(x2 - y2) + imag(b1) * sin(x2) * y2 + yy2 - x2 y3 = real(b1) * tan(x3 - y3) + imag(b1) * sin(x3) * y3 + yy3 - x3 endif z2 = x2 + flip(y2) z3 = x3 + flip(y3) IF (@fbm == true) complex pb = z2 * @scale * r + @noffset complex pc = z3 * @scale * r + @noffset float sumb = 0.0 float sumc = 0.0 float freq = 1.0 int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxb = floor(real(pb)) float fyb = floor(imag(pb)) float bx0b = fxb % 256 float by0b = fyb % 256 IF (bx0b < 0) bx0b = bx0b + 256 ENDIF IF (by0b < 0) by0b = by0b + 256 ENDIF float bx1b = (bx0b + 1) % 256 float by1b = (by0b + 1) % 256 float rx0b = real(pb) - fxb float ry0b = imag(pb) - fyb float rx1b = rx0b - 1 float ry1b = ry0b - 1 float fxc = floor(real(pc)) float fyc = floor(imag(pc)) float bx0c = fxc % 256 float by0c = fyc % 256 IF (bx0c < 0) bx0c = bx0c + 256 ENDIF IF (by0c < 0) by0c = by0c + 256 ENDIF float bx1c = (bx0c + 1) % 256 float by1c = (by0c + 1) % 256 float rx0c = real(pc) - fxc float ry0c = imag(pc) - fyc float rx1c = rx0c - 1 float ry1c = ry0c - 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 b00b = (bx0b^@npower % 65536 + by0b)^@npower % 65536 float b10b = (bx1b^@npower % 65536 + by0b)^@npower % 65536 float b01b = (bx0b^@npower % 65536 + by1b)^@npower % 65536 float b11b = (bx1b^@npower % 65536 + by1b)^@npower % 65536 float b00c = (bx0c^@npower % 65536 + by0c)^@npower % 65536 float b10c = (bx1c^@npower % 65536 + by0c)^@npower % 65536 float b01c = (bx0c^@npower % 65536 + by1c)^@npower % 65536 float b11c = (bx1c^@npower % 65536 + by1c)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0b = (b00b)^@npower*0.25 % 512 - 256 float g_b10_0b = (b10b)^@npower*0.25 % 512 - 256 float g_b01_0b = (b01b)^@npower*0.25 % 512 - 256 float g_b11_0b = (b11b)^@npower*0.25 % 512 - 256 float g_b00_1b = (b00b+1)^@npower*0.25 % 512 - 256 float g_b10_1b = (b10b+1)^@npower*0.25 % 512 - 256 float g_b01_1b = (b01b+1)^@npower*0.25 % 512 - 256 float g_b11_1b = (b11b+1)^@npower*0.25 % 512 - 256 float g_b00_0c = (b00c)^@npower*0.25 % 512 - 256 float g_b10_0c = (b10c)^@npower*0.25 % 512 - 256 float g_b01_0c = (b01c)^@npower*0.25 % 512 - 256 float g_b11_0c = (b11c)^@npower*0.25 % 512 - 256 float g_b00_1c = (b00c+1)^@npower*0.25 % 512 - 256 float g_b10_1c = (b10c+1)^@npower*0.25 % 512 - 256 float g_b01_1c = (b01c+1)^@npower*0.25 % 512 - 256 float g_b11_1c = (b11c+1)^@npower*0.25 % 512 - 256 ; normalize each vector float db = 0.0 float dc = 0.0; db = 1 / sqrt(sqr(g_b00_0b) + sqr(g_b00_1b)) g_b00_0b = g_b00_0b * db g_b00_1b = g_b00_1b * db db = 1 / sqrt(sqr(g_b10_0b) + sqr(g_b10_1b)) g_b10_0b = g_b10_0b * db g_b10_1b = g_b10_1b * db db = 1 / sqrt(sqr(g_b01_0b) + sqr(g_b01_1b)) g_b01_0b = g_b01_0b * db g_b01_1b = g_b01_1b * db db = 1 / sqrt(sqr(g_b11_0b) + sqr(g_b11_1b)) g_b11_0b = g_b11_0b * db g_b11_1b = g_b11_1b * db dc = 1 / sqrt(sqr(g_b00_0c) + sqr(g_b00_1c)) g_b00_0c = g_b00_0c * dc g_b00_1c = g_b00_1c * dc dc = 1 / sqrt(sqr(g_b10_0c) + sqr(g_b10_1c)) g_b10_0c = g_b10_0c * dc g_b10_1c = g_b10_1c * dc dc = 1 / sqrt(sqr(g_b01_0c) + sqr(g_b01_1c)) g_b01_0c = g_b01_0c * dc g_b01_1c = g_b01_1c * dc dc = 1 / sqrt(sqr(g_b11_0c) + sqr(g_b11_1c)) g_b11_0c = g_b11_0c * dc g_b11_1c = g_b11_1c * dc ; produce colors for each corner float u1b = rx0b * g_b00_0b + ry0b * g_b00_1b float v1b = rx1b * g_b10_0b + ry0b * g_b10_1b float u2b = rx0b * g_b01_0b + ry1b * g_b01_1b float v2b = rx1b * g_b11_0b + ry1b * g_b11_1b float u1c = rx0c * g_b00_0c + ry0c * g_b00_1c float v1c = rx1c * g_b10_0c + ry0c * g_b10_1c float u2c = rx0c * g_b01_0c + ry1c * g_b01_1c float v2c = rx1c * g_b11_0c + ry1c * g_b11_1c ; interpolate between corners using ; bilinear filtering float sxb = sqr(rx0b) * (3 - rx0b*2) float syb = sqr(ry0b) * (3 - ry0b*2) float na2 = u1b + sxb*(v1b-u1b) float nb2 = u2b + sxb*(v2b-u2b) float sxc = sqr(rx0c) * (3 - rx0c*2) float syc = sqr(ry0c) * (3 - ry0c*2) float na3 = u1c + sxc*(v1c-u1c) float nb3 = u2c + sxc*(v2c-u2c) sumb = sumb + real(@nfn1(na2 + syb*(nb2-na2)))*freq sumc = sumc + real(@nfn1(na3 + syc*(nb3-na3)))*freq freq = freq * @step pb = pb * r2 / @step pc = pc * r2 / @step i = i - 1 ENDWHILE z2 = z2 + (sumb+@coloroffset)*0.5*@distortion z3 = z3 + (sumc+@coloroffset)*0.5*@distortion endif ENDIF modz = |z1| if (@slope == true) if (@zmode == 0) sum1 = sum1 + exp(-cabs(z1)) sum2 = sum2 + exp(-cabs(z2)) sum3 = sum3 + exp(-cabs(z3)) elseif (@zmode == 1) sum1 = cabs(z1 - #pixel) sum2 = cabs(z2 - #pixel) sum3 = cabs(z3 - #pixel) else sum1 = cabs(z1) sum2 = cabs(z2) sum3 = cabs(z3) endif done = done + 1 ; increment iteration counter IF (modz > @bailout || \ @everyiter || \ done == #maxit + 2) ; done, or every iteration, or last ; determine continuous iteration (height) for each point e1 = sum1 * @zscale e2 = sum2 * @zscale e3 = sum3 * @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 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 else z = z1 endif IF (modz > @bailout) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope MartSam 3" maxiter = 1 magn = .2 param version caption = "Version" default = 1.22 visible = false endparam param mode caption = "Mode" default = 0 enum = "x1 ; y1" "y1 ; x1" "x1 + y1 ; x1 - y1" \ "x1 + y ; y1 - x" endparam param a caption = "a" default = (1,.5) endparam param b caption = "b" default = (1,.5) endparam param c caption = "c" default = 1.0 endparam param ab1 caption = "|a| = |b| = c ?" default = false hint = "Useful to get images of the same \ complexity. Choose a nice c value and \ play with a and b." endparam func fr1 caption = "Real Func 1" default = ident() endfunc func fi1 caption = "Imag Func 1" default = ident() endfunc param bailout caption = "Bailout Value" default = 1.0e20 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam bool param fbm caption = "fBm texturing?" default = false endparam heading caption = "fBm Parameters" visible = @fbm == true endheading param distortion caption = "Noise Strength" default = 1.0 visible = @fbm == true endparam param coloroffset caption = "Coloring Offset" default = 0.0 hint = "Sets the coloring offset from zero. Increase this if you see \ large areas of solid color." visible = @fbm == true endparam param noffset 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." visible = @fbm == true endparam param scale caption = "Noise Scale" default = 1.0 hint = "This is the overall scale of the noise." visible = @fbm == true endparam param angle caption = "Noise Rotation" default = 0.0 hint = "This is the angle, in degrees, of the noise." visible = @fbm == true endparam param step caption = "Noise Scale Step" default = 0.5 hint = "This is the step in scale between noise iterations." visible = @fbm == true endparam param anglestep caption = "Noise Rotation Step" default = 37.0 hint = "This is the angle, in degrees, to rotate between noise \ iterations." visible = @fbm == true endparam param octaves caption = "Noise Octaves" default = 7 min = 1 hint = "This is the number of iterations of the noise formula." visible = @fbm == true endparam param npower caption = "Noise Exponent" default = 2.0 hint = "This is the exponent used to scramble numbers." visible = @fbm == true endparam func nfn1 caption = "Noise Function" default = ident() visible = @fbm == true endfunc bool param slope caption = "Apply slope?" default = true endparam heading caption = "Slope Parameters" visible = @slope == true endheading param offset caption = "Orbit Separation" default = 0.01 hint = "Defines how far apart the simultaneous orbits are.\ Smaller distances will produce more accurate results." visible = @slope == true endparam param zmode caption = "Height Value" enum = "smoothed iteration" "magnitude (z-pixel)" "magnitude (z)" default = 0 visible = @slope==true endparam param xfer caption = "Height Transfer" default = 1 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." visible = @slope == true 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." visible = @slope == true endparam param zscale2 caption = "Height Post-Scale" default = 1.0 hint = "Specifies the ratio between height and distance; like \ Height Pre-Scale, except that this value is applied after \ the transfer function." visible = @slope == true 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." visible = @slope == true endparam } gnd-SlopeMartSam4 { ; based upon the slope (Mandelbrot) ; formula of Damien Jones ; modified MartSam4 formula from Samuel Monnier, 1999 ; Inspired from the Martin formula (by ; Mark Townsend) ; compound with the models of slope formulas from Ron Barnett. ; These slopes formulas are dedicated to the memory of Carol Walske, (1955, 2004). ; version 1.1, January 2005 ; Gilles Nadeau, 23/01/2005 ; Slope Optional, v1.1 by Susan Chambless, Mar, 2005. ; ; Damien's fBm added September, 2005 ; version 1.22, ; Gilles, 17/09/2005 ; Use inside colouring. ; Modifying the iteration number will change ; the image. ; With this one, you will get better result ; if you set a slow increasing transfer ; function like cubereoot or Atan. init: z1 = #pixel ; primary iterated point z2 = #pixel + @offset ; horizontally offset point z3 = #pixel + flip(@offset) ; vertically offset point x1 = real(z1) + real(@start) x2 = real(z2) + real(@start) x3 = real(z3) + real(@start) y1 = imag(z1) + imag(@start) y2 = imag(z2) + imag(@start) y3 = imag(z3) + imag(@start) xx1 = @fr1(real(z1)) xx2 = @fr1(real(z2)) xx3 = @fr1(real(z3)) yy1 = @fi1(imag(z1)) yy2 = @fi1(imag(z2)) yy3 = @fi1(imag(z3)) int done = 2 float modz = 0.0 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 sum1 = 0.0 float sum2 = 0.0 float sum3 = 0.0 if @ab1 a1 = @a/sqrt(|@a|) * @c b1 = @b/sqrt(|@b|) * @c else a1 = @a b1 = @b endif complex r = (0,1) ^ (@angle / 90.0) complex r2 = (0,1) ^ (@anglestep / 90.0) loop: if @mode == 0 x1 = real(a1) * sin(x1 - xx1) + imag(a1) * yy1/x1 y1 = real(b1) * sin(y1 - yy1) + imag(b1) * y1/xx1 elseif @mode == 1 x1 = real(a1) * sin(x1 - xx1) + imag(a1) * yy1/xx1 y1 = real(b1) * sin(y1 - yy1) + imag(b1) * y1/x1 elseif @mode == 2 x1 = real(a1) * sin(x1 - xx1) + imag(a1) * yy1/y1 y1 = real(b1) * sin(y1 - yy1) + imag(b1) * xx1/x1 elseif @mode == 3 x1 = real(a1) * sin(x1 - xx1) + imag(a1) * yy1/y1 y1 = real(b1) * sin(y1 - yy1) + imag(b1) * x1/xx1 elseif @mode == 4 x1 = real(a1) * sin(x1 - xx1) + imag(a1) * x1/xx1 y1 = real(b1) * sin(y1 - yy1) + imag(b1) * y1/yy1 elseif @mode == 5 x1 = real(a1) * sin(x1 - xx1) + imag(a1) * xx1/x1 y1 = real(b1) * sin(y1 - yy1) + imag(b1) * yy1/y1 elseif @mode == 6 x1 = real(a1) * sin(x1 - xx1) + imag(a1) * xx1/y1 y1 = real(b1) * sin(y1 - yy1) + imag(b1) * yy1/x1 elseif @mode == 7 x1 = real(a1) * sin(x1 - xx1) + imag(a1) * y1/xx1 y1 = real(b1) * sin(y1 - yy1) + imag(b1) * x1/yy1 else x1 = real(a1) * sin(x1 - xx1) + imag(a1) * y1/yy1 y1 = real(b1) * sin(y1 - yy1) + imag(b1) * x1/xx1 endif z1 = x1 + flip(y1) IF (@fbm == true) complex pa = z1 * @scale * r + @noffset float suma = 0.0 float freq = 1.0 int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxa = floor(real(pa)) float fya = floor(imag(pa)) float bx0a = fxa % 256 float by0a = fya % 256 IF (bx0a < 0) bx0a = bx0a + 256 ENDIF IF (by0a < 0) by0a = by0a + 256 ENDIF float bx1a = (bx0a + 1) % 256 float by1a = (by0a + 1) % 256 float rx0a = real(pa) - fxa float ry0a = imag(pa) - fya float rx1a = rx0a - 1 float ry1a = ry0a - 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 b00a = (bx0a^@npower % 65536 + by0a)^@npower % 65536 float b10a = (bx1a^@npower % 65536 + by0a)^@npower % 65536 float b01a = (bx0a^@npower % 65536 + by1a)^@npower % 65536 float b11a = (bx1a^@npower % 65536 + by1a)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0a = (b00a)^@npower*0.25 % 512 - 256 float g_b10_0a = (b10a)^@npower*0.25 % 512 - 256 float g_b01_0a = (b01a)^@npower*0.25 % 512 - 256 float g_b11_0a = (b11a)^@npower*0.25 % 512 - 256 float g_b00_1a = (b00a+1)^@npower*0.25 % 512 - 256 float g_b10_1a = (b10a+1)^@npower*0.25 % 512 - 256 float g_b01_1a = (b01a+1)^@npower*0.25 % 512 - 256 float g_b11_1a = (b11a+1)^@npower*0.25 % 512 - 256 ; normalize each vector float da = 0.0; da = 1 / sqrt(sqr(g_b00_0a) + sqr(g_b00_1a)) g_b00_0a = g_b00_0a * da g_b00_1a = g_b00_1a * da da = 1 / sqrt(sqr(g_b10_0a) + sqr(g_b10_1a)) g_b10_0a = g_b10_0a * da g_b10_1a = g_b10_1a * da da = 1 / sqrt(sqr(g_b01_0a) + sqr(g_b01_1a)) g_b01_0a = g_b01_0a * da g_b01_1a = g_b01_1a * da da = 1 / sqrt(sqr(g_b11_0a) + sqr(g_b11_1a)) g_b11_0a = g_b11_0a * da g_b11_1a = g_b11_1a * da ; produce colors for each corner float u1a = rx0a * g_b00_0a + ry0a * g_b00_1a float v1a = rx1a * g_b10_0a + ry0a * g_b10_1a float u2a = rx0a * g_b01_0a + ry1a * g_b01_1a float v2a = rx1a * g_b11_0a + ry1a * g_b11_1a ; interpolate between corners using ; bilinear filtering float sxa = sqr(rx0a) * (3 - rx0a*2) float sya = sqr(ry0a) * (3 - ry0a*2) float na1 = u1a + sxa*(v1a-u1a) float nb1 = u2a + sxa*(v2a-u2a) suma = suma + real(@nfn1(na1 + sya*(nb1-na1)))*freq freq = freq * @step pa = pa * r2 / @step i = i - 1 ENDWHILE z1 = z1 + (suma+@coloroffset)*0.5*@distortion ENDIF if (@slope) if @mode == 0 x2 = real(a1) * sin(x2 - xx2) + imag(a1) * yy2/x2 x3 = real(a1) * sin(x3 - xx3) + imag(a1) * yy3/x3 y2 = real(b1) * sin(y2 - yy2) + imag(b1) * y2/xx2 y3 = real(b1) * sin(y3 - yy3) + imag(b1) * y3/xx3 elseif @mode == 1 x2 = real(a1) * sin(x2 - xx2) + imag(a1) * yy2/xx2 x3 = real(a1) * sin(x3 - xx3) + imag(a1) * yy3/xx3 y2 = real(b1) * sin(y2 - yy2) + imag(b1) * y2/x2 y3 = real(b1) * sin(y3 - yy3) + imag(b1) * y3/x3 elseif @mode == 2 x2 = real(a1) * sin(x2 - xx2) + imag(a1) * yy2/y2 x3 = real(a1) * sin(x3 - xx3) + imag(a1) * yy3/y3 y2 = real(b1) * sin(y2 - yy2) + imag(b1) * xx2/x2 y3 = real(b1) * sin(y3 - yy3) + imag(b1) * xx3/x3 elseif @mode == 3 x2 = real(a1) * sin(x2 - xx2) + imag(a1) * yy2/y2 x3 = real(a1) * sin(x3 - xx3) + imag(a1) * yy3/y3 y2 = real(b1) * sin(y2 - yy2) + imag(b1) * x2/xx2 y3 = real(b1) * sin(y3 - yy3) + imag(b1) * x3/xx3 elseif @mode == 4 x2 = real(a1) * sin(x2 - xx2) + imag(a1) * x2/xx2 x3 = real(a1) * sin(x3 - xx3) + imag(a1) * x3/xx3 y2 = real(b1) * sin(y2 - yy2) + imag(b1) * y2/yy2 y3 = real(b1) * sin(y3 - yy3) + imag(b1) * y3/yy3 elseif @mode == 5 x2 = real(a1) * sin(x2 - xx2) + imag(a1) * xx2/x2 x3 = real(a1) * sin(x3 - xx3) + imag(a1) * xx3/x3 y2 = real(b1) * sin(y2 - yy2) + imag(b1) * yy2/y2 y3 = real(b1) * sin(y3 - yy3) + imag(b1) * yy3/y3 elseif @mode == 6 x2 = real(a1) * sin(x2 - xx2) + imag(a1) * xx2/y2 x3 = real(a1) * sin(x3 - xx3) + imag(a1) * xx3/y3 y2 = real(b1) * sin(y2 - yy2) + imag(b1) * yy2/x2 y3 = real(b1) * sin(y3 - yy3) + imag(b1) * yy3/x3 elseif @mode == 7 x2 = real(a1) * sin(x2 - xx2) + imag(a1) * y2/xx2 x3 = real(a1) * sin(x3 - xx3) + imag(a1) * y3/xx3 y2 = real(b1) * sin(y2 - yy2) + imag(b1) * x2/yy2 y3 = real(b1) * sin(y3 - yy3) + imag(b1) * x3/yy3 else x2 = real(a1) * sin(x2 - xx2) + imag(a1) * y2/yy2 x3 = real(a1) * sin(x3 - xx3) + imag(a1) * y3/yy3 y2 = real(b1) * sin(y2 - yy2) + imag(b1) * x2/xx2 y3 = real(b1) * sin(y3 - yy3) + imag(b1) * x3/xx3 endif z2 = x2 + flip(y2) z3 = x3 + flip(y3) IF (@fbm == true) complex pb = z2 * @scale * r + @noffset complex pc = z3 * @scale * r + @noffset float sumb = 0.0 float sumc = 0.0 float freq = 1.0 int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxb = floor(real(pb)) float fyb = floor(imag(pb)) float bx0b = fxb % 256 float by0b = fyb % 256 IF (bx0b < 0) bx0b = bx0b + 256 ENDIF IF (by0b < 0) by0b = by0b + 256 ENDIF float bx1b = (bx0b + 1) % 256 float by1b = (by0b + 1) % 256 float rx0b = real(pb) - fxb float ry0b = imag(pb) - fyb float rx1b = rx0b - 1 float ry1b = ry0b - 1 float fxc = floor(real(pc)) float fyc = floor(imag(pc)) float bx0c = fxc % 256 float by0c = fyc % 256 IF (bx0c < 0) bx0c = bx0c + 256 ENDIF IF (by0c < 0) by0c = by0c + 256 ENDIF float bx1c = (bx0c + 1) % 256 float by1c = (by0c + 1) % 256 float rx0c = real(pc) - fxc float ry0c = imag(pc) - fyc float rx1c = rx0c - 1 float ry1c = ry0c - 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 b00b = (bx0b^@npower % 65536 + by0b)^@npower % 65536 float b10b = (bx1b^@npower % 65536 + by0b)^@npower % 65536 float b01b = (bx0b^@npower % 65536 + by1b)^@npower % 65536 float b11b = (bx1b^@npower % 65536 + by1b)^@npower % 65536 float b00c = (bx0c^@npower % 65536 + by0c)^@npower % 65536 float b10c = (bx1c^@npower % 65536 + by0c)^@npower % 65536 float b01c = (bx0c^@npower % 65536 + by1c)^@npower % 65536 float b11c = (bx1c^@npower % 65536 + by1c)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0b = (b00b)^@npower*0.25 % 512 - 256 float g_b10_0b = (b10b)^@npower*0.25 % 512 - 256 float g_b01_0b = (b01b)^@npower*0.25 % 512 - 256 float g_b11_0b = (b11b)^@npower*0.25 % 512 - 256 float g_b00_1b = (b00b+1)^@npower*0.25 % 512 - 256 float g_b10_1b = (b10b+1)^@npower*0.25 % 512 - 256 float g_b01_1b = (b01b+1)^@npower*0.25 % 512 - 256 float g_b11_1b = (b11b+1)^@npower*0.25 % 512 - 256 float g_b00_0c = (b00c)^@npower*0.25 % 512 - 256 float g_b10_0c = (b10c)^@npower*0.25 % 512 - 256 float g_b01_0c = (b01c)^@npower*0.25 % 512 - 256 float g_b11_0c = (b11c)^@npower*0.25 % 512 - 256 float g_b00_1c = (b00c+1)^@npower*0.25 % 512 - 256 float g_b10_1c = (b10c+1)^@npower*0.25 % 512 - 256 float g_b01_1c = (b01c+1)^@npower*0.25 % 512 - 256 float g_b11_1c = (b11c+1)^@npower*0.25 % 512 - 256 ; normalize each vector float db = 0.0 float dc = 0.0; db = 1 / sqrt(sqr(g_b00_0b) + sqr(g_b00_1b)) g_b00_0b = g_b00_0b * db g_b00_1b = g_b00_1b * db db = 1 / sqrt(sqr(g_b10_0b) + sqr(g_b10_1b)) g_b10_0b = g_b10_0b * db g_b10_1b = g_b10_1b * db db = 1 / sqrt(sqr(g_b01_0b) + sqr(g_b01_1b)) g_b01_0b = g_b01_0b * db g_b01_1b = g_b01_1b * db db = 1 / sqrt(sqr(g_b11_0b) + sqr(g_b11_1b)) g_b11_0b = g_b11_0b * db g_b11_1b = g_b11_1b * db dc = 1 / sqrt(sqr(g_b00_0c) + sqr(g_b00_1c)) g_b00_0c = g_b00_0c * dc g_b00_1c = g_b00_1c * dc dc = 1 / sqrt(sqr(g_b10_0c) + sqr(g_b10_1c)) g_b10_0c = g_b10_0c * dc g_b10_1c = g_b10_1c * dc dc = 1 / sqrt(sqr(g_b01_0c) + sqr(g_b01_1c)) g_b01_0c = g_b01_0c * dc g_b01_1c = g_b01_1c * dc dc = 1 / sqrt(sqr(g_b11_0c) + sqr(g_b11_1c)) g_b11_0c = g_b11_0c * dc g_b11_1c = g_b11_1c * dc ; produce colors for each corner float u1b = rx0b * g_b00_0b + ry0b * g_b00_1b float v1b = rx1b * g_b10_0b + ry0b * g_b10_1b float u2b = rx0b * g_b01_0b + ry1b * g_b01_1b float v2b = rx1b * g_b11_0b + ry1b * g_b11_1b float u1c = rx0c * g_b00_0c + ry0c * g_b00_1c float v1c = rx1c * g_b10_0c + ry0c * g_b10_1c float u2c = rx0c * g_b01_0c + ry1c * g_b01_1c float v2c = rx1c * g_b11_0c + ry1c * g_b11_1c ; interpolate between corners using ; bilinear filtering float sxb = sqr(rx0b) * (3 - rx0b*2) float syb = sqr(ry0b) * (3 - ry0b*2) float na2 = u1b + sxb*(v1b-u1b) float nb2 = u2b + sxb*(v2b-u2b) float sxc = sqr(rx0c) * (3 - rx0c*2) float syc = sqr(ry0c) * (3 - ry0c*2) float na3 = u1c + sxc*(v1c-u1c) float nb3 = u2c + sxc*(v2c-u2c) sumb = sumb + real(@nfn1(na2 + syb*(nb2-na2)))*freq sumc = sumc + real(@nfn1(na3 + syc*(nb3-na3)))*freq freq = freq * @step pb = pb * r2 / @step pc = pc * r2 / @step i = i - 1 ENDWHILE z2 = z2 + (sumb+@coloroffset)*0.5*@distortion z3 = z3 + (sumc+@coloroffset)*0.5*@distortion endif ENDIF modz = |z1| if (@slope == true) if (@zmode == 0) sum1 = sum1 + exp(-cabs(z1)) sum2 = sum2 + exp(-cabs(z2)) sum3 = sum3 + exp(-cabs(z3)) elseif (@zmode == 1) sum1 = cabs(z1 - #pixel) sum2 = cabs(z2 - #pixel) sum3 = cabs(z3 - #pixel) else sum1 = cabs(z1) sum2 = cabs(z2) sum3 = cabs(z3) endif done = done + 1 ; increment iteration counter IF (modz > @bailout || \ @everyiter || \ done == #maxit + 2) ; done, or every iteration, or last ; determine continuous iteration (height) for each point e1 = sum1 * @zscale e2 = sum2 * @zscale e3 = sum3 * @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 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 else z = z1 endif IF (modz > @bailout) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope MartSam 4" maxiter = 3 magn = .2 param version caption = "Version" default = 1.22 visible = false endparam param mode caption = "Mode" default = 0 enum = "y1/x ; y/x1" "y1/x1 ; x/y" "y1/y ; x1/x" \ "y1/y ; x/x1" "x/x1 ; y/y1" "x1/x ; y1/y" \ "x1/y ; y1/x" "y/x1 ; x/y1" "y/y1 ; x/x1" endparam param start caption = "Starting Value" default = (1,.5) endparam param a caption = "a" default = (1,.5) endparam param b caption = "b" default = (1,.5) endparam param c caption = "c" default = 1.0 endparam param ab1 caption = "|a| = |b| = c ?" default = false hint = "Useful to get images of the same \ complexity. Choose a nice c value and \ play with a and b." endparam func fr1 caption = "Real Func 1" default = ident() endfunc func fi1 caption = "Imag Func 1" default = ident() endfunc param bailout caption = "Bailout Value" default = 1.0e20 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam bool param fbm caption = "fBm texturing?" default = false endparam heading caption = "fBm Parameters" visible = @fbm == true endheading param distortion caption = "Noise Strength" default = 1.0 visible = @fbm == true endparam param coloroffset caption = "Coloring Offset" default = 0.0 hint = "Sets the coloring offset from zero. Increase this if you see \ large areas of solid color." visible = @fbm == true endparam param noffset 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." visible = @fbm == true endparam param scale caption = "Noise Scale" default = 1.0 hint = "This is the overall scale of the noise." visible = @fbm == true endparam param angle caption = "Noise Rotation" default = 0.0 hint = "This is the angle, in degrees, of the noise." visible = @fbm == true endparam param step caption = "Noise Scale Step" default = 0.5 hint = "This is the step in scale between noise iterations." visible = @fbm == true endparam param anglestep caption = "Noise Rotation Step" default = 37.0 hint = "This is the angle, in degrees, to rotate between noise \ iterations." visible = @fbm == true endparam param octaves caption = "Noise Octaves" default = 7 min = 1 hint = "This is the number of iterations of the noise formula." visible = @fbm == true endparam param npower caption = "Noise Exponent" default = 2.0 hint = "This is the exponent used to scramble numbers." visible = @fbm == true endparam func nfn1 caption = "Noise Function" default = ident() visible = @fbm == true endfunc bool param slope caption = "Apply slope?" default = true endparam heading caption = "Slope Parameters" visible = @slope == true endheading param offset caption = "Orbit Separation" default = 0.01 hint = "Defines how far apart the simultaneous orbits are.\ Smaller distances will produce more accurate results." visible = @slope == true endparam param zmode caption = "Height Value" enum = "smoothed iteration" "magnitude (z-pixel)" "magnitude (z)" default = 0 visible = @slope==true endparam param xfer caption = "Height Transfer" default = 1 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." visible = @slope == true 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." visible = @slope == true endparam param zscale2 caption = "Height Post-Scale" default = 1.0 hint = "Specifies the ratio between height and distance; like \ Height Pre-Scale, except that this value is applied after \ the transfer function." visible = @slope == true 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." visible = @slope == true endparam } gnd-SlopeMartSam5 { ; based upon the slope (Mandelbrot) ; formula of Damien Jones ; modified MartSam5 formula from Samuel Monnier, 1999 ; Inspired from the Martin formula (by ; Mark Townsend) ; compound with the models of slope formulas from Ron Barnett. ; These slopes formulas are dedicated to the memory of Carol Walske, (1955, 2004). ; version 1.1, January 2005 ; Gilles Nadeau, 23/01/2005 ; Slope Optional, v1.1 by Susan Chambless, Mar, 2005. ; ; Damien's fBm added September, 2005 ; version 1.22, ; Gilles, 17/09/2005 ; Use inside colouring. ; Modifying the iteration number will change ; the image. init: z1 = #pixel ; primary iterated point z2 = #pixel + @offset ; horizontally offset point z3 = #pixel + flip(@offset) ; vertically offset point x1 = real(z1) x2 = real(z2) x3 = real(z3) y1 = imag(z1) y2 = imag(z2) y3 = imag(z3) xx1 = @fr1(x1) xx2 = @fr1(x2) xx3 = @fr1(x3) yy1 = @fi1(y1) yy2 = @fi1(y2) yy3 = @fi1(y3) int done = 2 float modz = 0.0 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 sum1 = 0.0 float sum2 = 0.0 float sum3 = 0.0 if @ab1 a1 = @a/sqrt(|@a|) * @c b1 = @b/sqrt(|@b|) * @c else a1 = @a b1 = @b endif complex r = (0,1) ^ (@angle / 90.0) complex r2 = (0,1) ^ (@anglestep / 90.0) loop: if @mode == 0 x1 = real(a1) * sin(x1) + imag(a1) * y1 + xx1 y1 = real(b1) * cos(y1) + imag(b1) * x1 + yy1 elseif @mode == 1 x1 = real(a1) * sin(x1) + imag(a1) * y1 + yy1 y1 = real(b1) * cos(y1) + imag(b1) * x1 + xx1 elseif @mode == 2 x1 = real(a1) * sin(x1) + imag(a1) * y1 + xx1 + yy1 y1 = real(b1) * cos(y1) + imag(b1) * x1 + xx1 - yy1 else x1 = real(a1) * sin(x1) + imag(a1) * y1 + xx1 + y1 y1 = real(b1) * cos(y1) + imag(b1) * x1 + yy1 - x1 endif z1 = x1 + flip(y1) IF (@fbm == true) complex pa = z1 * @scale * r + @noffset float suma = 0.0 float freq = 1.0 int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxa = floor(real(pa)) float fya = floor(imag(pa)) float bx0a = fxa % 256 float by0a = fya % 256 IF (bx0a < 0) bx0a = bx0a + 256 ENDIF IF (by0a < 0) by0a = by0a + 256 ENDIF float bx1a = (bx0a + 1) % 256 float by1a = (by0a + 1) % 256 float rx0a = real(pa) - fxa float ry0a = imag(pa) - fya float rx1a = rx0a - 1 float ry1a = ry0a - 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 b00a = (bx0a^@npower % 65536 + by0a)^@npower % 65536 float b10a = (bx1a^@npower % 65536 + by0a)^@npower % 65536 float b01a = (bx0a^@npower % 65536 + by1a)^@npower % 65536 float b11a = (bx1a^@npower % 65536 + by1a)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0a = (b00a)^@npower*0.25 % 512 - 256 float g_b10_0a = (b10a)^@npower*0.25 % 512 - 256 float g_b01_0a = (b01a)^@npower*0.25 % 512 - 256 float g_b11_0a = (b11a)^@npower*0.25 % 512 - 256 float g_b00_1a = (b00a+1)^@npower*0.25 % 512 - 256 float g_b10_1a = (b10a+1)^@npower*0.25 % 512 - 256 float g_b01_1a = (b01a+1)^@npower*0.25 % 512 - 256 float g_b11_1a = (b11a+1)^@npower*0.25 % 512 - 256 ; normalize each vector float da = 0.0; da = 1 / sqrt(sqr(g_b00_0a) + sqr(g_b00_1a)) g_b00_0a = g_b00_0a * da g_b00_1a = g_b00_1a * da da = 1 / sqrt(sqr(g_b10_0a) + sqr(g_b10_1a)) g_b10_0a = g_b10_0a * da g_b10_1a = g_b10_1a * da da = 1 / sqrt(sqr(g_b01_0a) + sqr(g_b01_1a)) g_b01_0a = g_b01_0a * da g_b01_1a = g_b01_1a * da da = 1 / sqrt(sqr(g_b11_0a) + sqr(g_b11_1a)) g_b11_0a = g_b11_0a * da g_b11_1a = g_b11_1a * da ; produce colors for each corner float u1a = rx0a * g_b00_0a + ry0a * g_b00_1a float v1a = rx1a * g_b10_0a + ry0a * g_b10_1a float u2a = rx0a * g_b01_0a + ry1a * g_b01_1a float v2a = rx1a * g_b11_0a + ry1a * g_b11_1a ; interpolate between corners using ; bilinear filtering float sxa = sqr(rx0a) * (3 - rx0a*2) float sya = sqr(ry0a) * (3 - ry0a*2) float na1 = u1a + sxa*(v1a-u1a) float nb1 = u2a + sxa*(v2a-u2a) suma = suma + real(@nfn1(na1 + sya*(nb1-na1)))*freq freq = freq * @step pa = pa * r2 / @step i = i - 1 ENDWHILE z1 = z1 + (suma+@coloroffset)*0.5*@distortion ENDIF if (@slope) if @mode == 0 x2 = real(a1) * sin(x2) + imag(a1) * y2 + xx2 x3 = real(a1) * sin(x3) + imag(a1) * y3 + xx3 y2 = real(b1) * cos(y2) + imag(b1) * x2 + yy2 y3 = real(b1) * cos(y3) + imag(b1) * x3 + yy3 elseif @mode == 1 x2 = real(a1) * sin(x2) + imag(a1) * y2 + yy2 x3 = real(a1) * sin(x3) + imag(a1) * y3 + yy3 y2 = real(b1) * cos(y2) + imag(b1) * x2 + xx2 y3 = real(b1) * cos(y3) + imag(b1) * x3 + xx3 elseif @mode == 2 x2 = real(a1) * sin(x2) + imag(a1) * y2 + xx2 + yy2 x3 = real(a1) * sin(x3) + imag(a1) * y3 + xx3 + yy3 y2 = real(b1) * cos(y2) + imag(b1) * x2 + xx2 - yy2 y3 = real(b1) * cos(y3) + imag(b1) * x3 + xx3 - yy3 else x2 = real(a1) * sin(x2) + imag(a1) * y2 + xx2 + y2 x3 = real(a1) * sin(x3) + imag(a1) * y3 + xx3 + y3 y2 = real(b1) * cos(y2) + imag(b1) * x2 + yy2 - x2 y3 = real(b1) * cos(y3) + imag(b1) * x3 + yy3 - x3 endif z2 = x2 + flip(y2) z3 = x3 + flip(y3) IF (@fbm == true) complex pb = z2 * @scale * r + @noffset complex pc = z3 * @scale * r + @noffset float sumb = 0.0 float sumc = 0.0 float freq = 1.0 int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxb = floor(real(pb)) float fyb = floor(imag(pb)) float bx0b = fxb % 256 float by0b = fyb % 256 IF (bx0b < 0) bx0b = bx0b + 256 ENDIF IF (by0b < 0) by0b = by0b + 256 ENDIF float bx1b = (bx0b + 1) % 256 float by1b = (by0b + 1) % 256 float rx0b = real(pb) - fxb float ry0b = imag(pb) - fyb float rx1b = rx0b - 1 float ry1b = ry0b - 1 float fxc = floor(real(pc)) float fyc = floor(imag(pc)) float bx0c = fxc % 256 float by0c = fyc % 256 IF (bx0c < 0) bx0c = bx0c + 256 ENDIF IF (by0c < 0) by0c = by0c + 256 ENDIF float bx1c = (bx0c + 1) % 256 float by1c = (by0c + 1) % 256 float rx0c = real(pc) - fxc float ry0c = imag(pc) - fyc float rx1c = rx0c - 1 float ry1c = ry0c - 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 b00b = (bx0b^@npower % 65536 + by0b)^@npower % 65536 float b10b = (bx1b^@npower % 65536 + by0b)^@npower % 65536 float b01b = (bx0b^@npower % 65536 + by1b)^@npower % 65536 float b11b = (bx1b^@npower % 65536 + by1b)^@npower % 65536 float b00c = (bx0c^@npower % 65536 + by0c)^@npower % 65536 float b10c = (bx1c^@npower % 65536 + by0c)^@npower % 65536 float b01c = (bx0c^@npower % 65536 + by1c)^@npower % 65536 float b11c = (bx1c^@npower % 65536 + by1c)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0b = (b00b)^@npower*0.25 % 512 - 256 float g_b10_0b = (b10b)^@npower*0.25 % 512 - 256 float g_b01_0b = (b01b)^@npower*0.25 % 512 - 256 float g_b11_0b = (b11b)^@npower*0.25 % 512 - 256 float g_b00_1b = (b00b+1)^@npower*0.25 % 512 - 256 float g_b10_1b = (b10b+1)^@npower*0.25 % 512 - 256 float g_b01_1b = (b01b+1)^@npower*0.25 % 512 - 256 float g_b11_1b = (b11b+1)^@npower*0.25 % 512 - 256 float g_b00_0c = (b00c)^@npower*0.25 % 512 - 256 float g_b10_0c = (b10c)^@npower*0.25 % 512 - 256 float g_b01_0c = (b01c)^@npower*0.25 % 512 - 256 float g_b11_0c = (b11c)^@npower*0.25 % 512 - 256 float g_b00_1c = (b00c+1)^@npower*0.25 % 512 - 256 float g_b10_1c = (b10c+1)^@npower*0.25 % 512 - 256 float g_b01_1c = (b01c+1)^@npower*0.25 % 512 - 256 float g_b11_1c = (b11c+1)^@npower*0.25 % 512 - 256 ; normalize each vector float db = 0.0 float dc = 0.0; db = 1 / sqrt(sqr(g_b00_0b) + sqr(g_b00_1b)) g_b00_0b = g_b00_0b * db g_b00_1b = g_b00_1b * db db = 1 / sqrt(sqr(g_b10_0b) + sqr(g_b10_1b)) g_b10_0b = g_b10_0b * db g_b10_1b = g_b10_1b * db db = 1 / sqrt(sqr(g_b01_0b) + sqr(g_b01_1b)) g_b01_0b = g_b01_0b * db g_b01_1b = g_b01_1b * db db = 1 / sqrt(sqr(g_b11_0b) + sqr(g_b11_1b)) g_b11_0b = g_b11_0b * db g_b11_1b = g_b11_1b * db dc = 1 / sqrt(sqr(g_b00_0c) + sqr(g_b00_1c)) g_b00_0c = g_b00_0c * dc g_b00_1c = g_b00_1c * dc dc = 1 / sqrt(sqr(g_b10_0c) + sqr(g_b10_1c)) g_b10_0c = g_b10_0c * dc g_b10_1c = g_b10_1c * dc dc = 1 / sqrt(sqr(g_b01_0c) + sqr(g_b01_1c)) g_b01_0c = g_b01_0c * dc g_b01_1c = g_b01_1c * dc dc = 1 / sqrt(sqr(g_b11_0c) + sqr(g_b11_1c)) g_b11_0c = g_b11_0c * dc g_b11_1c = g_b11_1c * dc ; produce colors for each corner float u1b = rx0b * g_b00_0b + ry0b * g_b00_1b float v1b = rx1b * g_b10_0b + ry0b * g_b10_1b float u2b = rx0b * g_b01_0b + ry1b * g_b01_1b float v2b = rx1b * g_b11_0b + ry1b * g_b11_1b float u1c = rx0c * g_b00_0c + ry0c * g_b00_1c float v1c = rx1c * g_b10_0c + ry0c * g_b10_1c float u2c = rx0c * g_b01_0c + ry1c * g_b01_1c float v2c = rx1c * g_b11_0c + ry1c * g_b11_1c ; interpolate between corners using ; bilinear filtering float sxb = sqr(rx0b) * (3 - rx0b*2) float syb = sqr(ry0b) * (3 - ry0b*2) float na2 = u1b + sxb*(v1b-u1b) float nb2 = u2b + sxb*(v2b-u2b) float sxc = sqr(rx0c) * (3 - rx0c*2) float syc = sqr(ry0c) * (3 - ry0c*2) float na3 = u1c + sxc*(v1c-u1c) float nb3 = u2c + sxc*(v2c-u2c) sumb = sumb + real(@nfn1(na2 + syb*(nb2-na2)))*freq sumc = sumc + real(@nfn1(na3 + syc*(nb3-na3)))*freq freq = freq * @step pb = pb * r2 / @step pc = pc * r2 / @step i = i - 1 ENDWHILE z2 = z2 + (sumb+@coloroffset)*0.5*@distortion z3 = z3 + (sumc+@coloroffset)*0.5*@distortion endif ENDIF modz = |z1| if (@slope == true) if (@zmode == 0) sum1 = sum1 + exp(-cabs(z1)) sum2 = sum2 + exp(-cabs(z2)) sum3 = sum3 + exp(-cabs(z3)) elseif (@zmode == 1) sum1 = cabs(z1 - #pixel) sum2 = cabs(z2 - #pixel) sum3 = cabs(z3 - #pixel) else sum1 = cabs(z1) sum2 = cabs(z2) sum3 = cabs(z3) endif done = done + 1 ; increment iteration counter IF (modz > @bailout || \ @everyiter || \ done == #maxit + 2) ; done, or every iteration, or last ; determine continuous iteration (height) for each point e1 = sum1 * @zscale e2 = sum2 * @zscale e3 = sum3 * @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 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 else z = z1 endif IF (modz > @bailout) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope MartSam 5" maxiter = 6 magn = .2 param version caption = "Version" default = 1.22 visible = false endparam param mode caption = "Mode" default = 0 enum = "x1 ; y1" "y1 ; x1" "x1 + y1 ; x1 - y1" \ "x1 + y ; y1 - x" endparam param a caption = "a" default = (1,1) endparam param b caption = "b" default = (1,-1) endparam param c caption = "c" default = 1.0 endparam param ab1 caption = "|a| = |b| = c ?" default = false hint = "Useful to get images of the same \ complexity. Choose a nice c value and \ play with a and b." endparam func fr1 caption = "Real Func 1" default = ident() endfunc func fi1 caption = "Imag Func 1" default = ident() endfunc param bailout caption = "Bailout Value" default = 1.0e20 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam bool param fbm caption = "fBm texturing?" default = false endparam heading caption = "fBm Parameters" visible = @fbm == true endheading param distortion caption = "Noise Strength" default = 1.0 visible = @fbm == true endparam param coloroffset caption = "Coloring Offset" default = 0.0 hint = "Sets the coloring offset from zero. Increase this if you see \ large areas of solid color." visible = @fbm == true endparam param noffset 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." visible = @fbm == true endparam param scale caption = "Noise Scale" default = 1.0 hint = "This is the overall scale of the noise." visible = @fbm == true endparam param angle caption = "Noise Rotation" default = 0.0 hint = "This is the angle, in degrees, of the noise." visible = @fbm == true endparam param step caption = "Noise Scale Step" default = 0.5 hint = "This is the step in scale between noise iterations." visible = @fbm == true endparam param anglestep caption = "Noise Rotation Step" default = 37.0 hint = "This is the angle, in degrees, to rotate between noise \ iterations." visible = @fbm == true endparam param octaves caption = "Noise Octaves" default = 7 min = 1 hint = "This is the number of iterations of the noise formula." visible = @fbm == true endparam param npower caption = "Noise Exponent" default = 2.0 hint = "This is the exponent used to scramble numbers." visible = @fbm == true endparam func nfn1 caption = "Noise Function" default = ident() visible = @fbm == true endfunc bool param slope caption = "Apply slope?" default = true endparam heading caption = "Slope Parameters" visible = @slope == true endheading param offset caption = "Orbit Separation" default = 0.01 hint = "Defines how far apart the simultaneous orbits are.\ Smaller distances will produce more accurate results." visible = @slope == true endparam param zmode caption = "Height Value" enum = "smoothed iteration" "magnitude (z-pixel)" "magnitude (z)" default = 0 visible = @slope==true endparam param xfer caption = "Height Transfer" default = 1 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." visible = @slope == true 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." visible = @slope == true endparam param zscale2 caption = "Height Post-Scale" default = 1.0 hint = "Specifies the ratio between height and distance; like \ Height Pre-Scale, except that this value is applied after \ the transfer function." visible = @slope == true 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." visible = @slope == true endparam } gnd-SlopeMartSam6 { ; based upon the slope (Mandelbrot) ; formula of Damien Jones ; modified MartSam6 formula from Samuel Monnier, 1999 ; Inspired from the Martin formula (by ; Mark Townsend) ; compound with the models of slope formulas from Ron Barnett. ; These slopes formulas are dedicated to the memory of Carol Walske, (1955, 2004). ; version 1.1, January 2005 ; Gilles Nadeau, 23/01/2005 ; Slope Optional, v1.1 by Susan Chambless, Mar, 2005. ; ; Damien's fBm added September, 2005 ; version 1.22, ; Gilles, 17/09/2005 ; Use inside colouring. ; By decreasing the number of iteration, ; you will get a smoother image. init: z1 = #pixel ; primary iterated point z2 = #pixel + @offset ; horizontally offset point z3 = #pixel + flip(@offset) ; vertically offset point x1 = real(z1) x2 = real(z2) x3 = real(z3) y1 = imag(z1) y2 = imag(z2) y3 = imag(z3) xx1 = @fr1(x1) xx2 = @fr1(x2) xx3 = @fr1(x3) yy1 = @fi1(y1) yy2 = @fi1(y2) yy3 = @fi1(y3) int done = 2 float modz = 0.0 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 sum1 = 0.0 float sum2 = 0.0 float sum3 = 0.0 if @ab1 a1 = @a/sqrt(|@a|) * @c b1 = @b/sqrt(|@b|) * @c else a1 = @a b1 = @b endif complex r = (0,1) ^ (@angle / 90.0) complex r2 = (0,1) ^ (@anglestep / 90.0) loop: if @mode == 0 x1 = real(a1) * sin(x1+yy1) + imag(a1) * cos(x1-yy1) + x1 y1 = real(b1) * cos(xx1-y1) + imag(b1) * sin(xx1+y1) + y1 elseif @mode == 1 x1 = real(a1) * sin(x1+yy1) + imag(a1) * cos(x1-yy1) + y1 y1 = real(b1) * cos(xx1-y1) + imag(b1) * sin(xx1+y1) + x1 elseif @mode == 2 x1 = real(a1) * sin(x1+yy1) + imag(a1) * cos(x1-yy1) + x1 + y1 y1 = real(b1) * cos(xx1-y1) + imag(b1) * sin(xx1+y1) + x1 - y1 else x1 = real(a1) * sin(x1+yy1) + imag(a1) * cos(x1-yy1) + xx1 + y1 y1 = real(b1) * cos(xx1-y1) + imag(b1) * sin(xx1+y1) + yy1 - x1 endif z1 = x1 + flip(y1) IF (@fbm == true) complex pa = z1 * @scale * r + @noffset float suma = 0.0 float freq = 1.0 int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxa = floor(real(pa)) float fya = floor(imag(pa)) float bx0a = fxa % 256 float by0a = fya % 256 IF (bx0a < 0) bx0a = bx0a + 256 ENDIF IF (by0a < 0) by0a = by0a + 256 ENDIF float bx1a = (bx0a + 1) % 256 float by1a = (by0a + 1) % 256 float rx0a = real(pa) - fxa float ry0a = imag(pa) - fya float rx1a = rx0a - 1 float ry1a = ry0a - 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 b00a = (bx0a^@npower % 65536 + by0a)^@npower % 65536 float b10a = (bx1a^@npower % 65536 + by0a)^@npower % 65536 float b01a = (bx0a^@npower % 65536 + by1a)^@npower % 65536 float b11a = (bx1a^@npower % 65536 + by1a)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0a = (b00a)^@npower*0.25 % 512 - 256 float g_b10_0a = (b10a)^@npower*0.25 % 512 - 256 float g_b01_0a = (b01a)^@npower*0.25 % 512 - 256 float g_b11_0a = (b11a)^@npower*0.25 % 512 - 256 float g_b00_1a = (b00a+1)^@npower*0.25 % 512 - 256 float g_b10_1a = (b10a+1)^@npower*0.25 % 512 - 256 float g_b01_1a = (b01a+1)^@npower*0.25 % 512 - 256 float g_b11_1a = (b11a+1)^@npower*0.25 % 512 - 256 ; normalize each vector float da = 0.0; da = 1 / sqrt(sqr(g_b00_0a) + sqr(g_b00_1a)) g_b00_0a = g_b00_0a * da g_b00_1a = g_b00_1a * da da = 1 / sqrt(sqr(g_b10_0a) + sqr(g_b10_1a)) g_b10_0a = g_b10_0a * da g_b10_1a = g_b10_1a * da da = 1 / sqrt(sqr(g_b01_0a) + sqr(g_b01_1a)) g_b01_0a = g_b01_0a * da g_b01_1a = g_b01_1a * da da = 1 / sqrt(sqr(g_b11_0a) + sqr(g_b11_1a)) g_b11_0a = g_b11_0a * da g_b11_1a = g_b11_1a * da ; produce colors for each corner float u1a = rx0a * g_b00_0a + ry0a * g_b00_1a float v1a = rx1a * g_b10_0a + ry0a * g_b10_1a float u2a = rx0a * g_b01_0a + ry1a * g_b01_1a float v2a = rx1a * g_b11_0a + ry1a * g_b11_1a ; interpolate between corners using ; bilinear filtering float sxa = sqr(rx0a) * (3 - rx0a*2) float sya = sqr(ry0a) * (3 - ry0a*2) float na1 = u1a + sxa*(v1a-u1a) float nb1 = u2a + sxa*(v2a-u2a) suma = suma + real(@nfn1(na1 + sya*(nb1-na1)))*freq freq = freq * @step pa = pa * r2 / @step i = i - 1 ENDWHILE z1 = z1 + (suma+@coloroffset)*0.5*@distortion ENDIF if (@slope) if @mode == 0 x2 = real(a1) * sin(x2+yy2) + imag(a1) * cos(x2-yy2) + x2 x3 = real(a1) * sin(x3+yy3) + imag(a1) * cos(x3-yy3) + x3 y2 = real(b1) * cos(xx2-y2) + imag(b1) * sin(xx2+y2) + y2 y3 = real(b1) * cos(xx3-y3) + imag(b1) * sin(xx3+y3) + y3 elseif @mode == 1 x2 = real(a1) * sin(x2+yy2) + imag(a1) * cos(x2-yy2) + y2 x3 = real(a1) * sin(x3+yy3) + imag(a1) * cos(x3-yy3) + y3 y2 = real(b1) * cos(xx2-y2) + imag(b1) * sin(xx2+y2) + x2 y3 = real(b1) * cos(xx3-y3) + imag(b1) * sin(xx3+y3) + x3 elseif @mode == 2 x2 = real(a1) * sin(x2+yy2) + imag(a1) * cos(x2-yy2) + x2 + y2 x3 = real(a1) * sin(x3+yy3) + imag(a1) * cos(x3-yy3) + x3 + y3 y2 = real(b1) * cos(xx2-y2) + imag(b1) * sin(xx2+y2) + x2 - y2 y3 = real(b1) * cos(xx3-y3) + imag(b1) * sin(xx3+y3) + x3 - y3 else x2 = real(a1) * sin(x2+yy2) + imag(a1) * cos(x2-yy2) + xx2 + y2 x3 = real(a1) * sin(x3+yy3) + imag(a1) * cos(x3-yy3) + xx3 + y3 y2 = real(b1) * cos(xx2-y2) + imag(b1) * sin(xx2+y2) + yy2 - x2 y3 = real(b1) * cos(xx3-y3) + imag(b1) * sin(xx3+y3) + yy3 - x3 endif z2 = x2 + flip(y2) z3 = x3 + flip(y3) IF (@fbm == true) complex pb = z2 * @scale * r + @noffset complex pc = z3 * @scale * r + @noffset float sumb = 0.0 float sumc = 0.0 float freq = 1.0 int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxb = floor(real(pb)) float fyb = floor(imag(pb)) float bx0b = fxb % 256 float by0b = fyb % 256 IF (bx0b < 0) bx0b = bx0b + 256 ENDIF IF (by0b < 0) by0b = by0b + 256 ENDIF float bx1b = (bx0b + 1) % 256 float by1b = (by0b + 1) % 256 float rx0b = real(pb) - fxb float ry0b = imag(pb) - fyb float rx1b = rx0b - 1 float ry1b = ry0b - 1 float fxc = floor(real(pc)) float fyc = floor(imag(pc)) float bx0c = fxc % 256 float by0c = fyc % 256 IF (bx0c < 0) bx0c = bx0c + 256 ENDIF IF (by0c < 0) by0c = by0c + 256 ENDIF float bx1c = (bx0c + 1) % 256 float by1c = (by0c + 1) % 256 float rx0c = real(pc) - fxc float ry0c = imag(pc) - fyc float rx1c = rx0c - 1 float ry1c = ry0c - 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 b00b = (bx0b^@npower % 65536 + by0b)^@npower % 65536 float b10b = (bx1b^@npower % 65536 + by0b)^@npower % 65536 float b01b = (bx0b^@npower % 65536 + by1b)^@npower % 65536 float b11b = (bx1b^@npower % 65536 + by1b)^@npower % 65536 float b00c = (bx0c^@npower % 65536 + by0c)^@npower % 65536 float b10c = (bx1c^@npower % 65536 + by0c)^@npower % 65536 float b01c = (bx0c^@npower % 65536 + by1c)^@npower % 65536 float b11c = (bx1c^@npower % 65536 + by1c)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0b = (b00b)^@npower*0.25 % 512 - 256 float g_b10_0b = (b10b)^@npower*0.25 % 512 - 256 float g_b01_0b = (b01b)^@npower*0.25 % 512 - 256 float g_b11_0b = (b11b)^@npower*0.25 % 512 - 256 float g_b00_1b = (b00b+1)^@npower*0.25 % 512 - 256 float g_b10_1b = (b10b+1)^@npower*0.25 % 512 - 256 float g_b01_1b = (b01b+1)^@npower*0.25 % 512 - 256 float g_b11_1b = (b11b+1)^@npower*0.25 % 512 - 256 float g_b00_0c = (b00c)^@npower*0.25 % 512 - 256 float g_b10_0c = (b10c)^@npower*0.25 % 512 - 256 float g_b01_0c = (b01c)^@npower*0.25 % 512 - 256 float g_b11_0c = (b11c)^@npower*0.25 % 512 - 256 float g_b00_1c = (b00c+1)^@npower*0.25 % 512 - 256 float g_b10_1c = (b10c+1)^@npower*0.25 % 512 - 256 float g_b01_1c = (b01c+1)^@npower*0.25 % 512 - 256 float g_b11_1c = (b11c+1)^@npower*0.25 % 512 - 256 ; normalize each vector float db = 0.0 float dc = 0.0; db = 1 / sqrt(sqr(g_b00_0b) + sqr(g_b00_1b)) g_b00_0b = g_b00_0b * db g_b00_1b = g_b00_1b * db db = 1 / sqrt(sqr(g_b10_0b) + sqr(g_b10_1b)) g_b10_0b = g_b10_0b * db g_b10_1b = g_b10_1b * db db = 1 / sqrt(sqr(g_b01_0b) + sqr(g_b01_1b)) g_b01_0b = g_b01_0b * db g_b01_1b = g_b01_1b * db db = 1 / sqrt(sqr(g_b11_0b) + sqr(g_b11_1b)) g_b11_0b = g_b11_0b * db g_b11_1b = g_b11_1b * db dc = 1 / sqrt(sqr(g_b00_0c) + sqr(g_b00_1c)) g_b00_0c = g_b00_0c * dc g_b00_1c = g_b00_1c * dc dc = 1 / sqrt(sqr(g_b10_0c) + sqr(g_b10_1c)) g_b10_0c = g_b10_0c * dc g_b10_1c = g_b10_1c * dc dc = 1 / sqrt(sqr(g_b01_0c) + sqr(g_b01_1c)) g_b01_0c = g_b01_0c * dc g_b01_1c = g_b01_1c * dc dc = 1 / sqrt(sqr(g_b11_0c) + sqr(g_b11_1c)) g_b11_0c = g_b11_0c * dc g_b11_1c = g_b11_1c * dc ; produce colors for each corner float u1b = rx0b * g_b00_0b + ry0b * g_b00_1b float v1b = rx1b * g_b10_0b + ry0b * g_b10_1b float u2b = rx0b * g_b01_0b + ry1b * g_b01_1b float v2b = rx1b * g_b11_0b + ry1b * g_b11_1b float u1c = rx0c * g_b00_0c + ry0c * g_b00_1c float v1c = rx1c * g_b10_0c + ry0c * g_b10_1c float u2c = rx0c * g_b01_0c + ry1c * g_b01_1c float v2c = rx1c * g_b11_0c + ry1c * g_b11_1c ; interpolate between corners using ; bilinear filtering float sxb = sqr(rx0b) * (3 - rx0b*2) float syb = sqr(ry0b) * (3 - ry0b*2) float na2 = u1b + sxb*(v1b-u1b) float nb2 = u2b + sxb*(v2b-u2b) float sxc = sqr(rx0c) * (3 - rx0c*2) float syc = sqr(ry0c) * (3 - ry0c*2) float na3 = u1c + sxc*(v1c-u1c) float nb3 = u2c + sxc*(v2c-u2c) sumb = sumb + real(@nfn1(na2 + syb*(nb2-na2)))*freq sumc = sumc + real(@nfn1(na3 + syc*(nb3-na3)))*freq freq = freq * @step pb = pb * r2 / @step pc = pc * r2 / @step i = i - 1 ENDWHILE z2 = z2 + (sumb+@coloroffset)*0.5*@distortion z3 = z3 + (sumc+@coloroffset)*0.5*@distortion endif ENDIF modz = |z1| if (@slope == true) if (@zmode == 0) sum1 = sum1 + exp(-cabs(z1)) sum2 = sum2 + exp(-cabs(z2)) sum3 = sum3 + exp(-cabs(z3)) elseif (@zmode == 1) sum1 = cabs(z1 - #pixel) sum2 = cabs(z2 - #pixel) sum3 = cabs(z3 - #pixel) else sum1 = cabs(z1) sum2 = cabs(z2) sum3 = cabs(z3) endif done = done + 1 ; increment iteration counter IF (modz > @bailout || \ @everyiter || \ done == #maxit + 2) ; done, or every iteration, or last ; determine continuous iteration (height) for each point e1 = sum1 * @zscale e2 = sum2 * @zscale e3 = sum3 * @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 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 else z = z1 endif IF (modz > @bailout) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope MartSam 6" maxiter = 5 magn = .2 param version caption = "Version" default = 1.22 visible = false endparam param mode caption = "Mode" default = 0 enum = "x ; y" "y ; x" "x + y ; x - y" \ "x1 + y ; y1 - x" endparam param a caption = "a" default = (2,-2) endparam param b caption = "b" default = (2,2) endparam param c caption = "c" default = 1.0 endparam param ab1 caption = "|a| = |b| = c ?" default = false hint = "Useful to get images of the same \ complexity. Choose a nice c value and \ play with a and b." endparam func fr1 caption = "Real Func 1" default = ident() endfunc func fi1 caption = "Imag Func 1" default = ident() endfunc param bailout caption = "Bailout Value" default = 1.0e20 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam bool param fbm caption = "fBm texturing?" default = false endparam heading caption = "fBm Parameters" visible = @fbm == true endheading param distortion caption = "Noise Strength" default = 1.0 visible = @fbm == true endparam param coloroffset caption = "Coloring Offset" default = 0.0 hint = "Sets the coloring offset from zero. Increase this if you see \ large areas of solid color." visible = @fbm == true endparam param noffset 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." visible = @fbm == true endparam param scale caption = "Noise Scale" default = 1.0 hint = "This is the overall scale of the noise." visible = @fbm == true endparam param angle caption = "Noise Rotation" default = 0.0 hint = "This is the angle, in degrees, of the noise." visible = @fbm == true endparam param step caption = "Noise Scale Step" default = 0.5 hint = "This is the step in scale between noise iterations." visible = @fbm == true endparam param anglestep caption = "Noise Rotation Step" default = 37.0 hint = "This is the angle, in degrees, to rotate between noise \ iterations." visible = @fbm == true endparam param octaves caption = "Noise Octaves" default = 7 min = 1 hint = "This is the number of iterations of the noise formula." visible = @fbm == true endparam param npower caption = "Noise Exponent" default = 2.0 hint = "This is the exponent used to scramble numbers." visible = @fbm == true endparam func nfn1 caption = "Noise Function" default = ident() visible = @fbm == true endfunc bool param slope caption = "Apply slope?" default = true endparam heading caption = "Slope Parameters" visible = @slope == true endheading param offset caption = "Orbit Separation" default = 0.01 hint = "Defines how far apart the simultaneous orbits are.\ Smaller distances will produce more accurate results." visible = @slope == true endparam param zmode caption = "Height Value" enum = "smoothed iteration" "magnitude (z-pixel)" "magnitude (z)" default = 0 visible = @slope==true endparam param xfer caption = "Height Transfer" default = 1 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." visible = @slope == true 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." visible = @slope == true endparam param zscale2 caption = "Height Post-Scale" default = 1.0 hint = "Specifies the ratio between height and distance; like \ Height Pre-Scale, except that this value is applied after \ the transfer function." visible = @slope == true 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." visible = @slope == true endparam } gnd-SlopeMartSam7 { ; based upon the slope (Mandelbrot) ; formula of Damien Jones ; modified MartSam7 formula from Samuel Monnier, 1999 ; Inspired from the Martin formula (by ; Mark Townsend) ; compound with the models of slope formulas from Ron Barnett. ; These slopes formulas are dedicated to the memory of Carol Walske, (1955, 2004). ; version 1.1, January 2005 ; Gilles Nadeau, 23/01/2005 ; Slope Optional, v1.1 by Susan Chambless, Mar, 2005. ; ; Damien's fBm added September, 2005 ; version 1.22, ; Gilles, 17/09/2005 ; Use inside colouring. ; By decreasing the number of iteration, ; you will get a smoother image. init: z1 = #pixel ; primary iterated point z2 = #pixel + @offset ; horizontally offset point z3 = #pixel + flip(@offset) ; vertically offset point x1 = real(z1) x2 = real(z2) x3 = real(z3) y1 = imag(z1) y2 = imag(z2) y3 = imag(z3) xx1 = @fr1(x1) xx2 = @fr1(x2) xx3 = @fr1(x3) yy1 = @fi1(y1) yy2 = @fi1(y2) yy3 = @fi1(y3) int done = 2 float modz = 0.0 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 sum1 = 0.0 float sum2 = 0.0 float sum3 = 0.0 if @ab1 a1 = @a/sqrt(|@a|) * @c b1 = @b/sqrt(|@b|) * @c else a1 = @a b1 = @b endif complex r = (0,1) ^ (@angle / 90.0) complex r2 = (0,1) ^ (@anglestep / 90.0) loop: if @mode == 0 x1 = sin(real(a1) * x1+y1) + cos(imag(a1) * y1-x1) + xx1 y1 = cos(real(b1) * y1-x1) + sin(imag(b1) * x1+y1) + yy1 elseif @mode == 1 x1 = sin(real(a1) * x1+y1) + cos(imag(a1) * y1-x1) + yy1 y1 = cos(real(b1) * y1-x1) + sin(imag(b1) * x1+y1) + xx1 elseif @mode == 2 x1 = sin(real(a1) * x1+y1) + cos(imag(a1) * y1-x1) + xx1 + yy1 y1 = cos(real(b1) * y1-x1) + sin(imag(b1) * x1+y1) + xx1 - yy1 else x1 = sin(real(a1) * x1+y1) + cos(imag(a1) * y1-x1) + xx1 + y1 y1 = cos(real(b1) * y1-x1) + sin(imag(b1) * x1+y1) + yy1 - x1 endif z1 = x1 + flip(y1) IF (@fbm == true) complex pa = z1 * @scale * r + @noffset float suma = 0.0 float freq = 1.0 int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxa = floor(real(pa)) float fya = floor(imag(pa)) float bx0a = fxa % 256 float by0a = fya % 256 IF (bx0a < 0) bx0a = bx0a + 256 ENDIF IF (by0a < 0) by0a = by0a + 256 ENDIF float bx1a = (bx0a + 1) % 256 float by1a = (by0a + 1) % 256 float rx0a = real(pa) - fxa float ry0a = imag(pa) - fya float rx1a = rx0a - 1 float ry1a = ry0a - 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 b00a = (bx0a^@npower % 65536 + by0a)^@npower % 65536 float b10a = (bx1a^@npower % 65536 + by0a)^@npower % 65536 float b01a = (bx0a^@npower % 65536 + by1a)^@npower % 65536 float b11a = (bx1a^@npower % 65536 + by1a)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0a = (b00a)^@npower*0.25 % 512 - 256 float g_b10_0a = (b10a)^@npower*0.25 % 512 - 256 float g_b01_0a = (b01a)^@npower*0.25 % 512 - 256 float g_b11_0a = (b11a)^@npower*0.25 % 512 - 256 float g_b00_1a = (b00a+1)^@npower*0.25 % 512 - 256 float g_b10_1a = (b10a+1)^@npower*0.25 % 512 - 256 float g_b01_1a = (b01a+1)^@npower*0.25 % 512 - 256 float g_b11_1a = (b11a+1)^@npower*0.25 % 512 - 256 ; normalize each vector float da = 0.0; da = 1 / sqrt(sqr(g_b00_0a) + sqr(g_b00_1a)) g_b00_0a = g_b00_0a * da g_b00_1a = g_b00_1a * da da = 1 / sqrt(sqr(g_b10_0a) + sqr(g_b10_1a)) g_b10_0a = g_b10_0a * da g_b10_1a = g_b10_1a * da da = 1 / sqrt(sqr(g_b01_0a) + sqr(g_b01_1a)) g_b01_0a = g_b01_0a * da g_b01_1a = g_b01_1a * da da = 1 / sqrt(sqr(g_b11_0a) + sqr(g_b11_1a)) g_b11_0a = g_b11_0a * da g_b11_1a = g_b11_1a * da ; produce colors for each corner float u1a = rx0a * g_b00_0a + ry0a * g_b00_1a float v1a = rx1a * g_b10_0a + ry0a * g_b10_1a float u2a = rx0a * g_b01_0a + ry1a * g_b01_1a float v2a = rx1a * g_b11_0a + ry1a * g_b11_1a ; interpolate between corners using ; bilinear filtering float sxa = sqr(rx0a) * (3 - rx0a*2) float sya = sqr(ry0a) * (3 - ry0a*2) float na1 = u1a + sxa*(v1a-u1a) float nb1 = u2a + sxa*(v2a-u2a) suma = suma + real(@nfn1(na1 + sya*(nb1-na1)))*freq freq = freq * @step pa = pa * r2 / @step i = i - 1 ENDWHILE z1 = z1 + (suma+@coloroffset)*0.5*@distortion ENDIF if (@slope) if @mode == 0 x2 = sin(real(a1) * x2+y2) + cos(imag(a1) * y2-x2) + xx2 x3 = sin(real(a1) * x3+y3) + cos(imag(a1) * y3-x3) + xx3 y2 = cos(real(b1) * y2-x2) + sin(imag(b1) * x2+y2) + yy2 y3 = cos(real(b1) * y3-x3) + sin(imag(b1) * x3+y3) + yy3 elseif @mode == 1 x2 = sin(real(a1) * x2+y2) + cos(imag(a1) * y2-x2) + yy2 x3 = sin(real(a1) * x3+y3) + cos(imag(a1) * y3-x3) + yy3 y2 = cos(real(b1) * y2-x2) + sin(imag(b1) * x2+y2) + xx2 y3 = cos(real(b1) * y3-x3) + sin(imag(b1) * x3+y3) + xx3 elseif @mode == 2 x2 = sin(real(a1) * x2+y2) + cos(imag(a1) * y2-x2) + xx2 + yy2 x3 = sin(real(a1) * x3+y3) + cos(imag(a1) * y3-x3) + xx3 + yy3 y2 = cos(real(b1) * y2-x2) + sin(imag(b1) * x2+y2) + xx2 - yy2 y3 = cos(real(b1) * y3-x3) + sin(imag(b1) * x3+y3) + xx3 - yy3 else x2 = sin(real(a1) * x2+y2) + cos(imag(a1) * y2-x2) + xx2 + y2 x3 = sin(real(a1) * x3+y3) + cos(imag(a1) * y3-x3) + xx3 + y3 y2 = cos(real(b1) * y2-x2) + sin(imag(b1) * x2+y2) + yy2 - x2 y3 = cos(real(b1) * y3-x3) + sin(imag(b1) * x3+y3) + yy3 - x3 endif z2 = x2 + flip(y2) z3 = x3 + flip(y3) IF (@fbm == true) complex pb = z2 * @scale * r + @noffset complex pc = z3 * @scale * r + @noffset float sumb = 0.0 float sumc = 0.0 float freq = 1.0 int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxb = floor(real(pb)) float fyb = floor(imag(pb)) float bx0b = fxb % 256 float by0b = fyb % 256 IF (bx0b < 0) bx0b = bx0b + 256 ENDIF IF (by0b < 0) by0b = by0b + 256 ENDIF float bx1b = (bx0b + 1) % 256 float by1b = (by0b + 1) % 256 float rx0b = real(pb) - fxb float ry0b = imag(pb) - fyb float rx1b = rx0b - 1 float ry1b = ry0b - 1 float fxc = floor(real(pc)) float fyc = floor(imag(pc)) float bx0c = fxc % 256 float by0c = fyc % 256 IF (bx0c < 0) bx0c = bx0c + 256 ENDIF IF (by0c < 0) by0c = by0c + 256 ENDIF float bx1c = (bx0c + 1) % 256 float by1c = (by0c + 1) % 256 float rx0c = real(pc) - fxc float ry0c = imag(pc) - fyc float rx1c = rx0c - 1 float ry1c = ry0c - 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 b00b = (bx0b^@npower % 65536 + by0b)^@npower % 65536 float b10b = (bx1b^@npower % 65536 + by0b)^@npower % 65536 float b01b = (bx0b^@npower % 65536 + by1b)^@npower % 65536 float b11b = (bx1b^@npower % 65536 + by1b)^@npower % 65536 float b00c = (bx0c^@npower % 65536 + by0c)^@npower % 65536 float b10c = (bx1c^@npower % 65536 + by0c)^@npower % 65536 float b01c = (bx0c^@npower % 65536 + by1c)^@npower % 65536 float b11c = (bx1c^@npower % 65536 + by1c)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0b = (b00b)^@npower*0.25 % 512 - 256 float g_b10_0b = (b10b)^@npower*0.25 % 512 - 256 float g_b01_0b = (b01b)^@npower*0.25 % 512 - 256 float g_b11_0b = (b11b)^@npower*0.25 % 512 - 256 float g_b00_1b = (b00b+1)^@npower*0.25 % 512 - 256 float g_b10_1b = (b10b+1)^@npower*0.25 % 512 - 256 float g_b01_1b = (b01b+1)^@npower*0.25 % 512 - 256 float g_b11_1b = (b11b+1)^@npower*0.25 % 512 - 256 float g_b00_0c = (b00c)^@npower*0.25 % 512 - 256 float g_b10_0c = (b10c)^@npower*0.25 % 512 - 256 float g_b01_0c = (b01c)^@npower*0.25 % 512 - 256 float g_b11_0c = (b11c)^@npower*0.25 % 512 - 256 float g_b00_1c = (b00c+1)^@npower*0.25 % 512 - 256 float g_b10_1c = (b10c+1)^@npower*0.25 % 512 - 256 float g_b01_1c = (b01c+1)^@npower*0.25 % 512 - 256 float g_b11_1c = (b11c+1)^@npower*0.25 % 512 - 256 ; normalize each vector float db = 0.0 float dc = 0.0; db = 1 / sqrt(sqr(g_b00_0b) + sqr(g_b00_1b)) g_b00_0b = g_b00_0b * db g_b00_1b = g_b00_1b * db db = 1 / sqrt(sqr(g_b10_0b) + sqr(g_b10_1b)) g_b10_0b = g_b10_0b * db g_b10_1b = g_b10_1b * db db = 1 / sqrt(sqr(g_b01_0b) + sqr(g_b01_1b)) g_b01_0b = g_b01_0b * db g_b01_1b = g_b01_1b * db db = 1 / sqrt(sqr(g_b11_0b) + sqr(g_b11_1b)) g_b11_0b = g_b11_0b * db g_b11_1b = g_b11_1b * db dc = 1 / sqrt(sqr(g_b00_0c) + sqr(g_b00_1c)) g_b00_0c = g_b00_0c * dc g_b00_1c = g_b00_1c * dc dc = 1 / sqrt(sqr(g_b10_0c) + sqr(g_b10_1c)) g_b10_0c = g_b10_0c * dc g_b10_1c = g_b10_1c * dc dc = 1 / sqrt(sqr(g_b01_0c) + sqr(g_b01_1c)) g_b01_0c = g_b01_0c * dc g_b01_1c = g_b01_1c * dc dc = 1 / sqrt(sqr(g_b11_0c) + sqr(g_b11_1c)) g_b11_0c = g_b11_0c * dc g_b11_1c = g_b11_1c * dc ; produce colors for each corner float u1b = rx0b * g_b00_0b + ry0b * g_b00_1b float v1b = rx1b * g_b10_0b + ry0b * g_b10_1b float u2b = rx0b * g_b01_0b + ry1b * g_b01_1b float v2b = rx1b * g_b11_0b + ry1b * g_b11_1b float u1c = rx0c * g_b00_0c + ry0c * g_b00_1c float v1c = rx1c * g_b10_0c + ry0c * g_b10_1c float u2c = rx0c * g_b01_0c + ry1c * g_b01_1c float v2c = rx1c * g_b11_0c + ry1c * g_b11_1c ; interpolate between corners using ; bilinear filtering float sxb = sqr(rx0b) * (3 - rx0b*2) float syb = sqr(ry0b) * (3 - ry0b*2) float na2 = u1b + sxb*(v1b-u1b) float nb2 = u2b + sxb*(v2b-u2b) float sxc = sqr(rx0c) * (3 - rx0c*2) float syc = sqr(ry0c) * (3 - ry0c*2) float na3 = u1c + sxc*(v1c-u1c) float nb3 = u2c + sxc*(v2c-u2c) sumb = sumb + real(@nfn1(na2 + syb*(nb2-na2)))*freq sumc = sumc + real(@nfn1(na3 + syc*(nb3-na3)))*freq freq = freq * @step pb = pb * r2 / @step pc = pc * r2 / @step i = i - 1 ENDWHILE z2 = z2 + (sumb+@coloroffset)*0.5*@distortion z3 = z3 + (sumc+@coloroffset)*0.5*@distortion endif ENDIF modz = |z1| if (@slope == true) if (@zmode == 0) sum1 = sum1 + exp(-cabs(z1)) sum2 = sum2 + exp(-cabs(z2)) sum3 = sum3 + exp(-cabs(z3)) elseif (@zmode == 1) sum1 = cabs(z1 - #pixel) sum2 = cabs(z2 - #pixel) sum3 = cabs(z3 - #pixel) else sum1 = cabs(z1) sum2 = cabs(z2) sum3 = cabs(z3) endif done = done + 1 ; increment iteration counter IF (modz > @bailout || \ @everyiter || \ done == #maxit + 2) ; done, or every iteration, or last ; determine continuous iteration (height) for each point e1 = sum1 * @zscale e2 = sum2 * @zscale e3 = sum3 * @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 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 else z = z1 endif IF (modz > @bailout) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope MartSam 7" maxiter = 5 magn = .2 param version caption = "Version" default = 1.22 visible = false endparam param mode caption = "Mode" default = 0 enum = "x1 ; y1" "y1 ; x1" "x1 + y1 ; x1 - y1" \ "x1 + y ; y1 - x" endparam param a caption = "a" default = (1,-1) endparam param b caption = "b" default = (1,1) endparam param c caption = "c" default = 1.0 endparam param ab1 caption = "|a| = |b| = c ?" default = false hint = "Useful to get images of the same \ complexity. Choose a nice c value and \ play with a and b." endparam func fr1 caption = "Real Func 1" default = ident() endfunc func fi1 caption = "Imag Func 1" default = ident() endfunc param bailout caption = "Bailout Value" default = 1.0e20 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam bool param fbm caption = "fBm texturing?" default = false endparam heading caption = "fBm Parameters" visible = @fbm == true endheading param distortion caption = "Noise Strength" default = 1.0 visible = @fbm == true endparam param coloroffset caption = "Coloring Offset" default = 0.0 hint = "Sets the coloring offset from zero. Increase this if you see \ large areas of solid color." visible = @fbm == true endparam param noffset 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." visible = @fbm == true endparam param scale caption = "Noise Scale" default = 1.0 hint = "This is the overall scale of the noise." visible = @fbm == true endparam param angle caption = "Noise Rotation" default = 0.0 hint = "This is the angle, in degrees, of the noise." visible = @fbm == true endparam param step caption = "Noise Scale Step" default = 0.5 hint = "This is the step in scale between noise iterations." visible = @fbm == true endparam param anglestep caption = "Noise Rotation Step" default = 37.0 hint = "This is the angle, in degrees, to rotate between noise \ iterations." visible = @fbm == true endparam param octaves caption = "Noise Octaves" default = 7 min = 1 hint = "This is the number of iterations of the noise formula." visible = @fbm == true endparam param npower caption = "Noise Exponent" default = 2.0 hint = "This is the exponent used to scramble numbers." visible = @fbm == true endparam func nfn1 caption = "Noise Function" default = ident() visible = @fbm == true endfunc bool param slope caption = "Apply slope?" default = true endparam heading caption = "Slope Parameters" visible = @slope == true endheading param offset caption = "Orbit Separation" default = 0.01 hint = "Defines how far apart the simultaneous orbits are.\ Smaller distances will produce more accurate results." visible = @slope == true endparam param zmode caption = "Height Value" enum = "smoothed iteration" "magnitude (z-pixel)" "magnitude (z)" default = 0 visible = @slope==true endparam param xfer caption = "Height Transfer" default = 1 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." visible = @slope == true 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." visible = @slope == true endparam param zscale2 caption = "Height Post-Scale" default = 1.0 hint = "Specifies the ratio between height and distance; like \ Height Pre-Scale, except that this value is applied after \ the transfer function." visible = @slope == true 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." visible = @slope == true endparam } gnd-SlopeMartSam8 { ; based upon the slope (Mandelbrot) ; formula of Damien Jones ; modified MartSam8 formula from Samuel Monnier, 1999 ; Inspired from the Martin formula (by ; Mark Townsend) ; compound with the models of slope formulas from Ron Barnett. ; These slopes formulas are dedicated to the memory of Carol Walske, (1955, 2004). ; version 1.1, January 2005 ; Gilles Nadeau, 23/01/2005 ; Slope Optional, v1.1 by Susan Chambless, Mar, 2005. ; ; Damien's fBm added September, 2005 ; version 1.22, ; Gilles, 17/09/2005 ; Use inside colouring. ; By decreasing the number of iteration, ; you will get a smoother image. init: z1 = #pixel ; primary iterated point z2 = #pixel + @offset ; horizontally offset point z3 = #pixel + flip(@offset) ; vertically offset point x1 = real(z1) x2 = real(z2) x3 = real(z3) y1 = imag(z1) y2 = imag(z2) y3 = imag(z3) xx1 = @fr1(x1) xx2 = @fr1(x2) xx3 = @fr1(x3) yy1 = @fi1(y1) yy2 = @fi1(y2) yy3 = @fi1(y3) int done = 2 float modz = 0.0 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 sum1 = 0.0 float sum2 = 0.0 float sum3 = 0.0 if @ab1 a1 = @a/sqrt(|@a|) * @c b1 = @b/sqrt(|@b|) * @c else a1 = @a b1 = @b endif complex r = (0,1) ^ (@angle / 90.0) complex r2 = (0,1) ^ (@anglestep / 90.0) loop: if @mode == 0 x1 = real(a1) * sin(imag(a1) * y1) + xx1 y1 = real(b1) * sin(imag(b1) * x1) + yy1 elseif @mode == 1 x1 = real(a1) * sin(imag(a1) * y1) + yy1 y1 = real(b1) * sin(imag(b1) * x1) + xx1 elseif @mode == 2 x1 = real(a1) * sin(imag(a1) * y1) + xx1 + yy1 y1 = real(b1) * sin(imag(b1) * x1) + xx1 - yy1 else x1 = real(a1) * sin(imag(a1) * y1) + xx1 + y1 y1 = real(b1) * sin(imag(b1) * x1) + yy1 - x1 endif z1 = x1 + flip(y1) IF (@fbm == true) complex pa = z1 * @scale * r + @noffset float suma = 0.0 float freq = 1.0 int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxa = floor(real(pa)) float fya = floor(imag(pa)) float bx0a = fxa % 256 float by0a = fya % 256 IF (bx0a < 0) bx0a = bx0a + 256 ENDIF IF (by0a < 0) by0a = by0a + 256 ENDIF float bx1a = (bx0a + 1) % 256 float by1a = (by0a + 1) % 256 float rx0a = real(pa) - fxa float ry0a = imag(pa) - fya float rx1a = rx0a - 1 float ry1a = ry0a - 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 b00a = (bx0a^@npower % 65536 + by0a)^@npower % 65536 float b10a = (bx1a^@npower % 65536 + by0a)^@npower % 65536 float b01a = (bx0a^@npower % 65536 + by1a)^@npower % 65536 float b11a = (bx1a^@npower % 65536 + by1a)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0a = (b00a)^@npower*0.25 % 512 - 256 float g_b10_0a = (b10a)^@npower*0.25 % 512 - 256 float g_b01_0a = (b01a)^@npower*0.25 % 512 - 256 float g_b11_0a = (b11a)^@npower*0.25 % 512 - 256 float g_b00_1a = (b00a+1)^@npower*0.25 % 512 - 256 float g_b10_1a = (b10a+1)^@npower*0.25 % 512 - 256 float g_b01_1a = (b01a+1)^@npower*0.25 % 512 - 256 float g_b11_1a = (b11a+1)^@npower*0.25 % 512 - 256 ; normalize each vector float da = 0.0; da = 1 / sqrt(sqr(g_b00_0a) + sqr(g_b00_1a)) g_b00_0a = g_b00_0a * da g_b00_1a = g_b00_1a * da da = 1 / sqrt(sqr(g_b10_0a) + sqr(g_b10_1a)) g_b10_0a = g_b10_0a * da g_b10_1a = g_b10_1a * da da = 1 / sqrt(sqr(g_b01_0a) + sqr(g_b01_1a)) g_b01_0a = g_b01_0a * da g_b01_1a = g_b01_1a * da da = 1 / sqrt(sqr(g_b11_0a) + sqr(g_b11_1a)) g_b11_0a = g_b11_0a * da g_b11_1a = g_b11_1a * da ; produce colors for each corner float u1a = rx0a * g_b00_0a + ry0a * g_b00_1a float v1a = rx1a * g_b10_0a + ry0a * g_b10_1a float u2a = rx0a * g_b01_0a + ry1a * g_b01_1a float v2a = rx1a * g_b11_0a + ry1a * g_b11_1a ; interpolate between corners using ; bilinear filtering float sxa = sqr(rx0a) * (3 - rx0a*2) float sya = sqr(ry0a) * (3 - ry0a*2) float na1 = u1a + sxa*(v1a-u1a) float nb1 = u2a + sxa*(v2a-u2a) suma = suma + real(@nfn1(na1 + sya*(nb1-na1)))*freq freq = freq * @step pa = pa * r2 / @step i = i - 1 ENDWHILE z1 = z1 + (suma+@coloroffset)*0.5*@distortion ENDIF if (@slope) if @mode == 0 x2 = real(a1) * sin(imag(a1) * y2) + xx2 x3 = real(a1) * sin(imag(a1) * y3) + xx3 y2 = real(b1) * sin(imag(b1) * x2) + yy2 y3 = real(b1) * sin(imag(b1) * x3) + yy3 elseif @mode == 1 x2 = real(a1) * sin(imag(a1) * y2) + yy2 x3 = real(a1) * sin(imag(a1) * y3) + yy3 y2 = real(b1) * sin(imag(b1) * x2) + xx2 y3 = real(b1) * sin(imag(b1) * x3) + xx3 elseif @mode == 2 x2 = real(a1) * sin(imag(a1) * y2) + xx2 + yy2 x3 = real(a1) * sin(imag(a1) * y3) + xx3 + yy3 y2 = real(b1) * sin(imag(b1) * x2) + xx2 - yy2 y3 = real(b1) * sin(imag(b1) * x3) + xx3 - yy3 else x2 = real(a1) * sin(imag(a1) * y2) + xx2 + y2 x3 = real(a1) * sin(imag(a1) * y3) + xx3 + y3 y2 = real(b1) * sin(imag(b1) * x2) + yy2 - x2 y3 = real(b1) * sin(imag(b1) * x3) + yy3 - x3 endif z2 = x2 + flip(y2) z3 = x3 + flip(y3) IF (@fbm == true) complex pb = z2 * @scale * r + @noffset complex pc = z3 * @scale * r + @noffset float sumb = 0.0 float sumc = 0.0 float freq = 1.0 int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxb = floor(real(pb)) float fyb = floor(imag(pb)) float bx0b = fxb % 256 float by0b = fyb % 256 IF (bx0b < 0) bx0b = bx0b + 256 ENDIF IF (by0b < 0) by0b = by0b + 256 ENDIF float bx1b = (bx0b + 1) % 256 float by1b = (by0b + 1) % 256 float rx0b = real(pb) - fxb float ry0b = imag(pb) - fyb float rx1b = rx0b - 1 float ry1b = ry0b - 1 float fxc = floor(real(pc)) float fyc = floor(imag(pc)) float bx0c = fxc % 256 float by0c = fyc % 256 IF (bx0c < 0) bx0c = bx0c + 256 ENDIF IF (by0c < 0) by0c = by0c + 256 ENDIF float bx1c = (bx0c + 1) % 256 float by1c = (by0c + 1) % 256 float rx0c = real(pc) - fxc float ry0c = imag(pc) - fyc float rx1c = rx0c - 1 float ry1c = ry0c - 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 b00b = (bx0b^@npower % 65536 + by0b)^@npower % 65536 float b10b = (bx1b^@npower % 65536 + by0b)^@npower % 65536 float b01b = (bx0b^@npower % 65536 + by1b)^@npower % 65536 float b11b = (bx1b^@npower % 65536 + by1b)^@npower % 65536 float b00c = (bx0c^@npower % 65536 + by0c)^@npower % 65536 float b10c = (bx1c^@npower % 65536 + by0c)^@npower % 65536 float b01c = (bx0c^@npower % 65536 + by1c)^@npower % 65536 float b11c = (bx1c^@npower % 65536 + by1c)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0b = (b00b)^@npower*0.25 % 512 - 256 float g_b10_0b = (b10b)^@npower*0.25 % 512 - 256 float g_b01_0b = (b01b)^@npower*0.25 % 512 - 256 float g_b11_0b = (b11b)^@npower*0.25 % 512 - 256 float g_b00_1b = (b00b+1)^@npower*0.25 % 512 - 256 float g_b10_1b = (b10b+1)^@npower*0.25 % 512 - 256 float g_b01_1b = (b01b+1)^@npower*0.25 % 512 - 256 float g_b11_1b = (b11b+1)^@npower*0.25 % 512 - 256 float g_b00_0c = (b00c)^@npower*0.25 % 512 - 256 float g_b10_0c = (b10c)^@npower*0.25 % 512 - 256 float g_b01_0c = (b01c)^@npower*0.25 % 512 - 256 float g_b11_0c = (b11c)^@npower*0.25 % 512 - 256 float g_b00_1c = (b00c+1)^@npower*0.25 % 512 - 256 float g_b10_1c = (b10c+1)^@npower*0.25 % 512 - 256 float g_b01_1c = (b01c+1)^@npower*0.25 % 512 - 256 float g_b11_1c = (b11c+1)^@npower*0.25 % 512 - 256 ; normalize each vector float db = 0.0 float dc = 0.0; db = 1 / sqrt(sqr(g_b00_0b) + sqr(g_b00_1b)) g_b00_0b = g_b00_0b * db g_b00_1b = g_b00_1b * db db = 1 / sqrt(sqr(g_b10_0b) + sqr(g_b10_1b)) g_b10_0b = g_b10_0b * db g_b10_1b = g_b10_1b * db db = 1 / sqrt(sqr(g_b01_0b) + sqr(g_b01_1b)) g_b01_0b = g_b01_0b * db g_b01_1b = g_b01_1b * db db = 1 / sqrt(sqr(g_b11_0b) + sqr(g_b11_1b)) g_b11_0b = g_b11_0b * db g_b11_1b = g_b11_1b * db dc = 1 / sqrt(sqr(g_b00_0c) + sqr(g_b00_1c)) g_b00_0c = g_b00_0c * dc g_b00_1c = g_b00_1c * dc dc = 1 / sqrt(sqr(g_b10_0c) + sqr(g_b10_1c)) g_b10_0c = g_b10_0c * dc g_b10_1c = g_b10_1c * dc dc = 1 / sqrt(sqr(g_b01_0c) + sqr(g_b01_1c)) g_b01_0c = g_b01_0c * dc g_b01_1c = g_b01_1c * dc dc = 1 / sqrt(sqr(g_b11_0c) + sqr(g_b11_1c)) g_b11_0c = g_b11_0c * dc g_b11_1c = g_b11_1c * dc ; produce colors for each corner float u1b = rx0b * g_b00_0b + ry0b * g_b00_1b float v1b = rx1b * g_b10_0b + ry0b * g_b10_1b float u2b = rx0b * g_b01_0b + ry1b * g_b01_1b float v2b = rx1b * g_b11_0b + ry1b * g_b11_1b float u1c = rx0c * g_b00_0c + ry0c * g_b00_1c float v1c = rx1c * g_b10_0c + ry0c * g_b10_1c float u2c = rx0c * g_b01_0c + ry1c * g_b01_1c float v2c = rx1c * g_b11_0c + ry1c * g_b11_1c ; interpolate between corners using ; bilinear filtering float sxb = sqr(rx0b) * (3 - rx0b*2) float syb = sqr(ry0b) * (3 - ry0b*2) float na2 = u1b + sxb*(v1b-u1b) float nb2 = u2b + sxb*(v2b-u2b) float sxc = sqr(rx0c) * (3 - rx0c*2) float syc = sqr(ry0c) * (3 - ry0c*2) float na3 = u1c + sxc*(v1c-u1c) float nb3 = u2c + sxc*(v2c-u2c) sumb = sumb + real(@nfn1(na2 + syb*(nb2-na2)))*freq sumc = sumc + real(@nfn1(na3 + syc*(nb3-na3)))*freq freq = freq * @step pb = pb * r2 / @step pc = pc * r2 / @step i = i - 1 ENDWHILE z2 = z2 + (sumb+@coloroffset)*0.5*@distortion z3 = z3 + (sumc+@coloroffset)*0.5*@distortion endif ENDIF modz = |z1| if (@slope == true) if (@zmode == 0) sum1 = sum1 + exp(-cabs(z1)) sum2 = sum2 + exp(-cabs(z2)) sum3 = sum3 + exp(-cabs(z3)) elseif (@zmode == 1) sum1 = cabs(z1 - #pixel) sum2 = cabs(z2 - #pixel) sum3 = cabs(z3 - #pixel) else sum1 = cabs(z1) sum2 = cabs(z2) sum3 = cabs(z3) endif done = done + 1 ; increment iteration counter IF (modz > @bailout || \ @everyiter || \ done == #maxit + 2) ; done, or every iteration, or last ; determine continuous iteration (height) for each point e1 = sum1 * @zscale e2 = sum2 * @zscale e3 = sum3 * @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 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 else z = z1 endif IF (modz > @bailout) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope MartSam 8" maxiter = 5 magn = .2 param version caption = "Version" default = 1.22 visible = false endparam param mode caption = "Mode" default = 0 enum = "x1 ; y1" "y1 ; x1" "x1 + y1 ; x1 - y1" \ "x1 + y ; y1 - x" endparam param a caption = "a" default = (2,-1) endparam param b caption = "b" default = (2,1) endparam param c caption = "c" default = 1.0 endparam param ab1 caption = "|a| = |b| = c ?" default = false hint = "Useful to get images of the same \ complexity. Choose a nice c value and \ play with a and b." endparam func fr1 caption = "Real Func 1" default = ident() endfunc func fi1 caption = "Imag Func 1" default = ident() endfunc param bailout caption = "Bailout Value" default = 1.0e20 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam bool param fbm caption = "fBm texturing?" default = false endparam heading caption = "fBm Parameters" visible = @fbm == true endheading param distortion caption = "Noise Strength" default = 1.0 visible = @fbm == true endparam param coloroffset caption = "Coloring Offset" default = 0.0 hint = "Sets the coloring offset from zero. Increase this if you see \ large areas of solid color." visible = @fbm == true endparam param noffset 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." visible = @fbm == true endparam param scale caption = "Noise Scale" default = 1.0 hint = "This is the overall scale of the noise." visible = @fbm == true endparam param angle caption = "Noise Rotation" default = 0.0 hint = "This is the angle, in degrees, of the noise." visible = @fbm == true endparam param step caption = "Noise Scale Step" default = 0.5 hint = "This is the step in scale between noise iterations." visible = @fbm == true endparam param anglestep caption = "Noise Rotation Step" default = 37.0 hint = "This is the angle, in degrees, to rotate between noise \ iterations." visible = @fbm == true endparam param octaves caption = "Noise Octaves" default = 7 min = 1 hint = "This is the number of iterations of the noise formula." visible = @fbm == true endparam param npower caption = "Noise Exponent" default = 2.0 hint = "This is the exponent used to scramble numbers." visible = @fbm == true endparam func nfn1 caption = "Noise Function" default = ident() visible = @fbm == true endfunc bool param slope caption = "Apply slope?" default = true endparam heading caption = "Slope Parameters" visible = @slope == true endheading param offset caption = "Orbit Separation" default = 0.01 hint = "Defines how far apart the simultaneous orbits are.\ Smaller distances will produce more accurate results." visible = @slope == true endparam param zmode caption = "Height Value" enum = "smoothed iteration" "magnitude (z-pixel)" "magnitude (z)" default = 0 visible = @slope==true endparam param xfer caption = "Height Transfer" default = 1 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." visible = @slope == true 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." visible = @slope == true endparam param zscale2 caption = "Height Post-Scale" default = 1.0 hint = "Specifies the ratio between height and distance; like \ Height Pre-Scale, except that this value is applied after \ the transfer function." visible = @slope == true 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." visible = @slope == true endparam } gnd-SlopeMartSam9 { ; based upon the slope (Mandelbrot) ; formula of Damien Jones ; modified MartSam9 formula from Samuel Monnier, 1999 ; Inspired from the Martin formula (by ; Mark Townsend) ; compound with the models of slope formulas from Ron Barnett. ; These slopes formulas are dedicated to the memory of Carol Walske, (1955, 2004). ; version 1.1, January 2005 ; Gilles Nadeau, 23/01/2005 ; Slope Optional, v1.1 by Susan Chambless, Mar, 2005. ; ; Damien's fBm added September, 2005 ; version 1.22, ; Gilles, 17/09/2005 ; Use inside colouring. ; By decreasing the number of iteration, ; you will get a smoother image. init: z1 = #pixel ; primary iterated point z2 = #pixel + @offset ; horizontally offset point z3 = #pixel + flip(@offset) ; vertically offset point x1 = real(z1) x2 = real(z2) x3 = real(z3) y1 = imag(z1) y2 = imag(z2) y3 = imag(z3) xx1 = @fr1(x1) xx2 = @fr1(x2) xx3 = @fr1(x3) yy1 = @fi1(y1) yy2 = @fi1(y2) yy3 = @fi1(y3) int done = 2 float modz = 0.0 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 sum1 = 0.0 float sum2 = 0.0 float sum3 = 0.0 if @ab1 a1 = @a/sqrt(|@a|) * @c b1 = @b/sqrt(|@b|) * @c else a1 = @a b1 = @b endif complex r = (0,1) ^ (@angle / 90.0) complex r2 = (0,1) ^ (@anglestep / 90.0) loop: if @mode == 0 x1 = real(a1) * sin(imag(a1) * x1) + xx1 y1 = real(b1) * sin(imag(b1) * y1) + yy1 elseif @mode == 1 x1 = real(a1) * sin(imag(a1) * x1) + yy1 y1 = real(b1) * sin(imag(b1) * y1) + xx1 elseif @mode == 2 x1 = real(a1) * sin(imag(a1) * x1) + xx1 + yy1 y1 = real(b1) * sin(imag(b1) * y1) + xx1 - yy1 else x1 = real(a1) * sin(imag(a1) * x1) + xx1 + y1 y1 = real(b1) * sin(imag(b1) * y1) + yy1 - x1 endif z1 = x1 + flip(y1) IF (@fbm == true) complex pa = z1 * @scale * r + @noffset float suma = 0.0 float freq = 1.0 int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxa = floor(real(pa)) float fya = floor(imag(pa)) float bx0a = fxa % 256 float by0a = fya % 256 IF (bx0a < 0) bx0a = bx0a + 256 ENDIF IF (by0a < 0) by0a = by0a + 256 ENDIF float bx1a = (bx0a + 1) % 256 float by1a = (by0a + 1) % 256 float rx0a = real(pa) - fxa float ry0a = imag(pa) - fya float rx1a = rx0a - 1 float ry1a = ry0a - 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 b00a = (bx0a^@npower % 65536 + by0a)^@npower % 65536 float b10a = (bx1a^@npower % 65536 + by0a)^@npower % 65536 float b01a = (bx0a^@npower % 65536 + by1a)^@npower % 65536 float b11a = (bx1a^@npower % 65536 + by1a)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0a = (b00a)^@npower*0.25 % 512 - 256 float g_b10_0a = (b10a)^@npower*0.25 % 512 - 256 float g_b01_0a = (b01a)^@npower*0.25 % 512 - 256 float g_b11_0a = (b11a)^@npower*0.25 % 512 - 256 float g_b00_1a = (b00a+1)^@npower*0.25 % 512 - 256 float g_b10_1a = (b10a+1)^@npower*0.25 % 512 - 256 float g_b01_1a = (b01a+1)^@npower*0.25 % 512 - 256 float g_b11_1a = (b11a+1)^@npower*0.25 % 512 - 256 ; normalize each vector float da = 0.0; da = 1 / sqrt(sqr(g_b00_0a) + sqr(g_b00_1a)) g_b00_0a = g_b00_0a * da g_b00_1a = g_b00_1a * da da = 1 / sqrt(sqr(g_b10_0a) + sqr(g_b10_1a)) g_b10_0a = g_b10_0a * da g_b10_1a = g_b10_1a * da da = 1 / sqrt(sqr(g_b01_0a) + sqr(g_b01_1a)) g_b01_0a = g_b01_0a * da g_b01_1a = g_b01_1a * da da = 1 / sqrt(sqr(g_b11_0a) + sqr(g_b11_1a)) g_b11_0a = g_b11_0a * da g_b11_1a = g_b11_1a * da ; produce colors for each corner float u1a = rx0a * g_b00_0a + ry0a * g_b00_1a float v1a = rx1a * g_b10_0a + ry0a * g_b10_1a float u2a = rx0a * g_b01_0a + ry1a * g_b01_1a float v2a = rx1a * g_b11_0a + ry1a * g_b11_1a ; interpolate between corners using ; bilinear filtering float sxa = sqr(rx0a) * (3 - rx0a*2) float sya = sqr(ry0a) * (3 - ry0a*2) float na1 = u1a + sxa*(v1a-u1a) float nb1 = u2a + sxa*(v2a-u2a) suma = suma + real(@nfn1(na1 + sya*(nb1-na1)))*freq freq = freq * @step pa = pa * r2 / @step i = i - 1 ENDWHILE z1 = z1 + (suma+@coloroffset)*0.5*@distortion ENDIF if (@slope) if @mode == 0 x2 = real(a1) * sin(imag(a1) * x2) + xx2 x3 = real(a1) * sin(imag(a1) * x3) + xx3 y2 = real(b1) * sin(imag(b1) * y2) + yy2 y3 = real(b1) * sin(imag(b1) * y3) + yy3 elseif @mode == 1 x2 = real(a1) * sin(imag(a1) * x2) + yy2 x3 = real(a1) * sin(imag(a1) * x3) + yy3 y2 = real(b1) * sin(imag(b1) * y2) + xx2 y3 = real(b1) * sin(imag(b1) * y3) + xx3 elseif @mode == 2 x2 = real(a1) * sin(imag(a1) * x2) + xx2 + yy2 x3 = real(a1) * sin(imag(a1) * x3) + xx3 + yy3 y2 = real(b1) * sin(imag(b1) * y2) + xx2 - yy2 y3 = real(b1) * sin(imag(b1) * y3) + xx3 - yy3 else x2 = real(a1) * sin(imag(a1) * x2) + xx2 + y2 x3 = real(a1) * sin(imag(a1) * x3) + xx3 + y3 y2 = real(b1) * sin(imag(b1) * y2) + yy2 - x2 y3 = real(b1) * sin(imag(b1) * y3) + yy3 - x3 endif z2 = x2 + flip(y2) z3 = x3 + flip(y3) IF (@fbm == true) complex pb = z2 * @scale * r + @noffset complex pc = z3 * @scale * r + @noffset float sumb = 0.0 float sumc = 0.0 float freq = 1.0 int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxb = floor(real(pb)) float fyb = floor(imag(pb)) float bx0b = fxb % 256 float by0b = fyb % 256 IF (bx0b < 0) bx0b = bx0b + 256 ENDIF IF (by0b < 0) by0b = by0b + 256 ENDIF float bx1b = (bx0b + 1) % 256 float by1b = (by0b + 1) % 256 float rx0b = real(pb) - fxb float ry0b = imag(pb) - fyb float rx1b = rx0b - 1 float ry1b = ry0b - 1 float fxc = floor(real(pc)) float fyc = floor(imag(pc)) float bx0c = fxc % 256 float by0c = fyc % 256 IF (bx0c < 0) bx0c = bx0c + 256 ENDIF IF (by0c < 0) by0c = by0c + 256 ENDIF float bx1c = (bx0c + 1) % 256 float by1c = (by0c + 1) % 256 float rx0c = real(pc) - fxc float ry0c = imag(pc) - fyc float rx1c = rx0c - 1 float ry1c = ry0c - 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 b00b = (bx0b^@npower % 65536 + by0b)^@npower % 65536 float b10b = (bx1b^@npower % 65536 + by0b)^@npower % 65536 float b01b = (bx0b^@npower % 65536 + by1b)^@npower % 65536 float b11b = (bx1b^@npower % 65536 + by1b)^@npower % 65536 float b00c = (bx0c^@npower % 65536 + by0c)^@npower % 65536 float b10c = (bx1c^@npower % 65536 + by0c)^@npower % 65536 float b01c = (bx0c^@npower % 65536 + by1c)^@npower % 65536 float b11c = (bx1c^@npower % 65536 + by1c)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0b = (b00b)^@npower*0.25 % 512 - 256 float g_b10_0b = (b10b)^@npower*0.25 % 512 - 256 float g_b01_0b = (b01b)^@npower*0.25 % 512 - 256 float g_b11_0b = (b11b)^@npower*0.25 % 512 - 256 float g_b00_1b = (b00b+1)^@npower*0.25 % 512 - 256 float g_b10_1b = (b10b+1)^@npower*0.25 % 512 - 256 float g_b01_1b = (b01b+1)^@npower*0.25 % 512 - 256 float g_b11_1b = (b11b+1)^@npower*0.25 % 512 - 256 float g_b00_0c = (b00c)^@npower*0.25 % 512 - 256 float g_b10_0c = (b10c)^@npower*0.25 % 512 - 256 float g_b01_0c = (b01c)^@npower*0.25 % 512 - 256 float g_b11_0c = (b11c)^@npower*0.25 % 512 - 256 float g_b00_1c = (b00c+1)^@npower*0.25 % 512 - 256 float g_b10_1c = (b10c+1)^@npower*0.25 % 512 - 256 float g_b01_1c = (b01c+1)^@npower*0.25 % 512 - 256 float g_b11_1c = (b11c+1)^@npower*0.25 % 512 - 256 ; normalize each vector float db = 0.0 float dc = 0.0; db = 1 / sqrt(sqr(g_b00_0b) + sqr(g_b00_1b)) g_b00_0b = g_b00_0b * db g_b00_1b = g_b00_1b * db db = 1 / sqrt(sqr(g_b10_0b) + sqr(g_b10_1b)) g_b10_0b = g_b10_0b * db g_b10_1b = g_b10_1b * db db = 1 / sqrt(sqr(g_b01_0b) + sqr(g_b01_1b)) g_b01_0b = g_b01_0b * db g_b01_1b = g_b01_1b * db db = 1 / sqrt(sqr(g_b11_0b) + sqr(g_b11_1b)) g_b11_0b = g_b11_0b * db g_b11_1b = g_b11_1b * db dc = 1 / sqrt(sqr(g_b00_0c) + sqr(g_b00_1c)) g_b00_0c = g_b00_0c * dc g_b00_1c = g_b00_1c * dc dc = 1 / sqrt(sqr(g_b10_0c) + sqr(g_b10_1c)) g_b10_0c = g_b10_0c * dc g_b10_1c = g_b10_1c * dc dc = 1 / sqrt(sqr(g_b01_0c) + sqr(g_b01_1c)) g_b01_0c = g_b01_0c * dc g_b01_1c = g_b01_1c * dc dc = 1 / sqrt(sqr(g_b11_0c) + sqr(g_b11_1c)) g_b11_0c = g_b11_0c * dc g_b11_1c = g_b11_1c * dc ; produce colors for each corner float u1b = rx0b * g_b00_0b + ry0b * g_b00_1b float v1b = rx1b * g_b10_0b + ry0b * g_b10_1b float u2b = rx0b * g_b01_0b + ry1b * g_b01_1b float v2b = rx1b * g_b11_0b + ry1b * g_b11_1b float u1c = rx0c * g_b00_0c + ry0c * g_b00_1c float v1c = rx1c * g_b10_0c + ry0c * g_b10_1c float u2c = rx0c * g_b01_0c + ry1c * g_b01_1c float v2c = rx1c * g_b11_0c + ry1c * g_b11_1c ; interpolate between corners using ; bilinear filtering float sxb = sqr(rx0b) * (3 - rx0b*2) float syb = sqr(ry0b) * (3 - ry0b*2) float na2 = u1b + sxb*(v1b-u1b) float nb2 = u2b + sxb*(v2b-u2b) float sxc = sqr(rx0c) * (3 - rx0c*2) float syc = sqr(ry0c) * (3 - ry0c*2) float na3 = u1c + sxc*(v1c-u1c) float nb3 = u2c + sxc*(v2c-u2c) sumb = sumb + real(@nfn1(na2 + syb*(nb2-na2)))*freq sumc = sumc + real(@nfn1(na3 + syc*(nb3-na3)))*freq freq = freq * @step pb = pb * r2 / @step pc = pc * r2 / @step i = i - 1 ENDWHILE z2 = z2 + (sumb+@coloroffset)*0.5*@distortion z3 = z3 + (sumc+@coloroffset)*0.5*@distortion endif ENDIF modz = |z1| if (@slope == true) if (@zmode == 0) sum1 = sum1 + exp(-cabs(z1)) sum2 = sum2 + exp(-cabs(z2)) sum3 = sum3 + exp(-cabs(z3)) elseif (@zmode == 1) sum1 = cabs(z1 - #pixel) sum2 = cabs(z2 - #pixel) sum3 = cabs(z3 - #pixel) else sum1 = cabs(z1) sum2 = cabs(z2) sum3 = cabs(z3) endif done = done + 1 ; increment iteration counter IF (modz > @bailout || \ @everyiter || \ done == #maxit + 2) ; done, or every iteration, or last ; determine continuous iteration (height) for each point e1 = sum1 * @zscale e2 = sum2 * @zscale e3 = sum3 * @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 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 else z = z1 endif IF (modz > @bailout) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope MartSam 9" maxiter = 5 magn = .2 param version caption = "Version" default = 1.22 visible = false endparam param mode caption = "Mode" default = 0 enum = "x1 ; y1" "y1 ; x1" "x1 + y1 ; x1 - y1" \ "x1 + y ; y1 - x" endparam param a caption = "a" default = (2,-1) endparam param b caption = "b" default = (2,1) endparam param c caption = "c" default = 1.0 endparam param ab1 caption = "|a| = |b| = c ?" default = false hint = "Useful to get images of the same \ complexity. Choose a nice c value and \ play with a and b." endparam func fr1 caption = "Real Func 1" default = ident() endfunc func fi1 caption = "Imag Func 1" default = ident() endfunc param bailout caption = "Bailout Value" default = 1.0e20 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam bool param fbm caption = "fBm texturing?" default = false endparam heading caption = "fBm Parameters" visible = @fbm == true endheading param distortion caption = "Noise Strength" default = 1.0 visible = @fbm == true endparam param coloroffset caption = "Coloring Offset" default = 0.0 hint = "Sets the coloring offset from zero. Increase this if you see \ large areas of solid color." visible = @fbm == true endparam param noffset 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." visible = @fbm == true endparam param scale caption = "Noise Scale" default = 1.0 hint = "This is the overall scale of the noise." visible = @fbm == true endparam param angle caption = "Noise Rotation" default = 0.0 hint = "This is the angle, in degrees, of the noise." visible = @fbm == true endparam param step caption = "Noise Scale Step" default = 0.5 hint = "This is the step in scale between noise iterations." visible = @fbm == true endparam param anglestep caption = "Noise Rotation Step" default = 37.0 hint = "This is the angle, in degrees, to rotate between noise \ iterations." visible = @fbm == true endparam param octaves caption = "Noise Octaves" default = 7 min = 1 hint = "This is the number of iterations of the noise formula." visible = @fbm == true endparam param npower caption = "Noise Exponent" default = 2.0 hint = "This is the exponent used to scramble numbers." visible = @fbm == true endparam func nfn1 caption = "Noise Function" default = ident() visible = @fbm == true endfunc bool param slope caption = "Apply slope?" default = true endparam heading caption = "Slope Parameters" visible = @slope == true endheading param offset caption = "Orbit Separation" default = 0.01 hint = "Defines how far apart the simultaneous orbits are.\ Smaller distances will produce more accurate results." visible = @slope == true endparam param zmode caption = "Height Value" enum = "smoothed iteration" "magnitude (z-pixel)" "magnitude (z)" default = 0 visible = @slope==true endparam param xfer caption = "Height Transfer" default = 1 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." visible = @slope == true 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." visible = @slope == true endparam param zscale2 caption = "Height Post-Scale" default = 1.0 hint = "Specifies the ratio between height and distance; like \ Height Pre-Scale, except that this value is applied after \ the transfer function." visible = @slope == true 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." visible = @slope == true endparam } gnd-SlopeMartSam10 { ; based upon the slope (Mandelbrot) ; formula of Damien Jones ; modified MartSam10 formula from Samuel Monnier, 1999 ; Inspired from the Martin formula (by ; Mark Townsend) ; compound with the models of slope formulas from Ron Barnett. ; These slopes formulas are dedicated to the memory of Carol Walske, (1955, 2004). ; version 1.1, January 2005 ; Gilles Nadeau, 23/01/2005 ; Slope Optional, v1.1 by Susan Chambless, Mar, 2005. ; ; Damien's fBm added September, 2005 ; version 1.22, ; Gilles, 17/09/2005 ; Use inside colouring. ; By decreasing the number of iteration, ; you will get a smoother image. init: z1 = #pixel ; primary iterated point z2 = #pixel + @offset ; horizontally offset point z3 = #pixel + flip(@offset) ; vertically offset point x1 = real(z1) x2 = real(z2) x3 = real(z3) y1 = imag(z1) y2 = imag(z2) y3 = imag(z3) xx1 = @fr1(x1) xx2 = @fr1(x2) xx3 = @fr1(x3) yy1 = @fi1(y1) yy2 = @fi1(y2) yy3 = @fi1(y3) int done = 2 float modz = 0.0 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 sum1 = 0.0 float sum2 = 0.0 float sum3 = 0.0 if @ab1 a1 = @a/sqrt(|@a|) * @c b1 = @b/sqrt(|@b|) * @c else a1 = @a b1 = @b endif complex r = (0,1) ^ (@angle / 90.0) complex r2 = (0,1) ^ (@anglestep / 90.0) loop: if @mode == 0 x1 = real(a1) * (sin(x1) - cos(y1)) + imag(a1) * (cos(x1 - y1)) + xx1 y1 = real(b1) * (sin(y1) - cos(x1)) + imag(b1) * (sin(y1 - x1)) + yy1 elseif @mode == 1 x1 = real(a1) * (sin(x1) - cos(y1)) + imag(a1) * (cos(x1 - y1)) + yy1 y1 = real(b1) * (sin(y1) - cos(x1)) + imag(b1) * (sin(y1 - x1)) + xx1 elseif @mode == 2 x1 = real(a1) * (sin(x1) - cos(y1)) + imag(a1) * (cos(x1 - y1)) + xx1 + yy1 y1 = real(b1) * (sin(y1) - cos(x1)) + imag(b1) * (sin(y1 - x1)) + xx1 - yy1 else x1 = real(a1) * (sin(x1) - cos(y1)) + imag(a1) * (cos(x1 - y1)) + xx1 + y1 y1 = real(b1) * (sin(y1) - cos(x1)) + imag(b1) * (sin(y1 - x1)) + yy1 - x1 endif z1 = x1 + flip(y1) IF (@fbm == true) complex pa = z1 * @scale * r + @noffset float suma = 0.0 float freq = 1.0 int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxa = floor(real(pa)) float fya = floor(imag(pa)) float bx0a = fxa % 256 float by0a = fya % 256 IF (bx0a < 0) bx0a = bx0a + 256 ENDIF IF (by0a < 0) by0a = by0a + 256 ENDIF float bx1a = (bx0a + 1) % 256 float by1a = (by0a + 1) % 256 float rx0a = real(pa) - fxa float ry0a = imag(pa) - fya float rx1a = rx0a - 1 float ry1a = ry0a - 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 b00a = (bx0a^@npower % 65536 + by0a)^@npower % 65536 float b10a = (bx1a^@npower % 65536 + by0a)^@npower % 65536 float b01a = (bx0a^@npower % 65536 + by1a)^@npower % 65536 float b11a = (bx1a^@npower % 65536 + by1a)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0a = (b00a)^@npower*0.25 % 512 - 256 float g_b10_0a = (b10a)^@npower*0.25 % 512 - 256 float g_b01_0a = (b01a)^@npower*0.25 % 512 - 256 float g_b11_0a = (b11a)^@npower*0.25 % 512 - 256 float g_b00_1a = (b00a+1)^@npower*0.25 % 512 - 256 float g_b10_1a = (b10a+1)^@npower*0.25 % 512 - 256 float g_b01_1a = (b01a+1)^@npower*0.25 % 512 - 256 float g_b11_1a = (b11a+1)^@npower*0.25 % 512 - 256 ; normalize each vector float da = 0.0; da = 1 / sqrt(sqr(g_b00_0a) + sqr(g_b00_1a)) g_b00_0a = g_b00_0a * da g_b00_1a = g_b00_1a * da da = 1 / sqrt(sqr(g_b10_0a) + sqr(g_b10_1a)) g_b10_0a = g_b10_0a * da g_b10_1a = g_b10_1a * da da = 1 / sqrt(sqr(g_b01_0a) + sqr(g_b01_1a)) g_b01_0a = g_b01_0a * da g_b01_1a = g_b01_1a * da da = 1 / sqrt(sqr(g_b11_0a) + sqr(g_b11_1a)) g_b11_0a = g_b11_0a * da g_b11_1a = g_b11_1a * da ; produce colors for each corner float u1a = rx0a * g_b00_0a + ry0a * g_b00_1a float v1a = rx1a * g_b10_0a + ry0a * g_b10_1a float u2a = rx0a * g_b01_0a + ry1a * g_b01_1a float v2a = rx1a * g_b11_0a + ry1a * g_b11_1a ; interpolate between corners using ; bilinear filtering float sxa = sqr(rx0a) * (3 - rx0a*2) float sya = sqr(ry0a) * (3 - ry0a*2) float na1 = u1a + sxa*(v1a-u1a) float nb1 = u2a + sxa*(v2a-u2a) suma = suma + real(@nfn1(na1 + sya*(nb1-na1)))*freq freq = freq * @step pa = pa * r2 / @step i = i - 1 ENDWHILE z1 = z1 + (suma+@coloroffset)*0.5*@distortion ENDIF if (@slope) if @mode == 0 x2 = real(a1) * (sin(x2) - cos(y2)) + imag(a1) * (cos(x2 - y2)) + xx2 x3 = real(a1) * (sin(x3) - cos(y3)) + imag(a1) * (cos(x3 - y3)) + xx3 y2 = real(b1) * (sin(y2) - cos(x2)) + imag(b1) * (sin(y2 - x2)) + yy2 y3 = real(b1) * (sin(y3) - cos(x3)) + imag(b1) * (sin(y3 - x3)) + yy3 elseif @mode == 1 x2 = real(a1) * (sin(x2) - cos(y2)) + imag(a1) * (cos(x2 - y2)) + yy2 x3 = real(a1) * (sin(x3) - cos(y3)) + imag(a1) * (cos(x3 - y3)) + yy3 y2 = real(b1) * (sin(y2) - cos(x2)) + imag(b1) * (sin(y2 - x2)) + xx2 y3 = real(b1) * (sin(y3) - cos(x3)) + imag(b1) * (sin(y3 - x3)) + xx3 elseif @mode == 2 x2 = real(a1) * (sin(x2) - cos(y2)) + imag(a1) * (cos(x2 - y2)) + xx2 + yy2 x3 = real(a1) * (sin(x3) - cos(y3)) + imag(a1) * (cos(x3 - y3)) + xx3 + yy3 y2 = real(b1) * (sin(y2) - cos(x2)) + imag(b1) * (sin(y2 - x2)) + xx2 - yy2 y3 = real(b1) * (sin(y3) - cos(x3)) + imag(b1) * (sin(y3 - x3)) + xx3 - yy3 else x2 = real(a1) * (sin(x2) - cos(y2)) + imag(a1) * (cos(x2 - y2)) + xx2 + y2 x3 = real(a1) * (sin(x3) - cos(y3)) + imag(a1) * (cos(x3 - y3)) + xx3 + y3 y2 = real(b1) * (sin(y2) - cos(x2)) + imag(b1) * (sin(y2 - x2)) + yy2 - x2 y3 = real(b1) * (sin(y3) - cos(x3)) + imag(b1) * (sin(y3 - x3)) + yy3 - x3 endif z2 = x2 + flip(y2) z3 = x3 + flip(y3) IF (@fbm == true) complex pb = z2 * @scale * r + @noffset complex pc = z3 * @scale * r + @noffset float sumb = 0.0 float sumc = 0.0 float freq = 1.0 int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxb = floor(real(pb)) float fyb = floor(imag(pb)) float bx0b = fxb % 256 float by0b = fyb % 256 IF (bx0b < 0) bx0b = bx0b + 256 ENDIF IF (by0b < 0) by0b = by0b + 256 ENDIF float bx1b = (bx0b + 1) % 256 float by1b = (by0b + 1) % 256 float rx0b = real(pb) - fxb float ry0b = imag(pb) - fyb float rx1b = rx0b - 1 float ry1b = ry0b - 1 float fxc = floor(real(pc)) float fyc = floor(imag(pc)) float bx0c = fxc % 256 float by0c = fyc % 256 IF (bx0c < 0) bx0c = bx0c + 256 ENDIF IF (by0c < 0) by0c = by0c + 256 ENDIF float bx1c = (bx0c + 1) % 256 float by1c = (by0c + 1) % 256 float rx0c = real(pc) - fxc float ry0c = imag(pc) - fyc float rx1c = rx0c - 1 float ry1c = ry0c - 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 b00b = (bx0b^@npower % 65536 + by0b)^@npower % 65536 float b10b = (bx1b^@npower % 65536 + by0b)^@npower % 65536 float b01b = (bx0b^@npower % 65536 + by1b)^@npower % 65536 float b11b = (bx1b^@npower % 65536 + by1b)^@npower % 65536 float b00c = (bx0c^@npower % 65536 + by0c)^@npower % 65536 float b10c = (bx1c^@npower % 65536 + by0c)^@npower % 65536 float b01c = (bx0c^@npower % 65536 + by1c)^@npower % 65536 float b11c = (bx1c^@npower % 65536 + by1c)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0b = (b00b)^@npower*0.25 % 512 - 256 float g_b10_0b = (b10b)^@npower*0.25 % 512 - 256 float g_b01_0b = (b01b)^@npower*0.25 % 512 - 256 float g_b11_0b = (b11b)^@npower*0.25 % 512 - 256 float g_b00_1b = (b00b+1)^@npower*0.25 % 512 - 256 float g_b10_1b = (b10b+1)^@npower*0.25 % 512 - 256 float g_b01_1b = (b01b+1)^@npower*0.25 % 512 - 256 float g_b11_1b = (b11b+1)^@npower*0.25 % 512 - 256 float g_b00_0c = (b00c)^@npower*0.25 % 512 - 256 float g_b10_0c = (b10c)^@npower*0.25 % 512 - 256 float g_b01_0c = (b01c)^@npower*0.25 % 512 - 256 float g_b11_0c = (b11c)^@npower*0.25 % 512 - 256 float g_b00_1c = (b00c+1)^@npower*0.25 % 512 - 256 float g_b10_1c = (b10c+1)^@npower*0.25 % 512 - 256 float g_b01_1c = (b01c+1)^@npower*0.25 % 512 - 256 float g_b11_1c = (b11c+1)^@npower*0.25 % 512 - 256 ; normalize each vector float db = 0.0 float dc = 0.0; db = 1 / sqrt(sqr(g_b00_0b) + sqr(g_b00_1b)) g_b00_0b = g_b00_0b * db g_b00_1b = g_b00_1b * db db = 1 / sqrt(sqr(g_b10_0b) + sqr(g_b10_1b)) g_b10_0b = g_b10_0b * db g_b10_1b = g_b10_1b * db db = 1 / sqrt(sqr(g_b01_0b) + sqr(g_b01_1b)) g_b01_0b = g_b01_0b * db g_b01_1b = g_b01_1b * db db = 1 / sqrt(sqr(g_b11_0b) + sqr(g_b11_1b)) g_b11_0b = g_b11_0b * db g_b11_1b = g_b11_1b * db dc = 1 / sqrt(sqr(g_b00_0c) + sqr(g_b00_1c)) g_b00_0c = g_b00_0c * dc g_b00_1c = g_b00_1c * dc dc = 1 / sqrt(sqr(g_b10_0c) + sqr(g_b10_1c)) g_b10_0c = g_b10_0c * dc g_b10_1c = g_b10_1c * dc dc = 1 / sqrt(sqr(g_b01_0c) + sqr(g_b01_1c)) g_b01_0c = g_b01_0c * dc g_b01_1c = g_b01_1c * dc dc = 1 / sqrt(sqr(g_b11_0c) + sqr(g_b11_1c)) g_b11_0c = g_b11_0c * dc g_b11_1c = g_b11_1c * dc ; produce colors for each corner float u1b = rx0b * g_b00_0b + ry0b * g_b00_1b float v1b = rx1b * g_b10_0b + ry0b * g_b10_1b float u2b = rx0b * g_b01_0b + ry1b * g_b01_1b float v2b = rx1b * g_b11_0b + ry1b * g_b11_1b float u1c = rx0c * g_b00_0c + ry0c * g_b00_1c float v1c = rx1c * g_b10_0c + ry0c * g_b10_1c float u2c = rx0c * g_b01_0c + ry1c * g_b01_1c float v2c = rx1c * g_b11_0c + ry1c * g_b11_1c ; interpolate between corners using ; bilinear filtering float sxb = sqr(rx0b) * (3 - rx0b*2) float syb = sqr(ry0b) * (3 - ry0b*2) float na2 = u1b + sxb*(v1b-u1b) float nb2 = u2b + sxb*(v2b-u2b) float sxc = sqr(rx0c) * (3 - rx0c*2) float syc = sqr(ry0c) * (3 - ry0c*2) float na3 = u1c + sxc*(v1c-u1c) float nb3 = u2c + sxc*(v2c-u2c) sumb = sumb + real(@nfn1(na2 + syb*(nb2-na2)))*freq sumc = sumc + real(@nfn1(na3 + syc*(nb3-na3)))*freq freq = freq * @step pb = pb * r2 / @step pc = pc * r2 / @step i = i - 1 ENDWHILE z2 = z2 + (sumb+@coloroffset)*0.5*@distortion z3 = z3 + (sumc+@coloroffset)*0.5*@distortion endif ENDIF modz = |z1| if (@slope == true) if (@zmode == 0) sum1 = sum1 + exp(-cabs(z1)) sum2 = sum2 + exp(-cabs(z2)) sum3 = sum3 + exp(-cabs(z3)) elseif (@zmode == 1) sum1 = cabs(z1 - #pixel) sum2 = cabs(z2 - #pixel) sum3 = cabs(z3 - #pixel) else sum1 = cabs(z1) sum2 = cabs(z2) sum3 = cabs(z3) endif done = done + 1 ; increment iteration counter IF (modz > @bailout || \ @everyiter || \ done == #maxit + 2) ; done, or every iteration, or last ; determine continuous iteration (height) for each point e1 = sum1 * @zscale e2 = sum2 * @zscale e3 = sum3 * @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 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 else z = z1 endif IF (modz > @bailout) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope MartSam 10" maxiter = 5 magn = .2 param version caption = "Version" default = 1.22 visible = false endparam param mode caption = "Mode" default = 0 enum = "x1 ; y1" "y1 ; x1" "x1 + y1 ; x1 - y1" \ "x1 + y ; y1 - x" endparam param a caption = "a" default = (2,-1) endparam param b caption = "b" default = (2,1) endparam param c caption = "c" default = 1.0 endparam param ab1 caption = "|a| = |b| = c ?" default = false hint = "Useful to get images of the same \ complexity. Choose a nice c value and \ play with a and b." endparam func fr1 caption = "Real Func 1" default = ident() endfunc func fi1 caption = "Imag Func 1" default = ident() endfunc param bailout caption = "Bailout Value" default = 1.0e20 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam bool param fbm caption = "fBm texturing?" default = false endparam heading caption = "fBm Parameters" visible = @fbm == true endheading param distortion caption = "Noise Strength" default = 1.0 visible = @fbm == true endparam param coloroffset caption = "Coloring Offset" default = 0.0 hint = "Sets the coloring offset from zero. Increase this if you see \ large areas of solid color." visible = @fbm == true endparam param noffset 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." visible = @fbm == true endparam param scale caption = "Noise Scale" default = 1.0 hint = "This is the overall scale of the noise." visible = @fbm == true endparam param angle caption = "Noise Rotation" default = 0.0 hint = "This is the angle, in degrees, of the noise." visible = @fbm == true endparam param step caption = "Noise Scale Step" default = 0.5 hint = "This is the step in scale between noise iterations." visible = @fbm == true endparam param anglestep caption = "Noise Rotation Step" default = 37.0 hint = "This is the angle, in degrees, to rotate between noise \ iterations." visible = @fbm == true endparam param octaves caption = "Noise Octaves" default = 7 min = 1 hint = "This is the number of iterations of the noise formula." visible = @fbm == true endparam param npower caption = "Noise Exponent" default = 2.0 hint = "This is the exponent used to scramble numbers." visible = @fbm == true endparam func nfn1 caption = "Noise Function" default = ident() visible = @fbm == true endfunc bool param slope caption = "Apply slope?" default = true endparam heading caption = "Slope Parameters" visible = @slope == true endheading param offset caption = "Orbit Separation" default = 0.01 hint = "Defines how far apart the simultaneous orbits are.\ Smaller distances will produce more accurate results." visible = @slope == true endparam param zmode caption = "Height Value" enum = "smoothed iteration" "magnitude (z-pixel)" "magnitude (z)" default = 0 visible = @slope==true endparam param xfer caption = "Height Transfer" default = 1 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." visible = @slope == true 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." visible = @slope == true endparam param zscale2 caption = "Height Post-Scale" default = 1.0 hint = "Specifies the ratio between height and distance; like \ Height Pre-Scale, except that this value is applied after \ the transfer function." visible = @slope == true 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." visible = @slope == true endparam } gnd-SlopeMartSam11 { ; based upon the slope (Mandelbrot) ; formula of Damien Jones ; modified MartSam11 formula from Samuel Monnier, 1999 ; Inspired from the Martin formula (by ; Mark Townsend) ; compound with the models of slope formulas from Ron Barnett. ; These slopes formulas are dedicated to the memory of Carol Walske, (1955, 2004). ; version 1.1, January 2005 ; Gilles Nadeau, 23/01/2005 ; Slope Optional, v1.1 by Susan Chambless, Mar, 2005. ; ; Damien's fBm added September, 2005 ; version 1.22, ; Gilles, 17/09/2005 ; Use inside colouring. ; By decreasing the number of iteration, ; you will get a smoother image. init: z1 = #pixel ; primary iterated point z2 = #pixel + @offset ; horizontally offset point z3 = #pixel + flip(@offset) ; vertically offset point x1 = real(z1) x2 = real(z2) x3 = real(z3) y1 = imag(z1) y2 = imag(z2) y3 = imag(z3) xx1 = @fr1(x1) xx2 = @fr1(x2) xx3 = @fr1(x3) yy1 = @fi1(y1) yy2 = @fi1(y2) yy3 = @fi1(y3) int done = 2 float modz = 0.0 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 sum1 = 0.0 float sum2 = 0.0 float sum3 = 0.0 if @ab1 a1 = @a/sqrt(|@a|) * @c b1 = @b/sqrt(|@b|) * @c else a1 = @a b1 = @b endif complex r = (0,1) ^ (@angle / 90.0) complex r2 = (0,1) ^ (@anglestep / 90.0) loop: if @mode == 0 x1 = sin(real(a1) * x1 + imag(a1) * xx1) + xx1 y1 = cos(real(b1) * y1 + imag(b1) * yy1) + yy1 elseif @mode == 1 x1 = sin(real(a1) * x1 + imag(a1) * xx1) + yy1 y1 = cos(real(b1) * y1 + imag(b1) * yy1) + xx1 elseif @mode == 2 x1 = sin(real(a1) * x1 + imag(a1) * xx1) + xx1 + yy1 y1 = cos(real(b1) * y1 + imag(b1) * yy1) + xx1 - yy1 else x1 = sin(real(a1) * x1 + imag(a1) * xx1) + xx1 + y1 y1 = cos(real(b1) * y1 + imag(b1) * yy1) + yy1 - x1 endif z1 = x1 + flip(y1) IF (@fbm == true) complex pa = z1 * @scale * r + @noffset float suma = 0.0 float freq = 1.0 int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxa = floor(real(pa)) float fya = floor(imag(pa)) float bx0a = fxa % 256 float by0a = fya % 256 IF (bx0a < 0) bx0a = bx0a + 256 ENDIF IF (by0a < 0) by0a = by0a + 256 ENDIF float bx1a = (bx0a + 1) % 256 float by1a = (by0a + 1) % 256 float rx0a = real(pa) - fxa float ry0a = imag(pa) - fya float rx1a = rx0a - 1 float ry1a = ry0a - 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 b00a = (bx0a^@npower % 65536 + by0a)^@npower % 65536 float b10a = (bx1a^@npower % 65536 + by0a)^@npower % 65536 float b01a = (bx0a^@npower % 65536 + by1a)^@npower % 65536 float b11a = (bx1a^@npower % 65536 + by1a)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0a = (b00a)^@npower*0.25 % 512 - 256 float g_b10_0a = (b10a)^@npower*0.25 % 512 - 256 float g_b01_0a = (b01a)^@npower*0.25 % 512 - 256 float g_b11_0a = (b11a)^@npower*0.25 % 512 - 256 float g_b00_1a = (b00a+1)^@npower*0.25 % 512 - 256 float g_b10_1a = (b10a+1)^@npower*0.25 % 512 - 256 float g_b01_1a = (b01a+1)^@npower*0.25 % 512 - 256 float g_b11_1a = (b11a+1)^@npower*0.25 % 512 - 256 ; normalize each vector float da = 0.0; da = 1 / sqrt(sqr(g_b00_0a) + sqr(g_b00_1a)) g_b00_0a = g_b00_0a * da g_b00_1a = g_b00_1a * da da = 1 / sqrt(sqr(g_b10_0a) + sqr(g_b10_1a)) g_b10_0a = g_b10_0a * da g_b10_1a = g_b10_1a * da da = 1 / sqrt(sqr(g_b01_0a) + sqr(g_b01_1a)) g_b01_0a = g_b01_0a * da g_b01_1a = g_b01_1a * da da = 1 / sqrt(sqr(g_b11_0a) + sqr(g_b11_1a)) g_b11_0a = g_b11_0a * da g_b11_1a = g_b11_1a * da ; produce colors for each corner float u1a = rx0a * g_b00_0a + ry0a * g_b00_1a float v1a = rx1a * g_b10_0a + ry0a * g_b10_1a float u2a = rx0a * g_b01_0a + ry1a * g_b01_1a float v2a = rx1a * g_b11_0a + ry1a * g_b11_1a ; interpolate between corners using ; bilinear filtering float sxa = sqr(rx0a) * (3 - rx0a*2) float sya = sqr(ry0a) * (3 - ry0a*2) float na1 = u1a + sxa*(v1a-u1a) float nb1 = u2a + sxa*(v2a-u2a) suma = suma + real(@nfn1(na1 + sya*(nb1-na1)))*freq freq = freq * @step pa = pa * r2 / @step i = i - 1 ENDWHILE z1 = z1 + (suma+@coloroffset)*0.5*@distortion ENDIF if (@slope) if @mode == 0 x2 = sin(real(a1) * x2 + imag(a1) * xx2) + xx2 x3 = sin(real(a1) * x3 + imag(a1) * xx3) + xx3 y2 = cos(real(b1) * y2 + imag(b1) * yy2) + yy2 y3 = cos(real(b1) * y3 + imag(b1) * yy3) + yy3 elseif @mode == 1 x2 = sin(real(a1) * x2 + imag(a1) * xx2) + yy2 x3 = sin(real(a1) * x3 + imag(a1) * xx3) + yy3 y2 = cos(real(b1) * y2 + imag(b1) * yy2) + xx2 y3 = cos(real(b1) * y3 + imag(b1) * yy3) + xx3 elseif @mode == 2 x2 = sin(real(a1) * x2 + imag(a1) * xx2) + xx2 + yy2 x3 = sin(real(a1) * x3 + imag(a1) * xx3) + xx3 + yy3 y2 = cos(real(b1) * y2 + imag(b1) * yy2) + xx2 - yy2 y3 = cos(real(b1) * y3 + imag(b1) * yy3) + xx3 - yy3 else x2 = sin(real(a1) * x2 + imag(a1) * xx2) + xx2 + y2 x3 = sin(real(a1) * x3 + imag(a1) * xx3) + xx3 + y3 y2 = cos(real(b1) * y2 + imag(b1) * yy2) + yy2 - x2 y3 = cos(real(b1) * y3 + imag(b1) * yy3) + yy3 - x3 endif z2 = x2 + flip(y2) z3 = x3 + flip(y3) IF (@fbm == true) complex pb = z2 * @scale * r + @noffset complex pc = z3 * @scale * r + @noffset float sumb = 0.0 float sumc = 0.0 float freq = 1.0 int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxb = floor(real(pb)) float fyb = floor(imag(pb)) float bx0b = fxb % 256 float by0b = fyb % 256 IF (bx0b < 0) bx0b = bx0b + 256 ENDIF IF (by0b < 0) by0b = by0b + 256 ENDIF float bx1b = (bx0b + 1) % 256 float by1b = (by0b + 1) % 256 float rx0b = real(pb) - fxb float ry0b = imag(pb) - fyb float rx1b = rx0b - 1 float ry1b = ry0b - 1 float fxc = floor(real(pc)) float fyc = floor(imag(pc)) float bx0c = fxc % 256 float by0c = fyc % 256 IF (bx0c < 0) bx0c = bx0c + 256 ENDIF IF (by0c < 0) by0c = by0c + 256 ENDIF float bx1c = (bx0c + 1) % 256 float by1c = (by0c + 1) % 256 float rx0c = real(pc) - fxc float ry0c = imag(pc) - fyc float rx1c = rx0c - 1 float ry1c = ry0c - 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 b00b = (bx0b^@npower % 65536 + by0b)^@npower % 65536 float b10b = (bx1b^@npower % 65536 + by0b)^@npower % 65536 float b01b = (bx0b^@npower % 65536 + by1b)^@npower % 65536 float b11b = (bx1b^@npower % 65536 + by1b)^@npower % 65536 float b00c = (bx0c^@npower % 65536 + by0c)^@npower % 65536 float b10c = (bx1c^@npower % 65536 + by0c)^@npower % 65536 float b01c = (bx0c^@npower % 65536 + by1c)^@npower % 65536 float b11c = (bx1c^@npower % 65536 + by1c)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0b = (b00b)^@npower*0.25 % 512 - 256 float g_b10_0b = (b10b)^@npower*0.25 % 512 - 256 float g_b01_0b = (b01b)^@npower*0.25 % 512 - 256 float g_b11_0b = (b11b)^@npower*0.25 % 512 - 256 float g_b00_1b = (b00b+1)^@npower*0.25 % 512 - 256 float g_b10_1b = (b10b+1)^@npower*0.25 % 512 - 256 float g_b01_1b = (b01b+1)^@npower*0.25 % 512 - 256 float g_b11_1b = (b11b+1)^@npower*0.25 % 512 - 256 float g_b00_0c = (b00c)^@npower*0.25 % 512 - 256 float g_b10_0c = (b10c)^@npower*0.25 % 512 - 256 float g_b01_0c = (b01c)^@npower*0.25 % 512 - 256 float g_b11_0c = (b11c)^@npower*0.25 % 512 - 256 float g_b00_1c = (b00c+1)^@npower*0.25 % 512 - 256 float g_b10_1c = (b10c+1)^@npower*0.25 % 512 - 256 float g_b01_1c = (b01c+1)^@npower*0.25 % 512 - 256 float g_b11_1c = (b11c+1)^@npower*0.25 % 512 - 256 ; normalize each vector float db = 0.0 float dc = 0.0; db = 1 / sqrt(sqr(g_b00_0b) + sqr(g_b00_1b)) g_b00_0b = g_b00_0b * db g_b00_1b = g_b00_1b * db db = 1 / sqrt(sqr(g_b10_0b) + sqr(g_b10_1b)) g_b10_0b = g_b10_0b * db g_b10_1b = g_b10_1b * db db = 1 / sqrt(sqr(g_b01_0b) + sqr(g_b01_1b)) g_b01_0b = g_b01_0b * db g_b01_1b = g_b01_1b * db db = 1 / sqrt(sqr(g_b11_0b) + sqr(g_b11_1b)) g_b11_0b = g_b11_0b * db g_b11_1b = g_b11_1b * db dc = 1 / sqrt(sqr(g_b00_0c) + sqr(g_b00_1c)) g_b00_0c = g_b00_0c * dc g_b00_1c = g_b00_1c * dc dc = 1 / sqrt(sqr(g_b10_0c) + sqr(g_b10_1c)) g_b10_0c = g_b10_0c * dc g_b10_1c = g_b10_1c * dc dc = 1 / sqrt(sqr(g_b01_0c) + sqr(g_b01_1c)) g_b01_0c = g_b01_0c * dc g_b01_1c = g_b01_1c * dc dc = 1 / sqrt(sqr(g_b11_0c) + sqr(g_b11_1c)) g_b11_0c = g_b11_0c * dc g_b11_1c = g_b11_1c * dc ; produce colors for each corner float u1b = rx0b * g_b00_0b + ry0b * g_b00_1b float v1b = rx1b * g_b10_0b + ry0b * g_b10_1b float u2b = rx0b * g_b01_0b + ry1b * g_b01_1b float v2b = rx1b * g_b11_0b + ry1b * g_b11_1b float u1c = rx0c * g_b00_0c + ry0c * g_b00_1c float v1c = rx1c * g_b10_0c + ry0c * g_b10_1c float u2c = rx0c * g_b01_0c + ry1c * g_b01_1c float v2c = rx1c * g_b11_0c + ry1c * g_b11_1c ; interpolate between corners using ; bilinear filtering float sxb = sqr(rx0b) * (3 - rx0b*2) float syb = sqr(ry0b) * (3 - ry0b*2) float na2 = u1b + sxb*(v1b-u1b) float nb2 = u2b + sxb*(v2b-u2b) float sxc = sqr(rx0c) * (3 - rx0c*2) float syc = sqr(ry0c) * (3 - ry0c*2) float na3 = u1c + sxc*(v1c-u1c) float nb3 = u2c + sxc*(v2c-u2c) sumb = sumb + real(@nfn1(na2 + syb*(nb2-na2)))*freq sumc = sumc + real(@nfn1(na3 + syc*(nb3-na3)))*freq freq = freq * @step pb = pb * r2 / @step pc = pc * r2 / @step i = i - 1 ENDWHILE z2 = z2 + (sumb+@coloroffset)*0.5*@distortion z3 = z3 + (sumc+@coloroffset)*0.5*@distortion endif ENDIF modz = |z1| if (@slope == true) if (@zmode == 0) sum1 = sum1 + exp(-cabs(z1)) sum2 = sum2 + exp(-cabs(z2)) sum3 = sum3 + exp(-cabs(z3)) elseif (@zmode == 1) sum1 = cabs(z1 - #pixel) sum2 = cabs(z2 - #pixel) sum3 = cabs(z3 - #pixel) else sum1 = cabs(z1) sum2 = cabs(z2) sum3 = cabs(z3) endif done = done + 1 ; increment iteration counter IF (modz > @bailout || \ @everyiter || \ done == #maxit + 2) ; done, or every iteration, or last ; determine continuous iteration (height) for each point e1 = sum1 * @zscale e2 = sum2 * @zscale e3 = sum3 * @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 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 else z = z1 endif IF (modz > @bailout) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope MartSam 11" maxiter = 5 magn = .2 param version caption = "Version" default = 1.22 visible = false endparam param mode caption = "Mode" default = 0 enum = "x1 ; y1" "y1 ; x1" "x1 + y1 ; x1 - y1" \ "x1 + y ; y1 - x" endparam param a caption = "a" default = (2,-1) endparam param b caption = "b" default = (2,1) endparam param c caption = "c" default = 1.0 endparam param ab1 caption = "|a| = |b| = c ?" default = false hint = "Useful to get images of the same \ complexity. Choose a nice c value and \ play with a and b." endparam func fr1 caption = "Real Func 1" default = ident() endfunc func fi1 caption = "Imag Func 1" default = ident() endfunc param bailout caption = "Bailout Value" default = 1.0e20 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam bool param fbm caption = "fBm texturing?" default = false endparam heading caption = "fBm Parameters" visible = @fbm == true endheading param distortion caption = "Noise Strength" default = 1.0 visible = @fbm == true endparam param coloroffset caption = "Coloring Offset" default = 0.0 hint = "Sets the coloring offset from zero. Increase this if you see \ large areas of solid color." visible = @fbm == true endparam param noffset 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." visible = @fbm == true endparam param scale caption = "Noise Scale" default = 1.0 hint = "This is the overall scale of the noise." visible = @fbm == true endparam param angle caption = "Noise Rotation" default = 0.0 hint = "This is the angle, in degrees, of the noise." visible = @fbm == true endparam param step caption = "Noise Scale Step" default = 0.5 hint = "This is the step in scale between noise iterations." visible = @fbm == true endparam param anglestep caption = "Noise Rotation Step" default = 37.0 hint = "This is the angle, in degrees, to rotate between noise \ iterations." visible = @fbm == true endparam param octaves caption = "Noise Octaves" default = 7 min = 1 hint = "This is the number of iterations of the noise formula." visible = @fbm == true endparam param npower caption = "Noise Exponent" default = 2.0 hint = "This is the exponent used to scramble numbers." visible = @fbm == true endparam func nfn1 caption = "Noise Function" default = ident() visible = @fbm == true endfunc bool param slope caption = "Apply slope?" default = true endparam heading caption = "Slope Parameters" visible = @slope == true endheading param offset caption = "Orbit Separation" default = 0.01 hint = "Defines how far apart the simultaneous orbits are.\ Smaller distances will produce more accurate results." visible = @slope == true endparam param zmode caption = "Height Value" enum = "smoothed iteration" "magnitude (z-pixel)" "magnitude (z)" default = 0 visible = @slope==true endparam param xfer caption = "Height Transfer" default = 1 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." visible = @slope == true 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." visible = @slope == true endparam param zscale2 caption = "Height Post-Scale" default = 1.0 hint = "Specifies the ratio between height and distance; like \ Height Pre-Scale, except that this value is applied after \ the transfer function." visible = @slope == true 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." visible = @slope == true endparam } gnd-SlopeMartSam12 { ; based upon the slope (Mandelbrot) ; formula of Damien Jones ; modified MartSam12 formula from Samuel Monnier, 1999 ; Inspired from the Martin formula (by ; Mark Townsend) ; compound with the models of slope formulas from Ron Barnett. ; These slopes formulas are dedicated to the memory of Carol Walske, (1955, 2004). ; version 1.1, January 2005 ; Gilles Nadeau, 23/01/2005 ; Slope Optional, v1.1 by Susan Chambless, Mar, 2005. ; ; Damien's fBm added September, 2005 ; version 1.22, ; Gilles, 17/09/2005 ; Use inside colouring. ; By decreasing the number of iteration, ; you will get a smoother image. init: z1 = #pixel ; primary iterated point z2 = #pixel + @offset ; horizontally offset point z3 = #pixel + flip(@offset) ; vertically offset point x1 = real(z1) x2 = real(z2) x3 = real(z3) y1 = imag(z1) y2 = imag(z2) y3 = imag(z3) xx1 = @fr1(x1) xx2 = @fr1(x2) xx3 = @fr1(x3) yy1 = @fi1(y1) yy2 = @fi1(y2) yy3 = @fi1(y3) px1 = 0.0 px2 = 0.0 px3 = 0.0 py1 = 0.0 py2 = 0.0 py3 = 0.0 int done = 2 float modz = 0.0 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 sum1 = 0.0 float sum2 = 0.0 float sum3 = 0.0 if @ab1 a1 = @a/sqrt(|@a|) * @c b1 = @b/sqrt(|@b|) * @c else a1 = @a b1 = @b endif complex r = (0,1) ^ (@angle / 90.0) complex r2 = (0,1) ^ (@anglestep / 90.0) loop: if @mode == 0 px1 = x1 x1 = x1 - real(a1) * sin(imag(a1) * py1 + xx1) py1 = y1 y1 = y1 - real(b1) * sin(imag(b1) * px1 + yy1) elseif @mode == 1 px1 = x1 x1 = x1 - real(a1) * sin(imag(a1) * py1 + yy1) py1 = y1 y1 = y1 - real(b1) * sin(imag(b1) * px1 + xx1) elseif @mode == 2 px1 = x1 x1 = x1 - real(a1) * sin(imag(a1) * py1 + xx1 + yy1) py1 = y1 y1 = y1 - real(b1) * sin(imag(b1) * px1 + xx1 - yy1) else px1 = x1 x1 = x1 - real(a1) * sin(imag(a1) * py1 + xx1 + y1) py1 = y1 y1 = y1 - real(b1) * sin(imag(b1) * px1 + yy1 - x1) endif z1 = x1 + flip(y1) IF (@fbm == true) complex pa = z1 * @scale * r + @noffset float suma = 0.0 float freq = 1.0 int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxa = floor(real(pa)) float fya = floor(imag(pa)) float bx0a = fxa % 256 float by0a = fya % 256 IF (bx0a < 0) bx0a = bx0a + 256 ENDIF IF (by0a < 0) by0a = by0a + 256 ENDIF float bx1a = (bx0a + 1) % 256 float by1a = (by0a + 1) % 256 float rx0a = real(pa) - fxa float ry0a = imag(pa) - fya float rx1a = rx0a - 1 float ry1a = ry0a - 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 b00a = (bx0a^@npower % 65536 + by0a)^@npower % 65536 float b10a = (bx1a^@npower % 65536 + by0a)^@npower % 65536 float b01a = (bx0a^@npower % 65536 + by1a)^@npower % 65536 float b11a = (bx1a^@npower % 65536 + by1a)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0a = (b00a)^@npower*0.25 % 512 - 256 float g_b10_0a = (b10a)^@npower*0.25 % 512 - 256 float g_b01_0a = (b01a)^@npower*0.25 % 512 - 256 float g_b11_0a = (b11a)^@npower*0.25 % 512 - 256 float g_b00_1a = (b00a+1)^@npower*0.25 % 512 - 256 float g_b10_1a = (b10a+1)^@npower*0.25 % 512 - 256 float g_b01_1a = (b01a+1)^@npower*0.25 % 512 - 256 float g_b11_1a = (b11a+1)^@npower*0.25 % 512 - 256 ; normalize each vector float da = 0.0; da = 1 / sqrt(sqr(g_b00_0a) + sqr(g_b00_1a)) g_b00_0a = g_b00_0a * da g_b00_1a = g_b00_1a * da da = 1 / sqrt(sqr(g_b10_0a) + sqr(g_b10_1a)) g_b10_0a = g_b10_0a * da g_b10_1a = g_b10_1a * da da = 1 / sqrt(sqr(g_b01_0a) + sqr(g_b01_1a)) g_b01_0a = g_b01_0a * da g_b01_1a = g_b01_1a * da da = 1 / sqrt(sqr(g_b11_0a) + sqr(g_b11_1a)) g_b11_0a = g_b11_0a * da g_b11_1a = g_b11_1a * da ; produce colors for each corner float u1a = rx0a * g_b00_0a + ry0a * g_b00_1a float v1a = rx1a * g_b10_0a + ry0a * g_b10_1a float u2a = rx0a * g_b01_0a + ry1a * g_b01_1a float v2a = rx1a * g_b11_0a + ry1a * g_b11_1a ; interpolate between corners using ; bilinear filtering float sxa = sqr(rx0a) * (3 - rx0a*2) float sya = sqr(ry0a) * (3 - ry0a*2) float na1 = u1a + sxa*(v1a-u1a) float nb1 = u2a + sxa*(v2a-u2a) suma = suma + real(@nfn1(na1 + sya*(nb1-na1)))*freq freq = freq * @step pa = pa * r2 / @step i = i - 1 ENDWHILE z1 = z1 + (suma+@coloroffset)*0.5*@distortion ENDIF if (@slope) if @mode == 0 px2 = x2 px3 = x3 x2 = x2 - real(a1) * sin(imag(a1) * py2 + xx2) x3 = x3 - real(a1) * sin(imag(a1) * py3 + xx3) py2 = y2 py3 = y3 y2 = y2 - real(b1) * sin(imag(b1) * px2 + yy2) y3 = y3 - real(b1) * sin(imag(b1) * px3 + yy3) elseif @mode == 1 px2 = x2 px3 = x3 x2 = x2 - real(a1) * sin(imag(a1) * py2 + yy2) x3 = x3 - real(a1) * sin(imag(a1) * py3 + yy3) py2 = y2 py3 = y3 y2 = y2 - real(b1) * sin(imag(b1) * px2 + xx2) y3 = y3 - real(b1) * sin(imag(b1) * px3 + xx3) elseif @mode == 2 px2 = x2 px3 = x3 x2 = x2 - real(a1) * sin(imag(a1) * py2 + xx2 + yy2) x3 = x3 - real(a1) * sin(imag(a1) * py3 + xx3 + yy3) py2 = y2 py3 = y3 y2 = y2 - real(b1) * sin(imag(b1) * px2 + xx2 - yy2) y3 = y3 - real(b1) * sin(imag(b1) * px3 + xx3 - yy3) else px2 = x2 px3 = x3 x2 = x2 - real(a1) * sin(imag(a1) * py2 + xx2 + y2) x3 = x3 - real(a1) * sin(imag(a1) * py3 + xx3 + y3) py2 = y2 py3 = y3 y2 = y2 - real(b1) * sin(imag(b1) * px2 + yy2 - x2) y3 = y3 - real(b1) * sin(imag(b1) * px3 + yy3 - x3) endif z2 = x2 + flip(y2) z3 = x3 + flip(y3) IF (@fbm == true) complex pb = z2 * @scale * r + @noffset complex pc = z3 * @scale * r + @noffset float sumb = 0.0 float sumc = 0.0 float freq = 1.0 int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fxb = floor(real(pb)) float fyb = floor(imag(pb)) float bx0b = fxb % 256 float by0b = fyb % 256 IF (bx0b < 0) bx0b = bx0b + 256 ENDIF IF (by0b < 0) by0b = by0b + 256 ENDIF float bx1b = (bx0b + 1) % 256 float by1b = (by0b + 1) % 256 float rx0b = real(pb) - fxb float ry0b = imag(pb) - fyb float rx1b = rx0b - 1 float ry1b = ry0b - 1 float fxc = floor(real(pc)) float fyc = floor(imag(pc)) float bx0c = fxc % 256 float by0c = fyc % 256 IF (bx0c < 0) bx0c = bx0c + 256 ENDIF IF (by0c < 0) by0c = by0c + 256 ENDIF float bx1c = (bx0c + 1) % 256 float by1c = (by0c + 1) % 256 float rx0c = real(pc) - fxc float ry0c = imag(pc) - fyc float rx1c = rx0c - 1 float ry1c = ry0c - 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 b00b = (bx0b^@npower % 65536 + by0b)^@npower % 65536 float b10b = (bx1b^@npower % 65536 + by0b)^@npower % 65536 float b01b = (bx0b^@npower % 65536 + by1b)^@npower % 65536 float b11b = (bx1b^@npower % 65536 + by1b)^@npower % 65536 float b00c = (bx0c^@npower % 65536 + by0c)^@npower % 65536 float b10c = (bx1c^@npower % 65536 + by0c)^@npower % 65536 float b01c = (bx0c^@npower % 65536 + by1c)^@npower % 65536 float b11c = (bx1c^@npower % 65536 + by1c)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0b = (b00b)^@npower*0.25 % 512 - 256 float g_b10_0b = (b10b)^@npower*0.25 % 512 - 256 float g_b01_0b = (b01b)^@npower*0.25 % 512 - 256 float g_b11_0b = (b11b)^@npower*0.25 % 512 - 256 float g_b00_1b = (b00b+1)^@npower*0.25 % 512 - 256 float g_b10_1b = (b10b+1)^@npower*0.25 % 512 - 256 float g_b01_1b = (b01b+1)^@npower*0.25 % 512 - 256 float g_b11_1b = (b11b+1)^@npower*0.25 % 512 - 256 float g_b00_0c = (b00c)^@npower*0.25 % 512 - 256 float g_b10_0c = (b10c)^@npower*0.25 % 512 - 256 float g_b01_0c = (b01c)^@npower*0.25 % 512 - 256 float g_b11_0c = (b11c)^@npower*0.25 % 512 - 256 float g_b00_1c = (b00c+1)^@npower*0.25 % 512 - 256 float g_b10_1c = (b10c+1)^@npower*0.25 % 512 - 256 float g_b01_1c = (b01c+1)^@npower*0.25 % 512 - 256 float g_b11_1c = (b11c+1)^@npower*0.25 % 512 - 256 ; normalize each vector float db = 0.0 float dc = 0.0; db = 1 / sqrt(sqr(g_b00_0b) + sqr(g_b00_1b)) g_b00_0b = g_b00_0b * db g_b00_1b = g_b00_1b * db db = 1 / sqrt(sqr(g_b10_0b) + sqr(g_b10_1b)) g_b10_0b = g_b10_0b * db g_b10_1b = g_b10_1b * db db = 1 / sqrt(sqr(g_b01_0b) + sqr(g_b01_1b)) g_b01_0b = g_b01_0b * db g_b01_1b = g_b01_1b * db db = 1 / sqrt(sqr(g_b11_0b) + sqr(g_b11_1b)) g_b11_0b = g_b11_0b * db g_b11_1b = g_b11_1b * db dc = 1 / sqrt(sqr(g_b00_0c) + sqr(g_b00_1c)) g_b00_0c = g_b00_0c * dc g_b00_1c = g_b00_1c * dc dc = 1 / sqrt(sqr(g_b10_0c) + sqr(g_b10_1c)) g_b10_0c = g_b10_0c * dc g_b10_1c = g_b10_1c * dc dc = 1 / sqrt(sqr(g_b01_0c) + sqr(g_b01_1c)) g_b01_0c = g_b01_0c * dc g_b01_1c = g_b01_1c * dc dc = 1 / sqrt(sqr(g_b11_0c) + sqr(g_b11_1c)) g_b11_0c = g_b11_0c * dc g_b11_1c = g_b11_1c * dc ; produce colors for each corner float u1b = rx0b * g_b00_0b + ry0b * g_b00_1b float v1b = rx1b * g_b10_0b + ry0b * g_b10_1b float u2b = rx0b * g_b01_0b + ry1b * g_b01_1b float v2b = rx1b * g_b11_0b + ry1b * g_b11_1b float u1c = rx0c * g_b00_0c + ry0c * g_b00_1c float v1c = rx1c * g_b10_0c + ry0c * g_b10_1c float u2c = rx0c * g_b01_0c + ry1c * g_b01_1c float v2c = rx1c * g_b11_0c + ry1c * g_b11_1c ; interpolate between corners using ; bilinear filtering float sxb = sqr(rx0b) * (3 - rx0b*2) float syb = sqr(ry0b) * (3 - ry0b*2) float na2 = u1b + sxb*(v1b-u1b) float nb2 = u2b + sxb*(v2b-u2b) float sxc = sqr(rx0c) * (3 - rx0c*2) float syc = sqr(ry0c) * (3 - ry0c*2) float na3 = u1c + sxc*(v1c-u1c) float nb3 = u2c + sxc*(v2c-u2c) sumb = sumb + real(@nfn1(na2 + syb*(nb2-na2)))*freq sumc = sumc + real(@nfn1(na3 + syc*(nb3-na3)))*freq freq = freq * @step pb = pb * r2 / @step pc = pc * r2 / @step i = i - 1 ENDWHILE z2 = z2 + (sumb+@coloroffset)*0.5*@distortion z3 = z3 + (sumc+@coloroffset)*0.5*@distortion endif ENDIF modz = |z1| if (@slope == true) if (@zmode == 0) sum1 = sum1 + exp(-cabs(z1)) sum2 = sum2 + exp(-cabs(z2)) sum3 = sum3 + exp(-cabs(z3)) elseif (@zmode == 1) sum1 = cabs(z1 - #pixel) sum2 = cabs(z2 - #pixel) sum3 = cabs(z3 - #pixel) else sum1 = cabs(z1) sum2 = cabs(z2) sum3 = cabs(z3) endif done = done + 1 ; increment iteration counter IF (modz > @bailout || \ @everyiter || \ done == #maxit + 2) ; done, or every iteration, or last ; determine continuous iteration (height) for each point e1 = sum1 * @zscale e2 = sum2 * @zscale e3 = sum3 * @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 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 else z = z1 endif IF (modz > @bailout) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope MartSam 12" maxiter = 5 magn = .2 param version caption = "Version" default = 1.22 visible = false endparam param mode caption = "Mode" default = 0 enum = "x1 ; y1" "y1 ; x1" "x1 + y1 ; x1 - y1" \ "x1 + y ; y1 - x" endparam param a caption = "a" default = (2,-1) endparam param b caption = "b" default = (2,1) endparam param c caption = "c" default = 1.0 endparam param ab1 caption = "|a| = |b| = c ?" default = false hint = "Useful to get images of the same \ complexity. Choose a nice c value and \ play with a and b." endparam func fr1 caption = "Real Func 1" default = ident() endfunc func fi1 caption = "Imag Func 1" default = ident() endfunc param bailout caption = "Bailout Value" default = 1.0e20 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam bool param fbm caption = "fBm texturing?" default = false endparam heading caption = "fBm Parameters" visible = @fbm == true endheading param distortion caption = "Noise Strength" default = 1.0 visible = @fbm == true endparam param coloroffset caption = "Coloring Offset" default = 0.0 hint = "Sets the coloring offset from zero. Increase this if you see \ large areas of solid color." visible = @fbm == true endparam param noffset 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." visible = @fbm == true endparam param scale caption = "Noise Scale" default = 1.0 hint = "This is the overall scale of the noise." visible = @fbm == true endparam param angle caption = "Noise Rotation" default = 0.0 hint = "This is the angle, in degrees, of the noise." visible = @fbm == true endparam param step caption = "Noise Scale Step" default = 0.5 hint = "This is the step in scale between noise iterations." visible = @fbm == true endparam param anglestep caption = "Noise Rotation Step" default = 37.0 hint = "This is the angle, in degrees, to rotate between noise \ iterations." visible = @fbm == true endparam param octaves caption = "Noise Octaves" default = 7 min = 1 hint = "This is the number of iterations of the noise formula." visible = @fbm == true endparam param npower caption = "Noise Exponent" default = 2.0 hint = "This is the exponent used to scramble numbers." visible = @fbm == true endparam func nfn1 caption = "Noise Function" default = ident() visible = @fbm == true endfunc bool param slope caption = "Apply slope?" default = true endparam heading caption = "Slope Parameters" visible = @slope == true endheading param offset caption = "Orbit Separation" default = 0.01 hint = "Defines how far apart the simultaneous orbits are.\ Smaller distances will produce more accurate results." visible = @slope == true endparam param zmode caption = "Height Value" enum = "smoothed iteration" "magnitude (z-pixel)" "magnitude (z)" default = 0 visible = @slope==true endparam param xfer caption = "Height Transfer" default = 1 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." visible = @slope == true 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." visible = @slope == true endparam param zscale2 caption = "Height Post-Scale" default = 1.0 hint = "Specifies the ratio between height and distance; like \ Height Pre-Scale, except that this value is applied after \ the transfer function." visible = @slope == true 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." visible = @slope == true endparam } gnd-Slope_4D-Julia { ; based upon the slope (Julia) ; formula of Damien Jones ; Hypercomplex Julia formula ; compound with the models of slope formulas from Ron Barnett. ; 3d option added October, 2007 ; based on the Quaternion formula by Stig Pettersson. ; version 1.18, November 2007 ; Gilles Nadeau, 11/11/2007 ; init: complex zri1 = #pixel complex zri2 = #pixel + @offset; horizontally offset point complex zri3 = #pixel + flip(@offset); vertically offset point complex zjk1 = @zjk complex zjk2 = @zjk complex zjk3 = @zjk complex cri1 = @c1i complex cri2 = @c1i complex cri3 = @c1i complex cjk1 = @cjk complex cjk2 = @cjk complex cjk3 = @cjk complex zh = (0.0, 0.0) complex a = (0.0, 0.0) complex b = (0.0, 0.0) complex c = (0.0, 0.0) complex d = (0.0, 0.0) float x1 = 0.0 float y1 = 0.0 float z1 = 0.0 float w1 = 0.0 float x2 = 0.0 float y2 = 0.0 float z2 = 0.0 float w2 = 0.0 float x3 = 0.0 float y3 = 0.0 float z3 = 0.0 float w3 = 0.0 float cx1 = 0.0 float cy1 = 0.0 float cz1 = 0.0 float cw1 = 0.0 float cx2 = 0.0 float cy2 = 0.0 float cz2 = 0.0 float cw2 = 0.0 float cx3 = 0.0 float cy3 = 0.0 float cz3 = 0.0 float cw3 = 0.0 float a1 = 0.0 float bi = 0.0 float cj = 0.0 float dk = 0.0 float xa = 0.0 float xb = 0.0 float xc = 0.0 float xd = 0.0 float ya = 0.0 float yb = 0.0 float yc = 0.0 float yd = 0.0 float rx = 0.0 float ry = 0.0 float rz = 0.0 if (@version < 1.17) float cs = @cs else cs = 1.0 endif int done = 2 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 iterexp1 = 0.0 float iterexp2 = 0.0 float iterexp3 = 0.0 bool set0 = false bool set1 = false if (@dim3 == false) ; (yz plane rotation) ry = imag(zri1)*cos(#pi*@rotx/180) - real(zjk1)*sin(#pi*@rotx/180) rz = imag(zri1)*sin(#pi*@rotx/180) + real(zjk1)*cos(#pi*@rotx/180) zri1 = real(zri1) + ry*1i zjk1 = rz + imag(zjk1)*1i ry = imag(cri1)*cos(#pi*@rotx/180) - real(cjk1)*sin(#pi*@rotx/180) rz = imag(cri1)*sin(#pi*@rotx/180) + real(cjk1)*cos(#pi*@rotx/180) cri1 = real(cri1) + ry*1i cjk1 = rz + imag(cjk1)*1i ; (xz plane rotation) rx = real(zjk1)*sin(#pi*@roty/180) + real(zri1)*cos(#pi*@roty/180) rz = real(zjk1)*cos(#pi*@roty/180) - real(zri1)*sin(#pi*@roty/180) zri1 = rx + imag(zri1)*1i zjk1 = rz + imag(zjk1)*1i rx = real(cjk1)*sin(#pi*@roty/180) + real(cri1)*cos(#pi*@roty/180) rz = real(cjk1)*cos(#pi*@roty/180) - real(cri1)*sin(#pi*@roty/180) cri1 = rx + imag(cri1)*1i cjk1 = rz + imag(cjk1)*1i ; (xy plane rotation) rx = real(zri1)*cos(#pi*@rotz/180) - imag(zri1)*sin(#pi*@rotz/180) ry = real(zri1)*sin(#pi*@rotz/180) + imag(zri1)*cos(#pi*@rotz/180) zri1 = rx + ry*1i rx = real(cri1)*cos(#pi*@rotz/180) - imag(cri1)*sin(#pi*@rotz/180) ry = real(cri1)*sin(#pi*@rotz/180) + imag(cri1)*cos(#pi*@rotz/180) cri1 = rx + ry*1i if @fourthdim == 3 x1 = real(zri1) y1 = imag(zri1) z1 = real(zjk1) w1 = imag(zjk1) cx1 = real(cri1) cy1 = imag(cri1) cz1 = real(cjk1) cw1 = imag(cjk1) elseif @fourthdim == 2 x1 = real(zri1) y1 = imag(zri1) z1 = imag(zjk1) w1 = real(zjk1) cx1 = real(cri1) cy1 = imag(cri1) cz1 = imag(cjk1) cw1 = real(cjk1) elseif @fourthdim == 1 x1 = real(zjk1) y1 = imag(zjk1) z1 = real(zri1) w1 = imag(zri1) cx1 = real(cjk1) cy1 = imag(cjk1) cz1 = real(cri1) cw1 = imag(cri1) else x1 = imag(zjk1) y1 = real(zjk1) z1 = real(zri1) w1 = imag(zri1) cx1 = imag(cjk1) cy1 = real(cjk1) cz1 = real(cri1) cw1 = imag(cri1) endif if (@slope) ; (yz plane rotation) ry = imag(zri2)*cos(#pi*@rotx/180) - real(zjk2)*sin(#pi*@rotx/180) rz = imag(zri2)*sin(#pi*@rotx/180) + real(zjk2)*cos(#pi*@rotx/180) zri2 = real(zri2) + ry*1i zjk2 = rz + imag(zjk2)*1i ry = imag(zri3)*cos(#pi*@rotx/180) - real(zjk3)*sin(#pi*@rotx/180) rz = imag(zri3)*sin(#pi*@rotx/180) + real(zjk3)*cos(#pi*@rotx/180) zri3 = real(zri3) + ry*1i zjk3 = rz + imag(zjk3)*1i ry = imag(cri2)*cos(#pi*@rotx/180) - real(cjk2)*sin(#pi*@rotx/180) rz = imag(cri2)*sin(#pi*@rotx/180) + real(cjk2)*cos(#pi*@rotx/180) cri2 = real(cri2) + ry*1i cjk2 = rz + imag(cjk2)*1i ry = imag(cri3)*cos(#pi*@rotx/180) - real(cjk3)*sin(#pi*@rotx/180) rz = imag(cri3)*sin(#pi*@rotx/180) + real(cjk3)*cos(#pi*@rotx/180) cri3 = real(cri3) + ry*1i cjk3 = rz + imag(cjk3)*1i ; (xz plane rotation) rx = real(zjk2)*sin(#pi*@roty/180) + real(zri2)*cos(#pi*@roty/180) rz = real(zjk2)*cos(#pi*@roty/180) - real(zri2)*sin(#pi*@roty/180) zri2 = rx + imag(zri2)*1i zjk2 = rz + imag(zjk2)*1i rx = real(zjk3)*sin(#pi*@roty/180) + real(zri3)*cos(#pi*@roty/180) rz = real(zjk3)*cos(#pi*@roty/180) - real(zri3)*sin(#pi*@roty/180) zri3 = rx + imag(zri3)*1i zjk3 = rz + imag(zjk3)*1i rx = real(cjk2)*sin(#pi*@roty/180) + real(cri2)*cos(#pi*@roty/180) rz = real(cjk2)*cos(#pi*@roty/180) - real(cri2)*sin(#pi*@roty/180) cri2 = rx + imag(cri2)*1i cjk2 = rz + imag(cjk2)*1i rx = real(cjk3)*sin(#pi*@roty/180) + real(cri3)*cos(#pi*@roty/180) rz = real(cjk3)*cos(#pi*@roty/180) - real(cri3)*sin(#pi*@roty/180) cri3 = rx + imag(cri3)*1i cjk3 = rz + imag(cjk3)*1i ; (xy plane rotation) rx = real(zri2)*cos(#pi*@rotz/180) - imag(zri2)*sin(#pi*@rotz/180) ry = real(zri2)*sin(#pi*@rotz/180) + imag(zri2)*cos(#pi*@rotz/180) zri2 = rx + ry*1i rx = real(zri3)*cos(#pi*@rotz/180) - imag(zri3)*sin(#pi*@rotz/180) ry = real(zri3)*sin(#pi*@rotz/180) + imag(zri3)*cos(#pi*@rotz/180) zri3 = rx + ry*1i rx = real(cri2)*cos(#pi*@rotz/180) - imag(cri2)*sin(#pi*@rotz/180) ry = real(cri2)*sin(#pi*@rotz/180) + imag(cri2)*cos(#pi*@rotz/180) cri2 = rx + ry*1i rx = real(cri3)*cos(#pi*@rotz/180) - imag(cri3)*sin(#pi*@rotz/180) ry = real(cri3)*sin(#pi*@rotz/180) + imag(cri3)*cos(#pi*@rotz/180) cri3 = rx + ry*1i if @fourthdim == 3 x2 = real(zri2) y2 = imag(zri2) z2 = real(zjk2) w2 = imag(zjk2) x3 = real(zri3) y3 = imag(zri3) z3 = real(zjk3) w3 = imag(zjk3) cx2 = real(cri2) cy2 = imag(cri2) cz2 = real(cjk2) cw2 = imag(cjk2) cx3 = real(cri3) cy3 = imag(cri3) cz3 = real(cjk3) cw3 = imag(cjk3) elseif @fourthdim == 2 x2 = real(zri2) y2 = imag(zri2) z2 = imag(zjk2) w2 = real(zjk2) x3 = real(zri3) y3 = imag(zri3) z3 = imag(zjk3) w3 = real(zjk3) cx2 = real(cri2) cy2 = imag(cri2) cz2 = imag(cjk2) cw2 = real(cjk2) cx3 = real(cri3) cy3 = imag(cri3) cz3 = imag(cjk3) cw3 = real(cjk3) elseif @fourthdim == 1 x2 = real(zjk2) y2 = imag(zjk2) z2 = real(zri2) w2 = imag(zri2) x3 = real(zjk3) y3 = imag(zjk3) z3 = real(zri3) w3 = imag(zri3) cx2 = real(cjk2) cy2 = imag(cjk2) cz2 = real(cri2) cw2 = imag(cri2) cx3 = real(cjk3) cy3 = imag(cjk3) cz3 = real(cri3) cw3 = imag(cri3) else x2 = imag(zjk2) y2 = real(zjk2) z2 = real(zri2) w2 = imag(zri2) x3 = imag(zjk3) y3 = real(zjk3) z3 = real(zri3) w3 = imag(zri3) cx2 = imag(cjk2) cy2 = real(cjk2) cz2 = real(cri2) cw2 = imag(cri2) cx3 = imag(cjk3) cy3 = real(cjk3) cz3 = real(cri3) cw3 = imag(cri3) endif endif else int stepnum = @stepnum float zdist = @dist / 2 zjk1 = real(@zjk) - zdist + flip(imag(@zjk)) zjk2 = zjk1 zjk3 = zjk1 zh = zjk1 zjk1 = zh cx1 = real(@c1i) cy1 = imag(@c1i) cz1 = real(@cjk) cw1 = imag(@cjk) cx2 = real(@c1i) cy2 = imag(@c1i) cz2 = real(@cjk) cw2 = imag(@cjk) cx3 = real(@c1i) cy3 = imag(@c1i) cz3 = real(@cjk) cw3 = imag(@cjk) float delta = (real(@zjk) + zdist - real(zjk1)) / stepnum int n = 0 int i = 0 while (n < stepnum) && (set1 == false) zri1 = #pixel zri2 = #pixel + @offset zri3 = #pixel + flip(@offset) zjk1 = zh = zh + delta zjk2 = zjk1 zjk3 = zjk1 ; (yz plane rotation) ry = imag(zri1)*cos(#pi*@rotx/180) - real(zjk1)*sin(#pi*@rotx/180) rz = imag(zri1)*sin(#pi*@rotx/180) + real(zjk1)*cos(#pi*@rotx/180) zri1 = real(zri1) + ry*1i zjk1 = rz + imag(zjk1)*1i ; (xz plane rotation) rx = real(zjk1)*sin(#pi*@roty/180) + real(zri1)*cos(#pi*@roty/180) rz = real(zjk1)*cos(#pi*@roty/180) - real(zri1)*sin(#pi*@roty/180) zri1 = rx + imag(zri1)*1i zjk1 = rz + imag(zjk1)*1i ; (xy plane rotation) rx = real(zri1)*cos(#pi*@rotz/180) - imag(zri1)*sin(#pi*@rotz/180) ry = real(zri1)*sin(#pi*@rotz/180) + imag(zri1)*cos(#pi*@rotz/180) zri1 = rx + ry*1i if @fourthdim == 3 x1 = real(zri1) y1 = imag(zri1) z1 = real(zjk1) w1 = imag(zjk1) elseif @fourthdim == 2 x1 = real(zri1) y1 = imag(zri1) z1 = imag(zjk1) w1 = real(zjk1) elseif @fourthdim == 1 x1 = real(zjk1) y1 = imag(zjk1) z1 = real(zri1) w1 = imag(zri1) else x1 = imag(zjk1) y1 = real(zjk1) z1 = real(zri1) w1 = imag(zri1) endif if (@slope) ; (yz plane rotation) ry = imag(zri2)*cos(#pi*@rotx/180) - real(zjk2)*sin(#pi*@rotx/180) rz = imag(zri2)*sin(#pi*@rotx/180) + real(zjk2)*cos(#pi*@rotx/180) zri2 = real(zri2) + ry*1i zjk2 = rz + imag(zjk2)*1i ry = imag(zri3)*cos(#pi*@rotx/180) - real(zjk3)*sin(#pi*@rotx/180) rz = imag(zri3)*sin(#pi*@rotx/180) + real(zjk3)*cos(#pi*@rotx/180) zri3 = real(zri3) + ry*1i zjk3 = rz + imag(zjk3)*1i ; (xz plane rotation) rx = real(zjk2)*sin(#pi*@roty/180) + real(zri2)*cos(#pi*@roty/180) rz = real(zjk2)*cos(#pi*@roty/180) - real(zri2)*sin(#pi*@roty/180) zri2 = rx + imag(zri2)*1i zjk2 = rz + imag(zjk2)*1i rx = real(zjk3)*sin(#pi*@roty/180) + real(zri3)*cos(#pi*@roty/180) rz = real(zjk3)*cos(#pi*@roty/180) - real(zri3)*sin(#pi*@roty/180) zri3 = rx + imag(zri3)*1i zjk3 = rz + imag(zjk3)*1i ; (xy plane rotation) rx = real(zri2)*cos(#pi*@rotz/180) - imag(zri2)*sin(#pi*@rotz/180) ry = real(zri2)*sin(#pi*@rotz/180) + imag(zri2)*cos(#pi*@rotz/180) zri2 = rx + ry*1i rx = real(zri3)*cos(#pi*@rotz/180) - imag(zri3)*sin(#pi*@rotz/180) ry = real(zri3)*sin(#pi*@rotz/180) + imag(zri3)*cos(#pi*@rotz/180) zri3 = rx + ry*1i if @fourthdim == 3 x2 = real(zri2) y2 = imag(zri2) z2 = real(zjk2) w2 = imag(zjk2) x3 = real(zri3) y3 = imag(zri3) z3 = real(zjk3) w3 = imag(zjk3) elseif @fourthdim == 2 x2 = real(zri2) y2 = imag(zri2) z2 = imag(zjk2) w2 = real(zjk2) x3 = real(zri3) y3 = imag(zri3) z3 = imag(zjk3) w3 = real(zjk3) elseif @fourthdim == 1 x2 = real(zjk2) y2 = imag(zjk2) z2 = real(zri2) w2 = imag(zri2) x3 = real(zjk3) y3 = imag(zjk3) z3 = real(zri3) w3 = imag(zri3) else x2 = imag(zjk2) y2 = real(zjk2) z2 = real(zri2) w2 = imag(zri2) x3 = imag(zjk3) y3 = real(zjk3) z3 = real(zri3) w3 = imag(zri3) endif endif while (i < #maxiter) && (|zri1| + |zjk1| < @bailout) if (@var == 0) a1 = x1^2 - y1^2 - z1^2 + w1^2 bi = 2*(x1*y1 - z1*w1) cj = 2*(x1*z1 - y1*w1) dk = 2*(x1*w1 + y1*z1) x1 = a1 + cx1 y1 = bi + cy1 z1 = cj + cz1 w1 = dk + cw1 if (@slope) a1 = x2^2 - y2^2 - z2^2 + w2^2 bi = 2*(x2*y2 - z2*w2) cj = 2*(x2*z2 - y2*w2) dk = 2*(x2*w2 + y2*z2) x2 = a1 + cx2 y2 = bi + cy2 z2 = cj + cz2 w2 = dk + cw2 a1 = x3^2 - y3^2 - z3^2 + w3^2 bi = 2*(x3*y3 - z3*w3) cj = 2*(x3*z3 - y3*w3) dk = 2*(x3*w3 + y3*z3) x3 = a1 + cx3 y3 = bi + cy3 z3 = cj + cz3 w3 = dk + cw3 endif elseif (@var == 1) xa = x1 + cx1 xb = y1 + cy1 xc = z1 + cz1 xd = w1 + cw1 ya = x1 - cx1 yb = y1 - cy1 yc = z1 - cz1 yd = w1 - cw1 x1 = xa*ya - xb*yb - xc*yc + xd*yd y1 = xb*ya + xa*yb - xd*yc - xc*yd z1 = xc*ya - xd*yb + xa*yc - xb*yd w1 = xd*ya + xc*yb + xb*yc + xa*yd if (@slope) xa = x2 + cx2 xb = y2 + cy2 xc = z2 + cz2 xd = w2 + cw2 ya = x2 - cx2 yb = y2 - cy2 yc = z2 - cz2 yd = w2 - cw2 x2 = xa*ya - xb*yb - xc*yc + xd*yd y2 = xb*ya + xa*yb - xd*yc - xc*yd z2 = xc*ya - xd*yb + xa*yc - xb*yd w2 = xd*ya + xc*yb + xb*yc + xa*yd xa = x3 + cx3 xb = y3 + cy3 xc = z3 + cz3 xd = w3 + cw3 ya = x3 - cx3 yb = y3 - cy3 yc = z3 - cz3 yd = w3 - cw3 x3 = xa*ya - xb*yb - xc*yc + xd*yd y3 = xb*ya + xa*yb - xd*yc - xc*yd z3 = xc*ya - xd*yb + xa*yc - xb*yd w3 = xd*ya + xc*yb + xb*yc + xa*yd endif elseif (@var == 2) a1 = x1^3 - 3*x1*(y1^2 + z1^2 - w1^2) + 6*y1*z1*w1 bi= -y1^3 + 3*y1*(x1^2 - z1^2 + w1^2) - 6*x1*z1*w1 cj= -z1^3 + 3*z1*(w1^2 + x1^2 - y1^2) - 6*w1*x1*y1 dk = w1^3 - 3*w1*(z1^2 - x1^2 + y1^2) + 6*z1*x1*y1 x1 = a1 + cx1 y1 = bi + cy1 z1 = cj + cz1 w1 = dk + cw1 if (@slope) a1 = x2^3 - 3*x2*(y2^2 + z2^2 - w2^2) + 6*y2*z2*w2 bi= -y2^3 + 3*y2*(x2^2 - z2^2 + w2^2) - 6*x2*z2*w2 cj= -z2^3 + 3*z2*(w2^2 + x2^2 - y2^2) - 6*w2*x2*y2 dk = w2^3 - 3*w2*(z2^2 - x2^2 + y2^2) + 6*z2*x2*y2 x2 = a1 + cx2 y2 = bi + cy2 z2 = cj + cz2 w2 = dk + cw2 a1 = x3^3 - 3*x3*(y3^2 + z3^2 - w3^2) + 6*y3*z3*w3 bi= -y3^3 + 3*y3*(x3^2 - z3^2 + w3^2) - 6*x3*z3*w3 cj= -z3^3 + 3*z3*(w3^2 + x3^2 - y3^2) - 6*w3*x3*y3 dk = w3^3 - 3*w3*(z3^2 - x3^2 + y3^2) + 6*z3*x3*y3 x3 = a1 + cx3 y3 = bi + cy3 z3 = cj + cz3 w3 = dk + cw3 endif elseif (@var == 3) a = x1 - w1 + flip(y1 + z1) b = x1 + w1 + flip(y1 - z1) c = @fn1(a)^@power d = @fn1(b)^@power x1 = (real(c) + real(d)) / 2 + cx1 y1 = (imag(c) + imag(d)) / 2 + cy1 z1 = (imag(c) - imag(d)) / 2 + cz1 w1 = (real(d) - real(c)) / 2 + cw1 if (@slope) a = x2 - w2 + flip(y2 + z2) b = x2 + w2 + flip(y2 - z2) c = @fn1(a)^@power d = @fn1(b)^@power x2 = (real(c) + real(d)) / 2 + cx2 y2 = (imag(c) + imag(d)) / 2 + cy2 z2 = (imag(c) - imag(d)) / 2 + cz2 w2 = (real(d) - real(c)) / 2 + cw2 a = x3 - w3 + flip(y3 + z3) b = x3 + w3 + flip(y3 - z3) c = @fn1(a)^@power d = @fn1(b)^@power x3 = (real(c) + real(d)) / 2 + cx3 y3 = (imag(c) + imag(d)) / 2 + cy3 z3 = (imag(c) - imag(d)) / 2 + cz3 w3 = (real(d) - real(c)) / 2 + cw3 endif endif zri1 = x1 + flip(y1) zjk1 = z1 + flip(w1) if (@slope == true) zri2 = x2 + flip(y2) zjk2 = z2 + flip(w2) zri3 = x3 + flip(y3) zjk3 = z3 + flip(w3) endif i = i + 1 endwhile i = 0 n = n + 1 if (|zri1| + |zjk1| < @bailout) set1 = true endif endwhile if (set1 == true) zri1 = #pixel zri2 = #pixel + @offset zri3 = #pixel + flip(@offset) zjk1 = zh = zh - delta*cs zjk2 = zjk1 zjk3 = zjk1 endif if (set1 == false) && (@dim3 == true) set0 = true endif zri1 = #pixel zri2 = #pixel + @offset zri3 = #pixel + flip(@offset) zjk1 = zh = zh zjk2 = zjk1 zjk3 = zjk1 ; (yz plane rotation) ry = imag(zri1)*cos(#pi*@rotx/180) - real(zjk1)*sin(#pi*@rotx/180) rz = imag(zri1)*sin(#pi*@rotx/180) + real(zjk1)*cos(#pi*@rotx/180) zri1 = real(zri1) + ry*1i zjk1 = rz + imag(zjk1)*1i ; (xz plane rotation) rx = real(zjk1)*sin(#pi*@roty/180) + real(zri1)*cos(#pi*@roty/180) rz = real(zjk1)*cos(#pi*@roty/180) - real(zri1)*sin(#pi*@roty/180) zri1 = rx + imag(zri1)*1i zjk1 = rz + imag(zjk1)*1i ; (xy plane rotation) rx = real(zri1)*cos(#pi*@rotz/180) - imag(zri1)*sin(#pi*@rotz/180) ry = real(zri1)*sin(#pi*@rotz/180) + imag(zri1)*cos(#pi*@rotz/180) zri1 = rx + ry*1i if @fourthdim == 3 x1 = real(zri1) y1 = imag(zri1) z1 = real(zjk1) w1 = imag(zjk1) elseif @fourthdim == 2 x1 = real(zri1) y1 = imag(zri1) z1 = imag(zjk1) w1 = real(zjk1) elseif @fourthdim == 1 x1 = real(zjk1) y1 = imag(zjk1) z1 = real(zri1) w1 = imag(zri1) else x1 = imag(zjk1) y1 = real(zjk1) z1 = real(zri1) w1 = imag(zri1) endif if (@slope) ; (yz plane rotation) ry = imag(zri2)*cos(#pi*@rotx/180) - real(zjk2)*sin(#pi*@rotx/180) rz = imag(zri2)*sin(#pi*@rotx/180) + real(zjk2)*cos(#pi*@rotx/180) zri2 = real(zri2) + ry*1i zjk2 = rz + imag(zjk2)*1i ry = imag(zri3)*cos(#pi*@rotx/180) - real(zjk3)*sin(#pi*@rotx/180) rz = imag(zri3)*sin(#pi*@rotx/180) + real(zjk3)*cos(#pi*@rotx/180) zri3 = real(zri3) + ry*1i zjk3 = rz + imag(zjk3)*1i ; (xz plane rotation) rx = real(zjk2)*sin(#pi*@roty/180) + real(zri2)*cos(#pi*@roty/180) rz = real(zjk2)*cos(#pi*@roty/180) - real(zri2)*sin(#pi*@roty/180) zri2 = rx + imag(zri2)*1i zjk2 = rz + imag(zjk2)*1i rx = real(zjk3)*sin(#pi*@roty/180) + real(zri3)*cos(#pi*@roty/180) rz = real(zjk3)*cos(#pi*@roty/180) - real(zri3)*sin(#pi*@roty/180) zri3 = rx + imag(zri3)*1i zjk3 = rz + imag(zjk3)*1i ; (xy plane rotation) rx = real(zri2)*cos(#pi*@rotz/180) - imag(zri2)*sin(#pi*@rotz/180) ry = real(zri2)*sin(#pi*@rotz/180) + imag(zri2)*cos(#pi*@rotz/180) zri2 = rx + ry*1i rx = real(zri3)*cos(#pi*@rotz/180) - imag(zri3)*sin(#pi*@rotz/180) ry = real(zri3)*sin(#pi*@rotz/180) + imag(zri3)*cos(#pi*@rotz/180) zri3 = rx + ry*1i if @fourthdim == 3 x2 = real(zri2) y2 = imag(zri2) z2 = real(zjk2) w2 = imag(zjk2) x3 = real(zri3) y3 = imag(zri3) z3 = real(zjk3) w3 = imag(zjk3) elseif @fourthdim == 2 x2 = real(zri2) y2 = imag(zri2) z2 = imag(zjk2) w2 = real(zjk2) x3 = real(zri3) y3 = imag(zri3) z3 = imag(zjk3) w3 = real(zjk3) elseif @fourthdim == 1 x2 = real(zjk2) y2 = imag(zjk2) z2 = real(zri2) w2 = imag(zri2) x3 = real(zjk3) y3 = imag(zjk3) z3 = real(zri3) w3 = imag(zri3) else x2 = imag(zjk2) y2 = real(zjk2) z2 = real(zri2) w2 = imag(zri2) x3 = imag(zjk3) y3 = real(zjk3) z3 = real(zri3) w3 = imag(zri3) endif endif endif loop: if (set0 == false) if (@var == 0) a1 = x1^2 - y1^2 - z1^2 + w1^2 bi = 2*(x1*y1 - z1*w1) cj = 2*(x1*z1 - y1*w1) dk = 2*(x1*w1 + y1*z1) x1 = a1 + cx1 y1 = bi + cy1 z1 = cj + cz1 w1 = dk + cw1 if (@slope) a1 = x2^2 - y2^2 - z2^2 + w2^2 bi = 2*(x2*y2 - z2*w2) cj = 2*(x2*z2 - y2*w2) dk = 2*(x2*w2 + y2*z2) x2 = a1 + cx2 y2 = bi + cy2 z2 = cj + cz2 w2 = dk + cw2 a1 = x3^2 - y3^2 - z3^2 + w3^2 bi = 2*(x3*y3 - z3*w3) cj = 2*(x3*z3 - y3*w3) dk = 2*(x3*w3 + y3*z3) x3 = a1 + cx3 y3 = bi + cy3 z3 = cj + cz3 w3 = dk + cw3 endif elseif (@var == 1) xa = x1 + cx1 xb = y1 + cy1 xc = z1 + cz1 xd = w1 + cw1 ya = x1 - cx1 yb = y1 - cy1 yc = z1 - cz1 yd = w1 - cw1 x1 = xa*ya - xb*yb - xc*yc + xd*yd y1 = xb*ya + xa*yb - xd*yc - xc*yd z1 = xc*ya - xd*yb + xa*yc - xb*yd w1 = xd*ya + xc*yb + xb*yc + xa*yd if (@slope) xa = x2 + cx2 xb = y2 + cy2 xc = z2 + cz2 xd = w2 + cw2 ya = x2 - cx2 yb = y2 - cy2 yc = z2 - cz2 yd = w2 - cw2 x2 = xa*ya - xb*yb - xc*yc + xd*yd y2 = xb*ya + xa*yb - xd*yc - xc*yd z2 = xc*ya - xd*yb + xa*yc - xb*yd w2 = xd*ya + xc*yb + xb*yc + xa*yd xa = x3 + cx3 xb = y3 + cy3 xc = z3 + cz3 xd = w3 + cw3 ya = x3 - cx3 yb = y3 - cy3 yc = z3 - cz3 yd = w3 - cw3 x3 = xa*ya - xb*yb - xc*yc + xd*yd y3 = xb*ya + xa*yb - xd*yc - xc*yd z3 = xc*ya - xd*yb + xa*yc - xb*yd w3 = xd*ya + xc*yb + xb*yc + xa*yd endif elseif (@var == 2) a1 = x1^3 - 3*x1*(y1^2 + z1^2 - w1^2) + 6*y1*z1*w1 bi= -y1^3 + 3*y1*(x1^2 - z1^2 + w1^2) - 6*x1*z1*w1 cj= -z1^3 + 3*z1*(w1^2 + x1^2 - y1^2) - 6*w1*x1*y1 dk = w1^3 - 3*w1*(z1^2 - x1^2 + y1^2) + 6*z1*x1*y1 x1 = a1 + cx1 y1 = bi + cy1 z1 = cj + cz1 w1 = dk + cw1 if (@slope) a1 = x2^3 - 3*x2*(y2^2 + z2^2 - w2^2) + 6*y2*z2*w2 bi= -y2^3 + 3*y2*(x2^2 - z2^2 + w2^2) - 6*x2*z2*w2 cj= -z2^3 + 3*z2*(w2^2 + x2^2 - y2^2) - 6*w2*x2*y2 dk = w2^3 - 3*w2*(z2^2 - x2^2 + y2^2) + 6*z2*x2*y2 x2 = a1 + cx2 y2 = bi + cy2 z2 = cj + cz2 w2 = dk + cw2 a1 = x3^3 - 3*x3*(y3^2 + z3^2 - w3^2) + 6*y3*z3*w3 bi= -y3^3 + 3*y3*(x3^2 - z3^2 + w3^2) - 6*x3*z3*w3 cj= -z3^3 + 3*z3*(w3^2 + x3^2 - y3^2) - 6*w3*x3*y3 dk = w3^3 - 3*w3*(z3^2 - x3^2 + y3^2) + 6*z3*x3*y3 x3 = a1 + cx3 y3 = bi + cy3 z3 = cj + cz3 w3 = dk + cw3 endif elseif (@var == 3) a = x1 - w1 + flip(y1 + z1) b = x1 + w1 + flip(y1 - z1) c = @fn1(a)^@power d = @fn1(b)^@power x1 = (real(c) + real(d)) / 2 + cx1 y1 = (imag(c) + imag(d)) / 2 + cy1 z1 = (imag(c) - imag(d)) / 2 + cz1 w1 = (real(d) - real(c)) / 2 + cw1 if (@slope) a = x2 - w2 + flip(y2 + z2) b = x2 + w2 + flip(y2 - z2) c = @fn1(a)^@power d = @fn1(b)^@power x2 = (real(c) + real(d)) / 2 + cx2 y2 = (imag(c) + imag(d)) / 2 + cy2 z2 = (imag(c) - imag(d)) / 2 + cz2 w2 = (real(d) - real(c)) / 2 + cw2 a = x3 - w3 + flip(y3 + z3) b = x3 + w3 + flip(y3 - z3) c = @fn1(a)^@power d = @fn1(b)^@power x3 = (real(c) + real(d)) / 2 + cx3 y3 = (imag(c) + imag(d)) / 2 + cy3 z3 = (imag(c) - imag(d)) / 2 + cz3 w3 = (real(d) - real(c)) / 2 + cw3 endif endif endif zri1 = x1 + flip(y1) zjk1 = z1 + flip(w1) if (@slope == true) zri2 = x2 + flip(y2) zjk2 = z2 + flip(w2) zri3 = x3 + flip(y3) zjk3 = z3 + flip(w3) if (@version < 1.14) IF (@zmode == 5) iterexp1 = iterexp1 + exp(-cabs(zri1+zjk1)) iterexp2 = iterexp2 + exp(-cabs(zri2+zjk2)) iterexp3 = iterexp3 + exp(-cabs(zri3+zjk3)) ENDIF done = done + 1; increment iteration counter IF (@zmode == 0) ; smallest |z| d1 = |zri1|+|zjk1|; get current distances from origin d2 = |zri2|+|zjk2| d3 = |zri3|+|zjk3| IF (d1 < s1); update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 1) ; smallest |real(z)| d1 = abs(real(zri1+zjk1)); get current distances from i axis d2 = abs(real(zri2+zjk2)) d3 = abs(real(zri3+zjk3)) 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 |imag(z)| d1 = abs(imag(zri1+zjk1)); get current distances from r axis d2 = abs(imag(zri2+zjk2)) d3 = abs(imag(zri3+zjk3)) 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 |real(z)|+|imag(z)| d1 = abs(real(zri1+zjk1))+abs(imag(zri1+zjk1)); get current distances from i axis d2 = abs(real(zri2+zjk2))+abs(imag(zri2+zjk2)) d3 = abs(real(zri3+zjk3))+abs(imag(zri3+zjk3)) 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 |atan(z)| d1 = abs(atan2(zri1+zjk1)); get current angles d2 = abs(atan2(zri2+zjk2)) d3 = abs(atan2(zri3+zjk3)) IF (d1 < s1); update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ENDIF else IF (@zmode == 5) iterexp1 = iterexp1 + exp(-cabs(zri1)) iterexp2 = iterexp2 + exp(-cabs(zri2)) iterexp3 = iterexp3 + exp(-cabs(zri3)) ENDIF done = done + 1; increment iteration counter IF (@zmode == 0) ; smallest |z| d1 = |zri1|; get current distances from origin d2 = |zri2| d3 = |zri3| IF (d1 < s1); update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 1) ; smallest |real(z)| d1 = abs(real(zri1)); get current distances from i axis d2 = abs(real(zri2)) d3 = abs(real(zri3)) 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 |imag(z)| d1 = abs(imag(zri1)); get current distances from r axis d2 = abs(imag(zri2)) d3 = abs(imag(zri3)) 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 |real(z)|+|imag(z)| d1 = abs(real(zri1))+abs(imag(zri1)); get current distances from i axis d2 = abs(real(zri2))+abs(imag(zri2)) d3 = abs(real(zri3))+abs(imag(zri3)) 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 |atan(z)| d1 = abs(atan2(zri1)); get current angles d2 = abs(atan2(zri2)) d3 = abs(atan2(zri3)) IF (d1 < s1); update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ENDIF endif IF (@bailout < |zri1| + |zjk1| || \ @everyiter ||\ done == #maxit + 2); done, or every iteration, or last ; determine continuous iteration (height) for each point IF (@zmode >= 0 && @zmode <= 4) ; height based on smallest |z| e1 = s1 * @zscale e2 = s2 * @zscale e3 = s3 * @zscale ELSEIF (@zmode == 5) e1 = iterexp1 * @zscale e2 = iterexp2 * @zscale e3 = iterexp3 * @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 vx = e2 - e1 vy = e3 - e1 vz = -@offset ; normalize vector vd = 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 = zri1; use primary iteration value to keep periodicity working ENDIF else z = zri1 endif IF (@bailout < |zri1| + |zjk1|) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope 4-D Julia" maxiter = 149 param version caption = "Version" default = 1.18 visible = false endparam heading caption = "Slope 4-D Julia" endheading heading caption = "Use Damien's Lighting Coloring" endheading heading caption = "Or Ron's 3D Texturizer Formulas" endheading heading caption = "Most other coloring formulas" endheading heading caption = "can also be used." endheading param var caption = "Variation" enum = "First""Second""Third""Fourth" default = 0 endparam param fourthdim caption = "Fourth Dimension" enum = "z1" "zi" "zj" "zk" default = 3 endparam param c1i caption = "(c1, ci)" default = (-0.8, 0.1) endparam param cjk caption = "(cj, ck)" default = (0.0, 0.0) endparam param zjk caption = "(zj, zk)" default = (0.0, 0.0) endparam param rotx caption = "X Rotation" hint = "Rotates yz-plane." default = 0.0 min = -360.0 max = 360.0 endparam param roty caption = "Y Rotation" hint = "Rotates zx-plane." default = 0.0 min = -360.0 max = 360.0 endparam param rotz caption = "Z Rotation" hint = "Rotates xy-plane." default = 0.0 min = -360.0 max = 360.0 endparam param power caption = "Power" default = (4.0, 0.0) visible = @var == 3 endparam param bailout caption = "Bailout Value" default = 64.0 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam func fn1 caption = "Function" default = ident() visible = @var == 3 endfunc param dim3 caption = "3 Dimensional" default = false endparam param dist caption = "Z Distance" default = 4.0 visible = @dim3 == true endparam param cs caption = "Color Scaling" default = 1.0 visible = @dim3 == true && @version < 1.17 endparam param stepnum caption = "Number Of Slices" default = 400 visible = @dim3 == true endparam bool param slope caption = "Slope" default = true endparam heading caption = "Slope Parameters" visible = @slope == true endheading param offset caption = "Orbit Separation" default = 0.00000001 hint = "Defines how far apart the simultaneous orbits are. Smaller \ distances will produce more accurate results." visible = @slope == true endparam param zmode caption = "Height Value" default = 5 enum = "smallest |z|" "smallest |real(z)|" \ "smallest |imag(z)|" "smallest summ(z)" "smallest |atan(z)|" \ "smoothed iteration" hint = "Specifies what will be used to construct a height value." visible = @slope == true 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." visible = @slope == true 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." visible = @slope == true 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." visible = @slope == true 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." visible = @slope == true endparam switch: type = "gnd-Slope_4D-Mandelbrot" version = @version cjk = @cjk var = @var fourthdim = @fourthdim rotx = @rotx roty = @roty rotz = @rotz power = @power bailout = @bailout fn1 = @fn1 dim3 = @dim3 dist = @dist cs = @cs stepnum = @stepnum slope = @slope offset = @offset zmode = @zmode xfer = @xfer zscale = @zscale zscale2 = @zscale2 everyiter = @everyiter } gnd-Slope_4D-Mandelbrot { ; based upon the slope (Mandelbrot) ; formula of Damien Jones ; Hypercomplex Mandel formula ; compound with the models of slope formulas from Ron Barnett. ; 3d option added October, 2007 ; based on the Quaternion formula by Stig Pettersson. ; version 1.18, November 2007 ; Gilles Nadeau, 11/11/2007 ; init: complex cri1 = #pixel complex cri2 = #pixel + @offset; horizontally offset point complex cri3 = #pixel + flip(@offset); vertically offset point complex cjk1 = @cjk complex cjk2 = @cjk complex cjk3 = @cjk complex zri1 = (0.0, 0.0) complex zri2 = (0.0, 0.0) complex zri3 = (0.0, 0.0) complex zjk1 = (0.0, 0.0) complex zjk2 = (0.0, 0.0) complex zjk3 = (0.0, 0.0) complex zh = (0.0, 0.0) complex a = (0.0, 0.0) complex b = (0.0, 0.0) complex c = (0.0, 0.0) complex d = (0.0, 0.0) float x1 = 0.0 float y1 = 0.0 float z1 = 0.0 float w1 = 0.0 float x2 = 0.0 float y2 = 0.0 float z2 = 0.0 float w2 = 0.0 float x3 = 0.0 float y3 = 0.0 float z3 = 0.0 float w3 = 0.0 float cx1 = 0.0 float cy1 = 0.0 float cz1 = 0.0 float cw1 = 0.0 float cx2 = 0.0 float cy2 = 0.0 float cz2 = 0.0 float cw2 = 0.0 float cx3 = 0.0 float cy3 = 0.0 float cz3 = 0.0 float cw3 = 0.0 float a1 = 0.0 float bi = 0.0 float cj = 0.0 float dk = 0.0 float xa = 0.0 float xb = 0.0 float xc = 0.0 float xd = 0.0 float ya = 0.0 float yb = 0.0 float yc = 0.0 float yd = 0.0 float rx = 0.0 float ry = 0.0 float rz = 0.0 if (@version < 1.17) float cs = @cs else cs = 1.0 endif int done = 2 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 iterexp1 = 0.0 float iterexp2 = 0.0 float iterexp3 = 0.0 bool set0 = false bool set1 = false if (@dim3 == false) ; (yz plane rotation) ry = imag(cri1)*cos(#pi*@rotx/180) - real(cjk1)*sin(#pi*@rotx/180) rz = imag(cri1)*sin(#pi*@rotx/180) + real(cjk1)*cos(#pi*@rotx/180) cri1 = real(cri1) + ry*1i cjk1 = rz + imag(cjk1)*1i ; (xz plane rotation) rx = real(cjk1)*sin(#pi*@roty/180) + real(cri1)*cos(#pi*@roty/180) rz = real(cjk1)*cos(#pi*@roty/180) - real(cri1)*sin(#pi*@roty/180) cri1 = rx + imag(cri1)*1i cjk1 = rz + imag(cjk1)*1i ; (xy plane rotation) rx = real(cri1)*cos(#pi*@rotz/180) - imag(cri1)*sin(#pi*@rotz/180) ry = real(cri1)*sin(#pi*@rotz/180) + imag(cri1)*cos(#pi*@rotz/180) cri1 = rx + ry*1i if @fourthdim == 3 cx1 = real(cri1) cy1 = imag(cri1) cz1 = real(cjk1) cw1 = imag(cjk1) elseif @fourthdim == 2 cx1 = real(cri1) cy1 = imag(cri1) cz1 = imag(cjk1) cw1 = real(cjk1) elseif @fourthdim == 1 cx1 = real(cjk1) cy1 = imag(cjk1) cz1 = real(cri1) cw1 = imag(cri1) else cx1 = imag(cjk1) cy1 = real(cjk1) cz1 = real(cri1) cw1 = imag(cri1) endif if (@slope) ; (yz plane rotation) ry = imag(cri2)*cos(#pi*@rotx/180) - real(cjk2)*sin(#pi*@rotx/180) rz = imag(cri2)*sin(#pi*@rotx/180) + real(cjk2)*cos(#pi*@rotx/180) cri2 = real(cri2) + ry*1i cjk2 = rz + imag(cjk2)*1i ry = imag(cri3)*cos(#pi*@rotx/180) - real(cjk3)*sin(#pi*@rotx/180) rz = imag(cri3)*sin(#pi*@rotx/180) + real(cjk3)*cos(#pi*@rotx/180) cri3 = real(cri3) + ry*1i cjk3 = rz + imag(cjk3)*1i ; (xz plane rotation) rx = real(cjk2)*sin(#pi*@roty/180) + real(cri2)*cos(#pi*@roty/180) rz = real(cjk2)*cos(#pi*@roty/180) - real(cri2)*sin(#pi*@roty/180) cri2 = rx + imag(cri2)*1i cjk2 = rz + imag(cjk2)*1i rx = real(cjk3)*sin(#pi*@roty/180) + real(cri3)*cos(#pi*@roty/180) rz = real(cjk3)*cos(#pi*@roty/180) - real(cri3)*sin(#pi*@roty/180) cri3 = rx + imag(cri3)*1i cjk3 = rz + imag(cjk3)*1i ; (xy plane rotation) rx = real(cri2)*cos(#pi*@rotz/180) - imag(cri2)*sin(#pi*@rotz/180) ry = real(cri2)*sin(#pi*@rotz/180) + imag(cri2)*cos(#pi*@rotz/180) cri2 = rx + ry*1i rx = real(cri3)*cos(#pi*@rotz/180) - imag(cri3)*sin(#pi*@rotz/180) ry = real(cri3)*sin(#pi*@rotz/180) + imag(cri3)*cos(#pi*@rotz/180) cri3 = rx + ry*1i if @fourthdim == 3 cx2 = real(cri2) cy2 = imag(cri2) cz2 = real(cjk2) cw2 = imag(cjk2) cx3 = real(cri3) cy3 = imag(cri3) cz3 = real(cjk3) cw3 = imag(cjk3) elseif @fourthdim == 2 cx2 = real(cri2) cy2 = imag(cri2) cz2 = imag(cjk2) cw2 = real(cjk2) cx3 = real(cri3) cy3 = imag(cri3) cz3 = imag(cjk3) cw3 = real(cjk3) elseif @fourthdim == 1 cx2 = real(cjk2) cy2 = imag(cjk2) cz2 = real(cri2) cw2 = imag(cri2) cx3 = real(cjk3) cy3 = imag(cjk3) cz3 = real(cri3) cw3 = imag(cri3) else cx2 = imag(cjk2) cy2 = real(cjk2) cz2 = real(cri2) cw2 = imag(cri2) cx3 = imag(cjk3) cy3 = real(cjk3) cz3 = real(cri3) cw3 = imag(cri3) endif endif else int stepnum = @stepnum float zdist = @dist / 2 cjk1 = real(@cjk) - zdist + flip(imag(@cjk)) cjk2 = cjk1 cjk3 = cjk1 zh = cjk1 cjk1 = zh float delta = (real(@cjk) + zdist - real(cjk1)) / stepnum int n = 0 int i = 0 while (n < stepnum) && (set1 == false) cri1 = #pixel cri2 = #pixel + @offset cri3 = #pixel + flip(@offset) cjk1 = zh = zh + delta cjk2 = cjk1 cjk3 = cjk1 zri1 = (0.0, 0.0) zri2 = (0.0, 0.0) zri3 = (0.0, 0.0) zjk1 = (0.0, 0.0) zjk2 = (0.0, 0.0) zjk3 = (0.0, 0.0) x1 = 0.0 y1 = 0.0 z1 = 0.0 w1 = 0.0 x2 = 0.0 y2 = 0.0 z2 = 0.0 w2 = 0.0 x3 = 0.0 y3 = 0.0 z3 = 0.0 w3 = 0.0 ; (yz plane rotation) ry = imag(cri1)*cos(#pi*@rotx/180) - real(cjk1)*sin(#pi*@rotx/180) rz = imag(cri1)*sin(#pi*@rotx/180) + real(cjk1)*cos(#pi*@rotx/180) cri1 = real(cri1) + ry*1i cjk1 = rz + imag(cjk1)*1i ; (xz plane rotation) rx = real(cjk1)*sin(#pi*@roty/180) + real(cri1)*cos(#pi*@roty/180) rz = real(cjk1)*cos(#pi*@roty/180) - real(cri1)*sin(#pi*@roty/180) cri1 = rx + imag(cri1)*1i cjk1 = rz + imag(cjk1)*1i ; (xy plane rotation) rx = real(cri1)*cos(#pi*@rotz/180) - imag(cri1)*sin(#pi*@rotz/180) ry = real(cri1)*sin(#pi*@rotz/180) + imag(cri1)*cos(#pi*@rotz/180) cri1 = rx + ry*1i if @fourthdim == 3 cx1 = real(cri1) cy1 = imag(cri1) cz1 = real(cjk1) cw1 = imag(cjk1) elseif @fourthdim == 2 cx1 = real(cri1) cy1 = imag(cri1) cz1 = imag(cjk1) cw1 = real(cjk1) elseif @fourthdim == 1 cx1 = real(cjk1) cy1 = imag(cjk1) cz1 = real(cri1) cw1 = imag(cri1) else cx1 = imag(cjk1) cy1 = real(cjk1) cz1 = real(cri1) cw1 = imag(cri1) endif if (@slope) ; (yz plane rotation) ry = imag(cri2)*cos(#pi*@rotx/180) - real(cjk2)*sin(#pi*@rotx/180) rz = imag(cri2)*sin(#pi*@rotx/180) + real(cjk2)*cos(#pi*@rotx/180) cri2 = real(cri2) + ry*1i cjk2 = rz + imag(cjk2)*1i ry = imag(cri3)*cos(#pi*@rotx/180) - real(cjk3)*sin(#pi*@rotx/180) rz = imag(cri3)*sin(#pi*@rotx/180) + real(cjk3)*cos(#pi*@rotx/180) cri3 = real(cri3) + ry*1i cjk3 = rz + imag(cjk3)*1i ; (xz plane rotation) rx = real(cjk2)*sin(#pi*@roty/180) + real(cri2)*cos(#pi*@roty/180) rz = real(cjk2)*cos(#pi*@roty/180) - real(cri2)*sin(#pi*@roty/180) cri2 = rx + imag(cri2)*1i cjk2 = rz + imag(cjk2)*1i rx = real(cjk3)*sin(#pi*@roty/180) + real(cri3)*cos(#pi*@roty/180) rz = real(cjk3)*cos(#pi*@roty/180) - real(cri3)*sin(#pi*@roty/180) cri3 = rx + imag(cri3)*1i cjk3 = rz + imag(cjk3)*1i ; (xy plane rotation) rx = real(cri2)*cos(#pi*@rotz/180) - imag(cri2)*sin(#pi*@rotz/180) ry = real(cri2)*sin(#pi*@rotz/180) + imag(cri2)*cos(#pi*@rotz/180) cri2 = rx + ry*1i rx = real(cri3)*cos(#pi*@rotz/180) - imag(cri3)*sin(#pi*@rotz/180) ry = real(cri3)*sin(#pi*@rotz/180) + imag(cri3)*cos(#pi*@rotz/180) cri3 = rx + ry*1i if @fourthdim == 3 cx2 = real(cri2) cy2 = imag(cri2) cz2 = real(cjk2) cw2 = imag(cjk2) cx3 = real(cri3) cy3 = imag(cri3) cz3 = real(cjk3) cw3 = imag(cjk3) elseif @fourthdim == 2 cx2 = real(cri2) cy2 = imag(cri2) cz2 = imag(cjk2) cw2 = real(cjk2) cx3 = real(cri3) cy3 = imag(cri3) cz3 = imag(cjk3) cw3 = real(cjk3) elseif @fourthdim == 1 cx2 = real(cjk2) cy2 = imag(cjk2) cz2 = real(cri2) cw2 = imag(cri2) cx3 = real(cjk3) cy3 = imag(cjk3) cz3 = real(cri3) cw3 = imag(cri3) else cx2 = imag(cjk2) cy2 = real(cjk2) cz2 = real(cri2) cw2 = imag(cri2) cx3 = imag(cjk3) cy3 = real(cjk3) cz3 = real(cri3) cw3 = imag(cri3) endif endif while (i < #maxiter) && (|zri1| + |zjk1| < @bailout) if (@var == 0) a1 = x1^2 - y1^2 - z1^2 + w1^2 bi = 2*(x1*y1 - z1*w1) cj = 2*(x1*z1 - y1*w1) dk = 2*(x1*w1 + y1*z1) x1 = a1 + cx1 y1 = bi + cy1 z1 = cj + cz1 w1 = dk + cw1 if (@slope) a1 = x2^2 - y2^2 - z2^2 + w2^2 bi = 2*(x2*y2 - z2*w2) cj = 2*(x2*z2 - y2*w2) dk = 2*(x2*w2 + y2*z2) x2 = a1 + cx2 y2 = bi + cy2 z2 = cj + cz2 w2 = dk + cw2 a1 = x3^2 - y3^2 - z3^2 + w3^2 bi = 2*(x3*y3 - z3*w3) cj = 2*(x3*z3 - y3*w3) dk = 2*(x3*w3 + y3*z3) x3 = a1 + cx3 y3 = bi + cy3 z3 = cj + cz3 w3 = dk + cw3 endif elseif (@var == 1) xa = x1 + cx1 xb = y1 + cy1 xc = z1 + cz1 xd = w1 + cw1 ya = x1 - cx1 yb = y1 - cy1 yc = z1 - cz1 yd = w1 - cw1 x1 = xa*ya - xb*yb - xc*yc + xd*yd y1 = xb*ya + xa*yb - xd*yc - xc*yd z1 = xc*ya - xd*yb + xa*yc - xb*yd w1 = xd*ya + xc*yb + xb*yc + xa*yd if (@slope) xa = x2 + cx2 xb = y2 + cy2 xc = z2 + cz2 xd = w2 + cw2 ya = x2 - cx2 yb = y2 - cy2 yc = z2 - cz2 yd = w2 - cw2 x2 = xa*ya - xb*yb - xc*yc + xd*yd y2 = xb*ya + xa*yb - xd*yc - xc*yd z2 = xc*ya - xd*yb + xa*yc - xb*yd w2 = xd*ya + xc*yb + xb*yc + xa*yd xa = x3 + cx3 xb = y3 + cy3 xc = z3 + cz3 xd = w3 + cw3 ya = x3 - cx3 yb = y3 - cy3 yc = z3 - cz3 yd = w3 - cw3 x3 = xa*ya - xb*yb - xc*yc + xd*yd y3 = xb*ya + xa*yb - xd*yc - xc*yd z3 = xc*ya - xd*yb + xa*yc - xb*yd w3 = xd*ya + xc*yb + xb*yc + xa*yd endif elseif (@var == 2) a1 = x1^3 - 3*x1*(y1^2 + z1^2 - w1^2) + 6*y1*z1*w1 bi= -y1^3 + 3*y1*(x1^2 - z1^2 + w1^2) - 6*x1*z1*w1 cj= -z1^3 + 3*z1*(w1^2 + x1^2 - y1^2) - 6*w1*x1*y1 dk = w1^3 - 3*w1*(z1^2 - x1^2 + y1^2) + 6*z1*x1*y1 x1 = a1 + cx1 y1 = bi + cy1 z1 = cj + cz1 w1 = dk + cw1 if (@slope) a1 = x2^3 - 3*x2*(y2^2 + z2^2 - w2^2) + 6*y2*z2*w2 bi= -y2^3 + 3*y2*(x2^2 - z2^2 + w2^2) - 6*x2*z2*w2 cj= -z2^3 + 3*z2*(w2^2 + x2^2 - y2^2) - 6*w2*x2*y2 dk = w2^3 - 3*w2*(z2^2 - x2^2 + y2^2) + 6*z2*x2*y2 x2 = a1 + cx2 y2 = bi + cy2 z2 = cj + cz2 w2 = dk + cw2 a1 = x3^3 - 3*x3*(y3^2 + z3^2 - w3^2) + 6*y3*z3*w3 bi= -y3^3 + 3*y3*(x3^2 - z3^2 + w3^2) - 6*x3*z3*w3 cj= -z3^3 + 3*z3*(w3^2 + x3^2 - y3^2) - 6*w3*x3*y3 dk = w3^3 - 3*w3*(z3^2 - x3^2 + y3^2) + 6*z3*x3*y3 x3 = a1 + cx3 y3 = bi + cy3 z3 = cj + cz3 w3 = dk + cw3 endif elseif (@var == 3) a = x1 - w1 + flip(y1 + z1) b = x1 + w1 + flip(y1 - z1) c = @fn1(a)^@power d = @fn1(b)^@power x1 = (real(c) + real(d)) / 2 + cx1 y1 = (imag(c) + imag(d)) / 2 + cy1 z1 = (imag(c) - imag(d)) / 2 + cz1 w1 = (real(d) - real(c)) / 2 + cw1 if (@slope) a = x2 - w2 + flip(y2 + z2) b = x2 + w2 + flip(y2 - z2) c = @fn1(a)^@power d = @fn1(b)^@power x2 = (real(c) + real(d)) / 2 + cx2 y2 = (imag(c) + imag(d)) / 2 + cy2 z2 = (imag(c) - imag(d)) / 2 + cz2 w2 = (real(d) - real(c)) / 2 + cw2 a = x3 - w3 + flip(y3 + z3) b = x3 + w3 + flip(y3 - z3) c = @fn1(a)^@power d = @fn1(b)^@power x3 = (real(c) + real(d)) / 2 + cx3 y3 = (imag(c) + imag(d)) / 2 + cy3 z3 = (imag(c) - imag(d)) / 2 + cz3 w3 = (real(d) - real(c)) / 2 + cw3 endif endif zri1 = x1 + flip(y1) zjk1 = z1 + flip(w1) if (@slope == true) zri2 = x2 + flip(y2) zjk2 = z2 + flip(w2) zri3 = x3 + flip(y3) zjk3 = z3 + flip(w3) endif i = i + 1 endwhile i = 0 n = n + 1 if (|zri1| + |zjk1| < @bailout) set1 = true endif endwhile if (set1 == true) cri1 = #pixel cri2 = #pixel + @offset cri3 = #pixel + flip(@offset) cjk1 = zh = zh - delta*cs cjk2 = cjk1 cjk3 = cjk1 zri1 = (0.0, 0.0) zri2 = (0.0, 0.0) zri3 = (0.0, 0.0) zjk1 = (0.0, 0.0) zjk2 = (0.0, 0.0) zjk3 = (0.0, 0.0) x1 = 0.0 y1 = 0.0 z1 = 0.0 w1 = 0.0 x2 = 0.0 y2 = 0.0 z2 = 0.0 w2 = 0.0 x3 = 0.0 y3 = 0.0 z3 = 0.0 w3 = 0.0 endif if (set1 == false) && (@dim3 == true) set0 = true endif cri1 = #pixel cri2 = #pixel + @offset cri3 = #pixel + flip(@offset) cjk1 = zh = zh cjk2 = cjk1 cjk3 = cjk1 zri1 = (0.0, 0.0) zri2 = (0.0, 0.0) zri3 = (0.0, 0.0) zjk1 = (0.0, 0.0) zjk2 = (0.0, 0.0) zjk3 = (0.0, 0.0) x1 = 0.0 y1 = 0.0 z1 = 0.0 w1 = 0.0 x2 = 0.0 y2 = 0.0 z2 = 0.0 w2 = 0.0 x3 = 0.0 y3 = 0.0 z3 = 0.0 w3 = 0.0 ; (yz plane rotation) ry = imag(cri1)*cos(#pi*@rotx/180) - real(cjk1)*sin(#pi*@rotx/180) rz = imag(cri1)*sin(#pi*@rotx/180) + real(cjk1)*cos(#pi*@rotx/180) cri1 = real(cri1) + ry*1i cjk1 = rz + imag(cjk1)*1i ; (xz plane rotation) rx = real(cjk1)*sin(#pi*@roty/180) + real(cri1)*cos(#pi*@roty/180) rz = real(cjk1)*cos(#pi*@roty/180) - real(cri1)*sin(#pi*@roty/180) cri1 = rx + imag(cri1)*1i cjk1 = rz + imag(cjk1)*1i ; (xy plane rotation) rx = real(cri1)*cos(#pi*@rotz/180) - imag(cri1)*sin(#pi*@rotz/180) ry = real(cri1)*sin(#pi*@rotz/180) + imag(cri1)*cos(#pi*@rotz/180) cri1 = rx + ry*1i if @fourthdim == 3 cx1 = real(cri1) cy1 = imag(cri1) cz1 = real(cjk1) cw1 = imag(cjk1) elseif @fourthdim == 2 cx1 = real(cri1) cy1 = imag(cri1) cz1 = imag(cjk1) cw1 = real(cjk1) elseif @fourthdim == 1 cx1 = real(cjk1) cy1 = imag(cjk1) cz1 = real(cri1) cw1 = imag(cri1) else cx1 = imag(cjk1) cy1 = real(cjk1) cz1 = real(cri1) cw1 = imag(cri1) endif if (@slope) ; (yz plane rotation) ry = imag(cri2)*cos(#pi*@rotx/180) - real(cjk2)*sin(#pi*@rotx/180) rz = imag(cri2)*sin(#pi*@rotx/180) + real(cjk2)*cos(#pi*@rotx/180) cri2 = real(cri2) + ry*1i cjk2 = rz + imag(cjk2)*1i ry = imag(cri3)*cos(#pi*@rotx/180) - real(cjk3)*sin(#pi*@rotx/180) rz = imag(cri3)*sin(#pi*@rotx/180) + real(cjk3)*cos(#pi*@rotx/180) cri3 = real(cri3) + ry*1i cjk3 = rz + imag(cjk3)*1i ; (xz plane rotation) rx = real(cjk2)*sin(#pi*@roty/180) + real(cri2)*cos(#pi*@roty/180) rz = real(cjk2)*cos(#pi*@roty/180) - real(cri2)*sin(#pi*@roty/180) cri2 = rx + imag(cri2)*1i cjk2 = rz + imag(cjk2)*1i rx = real(cjk3)*sin(#pi*@roty/180) + real(cri3)*cos(#pi*@roty/180) rz = real(cjk3)*cos(#pi*@roty/180) - real(cri3)*sin(#pi*@roty/180) cri3 = rx + imag(cri3)*1i cjk3 = rz + imag(cjk3)*1i ; (xy plane rotation) rx = real(cri2)*cos(#pi*@rotz/180) - imag(cri2)*sin(#pi*@rotz/180) ry = real(cri2)*sin(#pi*@rotz/180) + imag(cri2)*cos(#pi*@rotz/180) cri2 = rx + ry*1i rx = real(cri3)*cos(#pi*@rotz/180) - imag(cri3)*sin(#pi*@rotz/180) ry = real(cri3)*sin(#pi*@rotz/180) + imag(cri3)*cos(#pi*@rotz/180) cri3 = rx + ry*1i if @fourthdim == 3 cx2 = real(cri2) cy2 = imag(cri2) cz2 = real(cjk2) cw2 = imag(cjk2) cx3 = real(cri3) cy3 = imag(cri3) cz3 = real(cjk3) cw3 = imag(cjk3) elseif @fourthdim == 2 cx2 = real(cri2) cy2 = imag(cri2) cz2 = imag(cjk2) cw2 = real(cjk2) cx3 = real(cri3) cy3 = imag(cri3) cz3 = imag(cjk3) cw3 = real(cjk3) elseif @fourthdim == 1 cx2 = real(cjk2) cy2 = imag(cjk2) cz2 = real(cri2) cw2 = imag(cri2) cx3 = real(cjk3) cy3 = imag(cjk3) cz3 = real(cri3) cw3 = imag(cri3) else cx2 = imag(cjk2) cy2 = real(cjk2) cz2 = real(cri2) cw2 = imag(cri2) cx3 = imag(cjk3) cy3 = real(cjk3) cz3 = real(cri3) cw3 = imag(cri3) endif endif endif loop: if (set0 == false) if (@var == 0) a1 = x1^2 - y1^2 - z1^2 + w1^2 bi = 2*(x1*y1 - z1*w1) cj = 2*(x1*z1 - y1*w1) dk = 2*(x1*w1 + y1*z1) x1 = a1 + cx1 y1 = bi + cy1 z1 = cj + cz1 w1 = dk + cw1 if (@slope) a1 = x2^2 - y2^2 - z2^2 + w2^2 bi = 2*(x2*y2 - z2*w2) cj = 2*(x2*z2 - y2*w2) dk = 2*(x2*w2 + y2*z2) x2 = a1 + cx2 y2 = bi + cy2 z2 = cj + cz2 w2 = dk + cw2 a1 = x3^2 - y3^2 - z3^2 + w3^2 bi = 2*(x3*y3 - z3*w3) cj = 2*(x3*z3 - y3*w3) dk = 2*(x3*w3 + y3*z3) x3 = a1 + cx3 y3 = bi + cy3 z3 = cj + cz3 w3 = dk + cw3 endif elseif (@var == 1) xa = x1 + cx1 xb = y1 + cy1 xc = z1 + cz1 xd = w1 + cw1 ya = x1 - cx1 yb = y1 - cy1 yc = z1 - cz1 yd = w1 - cw1 x1 = xa*ya - xb*yb - xc*yc + xd*yd y1 = xb*ya + xa*yb - xd*yc - xc*yd z1 = xc*ya - xd*yb + xa*yc - xb*yd w1 = xd*ya + xc*yb + xb*yc + xa*yd if (@slope) xa = x2 + cx2 xb = y2 + cy2 xc = z2 + cz2 xd = w2 + cw2 ya = x2 - cx2 yb = y2 - cy2 yc = z2 - cz2 yd = w2 - cw2 x2 = xa*ya - xb*yb - xc*yc + xd*yd y2 = xb*ya + xa*yb - xd*yc - xc*yd z2 = xc*ya - xd*yb + xa*yc - xb*yd w2 = xd*ya + xc*yb + xb*yc + xa*yd xa = x3 + cx3 xb = y3 + cy3 xc = z3 + cz3 xd = w3 + cw3 ya = x3 - cx3 yb = y3 - cy3 yc = z3 - cz3 yd = w3 - cw3 x3 = xa*ya - xb*yb - xc*yc + xd*yd y3 = xb*ya + xa*yb - xd*yc - xc*yd z3 = xc*ya - xd*yb + xa*yc - xb*yd w3 = xd*ya + xc*yb + xb*yc + xa*yd endif elseif (@var == 2) a1 = x1^3 - 3*x1*(y1^2 + z1^2 - w1^2) + 6*y1*z1*w1 bi= -y1^3 + 3*y1*(x1^2 - z1^2 + w1^2) - 6*x1*z1*w1 cj= -z1^3 + 3*z1*(w1^2 + x1^2 - y1^2) - 6*w1*x1*y1 dk = w1^3 - 3*w1*(z1^2 - x1^2 + y1^2) + 6*z1*x1*y1 x1 = a1 + cx1 y1 = bi + cy1 z1 = cj + cz1 w1 = dk + cw1 if (@slope) a1 = x2^3 - 3*x2*(y2^2 + z2^2 - w2^2) + 6*y2*z2*w2 bi= -y2^3 + 3*y2*(x2^2 - z2^2 + w2^2) - 6*x2*z2*w2 cj= -z2^3 + 3*z2*(w2^2 + x2^2 - y2^2) - 6*w2*x2*y2 dk = w2^3 - 3*w2*(z2^2 - x2^2 + y2^2) + 6*z2*x2*y2 x2 = a1 + cx2 y2 = bi + cy2 z2 = cj + cz2 w2 = dk + cw2 a1 = x3^3 - 3*x3*(y3^2 + z3^2 - w3^2) + 6*y3*z3*w3 bi= -y3^3 + 3*y3*(x3^2 - z3^2 + w3^2) - 6*x3*z3*w3 cj= -z3^3 + 3*z3*(w3^2 + x3^2 - y3^2) - 6*w3*x3*y3 dk = w3^3 - 3*w3*(z3^2 - x3^2 + y3^2) + 6*z3*x3*y3 x3 = a1 + cx3 y3 = bi + cy3 z3 = cj + cz3 w3 = dk + cw3 endif elseif (@var == 3) a = x1 - w1 + flip(y1 + z1) b = x1 + w1 + flip(y1 - z1) c = @fn1(a)^@power d = @fn1(b)^@power x1 = (real(c) + real(d)) / 2 + cx1 y1 = (imag(c) + imag(d)) / 2 + cy1 z1 = (imag(c) - imag(d)) / 2 + cz1 w1 = (real(d) - real(c)) / 2 + cw1 if (@slope) a = x2 - w2 + flip(y2 + z2) b = x2 + w2 + flip(y2 - z2) c = @fn1(a)^@power d = @fn1(b)^@power x2 = (real(c) + real(d)) / 2 + cx2 y2 = (imag(c) + imag(d)) / 2 + cy2 z2 = (imag(c) - imag(d)) / 2 + cz2 w2 = (real(d) - real(c)) / 2 + cw2 a = x3 - w3 + flip(y3 + z3) b = x3 + w3 + flip(y3 - z3) c = @fn1(a)^@power d = @fn1(b)^@power x3 = (real(c) + real(d)) / 2 + cx3 y3 = (imag(c) + imag(d)) / 2 + cy3 z3 = (imag(c) - imag(d)) / 2 + cz3 w3 = (real(d) - real(c)) / 2 + cw3 endif endif endif zri1 = x1 + flip(y1) zjk1 = z1 + flip(w1) if (@slope == true) zri2 = x2 + flip(y2) zjk2 = z2 + flip(w2) zri3 = x3 + flip(y3) zjk3 = z3 + flip(w3) if (@version < 1.14) IF (@zmode == 5) iterexp1 = iterexp1 + exp(-cabs(zri1+zjk1)) iterexp2 = iterexp2 + exp(-cabs(zri2+zjk2)) iterexp3 = iterexp3 + exp(-cabs(zri3+zjk3)) ENDIF done = done + 1; increment iteration counter IF (@zmode == 0) ; smallest |z| d1 = |zri1|+|zjk1|; get current distances from origin d2 = |zri2|+|zjk2| d3 = |zri3|+|zjk3| IF (d1 < s1); update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 1) ; smallest |real(z)| d1 = abs(real(zri1+zjk1)); get current distances from i axis d2 = abs(real(zri2+zjk2)) d3 = abs(real(zri3+zjk3)) 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 |imag(z)| d1 = abs(imag(zri1+zjk1)); get current distances from r axis d2 = abs(imag(zri2+zjk2)) d3 = abs(imag(zri3+zjk3)) 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 |real(z)|+|imag(z)| d1 = abs(real(zri1+zjk1))+abs(imag(zri1+zjk1)); get current distances from i axis d2 = abs(real(zri2+zjk2))+abs(imag(zri2+zjk2)) d3 = abs(real(zri3+zjk3))+abs(imag(zri3+zjk3)) 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 |atan(z)| d1 = abs(atan2(zri1+zjk1)); get current angles d2 = abs(atan2(zri2+zjk2)) d3 = abs(atan2(zri3+zjk3)) IF (d1 < s1); update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ENDIF else IF (@zmode == 5) iterexp1 = iterexp1 + exp(-cabs(zri1)) iterexp2 = iterexp2 + exp(-cabs(zri2)) iterexp3 = iterexp3 + exp(-cabs(zri3)) ENDIF done = done + 1; increment iteration counter IF (@zmode == 0) ; smallest |z| d1 = |zri1|; get current distances from origin d2 = |zri2| d3 = |zri3| IF (d1 < s1); update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ELSEIF (@zmode == 1) ; smallest |real(z)| d1 = abs(real(zri1)); get current distances from i axis d2 = abs(real(zri2)) d3 = abs(real(zri3)) 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 |imag(z)| d1 = abs(imag(zri1)); get current distances from r axis d2 = abs(imag(zri2)) d3 = abs(imag(zri3)) 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 |real(z)|+|imag(z)| d1 = abs(real(zri1))+abs(imag(zri1)); get current distances from i axis d2 = abs(real(zri2))+abs(imag(zri2)) d3 = abs(real(zri3))+abs(imag(zri3)) 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 |atan(z)| d1 = abs(atan2(zri1)); get current angles d2 = abs(atan2(zri2)) d3 = abs(atan2(zri3)) IF (d1 < s1); update smallest distances s1 = d1 ENDIF IF (d2 < s2) s2 = d2 ENDIF IF (d3 < s3) s3 = d3 ENDIF ENDIF endif IF (@bailout < |zri1| + |zjk1| || \ @everyiter ||\ done == #maxit + 2); done, or every iteration, or last ; determine continuous iteration (height) for each point IF (@zmode >= 0 && @zmode <= 4) ; height based on smallest |z| e1 = s1 * @zscale e2 = s2 * @zscale e3 = s3 * @zscale ELSEIF (@zmode == 5) e1 = iterexp1 * @zscale e2 = iterexp2 * @zscale e3 = iterexp3 * @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 vx = e2 - e1 vy = e3 - e1 vz = -@offset ; normalize vector vd = 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 = zri1; use primary iteration value to keep periodicity working ENDIF else z = zri1 endif IF (@bailout < |zri1| + |zjk1|) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope 4-D Mandelbrot" maxiter = 149 param version caption = "Version" default = 1.18 visible = false endparam heading caption = "Slope 4-D Mandelbrot" endheading heading caption = "Use Damien's Lighting Coloring" endheading heading caption = "Or Ron's 3D Texturizer Formulas" endheading heading caption = "Most other coloring formulas" endheading heading caption = "can also be used." endheading param var caption = "Variation" enum = "First""Second""Third""Fourth" default = 0 endparam param fourthdim caption = "Fourth Dimension" enum = "c1" "ci" "cj" "ck" default = 3 endparam param cjk caption = "(cj, ck)" default = (0.0, 0.0) endparam param rotx caption = "X Rotation" hint = "Rotates yz-plane." default = 0.0 min = -360.0 max = 360.0 endparam param roty caption = "Y Rotation" hint = "Rotates zx-plane." default = 0.0 min = -360.0 max = 360.0 endparam param rotz caption = "Z Rotation" hint = "Rotates xy-plane." default = 0.0 min = -360.0 max = 360.0 endparam param power caption = "Power" default = (4.0, 0.0) visible = @var == 3 endparam param bailout caption = "Bailout Value" default = 64.0 min = 0.0 hint = "Defines how soon an orbit bails out, i.e. doesn't \ belong to the set anymore." endparam func fn1 caption = "Function" default = ident() visible = @var == 3 endfunc param dim3 caption = "3 Dimensional" default = false endparam param dist caption = "Z Distance" default = 4.0 visible = @dim3 == true endparam param cs caption = "Color Scaling" default = 1.0 visible = @dim3 == true && @version < 1.17 endparam param stepnum caption = "Number Of Slices" default = 400 visible = @dim3 == true endparam bool param slope caption = "Slope" default = true endparam heading caption = "Slope Parameters" visible = @slope == true endheading param offset caption = "Orbit Separation" default = 0.00000001 hint = "Defines how far apart the simultaneous orbits are. Smaller \ distances will produce more accurate results." visible = @slope == true endparam param zmode caption = "Height Value" default = 5 enum = "smallest |z|" "smallest |real(z)|" \ "smallest |imag(z)|" "smallest summ(z)" "smallest |atan(z)|" \ "smoothed iteration" hint = "Specifies what will be used to construct a height value." visible = @slope == true 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." visible = @slope == true 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." visible = @slope == true 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." visible = @slope == true 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." visible = @slope == true endparam switch: type = "gnd-Slope_4D-Julia" version = @version c1i = #pixel cjk = @cjk var = @var fourthdim = @fourthdim rotx = @rotx roty = @roty rotz = @rotz power = @power bailout = @bailout fn1 = @fn1 dim3 = @dim3 dist = @dist cs = @cs stepnum = @stepnum slope = @slope offset = @offset zmode = @zmode xfer = @xfer zscale = @zscale zscale2 = @zscale2 everyiter = @everyiter } gnd-slope-chaotic-pixel { ; based upon the slope (Julia) ; formula of Damien Jones ; Slope Chaotic fBm Pixel ; compound with the models of slope formulas from Ron Barnett. ; Fractional Brownian Motion coloring method from Damien M. Jones. ; Inspired by ; Popcorn Plasma from Mark Townsend ; ; version 1.12, August 2005 ; Gilles Nadeau, 31/08/2005 ; global: int maxIter = #maxiter if (@inside == false) maxIter = #maxiter - 1 endif init: complex z1 = #pixel complex z2 = #pixel + @slope_offset; horizontally offset point complex z3 = #pixel + flip(@slope_offset); vertically offset point complex x = 0.0 complex y = 0.0 complex xx = 0.0 int iter = 0 int done = 2 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 sum1 = 0.0 float sum2 = 0.0 float sum3 = 0.0 complex r = (0,1) ^ (@angle / 90.0) complex r2 = (0,1) ^ (@anglestep / 90.0) complex p = z1 * @scale * r + @offset float sum = 0.0 float freq = 1.0 int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fx = floor(real(p)) float fy = floor(imag(p)) float bx0 = fx % 256 float by0 = fy % 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) - fx float ry0 = imag(p) - fy 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^@power % 65536 + by0)^@power % 65536 float b10 = (bx1^@power % 65536 + by0)^@power % 65536 float b01 = (bx0^@power % 65536 + by1)^@power % 65536 float b11 = (bx1^@power % 65536 + by1)^@power % 65536 ; produce a "random" vector for each corner float g_b00_0 = (b00)^@power*0.25 % 512 - 256 float g_b10_0 = (b10)^@power*0.25 % 512 - 256 float g_b01_0 = (b01)^@power*0.25 % 512 - 256 float g_b11_0 = (b11)^@power*0.25 % 512 - 256 float g_b00_1 = (b00+1)^@power*0.25 % 512 - 256 float g_b10_1 = (b10+1)^@power*0.25 % 512 - 256 float g_b01_1 = (b01+1)^@power*0.25 % 512 - 256 float g_b11_1 = (b11+1)^@power*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 + real(@fn1(a + sy*(b-a)))*freq freq = freq * @step p = p * r2 / @step i = i - 1 ENDWHILE sum = sum + 1 z1 = z1 / @g x = real(z1) y = imag(z1) xx = x if @method == 0 x = x - @h * @gn1(y + @gn2(@cc * sum * y)) y = y - @h * @gn3(xx + @gn4(@cc * sum * xx)) elseif @method == 1 x = x - @dt * @gn1(y + @ca * @gn2(@cb * sum * y)) y = y + @dt * @gn3(xx + @ca * @gn4(@cb * sum * xx)) elseif @method == 2 x = y - @mn1(x) y = @a * sum - xx endif z1 = x + flip(y) if (@slope == true) p = z2 * @scale * r + @offset float sum = 0.0 float freq = 1.0 int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fx = floor(real(p)) float fy = floor(imag(p)) float bx0 = fx % 256 float by0 = fy % 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) - fx float ry0 = imag(p) - fy 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^@power % 65536 + by0)^@power % 65536 float b10 = (bx1^@power % 65536 + by0)^@power % 65536 float b01 = (bx0^@power % 65536 + by1)^@power % 65536 float b11 = (bx1^@power % 65536 + by1)^@power % 65536 ; produce a "random" vector for each corner float g_b00_0 = (b00)^@power*0.25 % 512 - 256 float g_b10_0 = (b10)^@power*0.25 % 512 - 256 float g_b01_0 = (b01)^@power*0.25 % 512 - 256 float g_b11_0 = (b11)^@power*0.25 % 512 - 256 float g_b00_1 = (b00+1)^@power*0.25 % 512 - 256 float g_b10_1 = (b10+1)^@power*0.25 % 512 - 256 float g_b01_1 = (b01+1)^@power*0.25 % 512 - 256 float g_b11_1 = (b11+1)^@power*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 + real(@fn1(a + sy*(b-a)))*freq freq = freq * @step p = p * r2 / @step i = i - 1 ENDWHILE sum = sum + 1 z2 = z2 / @g x = real(z2) y = imag(z2) xx = x if @method == 0 x = x - @h * @gn1(y + @gn2(@cc * sum * y)) y = y - @h * @gn3(xx + @gn4(@cc * sum * xx)) elseif @method == 1 x = x - @dt * @gn1(y + @ca * @gn2(@cb * sum * y)) y = y + @dt * @gn3(xx + @ca * @gn4(@cb * sum * xx)) elseif @method == 2 x = y - @mn1(x) y = @a * sum - xx endif z2 = x + flip(y) p = z3 * @scale * r + @offset float sum = 0.0 float freq = 1.0 int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fx = floor(real(p)) float fy = floor(imag(p)) float bx0 = fx % 256 float by0 = fy % 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) - fx float ry0 = imag(p) - fy 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^@power % 65536 + by0)^@power % 65536 float b10 = (bx1^@power % 65536 + by0)^@power % 65536 float b01 = (bx0^@power % 65536 + by1)^@power % 65536 float b11 = (bx1^@power % 65536 + by1)^@power % 65536 ; produce a "random" vector for each corner float g_b00_0 = (b00)^@power*0.25 % 512 - 256 float g_b10_0 = (b10)^@power*0.25 % 512 - 256 float g_b01_0 = (b01)^@power*0.25 % 512 - 256 float g_b11_0 = (b11)^@power*0.25 % 512 - 256 float g_b00_1 = (b00+1)^@power*0.25 % 512 - 256 float g_b10_1 = (b10+1)^@power*0.25 % 512 - 256 float g_b01_1 = (b01+1)^@power*0.25 % 512 - 256 float g_b11_1 = (b11+1)^@power*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 + real(@fn1(a + sy*(b-a)))*freq freq = freq * @step p = p * r2 / @step i = i - 1 ENDWHILE sum = sum + 1 z3 = z3 / @g x = real(z3) y = imag(z3) xx = x if @method == 0 x = x - @h * @gn1(y + @gn2(@cc * sum * y)) y = y - @h * @gn3(xx + @gn4(@cc * sum * xx)) elseif @method == 1 x = x - @dt * @gn1(y + @ca * @gn2(@cb * sum * y)) y = y + @dt * @gn3(xx + @ca * @gn4(@cb * sum * xx)) elseif @method == 2 x = y - @mn1(x) y = @a * sum - xx endif z3 = x + flip(y) endif loop: iter = iter + 1 if (@slope == true) if @zmode == 0 sum1 = sum1 + exp(-cabs(z1)) sum2 = sum2 + exp(-cabs(z2)) sum3 = sum3 + exp(-cabs(z3)) else sum1 = cabs(z1 - #pixel) sum2 = cabs(z2 - #pixel) sum3 = cabs(z3 - #pixel) endif done = done + 1 ; increment iteration counter IF (maxIter < iter || \ @everyiter ||\ done == maxIter + 2); done, or every iteration, or last ; determine continuous iteration (height) for each point e1 = sum1 * @zscale e2 = sum2 * @zscale e3 = sum3 * @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 vx = e2-e1 vy = e3-e1 vz = -@slope_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 else z = z1 endif IF (iter > maxIter) done = 0 ENDIF bailout: (done > 0) default: title = "Slope Chaotic fBm Pixel" maxiter = 2 center = (0.00037463919,-0.000384736491) periodicity = 0 method = multipass float param version default = 1.12 visible = false endparam bool param inside caption = "Inside ?" default = false endparam param method caption = "fBm Method" enum = "Popcorn" "Dynamic" "Martin" default = 0 endparam param g caption = "Scale" default = 1.0 endparam heading caption = "Popcorn Parameters" visible = @method == 0 endheading param h caption = "Step size" default = (0.5, 0.0) visible = @method == 0 endparam param cc caption = "Constant C" default = (3.14159265358979, 0.0) visible = @method == 0 endparam heading caption = "Dynamic Parameters" visible = @method == 1 endheading param dt caption = "Step size" default = (0.5, 0.0) visible = @method == 1 endparam param ca caption = "Amplitude" default = (1.0, 0.0) visible = @method == 1 endparam param cb caption = "Frequency" default = (3.14159265358979, 0.0) visible = @method == 1 endparam heading caption = "Martin Parameters" visible = @method == 2 endheading param a caption = "A" default = (3.14159265358979, 0.0) visible = @method == 2 endparam func gn1 caption = "First Function" default = cosh() visible = @method == 0 || @method == 1 endfunc func gn2 caption = "Second Function" default = flip() visible = @method == 0 || @method == 1 endfunc func gn3 caption = "Third Function" default = sin() visible = @method == 0 || @method == 1 endfunc func gn4 caption = "Fourth Function" default = sqr() visible = @method == 0 || @method == 1 endfunc func mn1 caption = "First Function" default = sin() visible = @method == 2 endfunc heading caption = "fBm Parameters" endheading param offset caption = "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 = "Scale" default = 1.0 hint = "This is the overall scale of the noise." endparam param angle caption = "Rotation" default = 0.0 hint = "This is the angle, in degrees, of the noise." endparam param step caption = "Scale Step" default = 0.5 hint = "This is the step in scale between noise iterations." endparam param anglestep caption = "Rotation Step" default = 37.0 hint = "This is the angle, in degrees, to rotate between noise \ iterations." endparam param octaves caption = "Octaves" default = 7 min = 1 hint = "This is the number of iterations of the noise formula." endparam param power caption = "Exponent" default = 2.0 hint = "This is the exponent used to scramble numbers." endparam func fn1 caption = "Function" default = ident() endfunc bool param slope caption = "Apply slope?" default = true endparam heading caption = "Slope Parameters" visible = @slope == true endheading param slope_offset caption = "Orbit Separation" default = 0.00000001 hint = "Defines how far apart the simultaneous orbits are. Smaller \ distances will produce more accurate results." visible = @slope==true endparam param zmode caption = "Height Value" default = 0 enum = "smoothed iteration" "pixel distance" visible = @slope==true 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." visible = @slope==true 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." visible = @slope==true endparam param zscale2 caption = "Height Post-Scale" default = 1.0 hint = "Specifies the ratio between height and distance; like \ Height Pre-Scale, except that this value is applied after \ the transfer function." visible = @slope==true 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." visible = @slope==true endparam } gnd-slope-fBmMandelLambdaPwr { ; Slope fBm Lambda Mandelbrot ; Based on the formula Mandel Lambda Power from Ron Barnett ; compound with the models of fBm formulas from Damien M. Jones. ; This is the basic Lambda 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. ; ; version 1.17, September 2005 ; Gilles Nadeau, 06/09/2005 ; init: complex c1 = #pixel; primary iterated point complex c2 = c1 + @slope_offset; horizontally offset point complex c3 = c1 + flip(@slope_offset); vertically offset point complex z1 = @start + (1/(@power+1))^(1/@power) complex z2 = z1 complex z3 = z1 int done = 2 float modz = 0.0 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 iterexp1 = 0.0 float iterexp2 = 0.0 float iterexp3 = 0.0 complex oz1 = z1 complex oz2 = z2 complex oz3 = z3 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 (@fBm) 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 endif IF (@coloronly); only using fBm on coloring z1 = oz1; restore z from un-fBm'ed copy ENDIF z1 = c1*z1*(1-z1^@power); do Mandelbrot iteration IF (@coloronly); only using fBm on coloring oz1 = z1 ENDIF if (@fBm == true) IF (@noiseskip == 0.0 || noise); adding noise this iteration complex pa = z1 * @scale * r + @offset float sum1 = 0.0 float freq = 1.0 complex va = (0,0) int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fx0a = floor(real(pa)) float fy0a = floor(imag(pa)) float bx0a = fx0a % 256 float by0a = fy0a % 256 IF (bx0a < 0) bx0a = bx0a + 256 ENDIF IF (by0a < 0) by0a = by0a + 256 ENDIF float bx1a = (bx0a + 1) % 256 float by1a = (by0a + 1) % 256 float rx0a = real(pa) - fx0a float ry0a = imag(pa) - fy0a float rx1a = rx0a - 1 float ry1a = ry0a - 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 b00a = (bx0a^@npower % 65536 + by0a)^@npower % 65536 float b10a = (bx1a^@npower % 65536 + by0a)^@npower % 65536 float b01a = (bx0a^@npower % 65536 + by1a)^@npower % 65536 float b11a = (bx1a^@npower % 65536 + by1a)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0a = (b00a)^@npower*0.25 % 512 - 256 float g_b10_0a = (b10a)^@npower*0.25 % 512 - 256 float g_b01_0a = (b01a)^@npower*0.25 % 512 - 256 float g_b11_0a = (b11a)^@npower*0.25 % 512 - 256 float g_b00_1a = (b00a+1)^@npower*0.25 % 512 - 256 float g_b10_1a = (b10a+1)^@npower*0.25 % 512 - 256 float g_b01_1a = (b01a+1)^@npower*0.25 % 512 - 256 float g_b11_1a = (b11a+1)^@npower*0.25 % 512 - 256 ; normalize each vector float da = 0.0; da = 1 / sqrt(sqr(g_b00_0a) + sqr(g_b00_1a)) g_b00_0a = g_b00_0a * da g_b00_1a = g_b00_1a * da da = 1 / sqrt(sqr(g_b10_0a) + sqr(g_b10_1a)) g_b10_0a = g_b10_0a * da g_b10_1a = g_b10_1a * da da = 1 / sqrt(sqr(g_b01_0a) + sqr(g_b01_1a)) g_b01_0a = g_b01_0a * da g_b01_1a = g_b01_1a * da da = 1 / sqrt(sqr(g_b11_0a) + sqr(g_b11_1a)) g_b11_0a = g_b11_0a * da g_b11_1a = g_b11_1a * da ; produce colors for each corner float u1a = rx0a * g_b00_0a + ry0a * g_b00_1a float v1a = rx1a * g_b10_0a + ry0a * g_b10_1a float u2a = rx0a * g_b01_0a + ry1a * g_b01_1a float v2a = rx1a * g_b11_0a + ry1a * g_b11_1a ; interpolate between corners using ; bilinear filtering float sxa = sqr(rx0a) * (3 - rx0a*2) float sya = sqr(ry0a) * (3 - ry0a*2) float a1 = u1a + sxa*(v1a-u1a) float b1 = u2a + sxa*(v2a-u2a) sum1 = sum1 + real(@nfn1(a1 + sya*(b1-a1)))*freq freq = freq * @step pa = pa * r2 / @step i = i - 1 ENDWHILE IF (@style == 0); radial distortion va = (z1-c)/cabs(z1-c) * r3; use vector based on angle to distortion center ELSEIF (@style == 1); linear distortion va = r3; just use rotation vector ENDIF z1 = z1 + va * sum1*0.5*@distortion ENDIF endif IF (@coloronly == false); not just using fBm on coloring oz1 = z1; value for bailout is fBm'ed z ENDIF if (@slope == true) IF (@coloronly); only using fBm on coloring z2 = oz2 z3 = oz3 ENDIF z2 = c2*z2*(1-z2^@power) z3 = c3*z3*(1-z3^@power) IF (@coloronly); only using fBm on coloring oz2 = z2 oz3 = z3 ENDIF if (@fBm == true) IF (@noiseskip == 0.0 || noise); adding noise this iteration complex pb = z2 * @scale * r + @offset complex pc = z3 * @scale * r + @offset float sum2 = 0.0 float sum3 = 0.0 float freq = 1.0 complex vb = (0,0) complex vc = (0,0) int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fx0b = floor(real(pb)) float fy0b = floor(imag(pb)) float bx0b = fx0b % 256 float by0b = fy0b % 256 IF (bx0b < 0) bx0b = bx0b + 256 ENDIF IF (by0b < 0) by0b = by0b + 256 ENDIF float bx1b = (bx0b + 1) % 256 float by1b = (by0b + 1) % 256 float rx0b = real(pb) - fx0b float ry0b = imag(pb) - fy0b float rx1b = rx0b - 1 float ry1b = ry0b - 1 float fx0c = floor(real(pc)) float fy0c = floor(imag(pc)) float bx0c = fx0c % 256 float by0c = fy0c % 256 IF (bx0c < 0) bx0c = bx0c + 256 ENDIF IF (by0c < 0) by0c = by0c + 256 ENDIF float bx1c = (bx0c + 1) % 256 float by1c = (by0c + 1) % 256 float rx0c = real(pc) - fx0c float ry0c = imag(pc) - fy0c float rx1c = rx0c - 1 float ry1c = ry0c - 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 b00b = (bx0b^@npower % 65536 + by0b)^@npower % 65536 float b10b = (bx1b^@npower % 65536 + by0b)^@npower % 65536 float b01b = (bx0b^@npower % 65536 + by1b)^@npower % 65536 float b11b = (bx1b^@npower % 65536 + by1b)^@npower % 65536 float b00c = (bx0c^@npower % 65536 + by0c)^@npower % 65536 float b10c = (bx1c^@npower % 65536 + by0c)^@npower % 65536 float b01c = (bx0c^@npower % 65536 + by1c)^@npower % 65536 float b11c = (bx1c^@npower % 65536 + by1c)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0b = (b00b)^@npower*0.25 % 512 - 256 float g_b10_0b = (b10b)^@npower*0.25 % 512 - 256 float g_b01_0b = (b01b)^@npower*0.25 % 512 - 256 float g_b11_0b = (b11b)^@npower*0.25 % 512 - 256 float g_b00_1b = (b00b+1)^@npower*0.25 % 512 - 256 float g_b10_1b = (b10b+1)^@npower*0.25 % 512 - 256 float g_b01_1b = (b01b+1)^@npower*0.25 % 512 - 256 float g_b11_1b = (b11b+1)^@npower*0.25 % 512 - 256 float g_b00_0c = (b00c)^@npower*0.25 % 512 - 256 float g_b10_0c = (b10c)^@npower*0.25 % 512 - 256 float g_b01_0c = (b01c)^@npower*0.25 % 512 - 256 float g_b11_0c = (b11c)^@npower*0.25 % 512 - 256 float g_b00_1c = (b00c+1)^@npower*0.25 % 512 - 256 float g_b10_1c = (b10c+1)^@npower*0.25 % 512 - 256 float g_b01_1c = (b01c+1)^@npower*0.25 % 512 - 256 float g_b11_1c = (b11c+1)^@npower*0.25 % 512 - 256 ; normalize each vector float db = 0.0 float dc = 0.0; db = 1 / sqrt(sqr(g_b00_0b) + sqr(g_b00_1b)) g_b00_0b = g_b00_0b * db g_b00_1b = g_b00_1b * db db = 1 / sqrt(sqr(g_b10_0b) + sqr(g_b10_1b)) g_b10_0b = g_b10_0b * db g_b10_1b = g_b10_1b * db db = 1 / sqrt(sqr(g_b01_0b) + sqr(g_b01_1b)) g_b01_0b = g_b01_0b * db g_b01_1b = g_b01_1b * db db = 1 / sqrt(sqr(g_b11_0b) + sqr(g_b11_1b)) g_b11_0b = g_b11_0b * db g_b11_1b = g_b11_1b * db dc = 1 / sqrt(sqr(g_b00_0c) + sqr(g_b00_1c)) g_b00_0c = g_b00_0c * dc g_b00_1c = g_b00_1c * dc dc = 1 / sqrt(sqr(g_b10_0c) + sqr(g_b10_1c)) g_b10_0c = g_b10_0c * dc g_b10_1c = g_b10_1c * dc dc = 1 / sqrt(sqr(g_b01_0c) + sqr(g_b01_1c)) g_b01_0c = g_b01_0c * dc g_b01_1c = g_b01_1c * dc dc = 1 / sqrt(sqr(g_b11_0c) + sqr(g_b11_1c)) g_b11_0c = g_b11_0c * dc g_b11_1c = g_b11_1c * dc ; produce colors for each corner float u1b = rx0b * g_b00_0b + ry0b * g_b00_1b float v1b = rx1b * g_b10_0b + ry0b * g_b10_1b float u2b = rx0b * g_b01_0b + ry1b * g_b01_1b float v2b = rx1b * g_b11_0b + ry1b * g_b11_1b float u1c = rx0c * g_b00_0c + ry0c * g_b00_1c float v1c = rx1c * g_b10_0c + ry0c * g_b10_1c float u2c = rx0c * g_b01_0c + ry1c * g_b01_1c float v2c = rx1c * g_b11_0c + ry1c * g_b11_1c ; interpolate between corners using ; bilinear filtering float sxb = sqr(rx0b) * (3 - rx0b*2) float syb = sqr(ry0b) * (3 - ry0b*2) float a2 = u1b + sxb*(v1b-u1b) float b2 = u2b + sxb*(v2b-u2b) float sxc = sqr(rx0c) * (3 - rx0c*2) float syc = sqr(ry0c) * (3 - ry0c*2) float a3 = u1c + sxc*(v1c-u1c) float b3 = u2c + sxc*(v2c-u2c) sum2 = sum2 + real(@nfn1(a2 + syb*(b2-a2)))*freq sum3 = sum3 + real(@nfn1(a3 + syc*(b3-a3)))*freq freq = freq * @step pb = pb * r2 / @step pc = pc * r2 / @step i = i - 1 ENDWHILE IF (@style == 0); radial distortion vb = (z2-c)/cabs(z2-c) * r3 vc = (z3-c)/cabs(z3-c) * r3 ELSEIF (@style == 1); linear distortion vb = r3 vc = r3 ENDIF z2 = z2 + vb * sum2*0.5*@distortion z3 = z3 + vc * sum3*0.5*@distortion ENDIF endif IF (@coloronly == false); not just using fBm on coloring oz2 = z2 oz3 = z3 ENDIF endif modz = |oz1| if (@slope == true) iterexp1 = iterexp1 + exp(-cabs(z1)) iterexp2 = iterexp2 + exp(-cabs(z2)) iterexp3 = iterexp3 + exp(-cabs(z3)) done = done + 1 ; increment iteration counter IF (modz > @bailout || \ @everyiter || \ done == #maxit + 2) ; done, or every iteration, or last ; determine continuous iteration (height) for each point e1 = iterexp1 * @zscale e2 = iterexp2 * @zscale e3 = iterexp3 * @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 vx = e2-e1 vy = e3-e1 vz = -@slope_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 else z = z1 endif IF (modz > @bailout) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope Lambda Mandelbrot + fBm" center = (0.0,0) magn = 1.0 maxiter = 149 method = multipass param version caption = "Version" default = 1.17 visible = false endparam 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 = (1,0) hint = "Overall exponent for the equation. (1,0) gives \ the classic Lambda Mandelbrot type." endparam param bailout caption = "Bailout" default = 10000.0 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Lambda Mandelbrot set anymore." endparam bool param fBm caption = "fBm texturing?" default = true endparam heading caption = "fBm Parameters" visible = @fBm == true endheading param distortion caption = "Distortion Strength" default = 1.0 hint = "This is the amount the noise distorts the image." visible = @fBm == true 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." visible = @fBm == true endparam param distangle caption = "Distortion Angle" default = 0.0 hint = "This is the angle to rotate the distortion." visible = @fBm == true 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." visible = @fBm == true 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." visible = @fBm == true 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." visible = @fBm == true endparam param scale caption = "Noise Scale" default = 1.0 hint = "This is the overall scale of the noise." visible = @fBm == true endparam param angle caption = "Noise Rotation" default = 0.0 hint = "This is the angle, in degrees, of the noise." visible = @fBm == true endparam param step caption = "Noise Scale Step" default = 0.5 hint = "This is the step in scale between noise iterations." visible = @fBm == true endparam param anglestep caption = "Noise Rotation Step" default = 37.0 hint = "This is the angle, in degrees, to rotate between noise \ iterations." visible = @fBm == true endparam param octaves caption = "Noise Octaves" default = 7 min = 1 hint = "This is the number of iterations of the noise formula." visible = @fBm == true endparam param npower caption = "Noise Exponent" default = 2.0 hint = "This is the exponent used to scramble numbers." visible = @fBm == true endparam param noisestart caption = "Start Iteration" default = 0.0 hint = "This is the iteration at which to start adding noise." visible = @fBm == true endparam param noiseiter caption = "Noise Iterations" default = 10000.0 hint = "This is the number of iterations to add noise to." visible = @fBm == true endparam param noiseskip caption = "Skip Iterations" default = 0.0 hint = "This is the number of iterations to skip adding noise \ before starting again." visible = @fBm == true endparam func nfn1 caption = "Noise Function" default = ident() visible = @fBm == true endfunc param coloronly caption = "Coloring Only" default = true 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." visible = @fBm == true endparam bool param slope caption = "Apply slope?" default = true endparam heading caption = "Slope Parameters" visible = @slope == true endheading param slope_offset caption = "Orbit Separation" default = 0.00000001 hint = "Defines how far apart the simultaneous orbits are. Smaller \ distances will produce more accurate results." visible = @slope==true 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." visible = @slope==true 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." visible = @slope==true 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." visible = @slope==true 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." visible = @slope==true endparam switch: type = "gnd-slope-fBmLambdaPwr" version = @version seed = #pixel power = @power bailout = @bailout fBm = @fBm 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 slope_offset = @slope_offset slope = @slope xfer = @xfer zscale = @zscale zscale2 = @zscale2 everyiter = @everyiter nfn1 = @nfn1 } gnd-slope-fBmLambdaPwr { ; Slope fBm Lambda ; Based on the formula Lambda Power from Ron Barnett ; compound with the models of fBm formulas from Damien M. Jones. ; This is the basic Lambda 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. ; ; version 1.17, September 2005 ; Gilles Nadeau, 06/09/2005 ; init: complex z1 = #pixel; primary iterated point complex z2 = z1 + @slope_offset; horizontally offset point complex z3 = z1 + flip(@slope_offset); vertically offset point complex c1 = @seed complex c2 = c1 complex c3 = c1 int done = 2 float modz = 0.0 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 iterexp1 = 0.0 float iterexp2 = 0.0 float iterexp3 = 0.0 complex oz1 = z1 complex oz2 = z2 complex oz3 = z3 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 (@fBm) 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 endif IF (@coloronly); only using fBm on coloring z1 = oz1; restore z from un-fBm'ed copy ENDIF z1 = c1*z1*(1-z1^@power); do Mandelbrot iteration IF (@coloronly); only using fBm on coloring oz1 = z1 ENDIF if (@fBm == true) IF (@noiseskip == 0.0 || noise); adding noise this iteration complex pa = z1 * @scale * r + @offset float sum1 = 0.0 float freq = 1.0 complex va = (0,0) int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fx0a = floor(real(pa)) float fy0a = floor(imag(pa)) float bx0a = fx0a % 256 float by0a = fy0a % 256 IF (bx0a < 0) bx0a = bx0a + 256 ENDIF IF (by0a < 0) by0a = by0a + 256 ENDIF float bx1a = (bx0a + 1) % 256 float by1a = (by0a + 1) % 256 float rx0a = real(pa) - fx0a float ry0a = imag(pa) - fy0a float rx1a = rx0a - 1 float ry1a = ry0a - 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 b00a = (bx0a^@npower % 65536 + by0a)^@npower % 65536 float b10a = (bx1a^@npower % 65536 + by0a)^@npower % 65536 float b01a = (bx0a^@npower % 65536 + by1a)^@npower % 65536 float b11a = (bx1a^@npower % 65536 + by1a)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0a = (b00a)^@npower*0.25 % 512 - 256 float g_b10_0a = (b10a)^@npower*0.25 % 512 - 256 float g_b01_0a = (b01a)^@npower*0.25 % 512 - 256 float g_b11_0a = (b11a)^@npower*0.25 % 512 - 256 float g_b00_1a = (b00a+1)^@npower*0.25 % 512 - 256 float g_b10_1a = (b10a+1)^@npower*0.25 % 512 - 256 float g_b01_1a = (b01a+1)^@npower*0.25 % 512 - 256 float g_b11_1a = (b11a+1)^@npower*0.25 % 512 - 256 ; normalize each vector float da = 0.0; da = 1 / sqrt(sqr(g_b00_0a) + sqr(g_b00_1a)) g_b00_0a = g_b00_0a * da g_b00_1a = g_b00_1a * da da = 1 / sqrt(sqr(g_b10_0a) + sqr(g_b10_1a)) g_b10_0a = g_b10_0a * da g_b10_1a = g_b10_1a * da da = 1 / sqrt(sqr(g_b01_0a) + sqr(g_b01_1a)) g_b01_0a = g_b01_0a * da g_b01_1a = g_b01_1a * da da = 1 / sqrt(sqr(g_b11_0a) + sqr(g_b11_1a)) g_b11_0a = g_b11_0a * da g_b11_1a = g_b11_1a * da ; produce colors for each corner float u1a = rx0a * g_b00_0a + ry0a * g_b00_1a float v1a = rx1a * g_b10_0a + ry0a * g_b10_1a float u2a = rx0a * g_b01_0a + ry1a * g_b01_1a float v2a = rx1a * g_b11_0a + ry1a * g_b11_1a ; interpolate between corners using ; bilinear filtering float sxa = sqr(rx0a) * (3 - rx0a*2) float sya = sqr(ry0a) * (3 - ry0a*2) float a1 = u1a + sxa*(v1a-u1a) float b1 = u2a + sxa*(v2a-u2a) sum1 = sum1 + real(@nfn1(a1 + sya*(b1-a1)))*freq freq = freq * @step pa = pa * r2 / @step i = i - 1 ENDWHILE IF (@style == 0); radial distortion va = (z1-c)/cabs(z1-c) * r3; use vector based on angle to distortion center ELSEIF (@style == 1); linear distortion va = r3; just use rotation vector ENDIF z1 = z1 + va * sum1*0.5*@distortion ENDIF endif IF (@coloronly == false); not just using fBm on coloring oz1 = z1; value for bailout is fBm'ed z ENDIF if (@slope == true) IF (@coloronly); only using fBm on coloring z2 = oz2 z3 = oz3 ENDIF z2 = c2*z2*(1-z2^@power) z3 = c3*z3*(1-z3^@power) IF (@coloronly); only using fBm on coloring oz2 = z2 oz3 = z3 ENDIF if (@fBm == true) IF (@noiseskip == 0.0 || noise); adding noise this iteration complex pb = z2 * @scale * r + @offset complex pc = z3 * @scale * r + @offset float sum2 = 0.0 float sum3 = 0.0 float freq = 1.0 complex vb = (0,0) complex vc = (0,0) int i = @octaves WHILE (i > 0) ; determine integer coordinate for corners of square ; surrounding p float fx0b = floor(real(pb)) float fy0b = floor(imag(pb)) float bx0b = fx0b % 256 float by0b = fy0b % 256 IF (bx0b < 0) bx0b = bx0b + 256 ENDIF IF (by0b < 0) by0b = by0b + 256 ENDIF float bx1b = (bx0b + 1) % 256 float by1b = (by0b + 1) % 256 float rx0b = real(pb) - fx0b float ry0b = imag(pb) - fy0b float rx1b = rx0b - 1 float ry1b = ry0b - 1 float fx0c = floor(real(pc)) float fy0c = floor(imag(pc)) float bx0c = fx0c % 256 float by0c = fy0c % 256 IF (bx0c < 0) bx0c = bx0c + 256 ENDIF IF (by0c < 0) by0c = by0c + 256 ENDIF float bx1c = (bx0c + 1) % 256 float by1c = (by0c + 1) % 256 float rx0c = real(pc) - fx0c float ry0c = imag(pc) - fy0c float rx1c = rx0c - 1 float ry1c = ry0c - 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 b00b = (bx0b^@npower % 65536 + by0b)^@npower % 65536 float b10b = (bx1b^@npower % 65536 + by0b)^@npower % 65536 float b01b = (bx0b^@npower % 65536 + by1b)^@npower % 65536 float b11b = (bx1b^@npower % 65536 + by1b)^@npower % 65536 float b00c = (bx0c^@npower % 65536 + by0c)^@npower % 65536 float b10c = (bx1c^@npower % 65536 + by0c)^@npower % 65536 float b01c = (bx0c^@npower % 65536 + by1c)^@npower % 65536 float b11c = (bx1c^@npower % 65536 + by1c)^@npower % 65536 ; produce a "random" vector for each corner float g_b00_0b = (b00b)^@npower*0.25 % 512 - 256 float g_b10_0b = (b10b)^@npower*0.25 % 512 - 256 float g_b01_0b = (b01b)^@npower*0.25 % 512 - 256 float g_b11_0b = (b11b)^@npower*0.25 % 512 - 256 float g_b00_1b = (b00b+1)^@npower*0.25 % 512 - 256 float g_b10_1b = (b10b+1)^@npower*0.25 % 512 - 256 float g_b01_1b = (b01b+1)^@npower*0.25 % 512 - 256 float g_b11_1b = (b11b+1)^@npower*0.25 % 512 - 256 float g_b00_0c = (b00c)^@npower*0.25 % 512 - 256 float g_b10_0c = (b10c)^@npower*0.25 % 512 - 256 float g_b01_0c = (b01c)^@npower*0.25 % 512 - 256 float g_b11_0c = (b11c)^@npower*0.25 % 512 - 256 float g_b00_1c = (b00c+1)^@npower*0.25 % 512 - 256 float g_b10_1c = (b10c+1)^@npower*0.25 % 512 - 256 float g_b01_1c = (b01c+1)^@npower*0.25 % 512 - 256 float g_b11_1c = (b11c+1)^@npower*0.25 % 512 - 256 ; normalize each vector float db = 0.0 float dc = 0.0; db = 1 / sqrt(sqr(g_b00_0b) + sqr(g_b00_1b)) g_b00_0b = g_b00_0b * db g_b00_1b = g_b00_1b * db db = 1 / sqrt(sqr(g_b10_0b) + sqr(g_b10_1b)) g_b10_0b = g_b10_0b * db g_b10_1b = g_b10_1b * db db = 1 / sqrt(sqr(g_b01_0b) + sqr(g_b01_1b)) g_b01_0b = g_b01_0b * db g_b01_1b = g_b01_1b * db db = 1 / sqrt(sqr(g_b11_0b) + sqr(g_b11_1b)) g_b11_0b = g_b11_0b * db g_b11_1b = g_b11_1b * db dc = 1 / sqrt(sqr(g_b00_0c) + sqr(g_b00_1c)) g_b00_0c = g_b00_0c * dc g_b00_1c = g_b00_1c * dc dc = 1 / sqrt(sqr(g_b10_0c) + sqr(g_b10_1c)) g_b10_0c = g_b10_0c * dc g_b10_1c = g_b10_1c * dc dc = 1 / sqrt(sqr(g_b01_0c) + sqr(g_b01_1c)) g_b01_0c = g_b01_0c * dc g_b01_1c = g_b01_1c * dc dc = 1 / sqrt(sqr(g_b11_0c) + sqr(g_b11_1c)) g_b11_0c = g_b11_0c * dc g_b11_1c = g_b11_1c * dc ; produce colors for each corner float u1b = rx0b * g_b00_0b + ry0b * g_b00_1b float v1b = rx1b * g_b10_0b + ry0b * g_b10_1b float u2b = rx0b * g_b01_0b + ry1b * g_b01_1b float v2b = rx1b * g_b11_0b + ry1b * g_b11_1b float u1c = rx0c * g_b00_0c + ry0c * g_b00_1c float v1c = rx1c * g_b10_0c + ry0c * g_b10_1c float u2c = rx0c * g_b01_0c + ry1c * g_b01_1c float v2c = rx1c * g_b11_0c + ry1c * g_b11_1c ; interpolate between corners using ; bilinear filtering float sxb = sqr(rx0b) * (3 - rx0b*2) float syb = sqr(ry0b) * (3 - ry0b*2) float a2 = u1b + sxb*(v1b-u1b) float b2 = u2b + sxb*(v2b-u2b) float sxc = sqr(rx0c) * (3 - rx0c*2) float syc = sqr(ry0c) * (3 - ry0c*2) float a3 = u1c + sxc*(v1c-u1c) float b3 = u2c + sxc*(v2c-u2c) sum2 = sum2 + real(@nfn1(a2 + syb*(b2-a2)))*freq sum3 = sum3 + real(@nfn1(a3 + syc*(b3-a3)))*freq freq = freq * @step pb = pb * r2 / @step pc = pc * r2 / @step i = i - 1 ENDWHILE IF (@style == 0); radial distortion vb = (z2-c)/cabs(z2-c) * r3 vc = (z3-c)/cabs(z3-c) * r3 ELSEIF (@style == 1); linear distortion vb = r3 vc = r3 ENDIF z2 = z2 + vb * sum2*0.5*@distortion z3 = z3 + vc * sum3*0.5*@distortion ENDIF endif IF (@coloronly == false); not just using fBm on coloring oz2 = z2 oz3 = z3 ENDIF endif modz = |oz1| if (@slope == true) iterexp1 = iterexp1 + exp(-cabs(z1)) iterexp2 = iterexp2 + exp(-cabs(z2)) iterexp3 = iterexp3 + exp(-cabs(z3)) done = done + 1 ; increment iteration counter IF (modz > @bailout || \ @everyiter || \ done == #maxit + 2) ; done, or every iteration, or last ; determine continuous iteration (height) for each point e1 = iterexp1 * @zscale e2 = iterexp2 * @zscale e3 = iterexp3 * @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 vx = e2-e1 vy = e3-e1 vz = -@slope_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 else z = z1 endif IF (modz > @bailout) ; we're done done = 0 ENDIF bailout: (done > 0) default: title = "Slope Lambda Julia + fBm" center = (0,0) magn = 1.0 maxiter = 149 method = multipass param version caption = "Version" default = 1.17 visible = false endparam param seed caption = "Lambda Seed" default = (0.85,0.6) hint = "This is the Lambda seed, a constant parameter which \ defines the shape of the fractal." endparam param power caption = "Exponent" default = (1,0) hint = "Overall exponent for the equation. (1,0) gives \ the classic Lambda type." endparam param bailout caption = "Bailout" default = 10000.0 hint = "Defines how soon an orbit bails out, i.e. doesn't belong \ to the Lambda set anymore." endparam bool param fBm caption = "fBm texturing?" default = true endparam heading caption = "fBm Parameters" visible = @fBm == true endheading param distortion caption = "Distortion Strength" default = 1.0 hint = "This is the amount the noise distorts the image." visible = @fBm == true 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." visible = @fBm == true endparam param distangle caption = "Distortion Angle" default = 0.0 hint = "This is the angle to rotate the distortion." visible = @fBm == true 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." visible = @fBm == true 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." visible = @fBm == true 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." visible = @fBm == true endparam param scale caption = "Noise Scale" default = 1.0 hint = "This is the overall scale of the noise." visible = @fBm == true endparam param angle caption = "Noise Rotation" default = 0.0 hint = "This is the angle, in degrees, of the noise." visible = @fBm == true endparam param step caption = "Noise Scale Step" default = 0.5 hint = "This is the step in scale between noise iterations." visible = @fBm == true endparam param anglestep caption = "Noise Rotation Step" default = 37.0