1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize:...

29
1 Homogeneous Coordinates and Transformation

Transcript of 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize:...

Page 1: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

1

Homogeneous Coordinates and Transformation

Page 2: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

2

Line in R2

General line equation

Normalize:

Distance to origin

22 ba

c

(projection along n)

n(x,y)

For any two points on the line:

n line

Page 3: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

3

Line in R2

Parametric equation of a line

Corresponding implicit form:

0

0

0

:resultant

1221

22

11

22

11

2

2

1

1

22

11

xpvxpv

xpv

xpvR

yptv

xptv

v

py

v

px

tvpy

tvpx

Implicitize:

Page 4: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

4

Affine Transformation

Properties:• Collinearity (maps a line to a line)• Preserve ratio of distances (midpoint stays in the middle after transformation)

Page 5: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

5

Common 2D Affine Transformations

• Translation• Scaling• Reflection (Q = I–2uuT)• Rotation about origin• Shear

Page 6: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

6

Homogeneous Coordinate

• Motivation: to unify representations of affine map (esp. translation)

1101

1

y

xbAdAp

y

x

bApy

xp

y

xp

Page 7: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

7

DefinitionsEquivalence relation ~ on the set S = R3 \ {(0,0,0)}

Ex: Show that this relation is reflexive, symmetric, and transitive

Equivalence classes of the relation ~ Homogeneous coordinates

Homogeneous coordinates

Projective plane P2: the set of all equivalence classes

An equivalence class is referred to as a point in the projective plane.

aRcbRcaRbtransitive

bRaaRbsymmetric

aRareflexive

Xcba

:

:

:

,,

Page 8: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

8

Definitions

Choose a representative (u/w, v/w, 1) 1-1 correspondence with Cartesian plane

Points on P2:

I. [(u,v,w)] with w 0

II. [(u,v,w)] with w = 0

Corresponds to points-at-infinity, each with a specific direction

Points on P2: the plane R2 plus all the points at infinity

Page 9: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

9

Points at Infinity

01

:line ,Direction ,Point

1

y

x

y

x

tyb

txa

tyb

txa

y

x

b

a

t

t

tb

ta

Points at infinity: (x,y,0)

Reach the same point (at ), from any starting point

(x,y,0)

Page 10: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

10

Parallel Lines Intersect at Infinity

)0,1,2( :coordinate shomogeneou

)0,,2(:

2222

212

22

12

rrsolution

wvu

wvu

yx

yx

wv

wu

wv

wu

(-2,1,0)

Page 11: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

11

Visualization

• Line model [and spherical model]

Page 12: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

Visualization

12

]1,,[],,[3

2

3

1321 x

x

x

xxxx

Page 13: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

13

Line in Cartesian Space

2121

2121

,

0 0

:lines twoofon intersecti asPoint

0 0

:line a determine points Two

0

equation line sHomogeneou

),,(),,,(

00

llplpandlp

ppllpandlp

lp

wvupcbal

cwbvaucbyax wv

wu yx

(or any multiple of it)

(or any multiple of it)

Page 14: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

14

Examples (cases in R2)

• The line passes through (3,1) and (-4,5)

• Intersection of

01974

1974

154

113

21

yx

kji

kji

ppl

0143,087 yxyx

planeCartesian in ,

172325

143

871

1723

1725

21

kji

kji

llp

Page 15: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

15

• Two parallel lines • Defining a line with a point at infinity

kji

kji

llp

yxl

yxl

012

221

121

022:

012:

21

2

1

02

211

011

111

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

21

21

yx

kji

kji

ppl

pp

Page 16: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

16

Plane in Cartesian Space

3333

2222

1111

4321

321

,,

0 ,0 ,0

:points e thru threplaneA

0

equation plane sHomogeneou

),,,(),,,,(

00

wvus

wvus

wvus

eeee

kn

npandnpnp

np

wvuspdcban

dwcvbuasdczbyax wv

wu

ws zyx

0

:

3333

2222

1111

3333

2222

1111

4321

wvus

wvus

wvus

wvus

wvus

wvus

wvus

pepepepe

pn

Verify

iiii

iiii

i

Extend to P3 and R3Extend to P3 and R3

Page 17: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

17

Intersection of Three Planes

3333

2222

1111

4321

321 0 ,0 ,0

dcba

dcba

dcba

eeee

kp

pnandpnpn

)1,0,1,0(

0100

0001

1011

0,0,01 ofon intersecti The

4321

eeee

p

zxyx

Page 18: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

18

Line in R3

(Plücker Coordinate)

tqptx )(

qpq 0

Line in parametric form

Define

Plucker coordinate of the line (q, q0) p q

q0

Page 19: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

19

Space Transformation

• Translation

• Scaling

• Rotation about coordinate axes

• Rotation about arbitrary line

• Reflection about arbitrary plane (Q=I–2uuT)

Page 20: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

20

Transformed Equations

If transformation T is applied to geometry (line/plane), what’s the transformed equation?

• Apply T to homogenous line/plane equation?! NOT !!

Answers:• See handout p.3 (convert to parametric form;

transform the points; then to implicit equation)• More detailed version: see “homogeneous-

transformation.ppt” from R. Paul (next page)• Also related to the normal matrix in OpenGL.

Page 21: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

21

From Richard Paul Ch.1

Page 22: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

22

Summary

Point u on a plane:

wzyxu ,,,:point

0 dwczbyax

],,,[:plane dcba

0u 0u

Point u becomes v = HuPlane P’ becomes PH-1

0 1

11

uuHH

HuHvHReason:

After transformation H

Note if P is written as a column vector, the formula becomes P’ = H-TP

Page 23: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

23

Page 24: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

24

Transformationv = Huv = Hu

Page 25: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

25

From Opengl-1.ppt

Page 26: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

26

Vectors and Points are Different!

Point

• Homogenenous coordinatep = [x y z 1]

• M: affine transform (translate, rotate, scaling, reflect, …) p’= M p

Vector

• Homogeneous coordinatev = [x y z 0]

• Affine transform (applicable when M is invertible (not full rank; projection to 2D is not) v’= (M-1)T v

(ref)

glVertex

glNormal

Page 27: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

27

v’=Mv won’t work

0

1

2

0

1

1

100

010

002

0

1

1

1

0

2

1

0

1

100

010

002

1

0

1

1

1

0

1

1

0

100

010

002

1

1

0

100

010

002

scaling uniform-non

222

111

Mvvv

Mppp

Mppp

M

Page 28: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

28

On (M-1)T

• The w (homogeneous coord) of vectors are 0; hence, the translation part (31 vector) plays no role

• For rotation, M-1=MT, hence (MT)T = M: rotate the vector as before

• For scaling:T

s

s

s

z

y

x

MM

s

s

s

M

z

y

x

1

1

1

1

1

1

0

1000

vM

Page 29: 1 Homogeneous Coordinates and Transformation. 2 Line in R 2 General line equation Normalize: Distance to origin (projection along n) n (x,y) For any two.

29

Hence

0

1

0

1

1

100

010

00

0

1

1

100

010

002

scaling uniform-non

21

21

vMvv

M

T

This is known as the normal matrix (ref)