20
1 Homogeneous Transformation Ref: Richard Paul Chap. 1

1 Homogeneous Transformation Ref: Richard Paul Chap. 1

Embed Size (px)

Citation preview

1

Homogeneous Transformation

Ref: Richard Paul Chap. 1

2

Notation

Vector: vPlane: PFrame: I, APoint in space: pPoint p as a vector v in frame E: EvSame point as a vector w in frame H: Hw

Discussion is in 3-space

3

Vectors

[a,b,c,0]T: point at infinity

Inner (dot) product

Outer (cross) product

Homogeneous coordinate w

4

PlanesCompared with ax+by+cz+d = 0 …

[x/w,y/w,z/w]

[a/m,b/m,c/m]

-d/m

Point v on a plane:

5

Transformationv = Huv = Hu

With homogeneous coordinates, translate and rotation become linear transformations in R4

6

Plane Equation after Transformation

Given the transform:

Q (the plane P after transformation H):

Proof:

We require: (=0)

7

ExampleThe transform H:

The plane P defined by these points:(0,0,2), (1,0,2), (0,1,2) is [0,0,1,-2]

The plane after transformation:

6001

1000

4001

7100

3010

21001

PHQ

How to compute H-1 (see next page) …

Transformed points are(6,-3,7), (6,-2,7), (6,-3,8)

8

Inverse Transformation

Assumption: [n o a] is orthogonal

Verify:

Iappaaaoana

oppoaooono

nppnanonnn

TT

1000

1

9

Recall Normal Matrix

In OpenGL, normal vectors are transformed by normal matrix into eye spaceNormal matrix is the inverse transpose of modelview matrix (M-T)

Normal vector and plane equation are related!

1 MnnnMn To

Teo

Te

10

Rotating a Point

A

B

x

x’

RxuuR

uRuR

uux

iuRu

uux

ii

21

21

21

21

ˆˆ2

ˆˆ2

ˆˆ2

2,1,ˆˆ

ˆˆ2

2

1

1

2

01

10

01

10

)90cos()90sin(

)90sin()90cos(

x

R

Point rotation is closely related to coordinate transformation (next page)

Point rotation is closely related to coordinate transformation (next page)

(same coordinates in new bases)

11

Coordinate Transformation

B

A

x

2

1

1

2

01

10

01

10

)90cos()90sin(

)90sin()90cos(

1

2

xRx

R

x

ABA

B

BA

A :RBARotation that takes frame B to frame A

12

Ex: Coordinate Transform

A

Bx

frameB frameA to taking :

1

1

0

,

1

1

1

TT

xTx

xx

AB

BAB

A

BA

1

1

0

100

101

210

1

1

1

100

001

010

100

110

201

100

101

210

)90()1,2( RotTranslTAB

13

Ex: Coordinate Transform

A

B

x

xTx

RotTranslT

xx

ABA

B

BA

BA

1

1

2

100

201

110

1

0

2

100

201

110

100

001

010

100

210

101

)90()2,1(

1

0

2

,

1

1

2

14

Coordinate TransformglTranslatef (2,1,0);glRotatef (30,0,0,1);drawtank();

A frame frameW to taking :

,

TT

xTx

xFindxGive

WA

AWA

W

WA

1000

0100

1030cos30sin

2030sin30cos

1000

0100

0030cos30sin

0030sin30cos

1000

0100

1010

2001

TWA

tank

• Use the transformation of the tank (and its local coordinates) to find the world coordinates of specific points.

Vec3 X = proj (HTrans4(vec3(2,1,0))*HRot4(Vec3(0,0,1),30*3.14/180)*vec4(3,0,0,1);

• Implemented by SVL (ex: tip of tank)

A

W

(3,0)

15

Extra

16

Relative Transform & Frames

Rot(z,90) Rot(y,90) Trans(4,-3,7)

17

Reference Frame

18

Reference Frame (cont)The transformed vector is the same vector described w.r.t. the reference frame

19

Transform Equation omit

superscripts

20

The Problem

A

BO

Transform EquationOA AB = OB

100

2

12

100

2)30cos()30sin(

12)30sin()30cos(

100

64

64

100

6

4

100

630cos30sin

430sin30cos

23

21

21

23

23

21

23

21

21

23

21

23

1

23

21

21

23

B

A

A

O

O

O

100

324

234

100

33236

332136

100

2

12

100

64

64

21

23

23

21

41

43

23

23

41

43

23

21

21

23

23

21

23

21

21

23

21

23

BAB OOA 1

AB