POV-Ray : Newsgroups : povray.unofficial.patches : Being able to call DLLs/SOs as user defined functions : Re: Being able to call DLLs/SOs as user defined functions Server Time
25 Apr 2024 15:22:05 EDT (-0400)
  Re: Being able to call DLLs/SOs as user defined functions  
From: Warp
Date: 19 Apr 2011 12:05:29
Message: <4dadb2c9@news.povray.org>
bugman <nomail@nomail> wrote:
> I would really like to see this. As far as I know, it is not possible.

  Your example code has no recursion. Obviously it cannot produce the
Mandelbrot set without one. Try this:

//-------------------------------------------------------------------
#declare MaxIter = 32;

#declare MandelIteration = function(Re, Im, Zr, Zi, n)
{ select(n < MaxIter & Zr*Zr + Zi*Zi < 4, 0, n / MaxIter,
         MandelIteration(Re, Im,
                         Zr*Zr - Zi*Zi + Re,
                         2*Zr*Zi + Im,
                         n+1)) };

#declare Mandel = function { MandelIteration(x, y, 0, 0, 0) };

camera { location -z*3 look_at 0 }

box
{ <-3, -3, 0>, <3, 3, .1>
  pigment
  { function { Mandel(x, y, z) }
    color_map
    { [0 rgb 0]
      [1 rgb 1]
    }
  }
  finish { ambient 1 }
}
//-------------------------------------------------------------------

-- 
                                                          - Warp


Post a reply to this message

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