Basic Math Matrices & Transformations (revised)

Similar documents
Basic Math Matrices & Transformations

We could express the left side as a sum of vectors and obtain the Vector Form of a Linear System: a 12 a x n. a m2

Matrix Theory and Differential Equations Homework 6 Solutions, 10/5/6

18.06 Problem Set 1 Solutions Due Thursday, 11 February 2010 at 4 pm in Total: 100 points

A matrix over a field F is a rectangular array of elements from F. The symbol

Homogeneous Transformations

Introduction to Matrix Algebra

STRAND J: TRANSFORMATIONS, VECTORS and MATRICES

a 11 x 1 + a 12 x a 1n x n = b 1 a 21 x 1 + a 22 x a 2n x n = b 2.

ELEMENTARY LINEAR ALGEBRA

Math Bootcamp An p-dimensional vector is p numbers put together. Written as. x 1 x =. x p

PHYS 705: Classical Mechanics. Rigid Body Motion Introduction + Math Review

Robotics & Automation. Lecture 06. Serial Kinematic Chain, Forward Kinematics. John T. Wen. September 11, 2008

Matrices. Chapter Definitions and Notations

3D Coordinate Transformations. Tuesday September 8 th 2015

GEOMETRY AND VECTORS

(c)

Math 322. Spring 2015 Review Problems for Midterm 2

ICS 6N Computational Linear Algebra Matrix Algebra

ELEMENTARY LINEAR ALGEBRA

Ridig Body Motion Homogeneous Transformations

Linear Algebra. Paul Yiu. 6D: 2-planes in R 4. Department of Mathematics Florida Atlantic University. Fall 2011

Matrix Arithmetic. a 11 a. A + B = + a m1 a mn. + b. a 11 + b 11 a 1n + b 1n = a m1. b m1 b mn. and scalar multiplication for matrices via.

2.1 Matrices. 3 5 Solve for the variables in the following matrix equation.

Differential equations

Introduction and Vectors Lecture 1

Matrix Arithmetic. j=1

Spherical trigonometry

Math 4377/6308 Advanced Linear Algebra

ELEMENTARY LINEAR ALGEBRA

A FIRST COURSE IN LINEAR ALGEBRA. An Open Text by Ken Kuttler. Matrix Arithmetic

7x 5 x 2 x + 2. = 7x 5. (x + 1)(x 2). 4 x

LINEAR SYSTEMS AND MATRICES

ELEMENTARY LINEAR ALGEBRA

Section 5.5: Matrices and Matrix Operations

2013 HSC Mathematics Extension 2 Marking Guidelines

CSL361 Problem set 4: Basic linear algebra

CS123 INTRODUCTION TO COMPUTER GRAPHICS. Linear Algebra 1/33

Solving equations UNCORRECTED PAGE PROOFS

A matrix is a rectangular array of. objects arranged in rows and columns. The objects are called the entries. is called the size of the matrix, and

BASIC NOTIONS. x + y = 1 3, 3x 5y + z = A + 3B,C + 2D, DC are not defined. A + C =

Lecture 3: Matrix and Matrix Operations

A matrix is a rectangular array of. objects arranged in rows and columns. The objects are called the entries. is called the size of the matrix, and

10. Linear Systems of ODEs, Matrix multiplication, superposition principle (parts of sections )

1 Matrices and matrix algebra

Mathematics 1EM/1ES/1FM/1FS Notes, weeks 18-23

Linear Algebra Section 2.6 : LU Decomposition Section 2.7 : Permutations and transposes Wednesday, February 13th Math 301 Week #4

Study guide for Exam 1. by William H. Meeks III October 26, 2012

1D Wave PDE. Introduction to Partial Differential Equations part of EM, Scalar and Vector Fields module (PHY2064) Richard Sear.

Elementary maths for GMT

a11 a A = : a 21 a 22

Kinematics of a UR5. Rasmus Skovgaard Andersen Aalborg University

Matrix operations Linear Algebra with Computer Science Application

Chapter 5. Linear Algebra. A linear (algebraic) equation in. unknowns, x 1, x 2,..., x n, is. an equation of the form

