Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

rotation terminologies?

Name: Anonymous 2006-09-26 19:17

Okay so I'm codifying everything in this mathematics book for 3D engine programming into C++.  I have finished my Quaternion class to do what it's supposed to do.  And one of my functions is:


Quat& Quat::fromEuler(const float alpha, const float beta, const float gamma)
{
    Quat Qx(cos(alpha/2),    sin(alpha/2),    0.0f,    0.0f);
    Quat Qy(cos(beta/2),    0.0f,    sin(beta/2),    0.0f);
    Quat Qz(cos(gamma/2), 0.0f,    0.0f,    sin(gamma/2));

    return *this = Qx * Qy * Qz;
}

Okay I know this works, the math copied straight from the book and triple-checked it with other sources.

However, the book didn't really mention this one way or another, but am I guessing correctly that the alpha, beta, and gamma are the same thing as roll, pitch, and yaw?  I want to write an Angles class now that lets me encapsulate Quaternions inside them "invisibly" so I can express everything as roll, pitch, and yaw without worrying about Gimbal lock, but I'm not sure if these Euler angles are the same thing or not.  I just find it easiest to think in the roll, pitch, yaw mindset since it just seems the most intuitive to me.

It's not the math itself that confuses me this time, just vague on the terminologies.

Name: Anonymous 2006-09-26 19:32

And on a related but less important note, this textbook uses vectors as vertices.  I know this is technically okay to do, since, like vertices, they're just a tuple of x, y, z values.  But... it still seems somewhat "unclean", because vectors still *aren't vertices*.  Perhaps there's some profound "a-ha!" reason why the book doesn't use an explicit "vertex" notation later on, maybe in collision detection or shadow culling?  Maybe it has to do with the fact that you do treat vertices as if they're vectors when you calculate the perpendicular normal of a polygon?

Name: Anonymous 2006-09-27 14:06

ROTATE

Name: Anonymous 2006-09-27 20:08

they treat the vertices as vectors because it comes from linear algebra and the point is a solution to a multivariable system.  also, it makes a bit more intuitive sense to rotate a vector than a point.  anyway, your quaternions are determined by the amount of rotation and where youre rotating about.

most familiarly, your Qz would look like rotation about the origin on the x-y plane, since youre ignoring z.  so, yes, it is yaw.  your matrix for this rotation is

[cos(gamma/2)    0           ]
[0               sin(gamma/2)]

though i dont know why you have 1/2 of the angle, maybe im forgetting something?  but anyway, that sends x to cos(gamma/2)x and y to sin(gamma/2)y;  effectively it moves them along a circle on the plane.  comparitively, roll does this on the y-z plane and pitch on the x-z plane.

your alpha, beta, and gamma are then your angle of rotation about the x, y, z axis.  your guess that this is roll, pitch, yaw is correct.

Don't change these.
Name: Email:
Entire Thread Thread List