1 geometrical transformation 2 outline general transform 3d objects quaternion & 3d track ball

93
1 Geometrical Transformation

Post on 19-Dec-2015

218 views

Category:

Documents


0 download

TRANSCRIPT

1

Geometrical Transformation

2

Outline• General Transform

• 3D Objects

• Quaternion & 3D Track Ball

3

Modeling Transform• Specify transformation for objects

– Allow definitions of objects in own coordinate systems

– Allow use of object definition multiple times in a scene

4

Overview• 2D transformations

– Basic 2-D transformations– Matrix representation– Matrix composition

• 3D transformations– Basic 3-D transformation– Same as 2-D

• Transformation Hierarchies– Scene graphs

5

2-D Transformations

6

2-D Transformations

7

2-D Transformations

8

2-D Transformations

9

2-D Transformations

10

2-D Transformations

11

Basic 2D Transformations

xtxx '

ytyy '

xSxx '

ySyy '

xShyy y 'yShxx x '

sincos' yxx cossin' yyy

12

Basic 2D Transformations

xtxx '

ytyy '

xSxx '

ySyy '

yShxx x 'xShyy y '

sincos' yxx cossin' yyy

y

x

Syy

Sxx

'

'

13

Basic 2D Transformations

xtxx 'ytyy '

xSxx '

ySyy '

sincos' yxx cossin' yyy

yShxx x 'xShyy y '

cos)(sin)('

sin)(cos)('

yx

yx

SySxy

SySxx

14

Rotation around the origin (2-D)

15

Rotation around the origin (2-D)

16

Rotation around the origin (2-D)

17

Rotation (3-D)

18

Rotation (3-D)

19

Basic 2D Transformations

xtxx 'ytyy '

xSxx '

ySyy '

yShxx x 'xShyy y '

sincos' yxx cossin' yyy

cos)(sin)('

sin)(cos)('

yx

yx

SySxy

SySxx

20

Basic 2D Transformations

xtxx '

ytyy '

xSxx '

ySyy '

yShxx x 'xShyy y '

sincos' yxx cossin' yyy

yyx

xyx

tSySxy

tSySxx

cos)(sin)('

sin)(cos)('

21

Basic 2D Transformations

xtxx '

ytyy '

xSxx '

ySyy '

yShxx x 'xShyy y '

sincos' yxx cossin' yyy

yyx

xyx

tSySxy

tSySxx

cos)(sin)('

sin)(cos)('

22

Matrix Representation

23

Matrix Representation

24

2x2 Matrix

xsx x 'ysy y '

xsys

y

x

s

s

y

x

y

x

0

0

'

'

25

Scaling

26

Scaling Around A Point

27

2x2 Matrix

28

Shear (2-D)

29

Shear (3-D)

30

2x2 Matrix

31

2x2 Matrix

32

2D Translation

33

Basic 2D Transformations

34

Homogeneous Coordinates

35

Linear Transformations

36

Affine Transformations

37

Projective Transformations

38

Matrix Composition

39

Matrix Composition

40

Matrix Composition

41

Matrix Composition

42

3D Transformations

43

Basic 3D Transformations

44

Basic 3D Transformations

45

GENERAL ROTATION ABOUT ANAXIS

An axis in space is specified by a point P and a vector direction .Suppose that we wish to rotate an object about this arbitrary axis.

t

46

Developing the General Rotation Matrix

47

Developing the General Rotation Matrix

48

Developing the General Rotation Matrix

49

Developing the General Rotation Matrix

50

Developing the General Rotation Matrix

51

Developing the General Rotation Matrix

• Be careful …………

Z

X

(+,+)

(-,-)In both cases, tan(y/x) are positive.So, we need to carefully chooseit by checking the signs of x and y

52

Developing the General Rotation Matrix

Another problem is: rotation interpolation is not easy and not goodreported in many papers.

53

54

55

Angular displacement glRotate( , Ax,Ay,Az)

• (,n) defines an angular displacement of about an axis u or n for rotating a vector v

56

sin)()cos1)((cos

sin)(cos))(()(

sin)(cos][][][][ ||||||

vnvnnv

vnnvnvnvn

vnvvvRvRvvRvR

The above formula is a matrix form, so we can use Matrix to compute rotation

In above equation, v=(x,y,z)T and n=(ax,ay,az)T

57

58

59

60

61

Inverse Transformation

62

Inverse Transformation

63

Transform points, lines, planes etc.

64

Transforming Normals

65

Transformation Hierarchies

66

OpenGL transformation Matrices

67

OpenGL transformation Matrices

68

OpenGL transformation Matrices

69

OpenGL transformation Matrices

70

Transformation Example 1

71

Transformation Example 2

72

Transformation Example 2

73

Hierarchical Scene Graph

This topics will be taught in future or the next semester!!

74

75

76

77

78

79

80

81

82

83

84

85

86

Applications

87

Applications

88

Applications

89

90

91

92

93