*On 14/01/2009 at 21:10, xxxxxxxx wrote:*

User Information:

Cinema 4D Version: R9-11

Platform: Windows ; Mac ; Mac OSX ;

Language(s) : C++ ;

---------

How exactly would one convert a (direction) Vector into a Quaternion so that one could then use QSlerp() to do an interpolation (between two Vectors) and then retrieve the new Quaternion as a Vector? I know this is more a general mathematics question but I'm having difficulties with RotAxisToMatrix(!(v2%v1), VectorAngle(v2, v1)) trying to do something similar. Quaternions aren't as temporamental but they also aren't easily wedged in and out of Vector maths.

*On 14/01/2009 at 21:10, xxxxxxxx wrote:*

User Information:

Cinema 4D Version: R9-11

Platform: Windows ; Mac ; Mac OSX ;

Language(s) : C++ ;

---------

How exactly would one convert a (direction) Vector into a Quaternion so that one could then use QSlerp() to do an interpolation (between two Vectors) and then retrieve the new Quaternion as a Vector? I know this is more a general mathematics question but I'm having difficulties with RotAxisToMatrix(!(v2%v1), VectorAngle(v2, v1)) trying to do something similar. Quaternions aren't as temporamental but they also aren't easily wedged in and out of Vector maths.

*On 15/01/2009 at 01:36, xxxxxxxx wrote:*

Basically you create a rotation matrix by setting one of the matrix vectors to the direction vector and create perpendicular vectors for the other two matrix vectors. As a direction vector alone is not well defined you have to make a decision which of the matrix vectors you fill with what. Then you initialize the quaternion with the rotation matrix.

cheers,

Matthias

*On 15/01/2009 at 10:48, xxxxxxxx wrote:*

Howdy,

You can also use

> `Quaternion::SetAxis(const Vector& axis, Real wink)`

... where axis is your vector and wink can be some arbitrary value. As long as wink is the same value for both vectors, you should be able to get the correct slerp. ;o)

Adios,

Cactus Dan

*On 15/01/2009 at 16:31, xxxxxxxx wrote:*

Ah. Wasn't sure what to do about wink. ;) :)

Thanks, Dan.

]]>*On 15/01/2009 at 20:41, xxxxxxxx wrote:*

Howdy,

You're welcome. ;o)

Adios,

Cactus Dan