+ All Categories
Home > Documents > Geometric Transformations

Geometric Transformations

Date post: 01-Jan-2016
Category:
Upload: hermione-mendez
View: 58 times
Download: 0 times
Share this document with a friend
Description:
Geometric Transformations. Transformations. Local moving frame. Linear transformations Rigid transformations Affine transformations Projective transformations. T. Global reference frame. Linear Transformations. A linear transformation T is a mapping between vector spaces - PowerPoint PPT Presentation
Popular Tags:
44
Geometric Transformations
Transcript
Page 1: Geometric Transformations

Geometric Transformations

Page 2: Geometric Transformations

Transformations

• Linear transformations

• Rigid transformations

• Affine transformations

• Projective transformations

T

Global reference frame

Local moving frame

Page 3: Geometric Transformations

Linear Transformations

• A linear transformation T is a mapping between vector spaces– T maps vectors to vectors– linear combination is invariant under T

• In 3D-spaces, T can be represented by a 3x3 matrix

)()()()( 11000

NN

N

iii TcTcTccT vvvv

major) (Row

major)(Column )(

3331

1333

Nv

vMvT

Page 4: Geometric Transformations

Affine Transformations

• An affine transformation T is an mapping between affine spaces– T maps vectors to vectors, and points to points– T is a linear transformation on vectors– affine combination is invariant under T

• In 3D-spaces, T can be represented by a 3x3 matrix together with a 3x1 translation vector

)()()()( 11000

NN

N

iii TcTcTccT pppp

131333)( TpMpT

Page 5: Geometric Transformations

Homogeneous Coordinates

• Any affine transformation between 3D spaces can be represented by a 4x4 matrix

• Affine transformation is linear in homogeneous coordinates

110)( 131333 pTMpT

Page 6: Geometric Transformations

Projective Spaces

• Homogeneous coordinates– (x, y, z, w) = (x/w, y/w, z/w, 1)– Useful for handling perspective projection

• But, it is algebraically inconsistent !!

)1,0,3

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

)1,0,2

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

Page 7: Geometric Transformations

Examples of Affine Transformations

• 2D rotation

• 2D scaling

1100

0cossin

0sincos

1

y

x

y

x

yx, yx ,

11100

00

00

1

ys

xs

y

x

s

s

y

x

y

x

y

x

Page 8: Geometric Transformations

Examples of Affine Transformations

• 2D shear

• 2D reflection

11100

010

01

1

y

dyx

y

xd

y

x

11100

010

001

1

y

x

y

x

y

x

Page 9: Geometric Transformations

Examples of Affine Transformations

• 2D translation

11100

10

01

1y

x

y

x

ty

tx

y

x

t

t

y

x

Page 10: Geometric Transformations

Examples of Affine Transformations

• 2D transformation for vectors– Translation is simply ignored

00100

10

01

0

y

x

y

x

t

t

y

x

y

x

Page 11: Geometric Transformations

Examples of Affine Transformations

• 3D rotation

11000

0cossin0

0sincos0

0001

1

z

y

x

z

y

x

11000

0100

00cossin

00sincos

1

z

y

x

z

y

x

11000

0cos0sin

0010

0sin0cos

1

z

y

x

z

y

x

Page 12: Geometric Transformations

Pivot-Point Rotation

• Rotation with respect to a pivot point (x,y)

100

