wonder { fractal: title="wonder" width=320 height=240 numlayers=1 layer: caption="Layer 1" visible=yes alpha=no mapping: center=0.355895390860670044/-0.308605675303474996 magn=0.594520547970194354 angle=38.7981610831159636 formula: filename="zg.frm" entry="pienza" maxiter=2 percheck=normal inside: filename="pwc.ucl" entry="CarlsonTraps" transfer=linear repeat=yes p_trap_type="Harlequin" p_r=0.1 p_ring_radius=0.12 p_c=0.15/1.26875 p_num_ranges=8 p_colors_in_range=30 p_skip=1 p_back_color=254 p_solid=no f_fn1=sin outside: filename="pwc.ucl" entry="CarlsonTraps" transfer=linear repeat=yes p_trap_type="Harlequin" p_r=0.1 p_ring_radius=0.12 p_c=0.15/1.26875 p_num_ranges=8 p_colors_in_range=30 p_skip=1 p_back_color=254 p_solid=no f_fn1=exp gradient: smooth=yes numnodes=4 index=15 color=15658483 index=142 color=3019188 index=216 color=12032768 index=335 color=5034993 } zg.frm:pienza {; Giuseppe Zito z = pixel , c2 = -0.3916 c4 = -0.030243 c7 = -0.494857 c11 = -0.599758 c13 = 0.21419 d0 = 0.016549 : x = real(z), y = imag(z) s0 = x s0 = s0 -x s0 = s0 /c2 s0 = s0 /y s0 = s0 +c4 s0 = s0 -x s0 = s0 /x s0 = s0 -c7 s0 = s0 -x s0 = s0 *c11 s0 = s0 +c13 s0 = s0 +y s0 = s0 -x newx = s0 s0 =d0 s0 = s0 -y s0 = s0 -x s0 = s0 +y newy = s0 z = newx + flip(newy) newx < 4 && newx > -4 && newy < 4 && newy > -4 } pwc.ucl:CarlsonTraps { ; v2.00, May 1999 ; ; This formula is a collection of orbit traps devised by ; Paul W. Carlson and posted by him to the Ultra Fractal ; mailing list. They were converted to colouring methods ; by Luke Plant and Mark Townsend. ; init: ; Iteration counter int iter = 0 ; Real and imaginary components of z and their absolute values float x = 0 float y = 0 float Xabs = 0 float Yabs = 0 ; Temporary variable - any mode can use it as it chooses float temp = 0 ; Temporary variable for keeping track of something. float keep = 1e20 ; Flag that the orbit has been trapped bool trapped = false ; Final color range of trapped orbit float range_num = 0 ; The color index before conversion to UF range float color_index = @back_color ; Do some stuff for specific modes if @trap_type == 2 || @trap_type == 3 ; Methods coloring by trap float index_factor = @colors_in_range - 1 else ; Methods coloring by iteration float index_factor = (@colors_in_range - 1) / @r endif ; Tangent Balls & Flexballs float ratio = 0 float Dsqd0 = 0 float Dsqd1 = 0 float Dsqd2 = 0 float ZtoPsqd = 0 float Rc = @r float Phi = #pi / 8 float Rm = Rc / sin(Phi) float RcSqd = Rc^2 float Py = Rm * sin(2 * Phi) float Px = Rm * cos(2 * Phi) ; Fix up for FlexBalls float adjust = 0 if @trap_type == 2 Rm = @ring_radius float Ro = Rm + @r Py = 0.382683432365 * @r Px = 0.923879532511 * @r Dsqd0 = Ro * Ro + @r * @r - (Ro + Ro) * Px endif ; For Harlequin multiplier = @ring_radius ; For Squares if @trap_type == 7 ; Just pick a couple of spare variables Px = 0.5 + @r Py = 0.5 - @r endif loop: ; Many modes use these... x = real(#z) y = imag(#z) Xabs = abs(x) Yabs = abs(y) if @trap_type == 0 ; *** 3D Bubbles *** temp = sqrt(|#z|) if (temp < keep) keep = temp ; We don't skip any iterations for bubbles IF (keep < @r) trapped = true ; So that it's not mapped solid ; Modulate iter to find out range_num range_num = iter % @num_ranges color_index = index_factor * temp + range_num * @colors_in_range endif endif elseif @trap_type == 1 ; *** 3D Stalks *** if Xabs <= Yabs temp = Xabs else temp = Yabs endif if !trapped && iter >= @skip && temp < @r trapped = true range_num = iter % @num_ranges color_index = index_factor * temp + range_num * @colors_in_range endif elseif @trap_type == 2 ; *** Flexballs *** if !trapped && iter >= @skip && abs((cabs(#z) - Rm)) < @r trapped = true if Xabs >= Yabs ZtoPsqd = (Xabs - Px)^2 + (Yabs - Py)^2 adjust = 1 else ZtoPsqd = (Xabs - Py)^2 + (Yabs - Px)^2 adjust = 0 endif if (x >= 0 && y >= 0) range_num = 1 - adjust elseif (x < 0 && y >= 0) range_num = 2 + adjust elseif (x < 0 && y < 0) range_num = 5 - adjust else range_num = 6 + adjust endif ratio = sqrt(ZtoPsqd / Dsqd0) ; Modulate range_num for less than eight ranges. range_num = range_num % @num_ranges ; As it was fized: color_index = 29 * ratio + range_num * 30 color_index = index_factor * ratio + range_num * @colors_in_range endif elseif @trap_type == 3 ; *** Tangent Balls *** if !trapped && iter >= @skip && abs((cabs(#z) - Rm)) < Rc Dsqd0 = Xabs^2 + (Yabs - Rm)^2 Dsqd1 = (Xabs - Px)^2 + (Yabs - Py)^2 Dsqd2 = (Xabs - Rm)^2 + Yabs^2 if Dsqd0 < RcSqd trapped = true ZtoPsqd= Dsqd0 if y > 0 range_num = 0 else range_num = 4 endif elseif Dsqd1 < RcSqd trapped = true ZtoPsqd= Dsqd1 if y > 0&& x > 0 range_num = 1 elseif y < 0 && x > 0 range_num = 3 elseif y < 0 && x < 0 range_num = 5 else range_num = 7 endif elseif Dsqd2 < RcSqd trapped = true ZtoPsqd = Dsqd2 if x > 0 range_num = 2 else range_num = 6 endif endif if trapped ratio = sqrt(ZtoPsqd/Rcsqd) range_num = range_num % @num_ranges color_index = index_factor * ratio + range_num * @colors_in_range endif endif elseif @trap_type == 4 ; *** 3-Way *** if !trapped && ((keep < @r) && (|#z| > @r)) && iter >= @skip trapped = true range_num = iter % @num_ranges index_factor = (@colors_in_range - 1) * (@r - keep) / @r float color_index = index_factor + range_num * @colors_in_range endif keep = |#z| elseif @trap_type == 5 ; *** Rings *** temp = abs(|#z|-.25) if !trapped && temp < @r && iter >= @skip trapped = true range_num = iter % @num_ranges color_index = index_factor * temp + range_num * @colors_in_range endif elseif @trap_type == 6 ; *** Harlequin *** complex a = multiplier * atan(y / x) a = a * a + @c a = fn1(1 - a) / a temp = abs(|#z| - |a|) if !trapped && (temp < @r && iter >= @skip) trapped = true range_num = iter % @num_ranges color_index = index_factor * temp + range_num * @colors_in_range endif elseif @trap_type == 7 ; *** Squares *** if ((Xabs < Px) && (Xabs > Py) && (Yabs < Px) && (Yabs > Py)) float awr5 = abs(Xabs - 0.5) float awi5 = abs(Yabs - 0.5) if (awr5 <= awi5) temp = awr5 else temp = awi5 endif if !trapped && (temp < @r && iter > @skip) trapped = true range_num = iter % @num_ranges color_index = index_factor * temp + range_num * @colors_in_range endif endif endif iter = iter + 1 final: if trapped ; Adjust color index to gradient range. #index = (color_index + 1) % 256 / 256 else if @solid #solid = true else ; For the purists we don't have to be solid. #index = @back_color / 256 endif endif default: title = "Paul Carlson's Orbit Traps" param trap_type caption = "Trap type" hint = "Choose one of Paul Carlson's wonderful orbit traps." enum = "3D Bubbles" "3D Stalks" "FlexBalls" "Tangent Balls" \ "3-Way" "Rings" "Harlequin" "Squares" default = 1 endparam param r caption = "Element size" hint = "This has a different use for each mode and usually \ effects the size of the elements." default = 0.1 endparam param ring_radius caption = "Other parameter" hint = "This is the radius of the ring for FlexBalls and the angle \ multiplier for Harlequin." default = 0.12 min = 0 endparam param c caption = "Julia coordinates" hint = "Julia coordinates for the Harlequin trap mode." default = (0.15, 1.26875) endparam param num_ranges Caption = "Color ranges" hint = "This is the number of separate color ranges." default = 8 min = 1 max = 8 ; for now endparam param colors_in_range Caption = "Colors in range" hint = "This is the number of colors in each color range." default = 30 endparam param skip caption = "Iterations to skip" hint = "This is the number of iterations to skip before watching \ the orbit. It's not used for Bubbles." default = 1 min = 0 endparam param back_color caption = "Background color" hint = "This is the color used for orbits that aren't trapped. It has \ no effect if the background is solid." default = 254 min = 0 max = 255 endparam param solid caption = "Solid background" hint = "If this is enabled orbits that aren't trapped become solid." default = false endparam func fn1 caption = "Function" hint = "This is the function for the Harlequin trap mode." default = exp() endfunc }