POV-Ray : Newsgroups : povray.binaries.images : Alley Sunflower WIP : Re: Alley Sunflower WIP Server Time
31 Jul 2024 04:19:55 EDT (-0400)
  Re: Alley Sunflower WIP  
From: Nekar Xenos
Date: 28 Apr 2010 02:00:29
Message: <op.vbuyyunpufxv4h@go-dynamite>
On Wed, 28 Apr 2010 07:33:29 +0200, Edouard <pov### [at] edouardinfo> wrote:


> Ahh - I came across this problem several times in the past, and I ended  
> up
> learning about low-discrepancy sequences - which are completely  
> non-random, but
> more "randomly" distributed than a real random sequence.
>
> My code for a halton sequence is:
>
> #macro halton( index, base )
>  #local out = 0.0;
>  #local fraction = 1.0 / base;
>  #local i = index;
>  #while( i > 0 )
>   #local remainder = mod( i, base );
>   #local out = out + (fraction * remainder);
>   #local i = int(i / base);
>   #local fraction = fraction / base;
>  #end
>
>  out
> #end
>
> The base value is a prime number (the smaller the better), and the index  
> can be
> your brick number.
>
> Get a value out of it with "halton( brick_number, 2 )".
>

> Cheers,
> Edouard.
>

Thanks!

-Nekar Xenos-


Post a reply to this message

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