sin)cos1(cossin

sin)cos1(sincos

100

10

01

100

0cossin

0sincos

100

10

01

),()(),(

xy

yx

y

x

y

x

yxTRyxT

Page 13: Geometric Transformations

Fixed-Point Scaling• Scaling with respect to a fixed point (x,y)

100

)1(0

)1(0

100

10

01

100

00

00

100

10

01

),(),(),(

yss

xss

y

x

s

s

y

x

yxTssSyxT

yy

xx

y

x

yx

Page 14: Geometric Transformations

Scaling Direction

• Scaling along an arbitrary axis

)(),()(1 RssSR yx

)(1 R),( yx ssS)(R

Page 15: Geometric Transformations

Properties of Affine Transformations

• Any affine transformation between 3D spaces can be represented as a combination of a linear transformation followed by translation

• An affine transf. maps lines to lines

• An affine transf. maps parallel lines to parallel lines

• An affine transf. preserves ratios of distance along a line

• An affine transf. does not preserve absolute distances and angles

Page 16: Geometric Transformations

Review of Affine Frames

• A frame is defined as a set of vectors {vi | i=1, …, N} and a point o– Set of vectors {vi} are bases of the associate vector

space– o is an origin of the frame– N is the dimension of the affine space– Any point p can be written as

– Any vector v can be written as

NNccc vvvop 2211

NNccc vvvv 2211

Page 17: Geometric Transformations

Changing Frames

• Affine transformations as a change of frame

yx,

0v

1v

111010

1010

y

x

y

x

yxyx

ovvovv

ovvovv

0v1v

o

o

Page 18: Geometric Transformations

Changing Frames

• Affine transformations as a change of frame

ovvo

vvv

vvv

100

11001

11000

cc

bb

aa

11001

11001

111

000

111

000

1010

y

x

cba

cba

y

x

y

x

cba

cba

y

x

ovvovv

yx,

0v

1v0v

1v

o

o

Page 19: Geometric Transformations

Changing Frames

• In case the xyz system has standard bases

Page 20: Geometric Transformations

Rigid Transformations

• A rigid transformation T is a mapping between affine spaces– T maps vectors to vectors, and points to points– T preserves distances between all points– T preserves cross product for all vectors (to avoid

reflection)

• In 3-spaces, T can be represented as

1det and

where,)( 131333

RIRRRR

TpRpTT

T

Page 21: Geometric Transformations

Rigid Body Rotation

• Rigid body transformations allow only rotation and translation

• Rotation matrices form SO(3)– Special orthogonal group

IRRRR TT

1det R

(Distance preserving)

(No reflection)

Page 22: Geometric Transformations

Rigid Body Rotation

• R is normalized– The squares of the elements in any row or column

sum to 1

• R is orthogonal– The dot product of any pair of rows or any pair

columns is 0

• The rows (columns) of R correspond to the vectors of the principle axes of the rotated coordinate frame

IRRRR TT

Page 23: Geometric Transformations

3D Rotation About Arbitrary Axis

Page 24: Geometric Transformations

3D Rotation About Arbitrary Axis

1. Translation : rotation axis passes through the origin

2. Make the rotation axis on the z-axis

3. Do rotation

4. Rotation & translation

),,( 111 zyxT

)()( yx RR

)(zR

)()( 111 xy RRT

Page 25: Geometric Transformations

3D Rotation About Arbitrary Axis

• Rotate u onto the z-axis

Page 26: Geometric Transformations

3D Rotation About Arbitrary Axis• Rotate u onto the z-axis

– u’: Project u onto the yz-plane to compute angle – u’’: Rotate u about the x-axis by angle – Rotate u’’ onto the z-asis

Page 27: Geometric Transformations

3D Rotation About Arbitrary Axis

• Rotate u’ about the x-axis onto the z-axis– Let u=(a,b,c) and thus u’=(0,b,c)– Let uz=(0,0,1)

22cos

cb

c

z

z

uu

uu

bx

zxz

u

uuuuu sin22

sincb

bb

z

uu

Page 28: Geometric Transformations

3D Rotation About Arbitrary Axis• Rotate u’ about the x-axis onto the z-axis

– Since we know both cos and sin , the rotation matrix can be obtained

– Or, we can compute the signed angle

– Do not use acos() since its domain is limited to [-1,1]

1000

00

00

0001

)(

2222

2222

cb

c

cb

bcb

b

cb

c

x R

),(atan22222 cb

b

cb

c

Page 29: Geometric Transformations

Euler angles

• Arbitrary rotation can be represented by three rotation along x,y,z axis

1000

0

0

0CS-SSCCC

)()()(),,(

CCSCS

SCCSSCCSSSCS

SSCSC

RRRR xyzXYZ

Page 30: Geometric Transformations

Gimble

• Hardware implementation of Euler angles• Aircraft, Camera

Page 31: Geometric Transformations

Euler Angles

• Rotation about three orthogonal axes– 12 combinations

• XYZ, XYX, XZY, XZX• YZX, YZY, YXZ, YXY• ZXY, ZXZ, ZYX, ZYZ

• Gimble lock– Coincidence of inner most

and outmost gimbles’ rotation axes

– Loss of degree of freedom

Page 32: Geometric Transformations

Euler Angles

• Euler angles are ambiguous– Two different Euler angles can represent the same

orientation

– This ambiguity brings unexpected results of animation where frames are generated by interpolation.

),2

