POV-Ray : Newsgroups : povray.binaries.images : Re: The Cubic Mandelbrot [23 kb] : Re: The Cubic Mandelbrot [23 kb] Server Time
5 Nov 2024 18:22:18 EST (-0500)
  Re: The Cubic Mandelbrot [23 kb]  
From: Mike Williams
Date: 15 Jun 2005 17:05:02
Message: <jv40VAAufJsCFwlO@econym.demon.co.uk>
Wasn't it Emerald Orchid who wrote:
>>>The bottom image looks like one would expect. The other two look like I 
>>>maybe messed up my maths somewhere... they don't look right somehow.
>>>
>>>I'll go see if I can figure out if/where my code is wrong. :-S
>> 
>> I suspect that it has something to do with the values of T1 and T2.
>
>Indeed - that's the optimisation.
>
>The formula is z^3 - 3a^2z + b, as - as an optimisation - my code
>calculates t = 3a^2. Then the formula is z^3 - tz + b.
>
>Still... I'm staring at my code... and I'm not seeing anything wrong...
>hmmmm... 0:-)


I just spotted that the formula for the image you want it to look like
appears in the title bar of the gif. Namely:

        Z = Z^3 - 3.c^2.Z + 0

However, the function you're using for the 3D mandelbrot is

        Z = Z^3 - 3.c^2.Z + #pixel

on the X plane cross section, the real part of the #pixel is 0

This code plots Z = Z^3 - 3.c^2.Z + 0 using something similar to your
original 3D function, but I can't see how to get something 3D that does
this on the X axis and plots Z = Z^3 + #pixel on the Z axis at the same
time.


// Just useful.
#declare ReMul = function (Xr, Xi, Yr, Yi) {Xr * Yr - Xi * Yi};
#declare ImMul = function (Xr, Xi, Yr, Yi) {Xr * Yi + Xi * Yr};

#declare Re2 = function (Zr, Zi) {  Zr*Zr - Zi*Zi};
#declare Im2 = function (Zr, Zi) {2*Zr*Zi};

#declare Re3 = function (Zr, Zi) {  Zr*Zr*Zr - 3*Zr*Zi*Zi};
#declare Im3 = function (Zr, Zi) {3*Zr*Zr*Zi -   Zi*Zi*Zi};

// Change if you like...
#declare End = function (Zr, Zi) {Zr*Zr + Zi*Zi};

// Build recursive definition...
#declare Fn = array[21];

#declare Fn[0] = function (Zr, Zi, Tr, Ti, Br, Bi) {End(Zr, Zi)};

#declare lp=1;
#while (lp<21)
   #declare Fn[lp] = function (Zr, Zi, Tr, Ti, Br, Bi)
   {
     Fn[lp-1]
     (
       Re3(Zr, Zi) - ReMul(Zr, Zi, Tr, Ti) + Br,
       Im3(Zr, Zi) - ImMul(Zr, Zi, Tr, Ti) + Bi,
       Tr, Ti, Br, Bi
     )
   };

   #declare lp = lp + 1;
#end
#undef lp

// Change this at will... (Must be < 20 tho.)
#declare Iterations = 12;

// Don't touch...
#declare InitP = function (Ar, Ai, Br, Bi) {Fn[Iterations](+Ar, +Ai, 
3*Re2(Ar, Ai), 3*Im2(Ar, Ai), Br, Bi)};
#declare InitM = function (Ar, Ai, Br, Bi) {Fn[Iterations](-Ar, -Ai, 
3*Re2(Ar, Ai), 3*Im2(Ar, Ai), Br, Bi)};

// Now draw something!!
camera
{
   location <0, 0, -4.5>
   look_at <0, 0, 0>
}

light_source {<-2, +3, -5>, colour rgb <1.0, 0.0, 1.0>}
light_source {<+2, -3, -5>, colour rgb <0.0, 1.0, 0.0>}


plane {x,0
  pigment {
    function {min(InitP(z, y, x, 0) - 4, 10)} // changed this 
    colour_map {
      [0    rgb <0,0,0>]
      [0.0001 rgb <0,0,1>]
      [0.33 rgb <1,1,0>]
      [0.67 rgb <1,0,0>]
      [1.0  rgb <0,0,1>]
    }
  }
  finish {ambient 1}
  scale 2
  rotate <0,90,90>
}
    




-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.