|
|
Thanks. You understood correctly a somewhat incomplete explanation. What I
really needed was to rotate vector A by the same amount that base vector B
differs from new vector C (hope this makes sense). Ron seems to have divined
my purpose, so I have the answer.
BTW, you could've written
vlength(A)*vnormalize(B)
Trust me, I woud have understood :)
Margus
Johannes Hubert wrote in message <3722c103.0@news.povray.org>...
>
>Interrupt me if I am wrong ;-) but do I understand you correctly?
>
>You want to rotate a vector such, that it points in the same direction as
>some other vector?
>
>If so, I don't see the need for any rotational math. I would do it like
>this:
>
>Compute the length of vector A.
> lengthA = sqrt(Ax*Ax + Ay*Ay + Az*Az)
>
>Normalize B to length 1. (B')
> lengthB = sqrt(Bx*Bx + Ay*Ay + Az*Az)
> B' = [ Bx/lengthB By/lengthB Bz/lengthB ]
>
>Multiply it with the length of A (B'')
> B''= [ B'x*lengthA B'y*lengthA Bz*lengthA ]
>
>B'' is now the same direction as B and with the length of A.
>
>All in one formula:
>
> [ Bx / lengthB * lengthA ]
> [ ]
> B'' = [ By / lengthB * lengthA ]
> [ ]
> [ Bz / lengthB * lengthA ]
>
>(where lengthA and lengthB as given above)
>
>
>Is that what you want?
>
>
>Johannes.
>
>P.S. So, I'm showing my math in public? I *really* hope I got it right ;-)
>
>
>
Post a reply to this message
|
|