Public Group

# 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?

This topic is 2113 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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

##### Share on other sites

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.

##### Share on other sites

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.

##### Share on other sites

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.

##### Share on other sites
Thanks, everyone. And yeah, guess I can step it up.

##### Share on other sites

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)

• 18
• 29
• 11
• 24
• 20