6/16/2015©Zachary Wartell 2D Coordinate Systems, Change of Coordinates, and Matrices Revision:...

37
03/27/22 ©Zachary Wartell 2D Coordinate Systems, Change of Coordinates, and Matrices Revision: 1/8/2008 6:14:11 PM Copyright Zachary Wartell, University of North Carolina All Rights Reserved Textbook: Chapter 5 and Appendix
  • date post

    20-Dec-2015
  • Category

    Documents

  • view

    213
  • download

    0

Transcript of 6/16/2015©Zachary Wartell 2D Coordinate Systems, Change of Coordinates, and Matrices Revision:...

04/18/23©Zachary Wartell

2D Coordinate Systems,Change of Coordinates,

and Matrices

Revision: 1/8/2008 6:14:11 PMCopyright Zachary Wartell, University of North Carolina

All Rights Reserved

Textbook:Chapter 5 and Appendix

04/18/23©Zachary Wartell

Overview

• points, vectors, alignments & coordinates thereof• coordinate systems & coordinates thereof• change of coordinates for pt’s, vt’s

04/18/23©Zachary Wartell

Geometric Point

• Point – a location in space

04/18/23©Zachary Wartell

• Consider points in 1D space, drawn as a dot

• We also have 1D distance, drawn as a line segment

– Note, any line segment of the right length is a valid drawing of a given distance

Distance (in 1D space)

0 1 ….

d=2 d=2

l0=[0,2]0 1 ….

l1=[4.5,6.5]

d=2 d=2

l0=[0,2]0 1 ….

l1=[4.5,6.5]

d=2

l2=[5.5,7.5]

04/18/23©Zachary Wartell

• Displacement in 1D space is a “signed” distance, drawn as an directed line segment (also an ‘arrow’)

– Note, any directed line segment of the correct length and direction is a valid drawing of a given displacement

Displacement (in 1D space)

d=2 1/3 d=-1.75

l2=[6,4.25]l2=[0,2 1/3]

d=1.75

l1=[2,3.75]0 1

d=-1.75

l2=[6,4.25]

d=-1.75

l1=[3.75,2]0 1

d=-1.75

l3=[2.25,1.5]

04/18/23©Zachary Wartell

