POV-Ray : Newsgroups : povray.beta-test : Radiosity Status: Giving Up... : Re: Radiosity Status: Giving Up... Server Time
28 Jul 2024 22:19:44 EDT (-0400)
  Re: Radiosity Status: Giving Up...  
From: Warp
Date: 29 Dec 2008 18:25:49
Message: <49595c7d@news.povray.org>
Severi Salminen <sev### [at] notthissaunalahtifiinvalid> wrote:
> And this is the code I use:


>     double x,y,z;

>     do{
>         x = 2.0 * rNG.randomNumberClosed() - 1.0;
>         z = 2.0 * rNG.randomNumberClosed() - 1.0;
>     }
>     while(x*x + z*z > 1.0);

>     y = sqrt(1.0 - (x*x + z*z));


> There you have it: a random vector inside a hemishere.

  You still have to rotate it so that the hemisphere is tangential to
the surface. Probably requires multiplication with a matrix.

-- 
                                                          - Warp


Post a reply to this message

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