POV-Ray : Newsgroups : povray.general : Even distribution on a sphere : Re: Even distribution on a sphere Server Time
5 Aug 2024 08:21:38 EDT (-0400)
  Re: Even distribution on a sphere  
From: Tom Melly
Date: 15 Oct 2002 10:20:52
Message: <3dac2444@news.povray.org>
"Tom Melly" <tom### [at] tomandlucouk> wrote in message
news:3dac1e3c@news.povray.org...
>
> Hmm, this seems to work for a hemisphere (which is all I need - although I'm
> going to try and figure out how to make it work with any specified max angle).
>
> // okay where MZRot = 90
> #local ZRot = pow(rand(Rand1),0.5) * MZRot;
> #local YRot = rand(Rand1) * MYRot;
>


and this (rather kludgy) approach seems to work for a specified MZRot:

    #local ZRot = pow(rand(Rand1),0.5) * 90;
    #local YRot = MYRot*rand(Rand1);
    #if(rand(Rand1)<0.5)
      #local ZRot = 180 - ZRot;
    #end
    #if(ZRot <= MZRot)
            .... position coral
            ..... increment counter
    #end


Post a reply to this message

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