+ All Categories

CS361

Date post: 23-Feb-2016
Category:
Upload: jaron
View: 68 times
Download: 0 times
Share this document with a friend
Description:
Week 5 - Monday. CS361. Last time. What did we talk about last time? Trigonometry Transforms Affine transforms Rotation Scaling Shearing Concatenation of transforms. Questions?. Assignment 2. Project 2. Student Lecture: Normal Transforms and the Euler Transform . Normal transforms. - PowerPoint PPT Presentation
Popular Tags:
22
CS361 Week 5 - Monday
Transcript
Page 1: CS361

CS361Week 5 - Monday

Page 2: CS361

Last time

What did we talk about last time? Lines and planes Trigonometry Transforms

Affine transforms Rotation Scaling Shearing Concatenation of transforms

Page 3: CS361

Questions?

Page 4: CS361

Assignment 2

Page 5: CS361

Project 2

Page 6: CS361

Student Lecture: Normal Transforms and the Euler Transform

Page 7: CS361

Normal transforms The matrix used to transform points will not always work

on surface normals Rotation is fine

Uniform scaling can stretch the normal (which should be unit) Non-uniform scaling distorts the normal

Transforming by the transpose of the adjoint always gives the correct answer

In practice, the transpose of the inverse is usually used

Page 8: CS361

Intuition about why it works

Because of the singular value theorem, we can write any square, real-valued matrix M with positive determinant as: M = R1SR2 where R1 and R2 are rotation matrices and S is a scaling matrix

(M-1)T = ((R1SR2)-1)T

= (R2-1S-1R1

-1)T

= (R1-1)T(S-1)T(R2

-1)T

= R1 S-1 R2

Rotations are fine for the normals, but non-uniform scaling will distort them

The transpose of the inverse distorts the scale in the opposite direction

Page 9: CS361

Normal transform rules of thumb1. With homogeneous notation, translations do not

affect normals at all2. If only using rotations, you can use the regular

world transform for normals3. If using rotations and uniform scaling, you can use

the world transform for normals However, you'll need to normalize your normals so they

are unit4. If using rotations and non-uniform scaling, use the

transpose of the inverse or the transpose of the adjoint

They only differ by a factor of the determinant, and you'll have to normalize your normals anyway

Page 10: CS361

Inverses

For normals and other things, we need to be able to compute inverses Rigid body inverses were given before For a concatenation of simple transforms

with known parameters, the inverse can be done by inverting the parameters and reversing the order:▪ If M = T(t)R() then M-1 = R(-)T(-t)

For orthogonal matrices, M-1 = MT

If nothing is known, use the adjoint method

Page 11: CS361

Euler transform We can describe orientations from

some default orientation using the Euler transform

The default is usually looking down the –z axis with "up" as positive y

The new orientation is: E(h, p, r) = Rz(r)Rx(p)Ry(h) h is head, like shaking your head

"no"▪ Also called yaw

p is pitch, like nodding your head back and forth

r is roll… the third dimension

Page 12: CS361

Gimbal lock One trouble with Euler

angles is that they can exhibit gimbal lock

In gimbal lock, two axes become aligned, causing a degree of freedom to be lost

Euler angles can describe orientations in multiple ways, however the wrong choice of rotations may cause gimbal lock

Page 13: CS361

Rotation around an arbitrary axis Sometimes you want to rotate around some arbitrary axis r To do so, create an orthonormal basis r, s, and t as follows

Take the smallest component of r and set it to 0 Swap the two remaining components and negate the first one Divide the result by its norm, making it a normal vector s Let t = r x s

This basis can be made into a matrix M

The final transform X transforms the r-axis to the x-axis, does the rotation by α and then transforms back to r

X = MTRx(α)M

T

T

T

tsr

M

Page 14: CS361

Quaternions

Quaternions are a compact way to represent orientations

Pros: Compact (only four values needed) Do not suffer from gimbal lock Are easy to interpolate between

Cons: Are confusing Use three imaginary numbers Have their own set of operations

Page 15: CS361

Definition A quaternion has three imaginary parts and one

real part

We use vector notation for quaternions but put a hat on them

Note that the three imaginary number dimensions do not behave the way you might expect

wvwzyxwv qqkqjqiqq qqq ),ˆ(ˆ

kjiijjikkiikjjk

kji

1222

Page 16: CS361

Operations

Multiplication

Addition

Conjugate

Norm

Identity

),(ˆˆ vvwwvwvwvv rqqr rqrqrqrq

),(ˆˆ wwvv rq rqrq

),(*̂wv qqq

2222)̂( wzyx qqqqn q

)1,(ˆ 0i

Page 17: CS361

More operations

Inverse

One (useful) conjugate rule: Note that scalar multiplication is just like

scalar vector multiplication for any vector Quaternion quaternion multiplication is

associative but not commutative For any unit vector u, note that the

following is a unit quaternion:

*2

1 ˆ)̂(1ˆ qqq

n

)cos,(sinˆ φφuq

*** ˆˆ)̂ˆ( qrrq

Page 18: CS361

Quaternion transforms

Take a vector or point p and pretend its four coordinates make a quaternion

If you have a unit quaternion the result of is p rotated around the u axis by 2

Note that, because it's a unit quaternion,

There are ways to convert between rotation matrices and quaternions

The details are in the book

p̂)cos,(sinˆ φφuq

1ˆˆˆ qpq*1 ˆˆ qq

Page 19: CS361

Slerp Short for spherical linear interpolation Using unit quaternions that represent

orientations, we can slerp between them to find a new orientation at time t = [0,1], tracing the path on a unit sphere between the orientations

To find the angle between the quaternions, you can use the fact that cos = qxrx + qyry + qzrz + qwrw

rqrqs ˆsin

)sin(ˆsin

))1(sin(),̂,ˆ(̂φtφ

φtφt

Page 20: CS361

Upcoming

Page 21: CS361

Next time…

Vertex blending Morphing Projections

Page 22: CS361

Reminders

Keep reading Chapter 4Exam 1 next Friday


Recommended