POV-Ray : Newsgroups : povray.general : Even distribution on a sphere Server Time
5 Aug 2024 14:19:44 EDT (-0400)
  Even distribution on a sphere (Message 21 to 24 of 24)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Johannes Dahlstrom
Subject: Re: Even distribution on a sphere
Date: 21 Oct 2002 07:27:27
Message: <3db3e49e@news.povray.org>
Christopher James Huff wrote:

> I meant that stars are not distributed so the angular distances between
> each one and the nearest neighbor as seen from earth are approximately
> equal. Stars are not "evenly distributed", they are closer to being
> "randomly distributed". I think that approximately matches what you
> said, but I'm not sure. ;-)
>

Yep, that's essentially what I *tried* to say ;) Should've checked my 
message more carefully before sending, the last sentence ("...so that...") 
doesn't make much sense now. It should read something like "so that the 
distances between every point and its nearest neighbout are roughly equal", 
which is, of course, exactly what you said.

But this is getting a bit off-topic, as it's clear by now that what Tom 
wants is not an even distribution by the definition above, but a *flat* 
random distribution on a sphere :)


Post a reply to this message

From: Jellby
Subject: Re: Even distribution on a sphere
Date: 21 Oct 2002 17:11:47
Message: <3db46d92@news.povray.org>
Tom Melly wrote:

> 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,
> 

I'd say you need for RotZ a random distribution with probability 
proportional to sin(RotZ) (i.e. values close to 90 are more likely than 
values close to 0 or 180). So the problem is to get such a distribution 
from the uniform one that rand(x) gives (or should give). I'm not sure if 
asin(rand(x)) would do the trick (you'd have to make it fit into 0-180, I 
guess not.
You could try picking two random numbers, x and y, if y < sin(x) then RotZ = 
180*x


Post a reply to this message

From: Jellby
Subject: Re: Even distribution on a sphere
Date: 21 Oct 2002 17:16:58
Message: <3db46eca@news.povray.org>
Jellby wrote:

> You could try picking two random numbers, x and y, if y < sin(x) then RotZ
> = 180*x

Sorry, it's partly wrong and incomplete.

1. pick x and y
2. if y < sin(180*x) then RotZ = 180*x
3. else, go to 1

-- 
Ignacio Fernández Galván
Linux User #289967 (counter.li.org)
PGP Pub Key ID: 0x01A95F99 (pgp.escomplinux.org)


Post a reply to this message

From: nospam
Subject: Re: Even distribution on a sphere
Date: 21 Oct 2002 21:03:04
Message: <3db4620b.16446571@localhost>
On Fri, 18 Oct 2002 19:57:36 +0100, "Tom & Lu Melly"
<all### [at] tomandlucouk> wrote:

>
>I *think* you've misunderstood - it's avoiding the clumping of distribution
>at the poles that I'm trying to avoid. Of course the random numbers are
>evenly distributed - it's just that when you use them to rotate z, then y,
>you tend to get clumping at the top and bottom.
>
>

Pardon me for jumping in late.  If you just want to scatter
stuff on a sphere randomly without clumping at the poles,
it can be done.  I'll post source on povray.text.scene-files.
The subject should be "random points on a sphere"


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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