Chapter 2. Geometrical Methods - Quaternions -  전자공학 / Networked Virtual Computing Lab/ 조성업.

Slides:



Advertisements
Similar presentations
Vectors, Points, Lines and Planes Jim Van Verth Lars M. Bishop
Advertisements

Chapter 4 Euclidean Vector Spaces
Chapter 10 Vocabulary.
John C. Hart CS 318 Interactive Computer Graphics
CS B659: Principles of Intelligent Robot Motion Rigid Transformations.
3D Graphics for Game Programming (J. Han) Chapter XI Character Animation.
CE Statics Lecture 6.
Computer Graphics Recitation 2. 2 The plan today Learn about rotations in 2D and 3D. Representing rotations by quaternions.
3D Coordinate Systems and Transformations Revision 1
3D orientation.
CSCE 689: Computer Animation Rotation Representation and Interpolation
CSCE 441: Computer Graphics Rotation Representation and Interpolation
Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.
CSCE 641: Computer Graphics Rotation Representation and Interpolation Jinxiang Chai.
Orientations Goal: –Convenient representation of orientation of objects & characters in a scene Applications to: – inverse kinematics –rigid body simulation.
Lecture 7: Matrix-Vector Product; Matrix of a Linear Transformation; Matrix-Matrix Product Sections 2.1, 2.2.1,
CS I400/B659: Intelligent Robotics Rigid Transformations.
2IV60 Computer Graphics Basic Math for CG
Basics of Linear Algebra A review?. Matrix  Mathematical term essentially corresponding to an array  An arrangement of numbers into rows and columns.
Engineering Mechanics: Statics
Actors, Cameras, Action ! Scenes, Actors, Cameras 3D Transformations
Mathematical Topics Review of some concepts:  trigonometry  aliasing  coordinate systems  homogeneous coordinates  matrices, quaternions.
Vectors & Matrices Marq Singer
Quaternion and Virtual Trackball CSE 781 Introduction to 3D Image Generation Han-Wei Shen Winter 2007.
1.1 – 1.2 The Geometry and Algebra of Vectors.  Quantities that have magnitude but not direction are called scalars. Ex: Area, volume, temperature, time,
VECTOR CALCULUS. Vector Multiplication b sin   A = a  b Area of the parallelogram formed by a and b.
CS 450: COMPUTER GRAPHICS QUATERNIONS SPRING 2015 DR. MICHAEL J. REALE.
Computer Graphics Bing-Yu Chen National Taiwan University.
Key Frame Animation and Inverse Kinematics
Elementary Linear Algebra Anton & Rorres, 9th Edition
1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 13, 2002 Day 16.
CSE 681 Review: Transformations. CSE 681 Transformations Modeling transformations build complex models by positioning (transforming) simple components.
1 MAC 2103 Module 6 Euclidean Vector Spaces I. 2 Rev.F09 Learning Objectives Upon completing this module, you should be able to: 1. Use vector notation.
Week 5 - Wednesday.  What did we talk about last time?  Project 2  Normal transforms  Euler angles  Quaternions.
2.6 Addition and Subtraction of Cartesian Vectors
1 CS 430/536 Computer Graphics I 3D Transformations World Window to Viewport Transformation Week 2, Lecture 4 David Breen, William Regli and Maxim Peysakhov.
Vector Addition Cummutative Law A B C B A C A + B = C B + A = C A + B = B + A.
Sect. 4.2: Orthogonal Transformations
1 Chapter Objectives Parallelogram Law Cartesian vector form Dot product.
Concepts for Programming a Rigid Body Physics Engine Part 1 Presented by Scott Hawkins.
3D Kinematics Consists of two parts
Animating Rotations and Using Quaternions. What We’ll Talk About Animating Translation Animating 2D Rotation Euler Angle representation 3D Angle problems.
2-2 Properties from Algebra
CS 551/645 Fall 2000 Parameterized Rotations, Curves, and Surfaces.
VECTORS (Ch. 12) Vectors in the plane Definition: A vector v in the Cartesian plane is an ordered pair of real numbers:  a,b . We write v =  a,b  and.
Copyright © Cengage Learning. All rights reserved.
Analytic Geometry o f Space 3D Space (right-handed coordinate system) Introduction to Vectors –Let –We may to know the displacement from P to Q From P.
ES 240: Scientific and Engineering Computation. Chapter 8 Chapter 8: Linear Algebraic Equations and Matrices Uchechukwu Ofoegbu Temple University.
January 19, y X Z Translations Objects are usually defined relative to their own coordinate system. We can translate points in space to new positions.
3D Game Engine Design 1 3D Game Engine Design Ch D MAP LAB.
Graphics Graphics Korea University cgvr.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실.
Euler Angles This means, that we can represent an orientation with 3 numbers Assuming we limit ourselves to 3 rotations without successive rotations about.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Week 5 - Monday.  What did we talk about last time?  Lines and planes  Trigonometry  Transforms  Affine transforms  Rotation  Scaling  Shearing.
1 Dr. Scott Schaefer Quaternions and Complex Numbers.
Derivation of the 2D Rotation Matrix Changing View from Global to Local X Y X’ Y’  P Y Sin  X Cos  X’ = X Cos  + Y Sin  Y Cos  X Sin  Y’ = Y Cos.
UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS Advanced Math.
Learning from the Past, Looking to the Future James R. (Jim) Beaty, PhD - NASA Langley Research Center Vehicle Analysis Branch, Systems Analysis & Concepts.
Mathematics for Game Programming (1)3 인칭 카메라 (2)Particle dynamics (3)quaternion.
Properties of Algebra. 7 + ( ) = ( ) + 9.
Modeling Transformations
CPSC 641: Computer Graphics Rotation Representation and Interpolation
3D Geometric Transformation
Do Now.
Rotation representation and Interpolation
UMBC Graphics for Games
A definition we will encounter: Groups
Quaternions are back!!! A global quaternion q is defined as q = q0 + q where q = q1I+ q2 J+ q3K . where q0 is a scalar and q is a vector. A quaternion.
VIRTUAL ENVIRONMENT.
Chapter 2. Geometrical Methods
Presentation transcript:

