excellent dave, do you render with uf5 ?
i need to try some fancy formulas, have you uploaded the formulas, i would like to play around, and convert standard fractals
for using the 4d math method ...
Yes I did them with UF5 with my WIP version of the rendering method that I posted the pseudo-code for.
I'm still working on my 3D IFS formula so haven't redone the escape-time formula for general release yet.
Note that for the use of bugman's method for general formulas we need to define "a*b" - we have a^n but not the product of two or more different values.
Also this is purely a 3D method - Paul also previously posted a 4D version.
For the 3D method I would suggest that we convert the squared version:
{x,y,z}^2 = r^2{cos(2*theta)cos(2*phi),sin(2*theta)cos(2*phi),-sin(2*phi)}
r=sqrt(x²+y²+z²), theta=atan(y/x), phi=atan(z/sqrt(x²+y²))
for a*b such that:
{xa,ya,za}*{xb.yb,zb} = r^2{cos(2*theta)cos(2*phi),sin(2*theta)cos(2*phi),-sin(2*phi)}
where:
r = exp(log(sqrt(xa^2+ya^2+za^2))+log(sqrt(xb^2+yb^2+zb^2)))
theta=atan(y/x), phi=atan(z/sqrt(x²+y²)) where x=(xa+xb), y=(ya+yb) and z=(za+zb)
which I think is a commutative method.
Note that the value for r defined here can be simplified to: r = exp(0.5*(log(xa^2+ya^2+za^2)+log(xb^2+yb^2+zb^2)))
I'm not sure given that, how to "correctly" define division or even if it is possible ?
Haven't checked but I'm not sure that my suggested method for a*b would give the same result for a*a*a as the original a^3 method ?
Edit: Sorry - I wasn't thinking in terms of magnitudes and angles, for a*b that should probably be:
{xa,ya,za}*{xb.yb,zb} = r{cos(theta)cos(phi),sin(theta)cos(phi),-sin(phi)}
where:
r = exp(log(sqrt(xa^2+ya^2+za^2))+log(sqrt(xb^2+yb^2+zb^2)))
theta=atan(ya/xa)+atan(yb/xb), phi=atan(za/sqrt(xa²+ya²))+atan(zb/sqrt(xb²+yb²))
Is that correct ?
OK - now I'm embarassed, I missed that Twinbee had actually posted:
**************
// A triplex number is a '3D' number
triplex multiply(triplex a, triplex b) {
triplex n;
double pi=3.14159265;
double r = pow(a.x*b.x + a.y*b.y + a.z*b.z , 0.5);
double yang = atan2( pow(a.x*b.x + a.y*b.y, 0.5) , a.z ) ;
double zang = atan2(a.y , b.x);
n.x = (r*r) * sin( yang*2 + 0.5*pi ) * cos(zang*2 +pi);
n.y = (r*r) * sin( yang*2 + 0.5*pi ) * sin(zang*2 +pi);
n.z = (r*r) * cos( yang*2 + 0.5*pi );
return n;
}
***********************
Which gives a different a*b - so is bugman's formula more different from Twinbee's than I thought it was ?
Edit:
<blush> OK, my version is actually:
{xa,ya,za}*{xb.yb,zb} = r{cos(theta)cos(phi),sin(theta)cos(phi),-sin(phi)}
where:
r = sqrt((xa^2+ya^2+za^2)*(xb^2+yb^2+zb^2))
theta=atan(ya/xa)+atan(yb/xb), phi=atan(za/sqrt(xa²+ya²))+atan(zb/sqrt(xb²+yb²))
On balance I think I prefer a combination:
{xa,ya,za}*{xb.yb,zb} = r{cos(theta)cos(phi),sin(theta)cos(phi),-sin(phi)}
where:
r = abs(xa*xb+ya*yb+za*zb)
theta=atan(ya/xa)+atan(yb/xb), phi=atan(za/sqrt(xa²+ya²))+atan(zb/sqrt(xb²+yb²))
However we still need division ?
So maybe use this for a*b:
{xa,ya,za}*{xb.yb,zb} = r{cos(theta)cos(phi),sin(theta)cos(phi),-sin(phi)}
where:
r = sqrt((xa^2+ya^2+za^2)*(xb^2+yb^2+zb^2))
theta=atan(ya/xa)+atan(yb/xb), phi=atan(za/sqrt(xa²+ya²))+atan(zb/sqrt(xb²+yb²))
And this for a/b:
{xa,ya,za}/{xb.yb,zb} = r{cos(theta)cos(phi),sin(theta)cos(phi),-sin(phi)}
where:
r = sqrt((xa^2+ya^2+za^2)/(xb^2+yb^2+zb^2))
theta=atan(ya/xa)-atan(yb/xb), phi=atan(za/sqrt(xa²+ya²))-atan(zb/sqrt(xb²+yb²))