Graphics Reference
In-Depth Information
where
|
q
|
is the magnitude, or modulus, of q , and is equal to
= s 2 + x 2 + y 2 + z 2
q
(7.94)
It can also be shown that
qq 1 = q 1 q = 1
(7.95)
7.7.5 Rotating Points about an Axis
Basically, quaternions are associated with vectors rather than individual points.
Therefore, in order to manipulate a single vertex, we must first turn it into a
position vector, which has its tail vertex at the origin. A vertex can then be
represented in quaternion form by its equivalent position vector and a zero
scalar term. For example, a point P ( x , y , z ) is represented in quaternion form
by
p =[0+ x i + y j + z k ] (7.96)
which can then be transformed into another position vector using the process
described below. The coordinates of the rotated point are the components of
the rotated position vector. This may seem an indirect process, but in reality
it turns out to be rather simple. Let's now consider how this is achieved.
It can be shown that a position vector p can be rotated about an axis by
some angle using the following operation:
p = qpq 1
(7.97)
where the axis and angle of rotation are encoded within the unit quaternion
q , whose modulus is 1, and p is the rotated vector. For example, to rotate a
point P ( x , y , z ) through an angle θ about an axis, we use the following steps:
1
Convert the point P ( x , y , z ) to a quaternion p :
p =[0+ x i + y j + z k ]
2
Define the axis of rotation as a unit vector u :
u =[ x u i + y u j + z u k ]
3
Define the transforming quaternion q :
q =[cos( θ/ 2) , sin( θ/ 2) u ]
Define the inverse of the transforming quaternion q 1 :
4
q 1 =[cos( θ/ 2) ,
sin( θ/ 2) u ]
Compute p :
5
p = qpq 1
Search WWH ::




Custom Search