POV-Ray : Newsgroups : povray.unofficial.patches : crackle: suggested extensions : Re: crackle: suggested extensions Server Time
1 Sep 2024 18:17:58 EDT (-0400)
  Re: crackle: suggested extensions  
From: Anton Sherwood
Date: 6 Jun 2002 22:21:22
Message: <3D00188D.86C4C89E@pobox.com>
(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

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