Download Document

Document related concepts

Eigenvalues and eigenvectors wikipedia , lookup

Exterior algebra wikipedia , lookup

Orthogonal matrix wikipedia , lookup

Cross product wikipedia , lookup

Bivector wikipedia , lookup

Matrix calculus wikipedia , lookup

Vector space wikipedia , lookup

Laplace–Runge–Lenz vector wikipedia , lookup

Euclidean vector wikipedia , lookup

Four-vector wikipedia , lookup

Covariance and contravariance of vectors wikipedia , lookup

Rotation matrix wikipedia , lookup

Transcript
Comparing Two Motions
Jehee Lee
Seoul National University
Distance Metric for Motion Sequences
• How can we measure the difference between two
stylistic walking motions?
• How do we represent motion sequences?
– Rotation/orientation makes problems
• We do we compare two time-series data?
– What if the duration of one series differ from the other?
Affine Geometry
Jehee Lee
Seoul National University
Geometric Programming
• A way of handling geometric entities such as vectors,
points, and transforms.
• Traditionally, computer graphics packages are
implemented using homogeneous coordinates.
• We will review affine geometry and coordinate-invariant
geometric programming.
Example of coordinate-dependence
Point p
Point q
• What is the “sum” of these two positions ?
If you assume coordinates, …
p = (x1, y1)
q = (x2, y2)
• The sum is (x1+x2, y1+y2)
– Is it correct ?
– Is it geometrically meaningful ?
If you assume coordinates, …
p = (x1, y1)
(x1+x2, y1+y2)
q = (x2, y2)
Origin
• Vector sum
– (x1, y1) and (x2, y2) are considered as vectors from the origin to p
and q, respectively.
If you select a different origin, …
p = (x1, y1)
(x1+x2, y1+y2)
q = (x2, y2)
Origin
• If you choose a different coordinate frame, you will get a
different result
Vector and Affine Spaces
• Vector space
– Includes vectors and related operations
– No points
• Affine space
– Superset of vector space
– Includes vectors, points, and related operations
Points and Vectors
vector (p-q)
Point q
Point p
• A point is a position specified with coordinate values.
• A vector is specified as the difference between two
points.
• If an origin is specified, then a point can be represented
by a vector from the origin.
• But, a point is still not a vector in a coordinate-free point
of view.
Vector spaces
• A vector space consists of
– Set of vectors, together with
– Two operations: addition of vectors and multiplication
of vectors by scalar numbers
• A linear combination of vectors is also a vector
u, v, w V
  u   v   w V
Affine Spaces
• An affine space consists of
– Set of points, an associated vector space, and
– Two operations: the difference between two points
and the addition of a vector to a point
Coordinate-Invariant Geometric Operations
•
•
•
•
•
Addition
Subtraction
Scalar multiplication
Linear combination
Affine combination
Addition
p+w
u+v
w
v
u
u + v is a vector
p
p + w is a point
u, v, w : vectors
p, q : points
Subtraction
p
u-v
u
v
u - v is a vector
p-w
p-q
q
p - q is a vector
u, v, w : vectors
p, q : points
-w
p
p - w is a point
Scalar Multiplication
scalar • vector = vector
1 • point = point
0 • point = vector
c • point = (undefined) if (c≠0,1)
Linear Combination
• A linear space is spanned by a set of bases
– Any vector in the space can be represented as a
linear combination of bases
N
c v
i 0
i
i
 c0 v 0  c1 v1    cN v N  v
Affine Combination
N
c p
i 0
i
i
 c0p 0  c1p1    c N p N
N
N
i 0
i 1
 ( ci )p 0   ci (p i p 0 )