What about 2D Displacements? (Step #1)

• Step #1, need to define an alignment. – “Parallel lines all share a common alignment”

or– “An alignment, is what is common in a set of

parallel lines”• An alignment is drawn by drawing any line

parallel to the alignment

W/E alignment?/? alignmentNE/SW alignmentN/S alignment

3 different lines but all have the same “alignment”

04/18/23©Zachary Wartell

• geometric vectors are “2D displacements” or “direction with sign and magnitude” -- drawn by an (2D) directed line segment (‘arrow’)– Note, any arrow of the right length and

alignment is valid drawing of a given geometric vector

2D Displacements are called ‘geometric vectors’

Length=5

“Move North 5 meters”

Length=7“Move NW 7 meters” “Move SE 7 meters”

Leng

th=7

3 different arrowsbut all representativeof the same vector

04/18/23©Zachary Wartell

Geometric Vector versus Alignment

∙ a geometric vector gives more information than an alignment

Alignment is N/SVector is N at magnitude l

l this vector has same alignment as this one but different magnitude

04/18/23©Zachary Wartell

Please draw point (5,3)

?

04/18/23©Zachary Wartell

Point (5,3)A

(5,3)

A

“regular” recti-linear coordinate system (syn. Cartesian coordinate system)

04/18/23©Zachary Wartell

Point (5,3)B

(5,3)

(5,3)

04/18/23©Zachary Wartell

(5,3)

Point (5,3)C

(5,3)

(5,3)

04/18/23©Zachary Wartell

Point (5,3)D

(5,3)

(5,3)

(5,3)(5,3)

oblique (!) recti-linear coordinatesystem

04/18/23©Zachary Wartell

Please draw vector (3,2)

?

04/18/23©Zachary Wartell

Vector (3,2)A

(3,2)

04/18/23©Zachary Wartell

Vector (3,2)B

(3,2)

04/18/23©Zachary Wartell

Review: Points, Vectors, Arrows, Alignments

p: (5,3)

v: (1,3)

v: (1,3)

v: (1,3)

a0: ((0,0),(1,3))

a1: ((2,1),(3,4))

a3: ((-2,-1),(-1,2))

al0: (2k,1k), k∈R, k≠0

all lines with slope ½ have

alignment al 0

04/18/23©Zachary Wartell

DOF’s of 2D Elements

Element Degrees of freedom

Point 2 DOF

Vector 2 DOF

Arrow 4 DOF

Alignment 1 DOF

04/18/23©Zachary Wartell

Operation on Points & Vectors (2D or 3D)

• Points: pi - pj = v pi ± v = pj (p + 0 = p) tpi + (1-t)pj = pk - “affine combination”

• Vectors: vi ±vj = vk , vj = a ∙ vk (a R) or avi ± bvj = vk - ”linear combination”

length(v), |v| =

normalize(v), v'= (1/|v|) ∙ v dot product: vivj =

2 2 2x y z

cos

j

i i i j i j i j i j

j

i j

x

x y z y x x y y z z

z

v v

04/18/23©Zachary Wartell

Notation

(5,3)A

A,B,C – capital script letter is a coordinate system

(x,y)B or (xB,yB) – is a coordinate with respect to coordinate system B

A

Coordinate System is a 3-tuple, (o,x,y)o : a point called the originx : a vector called x-basis vectory : a vector called y-basis vector

o x

y

04/18/23©Zachary Wartell

Different Point/Coordinate & Same Coordinate/Point

• So far we’ve looked at different points with the same coordinate but conversely we can considered the same point with different coordinates! (5,3)

(5,3)

(5,3)(5,3)

(5,3)

(5,3)

(5,3)(5,3)

04/18/23©Zachary Wartell

(3,3)B, (1.33,0.33)A

Coordinates of point p

B

A

p

04/18/23©Zachary Wartell

Coordinates of Coordinate System A relative to B

B

A(2.5,1.5)B

(1/√2,1/√2)B(-1/√2,1/√2)B

Equivalent Questions:What is MB←A? -- “A to B"Where is A (as measured) in B? How do I superimpose B onto A?

(3,3)B, (1.33,0.33)Ap

04/18/23©Zachary Wartell

What is Minches←feet?

1D linear transform:

12 1/12

12 1/12

s s

M M

p M p p M p

p p

inches feet inches feet feet inches feet inches

inches inches feet feet feet feet inches inches

feet inches

p with coordinates (0.4)feet or(4.8)inches0inches unit vector

feet unit vector

Where is Feet in Inches? How to superimpose Inches onto Feet?

04/18/23©Zachary Wartell

Where is Celsius in Fahrenheit?How to superimpose Fahrenheit onto Celsius?

1D affine transform:

9 / 5 32 5 / 9 17.7

s t s t

M p M p

p p p p

far cel far cel cel far cel cel far cel far cel cel far

far cel cel far

p with coordinates (-8.81)cel or (16)far0far

fahrenheit unit vector & origin

celsius unit vector & origin

0cel,32far

scale by 9/5add 32 ‘s

What is Mfar←cel?

04/18/23©Zachary Wartell

Review: Matrices (1)

11 12 1

21 2

1 2

11

11 1

1

is a by matrix

, is a 'column matrix', is a 'row matrix'

Matrix Addition

is by , is by , is by

c

c

r r rc

c

r

ij ij

m m m

m mr c

m m m

v

v v

v

m n m n m n

c a b

M M

V U V U

C A B C A B

1

Matrix Multiplication:

is by , is by , is by

ij

n

ij ik kjk

m q m n p q

n p

c a b

C A BC AB

04/18/23©Zachary Wartell

Review: Matrices (2)

T

T T T

Property: Non-commutative:

Property: Distributive

Operation: Transpose

: where is by and is by

Property:

=

Operation: Determinant

det : , w

ij ji

m n n m

a b

AB BA

A B C AB AC

A B A B

AB B A

A A R

11 1211 22 21 12

21 22

11 12 13

21 22 231

31 32 33

1

here is by

det

det 1 det Ex:

1 det

nj k

jk jkj

nj k

jk jkk

n n

a aa a a a

a a

a a a

a a a a

a a a

a

A

A

A A

A

04/18/23©Zachary Wartell

Review: Matrices (3)

-1

1 1

1

Property:

det ( ) det det

Definition: Identity

1 0 0 0

0 1 0 0,

0 0 0

0 0 0 1

Operation: Inverse

: , where , are by and det 0 ( is 'non-singular')

1 det

det

j k

jkkj

n n

m

AB A B

I M I M

A B B A A B B B

M M M M I

M

M

04/18/23©Zachary Wartell

Review: Matrices (4)

Given two or more functions we 'compose' them by applying the result of one as

the input of the other

G( ), F( )

Then we might have

G(F( )), or F(G( )),

y x y x

x x

Operation : Composition (General)

F

or F(F(G(F( )))), etc...

We can use matrices to represent functions on column (or row) vectors.

G( ), where ,

F( ), where ,

Then we mi

x

G

Operation : Composition (Matrix)

y x y M x

y x y M x

F

F G

F G G F

ght have:

G(F( ))=

F(G( ))=

F(G(G(F( ))=

....etc...

Gx M M x

x M M x

x M M M M x

04/18/23©Zachary Wartell

B

A(2.5,1.5)B

(1/√2,1/√2)B(-1/√2,1/√2)B

B

A(2.5,1.5)B

(1/√2,1/√2)B(-1/√2,1/√2)B

Where is A in B?

A.x = ( 1/√2, 1/√2)A.y = (-1/√2, 1/√2)A.o = (2.5, 1.5)

Where is A in B? = What is MB←A?

1 2 1 2 2.5:

1.51 2 1 2

((0,0) ) (2.5,1.5)

((1,2) ) (1.79,3.62)

p

p

p

x x

y y

M

M

M

B A

B A

B A

B A

B A

A B

A B

(1,2)A, (1.79,3.62)B

p for “point”

04/18/23©Zachary Wartell

B

A(2.5,1.5)B

(1/√2,1/√2)B(-1/√2,1/√2)B

B

A(2.5,1.5)B

(1/√2,1/√2)B(-1/√2,1/√2)B

1 2 1 2 2.5:

1.51 2 1 2

((1,0) ) (1 2 ,1 2)

((0,1) ) ( 1 2 ,1 2)

V

V

V

x x

y y

M

M

M

B AB A

B A

B A A B

B A A B

What about the vectors?

Where is A in B?

A.x = ( 1/√2, 1/√2)A.y = (-1/√2, 1/√2)A.o = (2.5, 1.5)

Where is A in B? = What is MB←A? - vectors

V for “vector”

04/18/23©Zachary Wartell

More Compact:

1 2 1 2 2.5

: 1 2 1 2 1.5

0 0 1

where 1 for a point

0 for a vector

x x

y y

w w

w

w

MB A

B A B A

(1.79,3.62)

Where is A in B?

A.y = ( 1/√2, 1/√2)A.x = (-1/√2, 1/√2)A.o = (2.5, 1.5)

Compact Representation

B

A(2.5,1.5)B

(1/√2,1/√2)B(-1/√2,1/√2)B

B

A(2.5,1.5)B

(1/√2,1/√2)B(-1/√2,1/√2)B

04/18/23©Zachary Wartell

GeneralizationIn General:

- point

1 0 0 1 1:

- vector

0 0 0 1 0

x x x

y y y

x x x

y y y

x x

y y

x x

y y

.x .y .o

.x .y .o

M.x .y .o

.x .y .o

B A

B A

B A

B A

B A

A A A

A A A

A A A

A A A B

A(2.5,1.5)B

(1/√2,1/√2)B(-1/√2,1/√2)B

B

A(2.5,1.5)B

(1/√2,1/√2)B(-1/√2,1/√2)B

If I were being absurdly pedantic what sub-sub-script should go under the sub-scripts x,y,z? Answer:

x.xB

A

04/18/23©Zachary Wartell

Where is B in A? = What is MA←B?

More Compact:

1 2 1 2 2.76

: 1 2 1 2 1.73

0 0 1

11 2 1 2 2.5 1 2 1 2 2.76

!! 1 2 1 2 1.5 1 2 1 2 1.73

0 0 1 0 0 1

x x

y y

w w

MA B

A B A B

Where is B in A?

B.x = ( 1/√2, -1/√2)B.y = ( 1/√2, 1/√2)B.o = (-2.76, 1.73)

B

A(2.5,1.5)B

(1/√2,1/√2)B(-1/√2,1/√2)B

B

A(2.5,1.5)B

(1/√2,1/√2)B(-1/√2,1/√2)B

04/18/23©Zachary Wartell

What is relationship of MA←B and MB←A?

1 1

11 2 1 2 2.5 1 2 1 2 2.76

1 2 1 2 1.5 1 2 1 2 1.73

0 0 1 0 0 1

In general:

,

M M M MA B B A A B B A -generally inverse computation requires expensive Gaussian elimination. But in various specific cases (translate, scale, rotate) inverse computation can be quick!

B

A(2.5,1.5)B

(1/√2,1/√2)B(-1/√2,1/√2)B

B

A(2.5,1.5)B

(1/√2,1/√2)B(-1/√2,1/√2)B

04/18/23©Zachary Wartell

Revisions1.1

1. Added slide 132. Added Overview Slide3. Added explicit slide referencing “ITCS 4120-2D Transforms.ppt”4. re-ordered slides to better suit insertion of “ITCS 4120-2D Transforms.ppt”5. added 1D change of coordinates slides

1.2 -typos1.3 -added Matrix: Review slides1.4 -moved affine transform slides to other .ppt file -added DOF slide

-added ‘superimpose’ terminology to coordinate transform slides

04/18/23©Zachary Wartell

Alternative Convention MB←A and M A ←B

1 0 0

0 1 0

0 0 1 0 0 1 0 0 1

If and basis vectors have same interior angle (i.e. they are not sheared relative to e

x x x x x x

y y y yy y

.x .y .o .o .x .y

M .x .y .o .o .x .yB A

A A A A A A

A A A A A A

A B

11

ach other), then

1 0 0 0/ / 0

0 1 0 00 0 1

0 0 1 0 0 1

, where , and are a translation, rotation, and scale.

Now,

( )

x

y

.o .x.x .x .y .y

.o .y

T R S T R S

M M T R S

S

B A B A B A

B A A B A B A B A B

A B

A AA A A A

A A

1 1 1

1 1 1

Similarly we could write:

Note that here we've written by taking S,R, &T component matrices from . This is an alternative approach

used in some text

R T

M S R T

M M

A B A B

A B B A B A B A

A B B A

's (Hearn&Baker). This convention can be somewhat counter-intuitive. Why build by using inverse S,R,T

components . Is it not more intuitive build from it's own S,R,T components? So while

M

MA B

B A

1 1 1

1 1 1

the following are both correct

the T,R,S expression feels more intuitive than the S,R,T expression:

M T R S

S R T

M T R S

S R T

B A B A B A B A

A B A B A B

A B A B A B A B

B A B A B A