,0 and )0,2

, 21 (R(θ),r,r(rR zyx

Page 33: Geometric Transformations

Taxonomy of Transformations

• Linear transformations– 3x3 matrix– Rotation + scaling + shear

• Rigid transformations– SO(3) for rotation– 3D vector for translation

• Affine transformation– 3x3 matrix + 3D vector or 4x4 homogenous matrix– Linear transformation + translation

• Projective transformation– 4x4 matrix– Affine transformation + perspective projection

Page 34: Geometric Transformations

Taxonomy of Transformations

Projective

Affine

Rigid

Page 35: Geometric Transformations

Composite Transformations

• Composite 2D Translation

),(

),(),(

2121

2211

yyxx

yxyx

tttt

ttttT

T

TT

100

10

01

100

10

01

100

10

01

21

21

1

1

2

2

yy

xx

y

x

y

x

tt

tt

t

t

t

t

Page 36: Geometric Transformations

Composite Transformations

• Composite 2D Scaling

),(

),(),(

2121

2211

yyxx

yxyx

ssss

ssssT

S

SS

100

00

00

100

00

00

100

00

00

21

21

1

1

2

2

yy

xx

y

x

y

x

ss

ss

s

s

s

s

Page 37: Geometric Transformations

Composite Transformations

• Composite 2D Rotation

)(

)()(

12

12

R

RRT

100

0)cos()sin(

0)sin()cos(

100

0cossin

0sincos

100

0cossin

0sincos

1212

1212

11

11

22

22

Page 38: Geometric Transformations

OpenGL Geometric Transformations

• glMatrixMode(GL_MODELVIEW);

Page 39: Geometric Transformations

OpenGL Geometric Transformations

• Basic Transpormation:– glLoadIdentity();– glTranslatef(tx, ty, tz);– glRotatef(theta, vx, vy, vz); angle-axis

•(vx, vy, vz) is automatically normalized– glScalef(sx, sy, sz);– glLoadMatrixf(Glfloat elems[16]);

• Multiplication– glMultMatrixf(Glfloat elems[16]);– The current matrix is postmultiplied by the matrix – Column major

Page 40: Geometric Transformations

OpenGL Geometric Transformations

• Getting the current matrix value:– glGetFloatv (GL_MODELVIEW_MATRIX,

GLfloat elems[16]);• Column major 0 4 8 12

1 5 9 13

2 6 10 14

3 7 11 15

GLfloat mat [16];glGetFloatv (GL_MODELVIEW_MATRIX, mat);GLfloat mat [16];glGetFloatv (GL_MODELVIEW_MATRIX, mat);

Page 41: Geometric Transformations

OpenGL Geometric Transformations

• Matrix Direct Manipulation:– glLoadMatrixf(GLfloat elems[16]);

• Column major

– glMultMatrixf(GLfloat elems[16]);• The current matrix is postmultiplied by the matrix

0 4 8 12

1 5 9 13

2 6 10 14

3 7 11 15

glLoadIdentity();glMultMatrixf (M1);glMultMatrixf (M2);

glLoadIdentity();glMultMatrixf (M1);glMultMatrixf (M2);

M = M1∙M2

Page 42: Geometric Transformations

OpenGL GLUT Animation Function

• GLUT Idle Callback fuction: – Idling: when there is nothing to do.

• Redraw the scene:

glutIdelFunc ( MyIdle );glutIdelFunc ( MyIdle );

void MyIdle(){

… // things to do… // when Idling

}

void MyIdle(){

… // things to do… // when Idling

}

glutPostRedisplay ( );glutPostRedisplay ( );

Page 43: Geometric Transformations

Hierarchical Modeling

• A hierarchical model is created by nesting the descriptions of subparts into one another to form a tree organization

Page 44: Geometric Transformations

OpenGL Matrix Stacks

• Four matrix modes– Modelview, projection, texture, and color– glGetIntegerv(GL_MAX_MODELVIEW_STACK_DEPTH, stackSize);

• Stack processing– The top of the stack is the “current” matrix– glPushMatrix(); // Duplicate the current matrix at the top

– glPopMatrix(); // Remove the matrix at the top


Recommended