Example
• (p + q) / 2 : midpoint of line pq
• (p + q) / 3 : Can you find a geometric meaning ?
• (p + q + r) / 3 : center of gravity of ∆pqr
• (p/2 + q/2 – r) : a vector from r to the midpoint of
q and p
Summary
Rotation and Orientation:
Fundamentals
Jehee Lee
Seoul National University
What is Rotation ?
• Not intuitive
– Formal definitions are also confusing
• Many different ways to describe
–
–
–
–
–
–
Rotation (direction cosine) matrix
Euler angles
Axis-angle
Rotation vector
Helical angles
Unit quaternions
Orientation vs. Rotation
• Rotation
– Circular movement
• Orientation
– The state of being oriented
– Given a coordinate system, the orientation of an
object can be represented as a rotation from a
reference pose
Analogy
(point : vector) is similar to (orientation : rotation)
Both represent a sort of (state : movement)
Reference coordinate system
Analogy
(point : vector) is similar to (orientation : rotation)
Both represent a sort of (state : movement)
point : the 3d location of the bunny
vector : translational movement
Reference coordinate system
Analogy
(point : vector) is similar to (orientation : rotation)
Both represent a sort of (state : movement)
point : the 3d location of the bunny
vector : translational movement
orientation : the 3d orientation of the bunny
rotation : circular movement
Reference coordinate system
2D Orientation

2


or

0
Polar Coordinates


2
2D Orientation

2

 (t )

or


Time
0


2

Although the motion is continuous,
its representation could be discontinuous
2D Orientation

2

 (t )

or


Time
0 


2
Many-to-one correspondences
between 2D orientations and their
representations
Extra Parameter
Y
x  y 1
2
2
( x, y )

X
Extra Parameter
2x2 Rotation matrix is yet
another method of using
extra parameters
 cos 

 sin 
Y
x  y 1
2
 sin  

cos  
2
( x, y )

X
Complex Number
Imaginary
x  iy

Real
Complex Exponentiation
x  iy  cos   i sin 
Imaginary
e
x  iy

Real
i
2D Rotation
• Complex numbers are good for representing 2D
orientations, but inadequate for 2D rotations
• A complex number cannot distinguish different rotational
movements that result in the same final orientation
Imaginary
– Turn 120 degree counter-clockwise
– Turn -240 degree clockwise
– Turn 480 degree counter-clockwise

Real
  2
2D Rotation and Orientation
• 2D Rotation
– The consequence of any 2D rotational movement can be
uniquely represented by a turning angle
• 2D Orientation
– The non-singular parameterization of 2D orientations requires
extra parameters
• Eg) Complex numbers, 2x2 rotation matrices
Operations in 2D
• (orientation) : complex number
• (rotation) : scalar value
• exp(rotation) : complex number
2D Rotation and Displacement
Imaginary
c1  x  iy
Real
2D Rotation and Displacement
c2  c1  e
Imaginary
c2

c1  x  iy
Real
i
or
1
1 2
c c e
i
2D Orientation Composition
Imaginary
c2
c1  c2  (undefined )
c1
Real
2D Rotation Composition
Imaginary
e
i (  )


Real
i
 e e
i
Analogy
3D Rotation
• Given two arbitrary orientations of a rigid object,
X
X
Z
Z
Y
Y
3D Rotation
• We can always find a fixed axis of rotation and
an angle about the axis
v̂

Euler’s Rotation Theorem
The general displacement of a rigid body with
one point fixed is a rotation about some axis
Leonhard Euler (1707-1783)
In other words,
• Arbitrary 3D rotation equals to one rotation
around an axis
• Any 3D rotation leaves one vector unchanged
Rotation Vector
v̂
vˆ : unit vecto r
 : scalar angle

• Rotation vector (3 parameters) v   vˆ  ( x, y, z )
( , vˆ )
• Axis-Angle (2+1 parameters)
3D Orientation
• Unhappy with three parameters
– Euler angles
• Discontinuity (or many-to-one correspondences)
• Gimble lock
– Rotation vector (a.k.a Axis/Angle)
• Discontinuity (or many-to-one correspondences)


Using an Extra Parameter
• Euler parameters
 
e0  cos 
2
 e1 
e   vˆ sin   
 
 2
 2
e3 
 : rotation angle