Chapter 2. Geometrical Methods - Quaternions -  전자공학 / Networked Virtual Computing Lab/ 조성업

Networked Virtual Computing Lab. 2 Quaternion Algebra - 1  Quaternion definition  q = w + xi + yj + zk  Where w, x, y, z are real numbers  i 2 = j 2 = k 2 = -1  ij = -ji = k  jk = -kj = i  ki = -ik = j  q 0 * q 1 = ( w 0 w 1 - x 0 x 1 - y 0 y 1 - z 0 z 1 ) + (w 0 x 1 + x 0 w 1 + y 0 z 1 + z 0 y 1 ) i + (w 0 y 1 - x 0 z 1 + y 0 w 1 + z 0 x 1 ) j + (w 0 z 1 + x 0 y 1 - y 0 x 1 + z 0 w 1 ) k  교환 법칙 성립 안됨  ij = -ji = k / jk = -kj = i / ki = -ik = j  q 0 * q 1  q 1 * q 0

Networked Virtual Computing Lab. 3 Quaternion Algebra - 2  Conjugate of Quaternion  q * = (w + xi + yj + zk ) * = w - xi - yj – zk  ( q * ) * = q  ( pq) * = q * p *  Norm of Quaternion  Real value  N(q) = N(w + xi + yj + zk) = w 2 + x 2 + y 2 + z 2  N(q) = N(q * )  N(pq) = N(p)N(q)

Networked Virtual Computing Lab. 4 Quaternion Algebra - 3  Multiplicate Inverse of Quaternion  Notation: q  q -1  Property: q q -1 = q -1 q = 1  Inverse: q -1 = q * / N(q) Quaternion 을 real-value scalar 로 나눌 때에는 w, x, y, z 각각을 나눈다.  ( q -1 ) -1 = q / ( pq ) -1 = q -1 p -1  Unit Quaternion  Quaternion q for which N(q) = 1  q = q -1 / qq = q  q = cos  + u sin  u = u 0 i + u 1 j +u 2 k = (u 0,u 1,u 2 ) u has length 1 u u = -1

Networked Virtual Computing Lab. 5 Relationship of Quaternions to Rotations - 1  Unit Quaternion & Rotation  unit quaternion q = cos  + u sin  u = u 0 i + u 1 j +u 2 k = (u 0,u 1,u 2 ) u has length 1 u u = -1  v = v 0 i + v 1 j + v 2 k = (v 0, v 1, v 2 )  then in R (v) = q v q * … R (v) 는 3D vector v 를 3 차원 축 u 에 대해서 2  만큼 회전시키는 함수가 된다.  R (v) 가 rotation function 이라는 것을 증명하려면 다음 4 가지를 증명해야만 한다. R (v) is a 3D-Vector R (v) is a length-preserving function R (v) is a linear transformation R (v) does not have an reflection component

Networked Virtual Computing Lab. 6 Rotation Matrix about unit-length axis  from Angle & Axis to Rotation Matrix   = angle of rotation / U = unit-length axis of rotation  I = Identity matrix  S =  R = I + sin  S + (1 – cos  )S 2 0 -u 2 u 1 u 2 0 -u 0 -u 1 u 0 0