CMSC427 Geometry and Vectors

Time : 3 hours 02 - Mathematics - July 2006 Marks : 100 Pg - 1 Instructions : S E CT I O N - A

Properties of Transformations

WISCONSIN HIGH SCHOOL STATE MATHEMATICS MEET WISCONSIN MATHEMATICS COUNCIL March 4 8, Solutions

Designing Information Devices and Systems I Fall 2018 Lecture Notes Note 21

Solution to Homework 1

Prepared by: M. S. KumarSwamy, TGT(Maths) Page

2. A die is rolled 3 times, the probability of getting a number larger than the previous number each time is

Topics. Vectors (column matrices): Vector addition and scalar multiplication The matrix of a linear function y Ax The elements of a matrix A : A ij

Linear Algebra. Matrices Operations. Consider, for example, a system of equations such as x + 2y z + 4w = 0, 3x 4y + 2z 6w = 0, x 3y 2z + w = 0.

7.2. Matrix Multiplication. Introduction. Prerequisites. Learning Outcomes

Linear Algebra 1 Exam 2 Solutions 7/14/3

ARW Lecture 04 Point Tracking

Worksheet 3: Matrix-Vector Products ( 1.3)

CS123 INTRODUCTION TO COMPUTER GRAPHICS. Linear Algebra /34

Designing Information Devices and Systems I Discussion 2A

Page 52. Lecture 3: Inner Product Spaces Dual Spaces, Dirac Notation, and Adjoints Date Revised: 2008/10/03 Date Given: 2008/10/03

Reading. Affine transformations. Vector representation. Geometric transformations. x y z. x y. Required: Angel 4.1, Further reading:

MockTime.com. (b) (c) (d)

STEP Support Programme. STEP 2 Matrices Topic Notes

Linear Algebra and Matrix Inversion

Linear Algebra V = T = ( 4 3 ).

Linear Algebra Homework and Study Guide

Phys 201. Matrices and Determinants

Position and orientation of rigid bodies

Vectors Summary. can slide along the line of action. not restricted, defined by magnitude & direction but can be anywhere.

Solutions to Homework 3, Introduction to Differential Equations, 3450: , Dr. Montero, Spring 2009 M = 3 3 Det(M) = = 24.

Math 3191 Applied Linear Algebra

Quantum Mechanics for Scientists and Engineers. David Miller

Chapter 2. Linear Algebra. rather simple and learning them will eventually allow us to explain the strange results of

Math 4A Notes. Written by Victoria Kala Last updated June 11, 2017

Math 3108: Linear Algebra

Algebra II Notes Unit Four: Matrices and Determinants


MATH 15a: Linear Algebra Exam 1, Solutions

Math 2331 Linear Algebra

Linear Algebra & Geometry why is linear algebra useful in computer vision?

MATH2210 Notebook 2 Spring 2018

TABLE OF CONTENTS. Our aim is to give people math skillss in a very simple way Raymond J. Page 2 of 29

CSE 554 Lecture 7: Alignment

Math review. Math review

Matrix Algebra. Learning Objectives. Size of Matrix

Department of Physics, Korea University

1 Matrices and vector spaces

2013 HSC Mathematics Extension 1 Marking Guidelines

Matrices Gaussian elimination Determinants. Graphics 2009/2010, period 1. Lecture 4: matrices

Transcription:

Basic Math Matrices & Transformations (revised)

