POV-Ray : Newsgroups : povray.general : Even distribution on a sphere : Even distribution on a sphere Server Time
5 Aug 2024 08:19:59 EDT (-0400)
  Even distribution on a sphere  
From: Tom Melly
Date: 15 Oct 2002 07:03:11
Message: <3dabf5ef$1@news.povray.org>
Okay, I'm trying to randomly distribute objects, using trace, on a sphere.

So, I do something like:

RotZ = 180*rand(R1)
RotY = 360*rand(R1)
Trans = transform(translate y*10 rotate z*RotZ rotate y*RotY)
TVec = vtransform(<0,0,0>, Trans)
Inter = trace(Ob, TVec, -TVec)


The trouble is that I end up with a bunching of objects at the poles for all the
obvious reasons, so the question is, how do I best avoid this? I assume it's
something like:
ZRotFac = 1 + pow(abs((ZRot/90)-1),2);
ZRot = ZRot * ZRotFac

But,

a) is this correct? (well, it's not, afaik - the range 1..2 is too limited imho)
b) if not, what is?

--
#macro A(V,B,C,R)#while(B-256)#if(V-128/B>=0)sphere{0,.5translate<C-4R-1,9>
pigment{rgb<1-C/8R/2C/8>}}#local V=V-128/B;#end#local B=B*2;#local C=C+1;#
end#end A(234,1,0,2)A(85,1,0,1)A(81,1,0,0)light_source{-5 1}//Tom Melly


Post a reply to this message

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