Attributed to Russell Walsmith
Written by Paul Bourke
August 2005, Update: Oct 2014

The images shown here are based upon triternion arithmetic and are created in a similar way to the Mandelbrot set. That is, a function is iterated with some dependency on a position on the complex plane. The outcome of the series (infinity, zero, or otherwise) determines the state of that position and ultimately how it is represented graphically. Generally the distinction is made between the series tending to zero (inside the set) and other behavior (outside the set).

The difference here is the function being iterated is not in the complex plane but rather in three dimensions. To determine whether the position in 3D is inside or outside the set, a test is made whether the magnitude of the series (a vector) in 3D tends to zero. The result, as shown in the images is a Mandelbrot like outline, extruded in 3D space over some limited range.

The series in three dimensions is given by
   xn+1 = a + x0
   yn+1 = b + y0
   zn+1 = c + z0
   a = xn2 + 2 yn zn
   b = zn2 + 2 xn yn
   c = yn2 + 2 xn zn
and (x0,y0,z0) is the point in question.

In the images shown here the bounds of the cube shown is -1.75 to 0.75 in each dimension.

FracInt code by Russell Walsmith
; The reduced Tset formula
Frm4 {
   x=real(pixel), y=imag(pixel), z=p1
   a = x1^2 + 2*y1*z1
   b = z1^2 + 2*x1*y1
   c = y1^2 + 2*x1*z1
   x1 = a+x, y1 = b+y, z1 = c+z
   s = x1^2 + y1^2 + v1^2
   s < 100 
C style code to evaluate the triternion
int Eval(double x,double y,double z,int nmax)
   int n = 0;
   double x1 = 0,y1 = 0,z1 = 0;
   double a,b,c;
   double zz = 0;
   while (zz < 100 && n < nmax) {
      a = x1*x1 + 2*y1*z1;
      b = z1*z1 + 2*x1*y1;
      c = y1*y1 + 2*x1*z1;
      x1 = a + x;
      y1 = b + y;
      z1 = c + z;
      zz = x1*x1 + y1*y1 + z1*z1;

Update Oct 2014

Code to create a volume suitable for rendering with the Drishti volume visualisation software, although any volume rendering package could be used: triternion.c