I found that decreasing the scale factor reduces the complexity per iteration, which is probably important for higher order (z^n++, increased rotation multipliers, whatever you call 'em) versions of this.
Initialize the following parametric variables with whatever you like:
check.default= 1
fold.default=2
fixedRadius.default=1
minRadius.default=.5
pt.default=1 /* to set trig "planar" exponent */
lt.default=1 /* to set trig "linear" exponent */
mag.default=2 /* set "planar" rotations */
v.default = 2 /* set "linear" rotations (not really planar or linear... just call 'em that because... because... */
n.default= 2 /* to set magnitude.. generally match the rotations, but do whatever you want... really */
bail2.default=whatever /* if you use bailcontrol mode, you need to set a value for your bail exponent */
if (fractaltype=="Tglad Typo B") {
/* fold box onto itself */
if (sx > check) {
sx = fold - sx;
} else if (sx<0-check) {
sx = 0-fold - sx;
}
if (sy > check) {
sy = fold - sy;
} else if (sy<0-check) {
sy = 0-fold - sy;
}
if (sz > check) {
sz = fold - sz;
} else if (sz<0-check) {
sz = 0-fold - sz;
}
/*fold sphere onto itself */
r = (sx^2+sy^2+sz^2);
if (r < sqr(minRadius)) {
r1=(sqr(fixedRadius)/sqr(minRadius)); /* can initialize this, not repeat in loop, and other constants */
sx=sx*r1;
sy=sy*r1;
sz=sz*r1;
} else if (r < fixedRadius) {
r1=(sqr(fixedRadius)/(r));
sx=sx*r1;
sy=sy*r1;
sz=sz*r1;
}
if (r1mode) {
sx=sx+pixelr;
sy=sy+pixeli;
sz=sz+pixelj;
r=(sx^2+sy^2+sz^2)^(n/2);
} else {
if (r2mode) {
r=r^(n/2);
} else {
r=(sx^2+sy^2+sz^2)^(n/2);
}
}
theta=atan2(sx^pt+flip(sy^lt)); /* throw an if statement in here to eliminate extra calculations... remove the exponents */
tango=atan2(sx^pt+flip(sz^lt)); /* if pt = 1 && lt = 1 */
sx=r*cos(theta*mag)*scalef+pixelr;
sy=r*sin(theta*v)*scalef+pixeli;
sz=r*sin(tango*v)*scalef+pixelj;
if (bailcontrol) {
bail=abs(sx)^bail2+abs(sy)^bail2+abs(sz)^bail2;
} else {
bail=sqr(sx)+sqr(sy)+sqr(sz);
}
}
The images are from the z^8, file names have the various variables in them. Just a -90 degree horizontal rotation, followed by a zoom in on the central point and increased iterations from a low low 4 to a whopping 6.