Morgan L. Owens wrote:
I'm just impressed how you can get from
t1=z1*z1+2*z2*z3+c1 t2=z3*z3+2*z1*z2+c2 t3=z2*z2+2*z3*z1+c3 z1=t1 z2=t2 z3=t3
to
w1 = real(xy), w2 = imag(xy), w3 = zz xy = sqr(w1) + 2*w2*w3 xy = xy + flip(sqr(w3)+2*w1*w2) + p3 zz = sqr(w2) + 2*w1*w3 + real(p4)
without appearing to break into a sweat.
What you so courteously describe as a virtue is in fact a combination of lazyness, bad programming habits and Fractint parser "legacy code" (my first attempts to mimic Fractint's julibrot type where done without if-then-else-logic available and with a far smaller number of operations allowed per formula). With statements like A = B*c + D*e +..., where, say, lowercase variables represent real-only values, one is able to process two calculations in a single line by putting two real values in each complex variable (the uppercase ones). But this doesn't really happen in the above example, where (as you noted) I am constantly switching back and forth between real and pseudeo-complex number storing and nothing else - which only obfuscates what's going on. (Ha! Found an excuse for the old, ugly code: It seems to run a tiny bit faster than the new one :-)) Following are the two formulas (slightly) cleaned up. Regards, Gerald ----------------------- begin FRM ----------------------------- Rot3d_D3_Jul {;periodicity=no, outside=summ ;maxit > p5real*(p5imag+1) ; ;p1real: Rotation about x-axis (1st rotation) ;p1imag: Rotation about y-axis (2nd rotation) ;p2real: Far clipping plane ;p2imag: Near clipping plane ;p3real: cx ;p3imag: cy ;p4real: cz ;p4imag: Bailout ;p5real: Maxiter per slice ;p5imag: Number of slices - 1 ; bailout = imag(p4), tiefnum = imag(p5) delta = (real(p2)-imag(p2))/tiefnum tmp = pi/180 rotXax = exp(flip(real(p1)*tmp)), rotYax = exp(flip(imag(p1)*tmp)) ; HPixXY = rotYax VPixZ = real(rotXax) VPixXY = flip(conj(rotYax)) NXY = VPixZ*VPixXY NZ = imag(conj(rotXax)) VPixXY = -NZ*VPixXY ; tmp = NXY*imag(p2) + HPixXY*real(pixel) + VPixXY*imag(pixel) x1 = x0 = real(tmp), y1 = y0 = imag(tmp) z1 = z0 = NZ*imag(p2) + HPixZ*real(pixel) + VPixZ*imag(pixel) tmp = NXY*delta dx = real(tmp), dy = imag(tmp) dz = NZ*delta cx = real(p3), cy = imag(p3), cz = real(p4) sqx = sqr(x1), sqy = sqr(y1), sqz = sqr(z1) j = m = i = 0: w1 = x1, w2 = y1, w3 = z1 x1 = sqx + 2*w2*w3 + cx y1 = sqz + 2*w1*w2 + cy z1 = sqy + 2*w1*w3 + cz sqx = sqr(x1), sqy = sqr(y1), sqz = sqr(z1) IF (bailout >= sqx+sqy+sqz) i = i + 1 ELSE i = 0 m = m + 1 x1 = x0 = x0 + dx y1 = y0 = y0 + dy z1 = z0 = z0 + dz sqx = sqr(x1), sqy = sqr(y1), sqz = sqr(z1) ENDIF z = m - j j = j + 1 tiefnum >= m && p5 >= i } Rot3d_D3_Man {;periodicity=no, outside=summ ;maxit > p5real*(p5imag+1) ; ;p1real: Rotation about x-axis (1st rotation) ;p1imag: Rotation about y-axis (2nd rotation) ;p2real: Far clipping plane ;p2imag: Near clipping plane ;p3real: x(0) ;p3imag: y(0) ;p4real: z(0) ;p4imag: Bailout ;p5real: Maxiter per slice ;p5imag: Number of slices - 1 ; bailout = imag(p4), tiefnum = imag(p5) delta = (real(p2)-imag(p2))/tiefnum tmp = pi/180 rotXax = exp(flip(real(p1)*tmp)), rotYax = exp(flip(imag(p1)*tmp)) ; HPixXY = rotYax VPixZ = real(rotXax) VPixXY = flip(conj(rotYax)) NXY = VPixZ*VPixXY NZ = imag(conj(rotXax)) VPixXY = -NZ*VPixXY ; tmp = cxy0 = NXY*imag(p2) + HPixXY*real(pixel) + VPixXY*imag(pixel) cx = cx0 = real(tmp), cy = cy0 = imag(tmp) cz = cz0 = NZ*imag(p2) + HPixZ*real(pixel) + VPixZ*imag(pixel) tmp = NXY*delta, dcx = real(tmp), dcy = imag(tmp) dcz = NZ*delta x1 = real(p3), y1 = imag(p3), z1 = real(p4) sqx = sqr(x1), sqy = sqr(y1), sqz = sqr(z1) j = m = i = 0: w1 = x1, w2 = y1, w3 = z1 x1 = sqx + 2*w2*w3 + cx y1 = sqz + 2*w1*w2 + cy z1 = sqy + 2*w1*w3 + cz sqx = sqr(x1), sqy = sqr(y1), sqz = sqr(z1) IF (bailout >= sqx+sqy+sqz) i = i + 1 ELSE i = 0 m = m + 1 cx = cx0 = cx0 + dcx cy = cy0 = cy0 + dcy cz = cz0 = cz0 + dcz x1 = real(p3), y1 = imag(p3), z1 = real(p4) sqx = sqr(x1), sqy = sqr(y1), sqz = sqr(z1) ENDIF z = m - j j = j + 1 tiefnum >= m && p5 >= i } ------------------------ end FRM ------------------------------