Networked Virtual Computing Lab. 7 Conversion from Quaternion to Rotation Matrix  from Quaternion to Rotation Matrix  Solution: w, x, y, z  find  & U  R = I + sin  S + (1 – cos  )S 2  Some identities 2sin 2 (  /2) = 1- cos  sin(  ) = 2sin(  /2)cos(  /2)  From above two identities … 2wx = (sin  )u 0 / 2wy = (sin  )u 1 / 2wz = (sin  )u 2 2x 2 = ( 1 – cos  )u 0 2 / 2xy = (1 - cos  )u 0 u 1 / 2xz = (1 - cos  )u 0 u 2 2y 2 = ( 1 – cos  )u 1 2 / 2yz = (1 - cos  )u 1 u 2 2z 2 = ( 1 – cos  )u 2 2  Right-hand side of all above equations are terms in R = I + sin  S + (1 – cos  )S 2  replacing them yields … R = 1-2y 2 – 2z 2 2xy + 2wz 2xz – 2wy 2xy – 2wz 1-2x 2 – 2z 2 2yz + 2wx 2xz + 2wy 2yz – 2wx 1-2x 2 – 2y 2

Networked Virtual Computing Lab. 8 Quaternion Interpolation - 1  Interpolation  3D animation 을 위해서는 Quaternion 간의 interpolation 이 필요  Quaternion 의 곱셈은 행렬의 곱셈보다 빠르며, quaternion 의 interpolation 을 이용하면 매끄러운 animation 구현 가능  일반적인 interpolation 공식  q(t) = f 0 (t)q 0 + f 1 (t)q 1 ( 0  t  1 )  f 0 (t), f 1 (t) : scalar function  f 0 (0) = 1, f 0 (1) = 0  f 1 (0) = 0, f 1 (1) = 1

Networked Virtual Computing Lab. 9 Quaternion Interpolation - 2  LERP(Linear-interpolation)  lerp(t, q 0, q 1 ) = (1-t)q 0 + tq 1 = t(q 1 – q 0 ) + q 0  Interpolation 의 결과로 나타나는 quaternion 의 Norm(=magnitude) 가 달라진 다. 즉, magnitude 가 보존되지 않는다.  Rotation 에 사용하기 위해서는 Interpolation 의 결과로 나타나는 quaternion 의 Norm(=magnitude) 을 계속 scaling 해 주어야 한다.  속도는 빠르지만 곡선 형태의 매끄러운 animation 을 구현하기는 어렵다.

Networked Virtual Computing Lab. 10 Quaternion Interpolation – 3  SLERP(Spherical Linear Interpolation)  3D unit vector: sphere 상의 point 를 표현 가능  Unit quaternion: hyper-sphere 상의 point 를 정의 가능  Hyper-sphere 상의 두 quaternion 을 interpolation 해서 매끄러운 곡선 형태의 animation 구현 가능  수식  slerp(t, q 0, q 1 ) = [q 0 sin(  (1-t)) + q 1 sin(  )]/sin(  )  = q 0 와 q 1 사이의 각도 q 0, q 1 을 4 차원 vector 로 보고 내적을 이용해  계산 Magnitude 가 보존된다.  slerp(t, q 0, q 1 ) = q 0 (q 0 -1 q 1 ) t

Networked Virtual Computing Lab. 11 Quaternion Interpolation - 4  SLERP  장점 : 매끄러운 3D animation  단점 : 둘 이상의 quaternion 을 연속으로 interpolation 할 경우 각각의 제어점에 서 방향이 갑자기 꺽이는 듯한 경로가 생길 수 있음  Spherical Cubic Interpolation  양 끝점에서 좀 더 부드러운 곡선 경로 생성  SQUAD(t; p, q, a, b) = slerp( 2t(1-t); slerp(t; p, q), slerp(t; a, b) ) Interpolation 결과는 p~q 를 연결하는 호를 따르지 않고 a~b 를 잇는 호를 향한 곡선을 따른다. p q a b p q a b

Networked Virtual Computing Lab. 12 Quaternion Interpolation - 5  Spline Interpolation  N 개의 quaternion 이 있다고 할 때 {q n, a n, b n } (n=0, 1, 2, … N-1)  Interpolation 은 다음과 같이 이루어지게 된다. Sn(t) = squad(t, q n, q n+1, a n, b n+1 )  매끄러운 interpolation 결과를 얻기 위한 a n, b n 은 다음과 같다. a n = b n = q n exp[-(log(q n -1 q n-1 ) + log(q n -1 q n+1 ) ) / 4]