Beruflich Dokumente
Kultur Dokumente
cos() sin()
sin() cos()
a b
b a
S
1
Nurit Haspel CS612 - Algorithms in Bioinformatics
Rotations and Translations
Combining rigid body translations and rotations.
SE(n) special Euclidean groups:
SE(n) =
R V
0 1
90
90
180
R =
cos() sin()
sin() cos()
x
1
y
1
z
1
x
2
y
2
z
2
x
3
y
3
z
3
R
11
R
12
R
13
R
21
R
22
R
23
R
31
R
32
R
33
SO(3)
Nurit Haspel CS612 - Algorithms in Bioinformatics
Performing a Rotation on a Vector
R
11
R
12
R
13
R
21
R
22
R
23
R
31
R
32
R
33
v
x
v
y
v
z
R
11
v
x
+ R
12
v
y
+ R
13
v
z
R
21
v
x
+ R
22
v
y
+ R
23
v
z
R
31
v
x
+ R
32
v
y
+ R
33
v
z
1 0 0
0 cos sin
0 sin cos
R
y
() =
cos 0 sin
0 1 0
sin 0 cos
R
z
() =
cos sin 0
sin cos 0
0 0 1
z
= 30
y
z
= 45
= 15
R(, , ) =
cos cos cos sin sin sin cos cos sin cos + sin sin
sin cos sin sin sin + cos cos sin sin cos cos sin
sin cos sin cos cos
cos sin 0
sin cos 0
0 0 1
1 0 0
0 cos sin
0 sin cos
cos sin 0
sin cos 0
0 0 1
, 30
, 45
cos sin 0
sin cos 0
0 0 1
1 0 0
0 1 0
0 0 1
cos sin 0
sin cos 0
0 0 1
cos( + ) sin( + ) 0
sin( + ) cos( + ) 0
0 0 1
v
2
h = cos
2
+ (v
1
sin
2
)i + (v
2
sin
2
)j + (v
3
sin
2
)k
h = cos
2
+ v sin
2
h = cos
2
v sin
2
Nurit Haspel CS612 - Algorithms in Bioinformatics
Operations on Quaternions Multiplication
Given two quaternions h
1
= a
1
+ ib
1
+ jc
1
+ kd
1
,
h
2
= a
2
+ ib
2
+ jc
2
+ kd
2
Assume v = [b, c, d], like a 3-D vector.
h
1
h
2
= a
3
+ ib
3
+ jc
3
+ kd
3
Where:
a
3
= a
1
a
2
b
1
b
2
c
1
c
2
d
1
d
2
b
3
= a
1
b
2
+ a
2
b
1
+ c
1
d
2
c
2
d
1
c
3
= a
1
c
2
+ a
2
c
1
+ b
2
d
1
b
1
d
2
d
3
= a
1
d
2
+ a
2
d
1
+ b
1
c
2
b
2
c
1
h1 h2 = (a
1
a
2
v
1
v
2
, a
1
v
2
+ a
2
v
1
+ v
1
v
2
)
v
1
v
2
is the dot product of v
1
and v
2
, v
1
v
2
is the cross
product.
Nurit Haspel CS612 - Algorithms in Bioinformatics
Operations on Quaternions Rotation
Given a quaternion h = a + bi + cj + dk, dene its conjugate
quaternion h = a bi cj dk:
Transform point p(x, y, z) by sandwiching: h p h
Treat p as a quaternion with no real component (a=0).
The rotated point p
(x
, y
, z
= q
.
Sandwiching: S
h
(v) = h v h
(S
h1
S
h2
)(v) = S
h1
(S
h2
(v)) = S
h1
(h
2
vh
2
) =
h
1
(h
2
vh
2
)h1
= (h
1
h
2
)v(h
2
h
1
) = S
h
1
h
2
(v)
Nurit Haspel CS612 - Algorithms in Bioinformatics
Operations on Quaternions Useful Examples
a b c d Description
1 0 0 0 Identity, no rotation
0 1 0 0 180
0.5
0.5 0 0 90
0.5 0
0.5 0 90
0.5 0 0
0.5 90
0.5 -
0.5 0 0 -90
0.5 0 -
0.5 0 -90
0.5 0 0 -
0.5 -90
around Y axis
v = [0, 1, 0] (the rotation axis, which is the Y axis).
= 90
.
h = cos
2
+ (v
1
sin
2
)i + (v
2
sin
2
)j + (v
3
sin
2
)k =
0.5 + 0 i +
0.5 j + 0 k
h =
0.5 +
0.5 j
h =
0.5
0.5 j
Say p = [1, 2, 3] = 1 i + 2 j + 3 k
Transforming p:
p
= hph = (
0.5+
0.5
0.5j )
Nurit Haspel CS612 - Algorithms in Bioinformatics
Example Rotation by 90
around Y axis
Transforming p:
p
= hph = (
0.5+
0.5
0.5j )
h
1
h
2
= a
3
+ ib
3
+ jc
3
+ kd
3
Where:
a
3
= a
1
a
2
b
1
b
2
c
1
c
2
d
1
d
2
b
3
= a
1
b
2
+ a
2
b
1
+ c
1
d
2
c
2
d
1
c
3
= a
1
c
2
+ a
2
c
1
+ b
2
d
1
b
1
d
2
d
3
= a
1
d
2
+ a
2
d
1
+ b
1
c
2
b
2
c
1
p h = 2
0.5,
0.5 +3
0.5,
0.5 2, 3
0.5
0.5 =
2
0.5, 3.5
0.5, 2
0.5, 2.5
0.5
h p h = 2
0.5
0.5 2
0.5
0.5, 3.5
0.5
0.5 + 2.5
0.5
0.5, 2
0.5
0.5 + 2
0.5
0.5, 2.5
0.5
0.5 3.5
0.5
0.5
h p h = 0, 3, 2, 1
Nurit Haspel CS612 - Algorithms in Bioinformatics
Quaternions Vs. Matrices
A quaternion needs 4 doubles instead of 9
Sandwiching takes 28 multiplications while matrices need 9
Composing rotations takes 16 multiplications with quaternions
and 27 for matrices
When composing matrices, numerical inaccuracies lead to
distortions. Vectors are no longer orthonormal and angles are
distorted.
Quaternions do not distort angles and renormalization is just a
division by the quaternion magnitude : q = q/|q|
In interpolation with matrices R(t) = (1 t)R0 + tR1, R(t)
does not represent a rotation.
With q(t) = (1 t)q0 + tq1, q(t)/|q(t)| is a valid rotation
Nurit Haspel CS612 - Algorithms in Bioinformatics
Some Resources
http://mathworld.wolfram.com/RotationMatrix.html
http://mathworld.wolfram.com/EulerAngles.html
http://mathworld.wolfram.com/Quaternion.html
Nurit Haspel CS612 - Algorithms in Bioinformatics
Problems in Structural Bioinformatics
Protein folding.
Protein structural alignment
and motif discovery.
Protein-protein docking.
Protein-drug interaction.
...
Nurit Haspel CS612 - Algorithms in Bioinformatics