|
![](/i/fill.gif) |
(Will anyone ever read this?)
> > Ron Parker wrote:
> > > Do you happen to have a formula that will translate a random
> > > vector in the unit cube between <0,0,0> and <1,1,1> into a set
> > > of basis vectors and give uniform coverage of the space of all
> > > possible basis vectors? I seem to have left mine in my other
> > > coat.
>
> Anton Sherwood wrote:
> > I'll think about it some more, and come up with a dumb idea.
Anton Sherwood wrote:
> Got it. (I'll call your random vector <rx,ry,rz>)
> [...code...]
A year later, it hits me that this ought to work just as well:
rotate <360*rx, degrees(asin(1-2*ry)), 360*rz>
(though of course one wouldn't really use degrees arithmetic)
Choosing a basis is equivalent to choosing a point on the sphere and a
rotation around it. My first code essentially did it in that order.
The reverse looks more efficient.
--
Anton Sherwood, http://www.ogre.nu/
Post a reply to this message
|
![](/i/fill.gif) |