Docsity

Homogeneous Transformations - Introduction to Computer Graphics - Lecture Slides, Slides of Computer Graphics

Partial preview of the text

Download Homogeneous Transformations - Introduction to Computer Graphics - Lecture Slides and more Slides Computer Graphics in PDF only on Docsity!

Homogeneous Transformations

Example: Distance Between Lines^ „^

We have two non-intersecting 3D lines in space „^

Line 1 is defined by a point

p

on the line and a 1

ray

r^1

in the direction of the line, and line 2 is

defined by

p

and 2

r^2

„^

Find the closest distance between the two lines

p^1

p^2

r^1 r 2

Example: Distance Between Lines^ „^

Notice that the sign of the result might be positive ornegative depending on the geometric configuration, sowe should really take the absolute value if we want apositive distance „^

Also note that the equation could fail if |

r x^1

r |=0, implying^2

that the lines are parallel. We should really test for thissituation and use a different equation if the lines areparallel

(^

)^

(^

)

2 1

2 1 1 2

r

r

r

r

p

p

×

×

dist

Linear Transformations

d v M v^

1 2 3

3 3 3

2 2 2

1 1 1

3

3

3

3

2

2

2

2

1

1

1

1

d d d

v v v

c b a

c b a

c b a

v v v

d v c v b v a v d v c v b v a v d vc

v b v a v

x y z

x y z

z

y

x

z

z

y

x

y

z

y

x

x

Matrix Dot Matrix

N

M

L

33

32

31

23

22

21

13

12

11

33

32

31

23

22

21

13

12

11

33 32 31

23 22 21

13 12 11

n

n

n

n

n

n

n n n m m m

m

m

m

m m m l l l

l

l

l

l

l

l

32 13

22 12

12 11

12

n m n m n m

l^

Multiple Rotations & Scales^ „^

We can combine a sequence of rotations andscales into a single matrix „^

For example, we can combine a y-rotation,followed by a z-rotation, then a non-uniformscale, and finally an x-rotation:

(^

)^

(^

)^

(^

v

M

v

R R s S R M

γ^

y

z

x

Combining Transformations^ „^

We see that we can combine a sequenceof rotations and/or scales

„^

We can also combine a sequence oftranslations

„^

But what if we want to combinetranslations

with

rotations/scales?

Homogeneous Transformations

3

3

3

3

2

2

2

2

1

1

1

1

3 3 3 3

2 2 2 2

1 1 1 1

z

y

x

z

y

x

z

z

y

x

y

z

y

x

x

x y z

x y z

v

v

v

d v c v b v a v d v c v b v a v d vc

v b v a v

v v v

d c b a

d c b a

d c b a

v v v

v M v

Homogeneous Transformations^ „^

For example, a translation by vector

r^

followed

by a

z

-axis rotation can be represented as:

⎡^ ⎢ ⎢ ⎢ ⎢ ⎣

cos

sin

sin

cos

1

x y z

x y z

x y z

v v v r r r

v v v

Rotation Matrices

⎤ ⎥ ⎥ ⎥ ⎥ ⎦

⎡ ⎢ ⎢=⎢− ⎢ ⎣

1 0 0 0

0

cos 0

sin

0 0 1 0

0

sin 0

cos

θ

θ

θ

θ

θ y R

⎤ ⎥ ⎥ ⎥ ⎥ ⎦

⎡ ⎢ ⎢ ⎢ ⎢ ⎣

−

=

1 0

0 0

0

cos

sin 0

0

sin

cos 0

0 0

0 1

θ

θ

θ

θ

θ x R^

⎤ ⎥ ⎥ ⎥ ⎥ ⎦

⎡^ ⎢ ⎢ ⎢ ⎢ ⎣

−

=

1 0 0

0

0 1 0

0

0 0

cos

sin

0 0

sin

cos

θ

θ

θ

θ

θ z R

Docsity.com

Euler’s Theorem^ „^

Euler’s Theorem: Any two independentorthonormal coordinate frames can be relatedby a sequence of rotations (not more than three)about coordinate axes, where no two successiverotations may be about the same axis. „^

Not to be confused with Euler angles, Eulerintegration, Newton-Euler dynamics, inviscidEuler equations, Euler characteristic… „^

Leonard Euler (1707-1783)

Euler’s Theorem^ „^

There are two useful ways of looking at Euler’stheorem in relationship to orientations:

1.^

It tells us that we can represent any orientationas a rotation about three axes, for example x,then y, then z

2.^

It also tells us that any orientation can berepresented as a single rotation about someaxis by some angle

Orientation^ „^

One method for storing an orientation is to simply store it as a sequence ofrotations about principle axes, such as x, then y, then z. We refer to this as Euler angles.

This is a compact method, as it uses exactly 3 numbers to

store the orientation „^

Another option is to represent the orientation as a unit length axis and ascalar rotation angle, thus using 4 numbers in total. This is a conceptuallystraightforward method, but is of limited mathematical use, and so is notterribly common „^

A third option is to use a 3x3 matrix to represent orientation (or the upper3x3 portion of a 4x4 matrix). This method uses 9 numbers, and so mustcontain some extra information (namely, the scaling and shearing info) „^

A fourth option is to use a quaternion, which is a special type of 4-dimensional vector. This is a popular and mathematically powerful method,but a little bit strange… These are covered in Math155B and CSE „^

No matter which method is used to

store

the orientation information, we

usually need to turn it into a matrix in order to actually transform points ordo other useful things

Scale Transformations^ „^

The uniform scaling matrix scales an entire object by scale factor

s

„^

The non-uniform scaling matrix scales independently along the

x ,

y ,

and

z^

axes

⎤ ⎥ ⎥ ⎥ ⎥ ⎦

⎡ ⎢ ⎢=⎢ ⎢ ⎣

1 0 0 0

0

0 0

0 0

0

0 0 0

s s s su S

⎤ ⎥ ⎥ ⎥

⎡ ⎢ ⎢ ⎢ =^

0

0 0

0 0

0

0 0 0

z y x

n^

s s s s S

⎥ ⎦

⎢ ⎣^

1 0 0 0

Docsity.com