Quaternions: Can you multiply it with vertices, so that the vertices can be affine transformed (rotated on a non-origin point) by an arbitrary axis?

Started by
4 comments, last by Paradigm Shifter 10 years, 6 months ago

I'm starting to learn more about quaternions and its geometric meaning in the world of computer graphics.

From reading a borrowed book late in the night, I recall that one of its geometric meaning is that it can rotate a model once by an arbitrary axis spherically.

Can it allow affine transformation, so that a vertex Vn in an object space be rotated by a point (x + O1, y + O2, z + O3), where (O1, O2, O3) is the object space origin, and Vn is one of the vertices in a vertex buffer object?

Unless I have to re-borrow the book again...

Advertisement


Can it allow affine transformation, so that a vertex Vn in an object space be rotated by a point (x + O1, y + O2, z + O3), where (O1, O2, O3) is the object space origin, and Vn is one of the vertices in a vertex buffer object?

With quaternions rotation and scaling (and hence mirroring) can be expressed, but not translation (AFAIK). The usual case is rotation what requires the quaternion to be of unit length.

It is possible to rotate a position vector, as is described e.g. here. As with other rotation representations, the axis' of rotation direction is encoded in the rotation, but passes through the current (0,0,0) and hence may need to be translated explicitly if required.

As haegarr said, a unit quaternion represents a rotation in the vector space R^3, but it cannot represent a translation. You can represent a "movement" (which I define as an affine transformation that preserves distances and orientation) as the composition of a translation and a rotation, and the quaternion is a fine way to encode the rotation.

Looks like you got your answer. Just as an aside, I think it's safe to step up from the beginners section with questions like this, lol.

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.
Thanks, everyone. And yeah, guess I can step it up.

Maths and physics is the quaternion questions forum.

The point transform operation pointout = q * pointin * q-1 (where the point is pure imaginary i.e. the w component is 0) maps the origin to the origin so to rotate around a point you need to translate the object so its centre of rotation is at the origin, rotate the object and rotate the translation you applied, then apply the negated rotated translation to the object again.

Matrix multiplication also maps the origin to the origin, but in homogeneous coordinates the origin is actually (0, 0, 0, 1) and translation is possible. (Note the "real" origin (0, 0, 0, 0) isn't a valid element of homogeneous space and is indeed mapped to (0, 0, 0, 0) by multiplication by any 4x4 matrix).

EDIT: That is because matrix multiplication is a linear mapping, i.e.

f(k * a) = k * f(a)

and f(a + b) = f(a) + f(b)

from which we see f(0) = f(0 * a) = 0 * f(a) = 0. (Alternatively, f(0) = f(a + (-a)) = f(a) + f(-a) = f(a) - f(a) = 0)

"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley

This topic is closed to new replies.

Advertisement