Matrices An ordered table of numbers (or sub-tables) columns A{ 3 3 a a a 00 0 20 a a a 0 2 a a a 02 2 22 Rows Product : C BA AB, C a a 00 0 a a 0 b b 00 0 b b 0 a a 00 0 * b * b 00 00 + + a a 0 * b * b 0 0 a a 00 0 * b * b 0 0 + + a a 0 * b * b Identity : I 3 0 0 0 0 0 0

Definition: a c b d Example: Matrix Addition (+) x u y v + a+x c+u b+y d+v 5 2 6 0-2 -7 + 3 3 - Properties:. Closed result is always a matrix 2. Commutative A+B B+A 3. Associative (A+B)+C A+(B+C) 4. Identity A+0 A (null matrix) 5. Inverse A+A - 0 (negated matrix)

Matrix Multiplication (*) Definition: a c b d Example: x u y v * ax+cy au+cv bx+dy bu+dv 5 2 6 0-2 -7 + 5-37 6-46 Properties:. Closed result is always a matrix 2. NOT Commutative A*B! B*A 3. Associative (A*B)*C A*(B*C) 4. Identity A*I A (identity matrix) 5. Inverse A*A - I (difficult to obtain!) Distributive from either side (A+B)C AC + BC C(A+B) CA + CB

Examples: Vector is a special matrix v[x,y,z] row vector, x3 matrix v 2 column vector, 2x matrix

Vector addition: just like adding matrices Column vector a c b d x u y v + a+x c+u b+y d+v Row vector a c b d x u y v + a+x c+u b+y d+v

Matrix*Vector Multiplication: just like multiplying matrices y x v d c b a M 2 Mv v y x d c b a + + dy cx by ax Result is a new column vector Column vector on the right

Matrix*Vector Multiplication(example) 2 v 3 2 5 M 2 Mv v 2 3 2 5 + + 8 7 3*2 2* *2 5*

Matrices as transformations Matrix-vector multiplication creates a new vector. New vector means new location in space. If all points of an object is multiplied by a matrix, then the whole object assumes a new position (and may be new shape and size, too). This is called transformation. v x y y a M c v 2 Mv b d v v 2 x

Matrices as transformations (examples) 0 M 2 Mv v y x Transform 4 points [0,0], [,0],[,],[0,] using the matrix M. y 0 0, 0 0 v 2 v 0, 0 v v 2 v 2 v 2, v 2 v, 0 v v 2

S v v S 2 5 0 S 2 v 5 0 0 3 s x 0 0 s y 0 3 2 Scaling 5*+ 0*2 0*+ 3*2 S - /s x 0 0 /s y 5 6 S * S - I S s x 0 0 0 s y 0 0 0 s z 3D scaling matrix

Example: CT guidance i pixel (column index) NY number of pixels (typically 52) FOVY size of the body captured (in cm) dy FOVY / NY (pixel size, in cm) NX number of pixels (typically 52) FOVX size of the body captured (in cm) 2 0 dx FOVX / NX (pixel size, in cm) th slice thickness (cm or mm) S CT dx 0 0 0 dy 0 0 0 th

Rotation y v 2 R α v v 2 v v 2 R -α α v x

Rotation Matrix u and u _ u cos(α + β) sin(α + β) α β x cos(β) v v(x,y) and v ysin(β) cos(α) cos(β) sin(α) sin(β) sin(α) cos(β) + cos(α) sin(β)

Rotation Matrix u and u _ u cos(α + β) sin(α + β) α β x cos(β) v v(x,y) and v ysin(β) x cos(α) cos(β) sin(α) sin(β) sin(α) cos(β) + cos(α) sin(β) y

Rotation Matrix u and u _ u cos(α + β) sin(α + β) α β x cos(β) v v(x,y) and v ysin(β) x cos(α) cos(β) sin(α) sin(β) sin(α) cos(β) + cos(α) sin(β) y cos(α) x sin(α) y sin(α) x + cos(α) y cos(α) sin(α) sin(α) cos(α) x y _ v R α cos(α) sin(α) sin(α) cos(α) u R α v

Inverse of Rotation Matrix R α cos(α) sin(α) sin(α) cos(α) R - α cos(- α) sin(- α) sin(- α) cos(- α) R - α cos(α) sin(α) -sin(α) cos(α) - R α R - α The proof: R α * R - α I Series of Rotations R (α+β+γ) R α R β R χ

Rotation by α around z axis 3D Rotation Matrices R α cos(α) sin(α) 0 sin(α) cos(α) 0 0 0 v 2 R α v When applied on vector v, it does not change z coordinate. Try it! Rotation around all axes θ v 2 Example: 60, v, 2 Rv 0 R 60 / 2 3 / 2 3 / 2 / 2

Passage from reference system to another p a in F a α Frame a _ t p b in F b p b RSp a + t Frame b () scale, (2) rotate, and (3) translate to go from F a to F b

C-arm fluoroscopy j A pix (i.j,0) ADD L B i Pixel size dx,dy dx 0 0 S 0 dy 0 0 0 B [0,0,-ADD] SAD C S [0,0,SAD] A B + SA pix S

C-arm fluoroscopy i A 2pix (i 2.j 2,0) j A pix (i.j,0) j B2 B 2 R α B L 2 α ADD L B i Pixel size dx,dy dx 0 0 S 0 dy 0 0 0 S 2 R α S A 2 R α (B +S A 2pix ) SAD C B [0,0,-ADD] S [0,0,SAD] A B + SA pix S S2 TARGET L x L 2

Change of reference systems backwards (inverse transform) p b RSp a + t //subtract t p b t RSp a //left multiply by R - R - (p b t) Sp a //left multiply by S- S - R - (p b t) p a Slight problem: mixes translation vector with matrices Solution: make t translation vector appear as a matrix T in multiplications. Then the equations will read as: p b (T(R(Sp a )))

Introduce 4x4 Translation Matrix T 0 0 d x 0 0 d y 0 0 d z 0 0 0 v x y z Padding with (If I padded with 0 then inverse would not exist!) Tv 0 0 d x 0 0 d y 0 0 d z 0 0 0 x y z x+d x y+d y z+d z Problem: rotation and scaling matrices must also be padded, so that we can multiply all 4x4 matrices.

Homogeneous Matrices and Translation Matrix Rotation matrix by α around z axis Translation matrix R cos(a) sin(a) 0 0 α sin(a) cos(a) 0 0 0 0 0 0 0 0 T 0 0 d x 0 0 d y 0 0 d z 0 0 0 Scaling matrix S s x 0 0 0 0 s y 0 0 0 0 s z 0 0 0 0 v x y z Padding all vectors with p b (T(R(Sp a )))

Series of transformations Inverse transformation: Apq //apply A on p A - Ap A - q //mult both sides from left by A - pa - q //because A - AI Series of transformations CBApq //Apply A,B, then C on p (C (B (Ap))) q //use associative property Inverse of series of transformations CBApq //Apply A,B, then C on p A - B - C - qp //multiply by inverse from left forward inverse B A C A - B - p q p C - q

Inverse of coordinate transformations p b TRSp a Multiply from the left by T - T - p b RSp a Multiply from the left by R - R - T - p b Sp a Multiply from the left by S - S - R - T - p b p a

Reference frame transformations b p b p b T*R*S* p a F ab p a p b F ab p a a F ab is often called frame transformation or shortly frame

Series of reference frame transformation Most real systems involve complicated series of frames, where we traverse from frame to frame F ac b F bc c p c p c F bc F ab p a F ac p a F ab a All frames must be known: some of them are measured/calculated during the procedure, some of them are pre-operatively known through calibration.

Example: Robot-Assisted Ultrasound-Guided Liver Surgery LARS ROBOT Biopsy needle JHU 5-DOF needle driving robot Ultrasound System JHU volume visualization and planning display

Example cont d: some frames in the tracked dual-arm robot system Tracker p R F TR F HT F UH p U F HT F TR Handle Robot F UH US Target picked in US

Example: CT-guided Needle Placement with Robot Coordinate s CT Scanner Planning & control computer Robot Patient Surgeon Digital images Patient in the scanner with robot Screen of the surgical planning and control workstation Kidney biopsy Kavoussi & Stoianovici

Example cont d: Frames F R Robot F FR Fiducials p R F F p R F FR F CF p C F CF p C F C CT image

Example: Multi-Joint Serial Robots 4-joint serial robot F 4 p 4 F 3 p 0 p 4 F 34 F 23 F 2 F 0 p 0 F F 2 F 0

e e2 e3 orthonormal base e 2 e 3 v e Let e e 2 e 3 be orthonormal base vectors Let v be an arbitrary vector

Express v with e e 2 e 3 base vectors e 2 e 3 e 2 v v e e v

Express v with e e 2 e 3 base vectors e 2 (e 2 v ) e 2 e 3 e 2 v v e (e v ) e e v v (e v ) e + (e 2 v ) e 2 + (e 3 v ) e 3

Express v v 2 v 3 base with e e 2 e 3 base vectors e 3 v 3 v 2 e 2 v e v (e v ) e + (e 2 v ) e 2 + (e 3 v ) e 3 v 2 (e v 2 ) e + (e 2 v 2 ) e 2 + (e 3 v 2 ) e 3 v 3 (e v 3 ) e + (e 2 v 3 ) e 2 + (e 3 v 3 ) e 3

Express P in both coordinate systems P e 3 v 3 v 2 e 2 v e (Expressed v v 2 v 3 with (e e 2 e 3 ) orthonormal base vectors) v (e v ) e + (e 2 v ) e 2 + (e 3 v ) e 3 v 2 (e v 2 ) e + (e 2 v 2 ) e 2 + (e 3 v 2 ) e 3 v 3 (e v 3 ) e + (e 2 v 3 ) e 2 + (e 3 v 3 ) e 3 Express P in both coordinate systems P r e + s e 2 + te 3 (r, s, t are coordinate values) P x v + yv 2 + zv 3 (x, y, z are coordinate values)

Generalized rotation matrix Replace v, v 2 and v 3 with the long forms we just derived v (e v ) e + (e 2 v ) e 2 + (e 3 v ) e 3 v 2 (e v 2 ) e + (e 2 v 2 ) e 2 + (e 3 v 2 ) e 3 v 3 (e v 3 ) e + (e 2 v 3 ) e 2 + (e 3 v 3 ) e 3 P r e + s e 2 + te 3 (r, s, t are coordinate values) P x v + yv 2 + zv 3 (x, y, z are coordinate values) P x(e v ) e + x(e 2 v ) e 2 + x(e 3 v ) e 3 + y(e v 2 ) e + y(e 2 v 2 ) e 2 + y(e 3 v 2 ) e 3 + z(e v 3 ) e + z(e 2 v 3 ) e 2 + z(e 3 v 3 ) e 3 Group the e, e 2 and e 3 members P x(e v ) e + y(e v 2 ) e +z(e v 3 ) e + x(e 2 v ) e 2 + y(e 2 v 2 ) e 2 + z(e 2 v 3 ) e 2 + x(e 3 v ) e 3 + y(e 3 v 2 ) e 3 +z(e 3 v 3 ) e 3

Generalized rotation matrix Group the scale factors P (x(e v ) + y(e v 2 ) + z(e v 3 )) e + (x(e 2 v ) + y(e 2 v 2 ) + z(e 2 v 3 )) e 2 + (x(e 3 v ) + y(e 3 v 2 ) + z(e 3 v 3 )) e 3 P in (rst) Rearrange to column vector format. r s t x(e v ) + y(e v 2 ) + z(e v 3 ) x(e 2 v ) + y(e 2 v 2 ) + z(e 2 v 3 ) x(e 3 v ) + y(e 3 v 2 ) + z(e 3 v 3 ) Recognize matrix*vector product. r s t (e v ) (e v 2 ) (e v 3 ) (e 2 v ) (e 2 v 2 ) (e 2 v 3 ) (e 3 v ) (e 3 v 2 ) (e 3 v 3 ) x y z P in (xyz)

Generalized rotation matrix Direction cosines R e 2 (e v ) (e v 2 ) (e v 3 ) (e 2 v ) (e 2 v 2 ) (e 2 v 3 ) (e 3 v ) (e 3 v 2 ) (e 3 v 3 ) where ( e v ) cos (e v )cos (α) ( e 2 v ) cos (e 2 v )cos (β) ( e i v j ) cos (e i v j ) cos (β ij ) in special 2D case cos (b) sin (a) α e 2 v β α v e e v

Generalized rotation matrix R (e v ) (e v 2 ) (e v 3 ) (e 2 v ) (e 2 v 2 ) (e 2 v 3 ) (e 3 v ) (e 3 v 2 ) (e 3 v 3 ) e 3 v 3 v 2 e 2 v e