|
|
Paris scripsit::
> My "random cone" function produces a uniformly distributed set
> of points that are, at maximum, S steradians deviated from Y+ (ie <0,1,0>).
Rewrite it to take N directly instead of Y!
Or publish it...
> The bundle of such random unit vectors are in a "solid cone angle" that is
> centered about Y+ and S steradians wide. I then project this random vector
> into an "axis system" that is built up around N. (U, V, W orthogonal basis
> vectors). The final result is N, deviated randomly, but at most maximally
> deviated by S steradians. Repeated over and over, this gives rise to a
> bundle of random vectors who are all contained in a "cone" that has N as
> its principle axis.
>
>>> [3] I then project the random vector from [1] into the "axis system" in [2].
>> I would have rotated [y] to match [N] but that the same thing.
>
> That requires something like 6 trigonometric function calls. It is
> ridiculously slow. First you have to take 2 arc-sines in order to obtain
> phi and theta. Then you have to perform 2 more trig functions each for each
> rotation. That is just not feasible, don't you agree?
Nop! Only one rotation please!
Stop thinging in your fixed referential.
You need the vector product of Y and N, let's call it A. Of course,
you have to trap Y aligned with N... (two trivial cases)
You then need to rotate V, your deviated Y, around A so that Y
become N. That's what vaxis_rotate is made for!
UNTESTED CODE :
/* it DOES produce banding */
/* You might want to allow for a larger zone than strict equality
=0 and =2... replaced with <allowance and >2-allowance */
#macro Change(V,Y,N)
#local delta=vlength(Y-N);
#if (delta=2)
-V
#else
#if (delta=0)
V
#else
#local A = vcross(Y,N); /* check the left/right hand, I did not */
#local Ang= degrees(acos(vdot(Y,N)));
vaxis_rotate(V,A,Ang)
#end
#end
#end
--
Eifersucht ist die Leidenschaft, die mit Eifer sucht, was Leiden
schafft.
Eco: -8.75 Soc: -6.72
http://www.politicalcompass.org/
Post a reply to this message
|
|