vˆ : rotation axis
Quaternions
• William Rowan Hamilton (1805-1865)
– Algebraic couples (complex number) 1833
x  iy
where
i 2  1
Quaternions
• William Rowan Hamilton (1805-1865)
– Algebraic couples (complex number) 1833
x  iy
where
i 2  1
– Quaternions 1843
w  ix  jy  kz where
i  j  k  ijk  1
ij  k , jk  i, ki  j
2
2
2
ji  k , kj  i, ik   j
Unit Quaternions
• Unit quaternions represent 3D rotations
q  w  ix  jy  kz
S
3
 ( w, x, y, z )
 ( w, v )
w2  x 2  y 2  z 2  1
Rotation about an Arbitrary Axis
• Rotation about axis v̂ by angle 
v̂
( x, y , z )
( x, y, z)

1

p  qpq
where



q   cos , vˆ sin 
2
2

p  (0, x, y, z )
Purely Imaginary Quaternion
Unit Quaternion Algebra
• Identity
• Multiplication
• Inverse
q  (1,0,0,0)
q1q 2  ( w1 , v1 )( w2 , v 2 )
 ( w1w2  v1  v 2 , w1v 2  w2 v1  v1  v 2 )
q 1  ( w, x, y, z ) /( w2  x 2  y 2  z 2 )
 ( w, x, y, z ) /( w2  x 2  y 2  z 2 )
– Opposite axis or negative angle
• Unit quaternion space is
– closed under multiplication and inverse,
– but not closed under addition and subtraction
Unit Quaternion Algebra
• Antipodal equivalence
– q and –q represent the same rotation
Rq (p)  Rq (p)
– ex) rotation by  about opposite direction
– 2-to-1 mapping between S3 and SO(3)
– Twice as fast as in SO(3)
3D Orientations and Rotations
Orientations and rotations are different in
coordinate-invariant geometric programming
Use unit quaternions for orientation representation
– 3x3 orthogonal matrix is theoretically identical
Use 3-vectors for rotation representation
Tangent Vector
(Infinitesimal Rotation)
TqS
q
3
Tangent Vector
(Infinitesimal Rotation)
q
1
TqS
q
3
Tangent Vector
(Infinitesimal Rotation)
TI S
3
I  ( 1,0,0,0)
( 0, x, y, z )
Angular Velocity
1 1
  q q
2
Exp and Log
I
log
exp
exp( v)  exp( vˆ )  (cos  , vˆ sin  )
Exp and Log
I
log
exp
exp( v)  exp( vˆ )  (cos  , vˆ sin  )
Euler
parameters
 
e0  cos 
2
 e1 
e   vˆ sin   
 
 2
 2
e3 
Rotation Vector
R
3
p1
3
S q
1
u  p 2  p1
p2
q2
p 2  p1  u
 p1  (p 2  p1 )
q 2  q1exp( v)
 
1
1
2
 q1exp log q q

Rotation Vector
R
3
p1
u  p 2  p1
S
3
1
1
1
Iq q
q11q 2
p2
p 2  p1  u
 p1  (p 2  p1 )
q 2  q1exp( v)
 
1
1
2
 q1exp log q q

Rotation Vector
R
3

1
1
2
v  log q q

1
1
1
Iq q
p1
u  p 2  p1
q11q 2
p2
p 2  p1  u
 p1  (p 2  p1 )
q 2  q1exp( v)
 
1
1
2
 q1exp log q q

Geodesic Distance
R
3

1
1
2
v  log q q

1
1
1
Iq q
p1
u  p 2  p1
q11q 2
p2
d (p1 , p 2 )  p 2  p1

d (q1 , q 2 )  log q11q 2

Coordinate-Invariant Operations
Dynamic Time Warping
• The vertex correspondence problem
– Minimize the sum of distances between
corresponding vertices
– The correspondence must be continuous
• No missing vertices
• No cross edges (No turning back in time)
Signal A
Signal B
Dynamic Time Warping
• Find a chain from top-left to bottom-right
– Allowed to move horizontally, vertically, or diagonally