Mandelbulb is an ad-hoc system built on manipulating angles in spherical coordinates. To construct a spherical coordinate system in 3D you arbitrary choose a reference plane and a direction within that plane. Say the XY plane through the origin and the X axis. Then the first angle is the point in question projected into the plane and the angle formed with the X axis (azimuth). The second angle is the remaining part out of the plane which can be measured in a number of ways, such as with respect to the positive Z axis (zenith angle) or the angle formed with the plane (inclination). The last part of information is of course the magnitude of the vector to the point.
The two major flavors of Mandelbulb appear to be these:
vec3 mbulbAI(vec3 p, float m, const float n)
{
float a = atan(p.y, p.x); // on [-pi, pi]
float i = asin(p.z/m); // on [-pi/2, pi/2]
// scale the angles and magnitude by power
i *= n;
a *= n;
m = pow(m, n);
// convert back to Cartesian.
return m*vec3(cos(i)*cos(a), cos(i)*sin(a), sin(i));
}
vec3 mbulbAZ(vec3 p, float m, const float n)
{
float a = atan(p.y, p.x); // on [-pi, pi]
float z = acos(p.z/m); // on [0, pi]
// scale the angles and magnitude by power
a *= n;
z *= n;
m = pow(m, n);
// convert back to Cartesian
return m*vec3(sin(z)*cos(a), sin(z)*sin(a), cos(z));
}
All spherical coordinates can be also thought as a system which takes a predefined reference position on the unit sphere followed by a pair of rotations in a predefined manner and a uniform scaling.
AI: ref-point {1,0,0}, rotate -Y by i, rotate Z by a, scale
AZ: ref-point {0,0,1}, rotate +Y by z, rotate Z by a, scale
Now it's obvious that these two systems are trivially equivalent, say via trig identities or by observing rotation -Y is same as by Y and negating the angle and moving the reference from in Z to in X by adding pi/2. Of course these are the same since asin(x)+acos(x)=pi/2.
The above reference point, rotation and scaling view-point hopefully sounds familiar because that's one view point I gave above for quaternion formulations.
Taking AI, the first rotation is r
y = sin(i){0,-1,0}+cos(i), r
z=sin(a){0,0,1}+cos(a). These are for rotations of 2i and 2a. The combined is r = r
zr
y = {sin(a)sin(i), -cos(a)sin(i), cos(i)sin(a)} + cos(a)cos(i)
Okay..enough for now.