Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
CS Dept, UK1
CS 633 Computer Animation
Department of Computer Science
College of Engineering
University of Kentucky
Fuhua (Frank) Cheng
CS Dept, UK2
1. Introduction
1.1 What is Computer Animation
the process of using
“continuous image” to
convey information
deals with motion
CS Dept, UK3
1. Introduction
1.2 Applications
- motion films(https://www.youtube.com/watch?v=D0a0aNqTehM)
- television
- advertising(read Chapter 1)
CS Dept, UK4
2. Technical Background
The display pipeline:
Object space -
World space -
Eye space –
viewing parameters
field of view
Image space -
Screen space -
CS Dept, UK5
2. Technical Background
Ray Casting:
- act of tracing
rays through
world space
CS Dept, UK6
2. Technical Background
Ray Casting:
- implicitly
accomplishes
the perspective
transformation
(HOW ?)
CS Dept, UK7
2. Technical Background
Homogeneous Coordinates:
- why do we want to use homogeneous
coordinates ?
CS Dept, UK8
2. Technical Background
Transformation Matrices:
CS Dept, UK9
2. Technical Background
Compounding Transformations:beforeafter
CS Dept, UK10
2. Technical Background
Basic Transformations:
Translation
Rotation
Scaling (reflection)
CS Dept, UK11
Representing an arbitrary orientation:
Fixed angle representation
CS Dept, UK12
Representing an arbitrary orientation:
CS Dept, UK13
Representing an arbitrary orientation:
CS Dept, UK14
Representing an arbitrary orientation:
CS Dept, UK15
Representing an arbitrary orientation:
• Interpolation is difficult
CS Dept, UK16
Representing an arbitrary orientation:
0) ,90 ,0( )90 ,45 ,90(
90
90
45
90
Direct interpolation = ((0, 90, 0) + (90, 45, 90))/2
= (45, 67.5, 45)
CS Dept, UK17
Representing an arbitrary orientation:
0) ,90 ,0( )90 ,45 ,90(
90
90
45
90
Question: Is (45, 67.5, 45) coplanar with (0, 90, 0) and
(90, 45, 90) ?
CS Dept, UK18
Representing an arbitrary orientation:
0) ,90 ,0( )90 ,45 ,90(
90
90
4590
Desired interpolation = (90, 67.5, 90)
5.6790
CS Dept, UK19
Quaternions
Motivation:
multiplying complex numbers can be
interpreted as a rotation in two dimensions.
Can hyper-complex numbers be defined
so their multiplication can be viewed as
a rotation in three dimensions?
)(
21212121
iii
errerer
CS Dept, UK20
Quaternions
Remember that a general
rotation in three dimension
is defined by four numbers:
one for rotation angle
and three
for rotation axis
CS Dept, UK21
Quaternions: several approaches
1. 2 × 2 matrices of complex numbers
where
CS Dept, UK22
Quaternions: several approaches
2. Four dimensional vector space
one of the bases:
where4x4 Identity matrix
CS Dept, UK23
Quaternions: several approaches
3. Combination of a scaler and a vector
Conjugate quaternion:
Sum/difference:
CS Dept, UK24
Quaternions: several approaches
Product:
Norm:
Inverse:
Division:
Inner product Cross product
CS Dept, UK25
Representing rotations using quaternion:
CS Dept, UK26
Representing rotations using quaternion:
Rotate a point P by an angle about a unit
axis u:
CS Dept, UK27
Representing rotations using quaternion:
1. Represent the point P as
[0, r] ( or, [ 0, P ] )
2. represent the rotation by a quaternion
3. perform the rotation
CS Dept, UK28
Representing rotations using quaternion:
1. Represent the point P as
[0, r] ( or, [ 0, P ] )
2. represent the rotation by a quaternion
3. perform the rotation
CS Dept, UK29
Representing rotations using quaternion:
Example: Consider a rotation of point
P = (0, 1, 1) about the y-axis.
After rotation, we should get
= (1, 1, 0)
Would we?
90
P
P P’
CS Dept, UK30
Representing rotations using quaternion:
CS Dept, UK31
Representing rotations using quaternion:Hence,
CS Dept, UK32
Representing rotations using quaternion:
CS Dept, UK33
Representing rotations using quaternion:
Prove that the triple product indeed
performs a rotation of P about u.
First,
Note
that
CS Dept, UK34
CS Dept, UK35
Now prove that would give us
]2
sin,2
[cos ]2
sin2
cos,2
sin[
]2
sin,2
[cos
]2
sin2
sin02
cos,2
sin02
[cos
]2
sin,2
[cos],0[]2
sin,2
[cos
],0[ 1
ururru
u
ruurru
uru
qrq
CS Dept, UK36
Now prove that would give us
]2
sin2
sin2
cos
2sin
2cos
2cos
2sin
,2
sin2
sin2
cos2
cos2
sin[
]2
sin,2
[cos ]2
sin2
cos,2
sin[
2
22
2
uruur
rururu
uruurru
ururru
CS Dept, UK37
Now prove that would give us
]2
sin
2sin
2cos
2sin)(sin,0[
]2
sin2
sin2
cos
2sin
2cos
2cos
2sin
,2
sin2
sin2
cos2
cos2
sin[
2
222
2
22
2
uur
rrururu
uruur
rururu
uruurru
urururu
)(
0
CS Dept, UK38
Now prove that would give us
]P,0[
],0[
]sincos,0[
)]))((2
sin2
cos2
sin2
(cos
cossin,0[
]2
sin2cossin,0[
2222
2
r
ruuurruur
uur
rru
ururru
CS Dept, UK39
Geometric Meaning of Quaternions
Quaternions provide a clear difference
between a vector (point) and a rotation.
]sin,[cos :Rotation
],0[],0[ :orPoint/vect
uq
rP
All the operations for
vectors such as vector
addition/subtraction,
scalar multiplication hold.
2
CS Dept, UK40
Geometric Meaning of Quaternions
Rotation is performed as: 1],0[ qPq
Why?
Let
For R(P) to be a rotation,
It must satisfy four
properties:
1],0[)( qPqPR
CS Dept, UK41
Geometric Meaning of Quaternions
For R(P) to be a rotation, it must satisfy four
properties:
1. R(P) is a 3D vector
2. R(P) preserves length
3. R(P) is a linear
transformation
4. R(P) does not have
a reflection
component
CS Dept, UK42
R(P) is a 3D vector
Let W(p) represent the real part of the quaternion p.
Then we need to show that W(R(P))=0
First, note that quaternion multiplication is distributive
and associative. Besides, we have
and
2/)()( pppW
pqpq
CS Dept, UK43
R(P) is a 3D vector
Hence,
0
]0,0[
}2
],0[],0[{
2/}],0[],0[{
2/})],0[(],0[{
)],0[())((
qPP
q
qPqqPq
qPqqPq
qPqWPRW
CS Dept, UK44
R(P) preserves length
Let N(p) represent the length of the quaternion p,
2222)( then
if i.e.,
zyxwpN
kzjyixwp
]),0([
)(]),0([)(
)],0[())((
Hence,
)()()( that Note
PN
qNPNqN
qPqNPRN
qNpNpqN
CS Dept, UK45
R(P) is a linear transformationLet a be a scalar and P, Q be 3D vectors, then
)()(
],0[)],0[(
],0[]),0[(
],0[],0[
]},0[],0{[
],0[)(
QRPaR
qQqqPqa
qQqqPaq
qQqqaPq
qQaPq
qQaPqQaPR
CS Dept, UK46
R(P) does not have a reflection
component Consider R as a function of q for a fixed vector .
That is, R(q) = .
This function is a continuous function of q. For each q
it is a linear transformation with determinant D(q), so
the determinant itself is a continuous function of q.
Thus, , the identity function (the
limit is taken along any path of quaternions which
approach the quaternion 1) and .
By continuity, D(q) is identically 1 and R(q) does not
have a reflection component.
r
qrq ],0[
IRqRq
)1()(lim1
1)1()(lim1
DqDq
CS Dept, UK47
is the unit rotation axisu
u
u
],0[
]cossin,sincoscossin[
]sin,][coscos,sin[
]sin,][cos,0][sin,[cos
],0[)(
22
u
uu
uu
uuu
ququR
To see that is a unit rotation axis we need only
show that is unchanged by the rotation.
Indeed,
CS Dept, UK48
The rotation angle is 22
s and ,
ru
0 srsuru
.
and,
rus
usrsru
To see that the rotation angle is ,
let be a right-handed
set of orthonormal vectors, i.e.,
The vectors are all of unit length;
; and
The vector is rotated by an angle to the
vector , so .
u
r
s
r
qrq ],0[
)cos(],0[ qrqr
CS Dept, UK49
The rotation angle is
A quaternion q may also be viewed as a
4D vector (w; x; y; z). The dot product of
two quaternions is
Also,
and
for any unit quaternion with zero real part.
2
)( 101010101010
qqWzzyyxxwwqq
],0[],0[ rr
1],0[ 2 p
],0[ p
CS Dept, UK50
The rotation angle is
Hence, the rotation angle is
2
)2cos(
sincos
])sincos2,sin([cos
])sincos,0][sincos,0([
])sin,][cos,0][sin,][cos,0[(
)],0[],0([
],0[cos
22
22
uW
srsrW
ururW
qrqrW
qrqr
2
End of
Introduction &
Technical Background
CS Dept, UK51