POV-Ray : Newsgroups : povray.off-topic : Random vector through a hemisphere? : Random vector through a hemisphere? Server Time
10 Oct 2024 21:16:51 EDT (-0400)
  Random vector through a hemisphere?  
From: Severi Salminen
Date: 17 Feb 2008 06:15:13
Message: <47b81741$1@news.povray.org>
I'm trying to create a random uniformly distributed vector through a
hemisphere positioned at the intersection point between ray and an
object. I can already create a random vector but how do I quickly/easily
rotate it based on the desired hemisphere orientation?

I use left-handed coordinate system: x is right, y is up, and z is forward.

Let's have a vector V which is random vector inside a hemisphere which
has a pole at 0,1,0 (just like the northern hemisphere of Earth). I want
to orient the vector inside a hemisphere which has a pole pointing at
vector N. How do I do this? I'd prefer something that can be done
without expensive trigonometric functions or complex transformations -
if possible.

Example:

V = (0.71, 0.71, 0) //The random vector in "northern hemishpere")
N = (-1,0,0) //The pole I want to orientate the random vectors to)

The result should be like this or any other vector that results the same
distribution:

Vnew = (-0.71, 0.71, 0)

Any ideas? I got one idea from comp.graphics.algorithms but it doesn't
seem to work properly:

Vnew = Vec (dot (V, S), dot (V, N), dot (V, T))

Where N = normal, V the initial random vector in northern hemisphere, S
and T are tangents of the normal orthogonal to each other.


Post a reply to this message

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