View Full Version : Rotation vector?

Michalek366

11-26-2001, 01:29 AM

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).

bsperlin

11-26-2001, 06:41 AM

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

pi / 4 = 45 degrees

I found a useful rotation vector tutorial on www.makegames.com/3drotation (http://www.makegames.com/3drotation)

Barry

Michalek366

12-21-2001, 12:24 AM

I found a useful rotation vector tutorial on www.makegames.com/3drotation (http://www.makegames.com/3drotation)

nothing about my problem.

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.

Michalek366

12-21-2001, 12:33 AM

I found a useful rotation vector tutorial on www.makegames.com/3drotation (http://www.makegames.com/3drotation)

nothing about my problem.

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.

Jambolo

12-21-2001, 11:38 AM

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;

}

Michalek366

01-14-2002, 02:37 AM

Thanks!

This is just what I wanted http://www.opengl.org/discussion_boards/ubb/wink.gif

Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.