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