Game Development Reference
In-Depth Information
Now that we have constraint definitions, we need Jacobians. But to get that
right, I need to tell you a bit more about how I manipulate quaternion expressions.
9.5 Matrix-Based Quaternion Algebra
The quaternion algebra is covered in Chapter 1, so this section is just a simple
translation into language I find useful. The format I use here should help you
implement what is described in this chapter.
First, note that any quaternion q , p
can be represented as a simple four-
dimensional vector. That works for addition and subtraction, obviously. The only
thing needed to make the correspondence complete is to define the quaternion
product in terms of matrix-vector operations, as I do now. Since the quaternion
product of q , p
H
H
is linear in both q , p
R
4 , we can write it as the matrix-
vector product
qp =
Q
( q ) p =
P
( p ) q ,
corresponding to the right and left products, respectively, with the definitions
q s
q 1
q 2
q 3
= q s
= q
T ( q ) ,
q v
q 1
q s
q 3
q 2
G
Q
( q )=
q 2
q 3
q s
q 1
q s I 3 +[ q v ] ×
q v
q 3
q 2
q 1
q s
q s
−q 1
−q 2
−q 3
= q s
= q
T ( q ) ,
q v
q 1
q s
q 3
q 2
P ( q )=
E
q 2
q 3
q s
q 1
q v
q s I 3
[ q v ] ×
q 3
q 2
q 1
q s
where
( q )=
[ q v ] × ,
( q )=
q s I 3 +[ q v ] × ,
G
q v
q s I 3
E
q v
0
x 3
x 2
.
[ x ] × =
x 3
0
x 1
x 2
x 1
0
For the last definition, this means that [ x ] × y = x
×
y . For completeness, the
complex conjugation matrix is
10 0 0
0
= 10
0
, so q =
10 0
00
C
=
C
q .
10
00 0
I
1
Search Nedrilad ::




Custom Search