# Rotation vector?

hi everyone.

in 3dsmax SDK ive got a structure named MAXPOS (float x,y,z,w). 3dsmax usues this struct also for storing rotation vector (?). my problem is that i dont know how to code it. For example:

Ive got a vector (0.5, 0.5, 0) and a the rotation vector (0, 0, 0.707, 0.707). in the editor i sees this point rotated 90 deg with z axis. What is the formula to calculate it?
0.707 is exacly sin(PI/3) but i want PI/2!

thanks for unlighting my mind.

0.707 is exacly sin(PI/3) but i want PI/2!

Erm, my calculator says sin(pi/3) is 0.8660… 0.707 as you mention is probably 1/sqrt(2).

0.7071 = sin( pi/4 ) = cos( pi/4 )
pi / 4 = 45 degrees

I found a useful rotation vector tutorial on www.makegames.com/3drotation

Barry

I found a useful rotation vector tutorial on www.makegames.com/3drotation

iam absolutely green in quaternations, and i dont know how to process object rotating with only four values. they differ of what i see in my 3dstudio. the seems to be some trig functions, but their values arent equival to these i have.

I found a useful rotation vector tutorial on www.makegames.com/3drotation

iam absolutely green in quaternations, and i dont know how to process object rotating with only four values. they differ of what i see in my 3dstudio. the seems to be some trig functions, but their values arent equival to these i have.

If ( 0,0,.707,.707) is a quaternion, then it means rotate 90 degrees around the z axis.

Here’s code to convert axis/rotation to quaternion:

Quaternion::Quaternion( Vector3f const & axis, float angle )
{
assert( axis.IsNormalized() );

double const s = sin( angle * .5f );
double const c = cos( angle * .5f );

m_X = double( axis.m_X ) * s;
m_Y = double( axis.m_Y ) * s;
m_Z = double( axis.m_Z ) * s;
m_W = c;
}

Thanks!

This is just what I wanted 