Author Topic: eulerToAxis / axisToEuler  (Read 26834 times)

Not too long ago at a bar during IGC, the topic of quaternions came up and I was informed by my enebriated peers that what I was explaining as a quaternion was actually an Axis Angle and a quaternion was something entirely more complex like a double ended 4 dimensional cone with a spherical base (you can see this by how scary the quaternion wiki page looks compared to the axis angle page).

whoa whoa whoa whoa wait a second, theres bars that talk about this stuff? Wow, that would be a miracle for me to go to one of those bars Because for my career (I would say 'when i grow up' but thats childish and I am almost 'grown up') I am planning on being a game programer (very much like Eric "Badspot" Hartman and Ben Garney) and creating games (probably MOGs too) using the TGE or I would either like to become the head of a great gaming industy(im not fully sure wich type yet, either producing or publishing im pretty sure). I would have my company called: New Vision Inc.              Ok getting back on topic, what is IGC?

whoa whoa whoa whoa wait a second, theres bars that talk about this stuff? Wow, that would be a miracle for me to go to one of those bars Because for my career (I would say 'when i grow up' but thats childish and I am almost 'grown up') I am planning on being a game programer (very much like Eric "Badspot" Hartman and Ben Garney) and creating games (probably MOGs too) using the TGE or I would either like to become the head of a great gaming industy(im not fully sure wich type yet, either producing or publishing im pretty sure). I would have my company called: New Vision Inc.              Ok getting back on topic, what is IGC?
LOL

http://www.google.com/#q=igc+game
The second hit buddy.
Google is your friend, use it.
« Last Edit: December 03, 2009, 05:37:55 PM by BobAndRob »

Where do you put the script then?

Where do you put the script then?
If you don't know where to put it, I don't think you need to use it.

If you don't know where to put it, I don't think you need to use it.
Infact, sir. I am creating a map and im tired of spawning single loving trees across the map. So this tutorial would be helpfull.

EDIT: Wait.....nvm I think its console :/

Return Of Edit: Wtf.....nope...
« Last Edit: December 12, 2009, 09:37:32 PM by Tyler66 »

Infact, sir. I am creating a map and im tired of spawning single loving trees across the map. So this tutorial would be helpfull.

EDIT: Wait.....nvm I think its console :/

Return Of Edit: Wtf.....nope...

I don't think you need to use it.
Quote for truth.

Infact, sir. I am creating a map and im tired of spawning single loving trees across the map. So this tutorial would be helpfull.

EDIT: Wait.....nvm I think its console :/

Return Of Edit: Wtf.....nope...
This has nothing to do with spawning trees.
This part: "EDIT: Wait.....nvm I think its console :/"
means you have no idea what you're talking about.

 :cookieMonster:
It's helpful thank's!

Code: [Select]
function axisToEuler(%axis)
{
%angleOver2 = getWord(%axis,3) * 0.5;
%angleOver2 = -%angleOver2;
%sinThetaOver2 = mSin(%angleOver2);
%cosThetaOver2 = mCos(%angleOver2);
%q0 = %cosThetaOver2;
%q1 = getWord(%axis,0) * %sinThetaOver2;
%q2 = getWord(%axis,1) * %sinThetaOver2;
%q3 = getWord(%axis,2) * %sinThetaOver2;
%q0q0 = %q0 * %q0;
%q1q2 = %q1 * %q2;
%q0q3 = %q0 * %q3;
%q1q3 = %q1 * %q3;
%q0q2 = %q0 * %q2;
%q2q2 = %q2 * %q2;
%q2q3 = %q2 * %q3;
%q0q1 = %q0 * %q1;
%q3q3 = %q3 * %q3;
%m13 = 2.0 * (%q1q3 - %q0q2);
%m21 = 2.0 * (%q1q2 - %q0q3);
%m22 = 2.0 * %q0q0 - 1.0 + 2.0 * %q2q2;
%m23 = 2.0 * (%q2q3 + %q0q1);
%m33 = 2.0 * %q0q0 - 1.0 + 2.0 * %q3q3;
return mRadToDeg(mAsin(%m23)) SPC mRadToDeg(mAtan(-%m13, %m33)) SPC mRadToDeg(mAtan(-%m21, %m22));
}
« Last Edit: August 13, 2012, 05:37:27 PM by Ipquarx »


Go away.
calm down, i'm not doing anything wrong, i just posted a oh noes picture under some complicated looking code. harmless.

How does the axis angle system work? The Wikipedia article confuses me.

I'm used to euler angles so I'll use the functions.

For you aviation nuts out there, I have figured out the Euler angles for a flying vehicle. Pitch is Euler angle #1, roll is Euler angle #2, and yaw is Euler angle #3.
« Last Edit: July 11, 2012, 08:02:31 PM by Axolotl »

How does the axis angle system work? The Wikipedia article is way too complicated to understand the first paragraph
axistoeuler(0.5 0.5 0.5 pi) is 30 -135 -135
existoeuler(0.5 0 0 pi) is 0 -180 -180
What
How does the return of these functions work

Ok it seems to be that when rotation around ONE axis the rotation is x y z f, where i.e. x*f is the angle around the x axis and y and z are 0.
This works as long as you rotate around one axis.
When you rotate around multiple axis, it's like
wat
????

Ok I think I kinda figured it out...
xyz defines a vector3 and the object is then rotated f degrees around the vector