Geometric Transformation - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

Geometric Transformation

Description:

Affine Transformation. Preserve parallel lines and finite points. Includes Translation, Rotation, Scaling, Reflection, Shear. 3-D Translation ... – PowerPoint PPT presentation

Number of Views:61
Avg rating:3.0/5.0
Slides: 19
Provided by: hirosh4
Category:

less

Transcript and Presenter's Notes

Title: Geometric Transformation


1
Geometric Transformation 3-D Viewing
ECS175 Discussion Session 3
  • Hiroshi Akiba Jan 30, 2004

2
Outline
  • Geometric Transformations
  • Translation
  • Scaling
  • Rotations
  • Problem1
  • 3-D Viewing
  • Perspective Viewing
  • Problem2
  • GLUT Callback functions

3
Geometric Transformation
  • Affine Transformation
  • Preserve parallel lines and finite points.
  • Includes Translation, Rotation, Scaling,
    Reflection, Shear

4
3-D Translation
  • Translate point P(x,y,z) to P(x,y,z) by
    distance d(tx,ty,tz)

P
P
d
5
3-D Scaling
  • Scale point P(x,y,z) to P(x,y,z) by a factor
    of s(sx,sy,sz)

P
P
6
3-D Rotations (x-axis)
  • Rotate point P(x,y,z) to P(x,y,z) by

y
z
x
7
3-D Rotations (y-axis)
  • Rotate point P(x,y,z) to P(x,y,z) by

y
z
x
8
3-D Rotations (z-axis)
  • Rotate point P(x,y,z) to P(x,y,z) by

y
z
x
9
Transformation Matrices
  • Complex transformations are obtained by the
    product of these matrices

10
Problem1 Rotation About a Fixed Point
  • Q Give a 4x4 matrix M for rotating a cube ?
    about the axis passing through P(-1,2,1) and
    parallel to z axis. Here, P is a center of the
    cube.

y
x
z
11
Problem1 Rotation About a Fixed Point
  • Solution
  • M is the matrix to translate P to somewhere in
    the z axis such as origin, rotate ?about z axis,
    and translate back to P. Let the first
    translation matrix T and the rotation matrix R,
    then
  • where
  • the answer is verified by

12
3-D Viewing
  • Viewing(camera) coordinates
  • Define position and orientation of a camera
  • Object need to be described by this coordinates
    ?superimpose the viewing coordinates onto the
    world coordinates

Yw
Yw
gluLookAt(eye, at, up)

Xv
Yvup
Yv
d
eye
at
Zv
Xv
Zv
Zw
Zw
Xw
Xw
13
Perspective Projection
  • Projection reference point(center of projection)

Yw
Projection reference point
View Plane
Zw
Xw
14
Problem2 Perspective Projection
  • Q What are view coordinates of the perspective
    projection of the point P(3,3,-5) onto the view
    plane z-2. Here, the projection reference point
    is at (0,0,1) in the view coordinates.

P
Yw
?
Projection reference point
Zw
Xw
15
Problem2 Perspective Projection
  • Solution
  • Since the point is on the z-2 plane, z
    coordinate is 2
  • x and y coordinates are found by following graph
  • Hence, the answer is (3/2, 3/2, -2)

16
GLUT callback functions
  • glutDisplayFunc(disp)
  • void disp(void)
  • glutKeyboardFunc(key)
  • void key(unsigned char key, int x, int y)
  • glutMouseFunc(mouse)
  • void mouse(int button, int state, int x, int y)
  • glutReshapeFunc(reshape)
  • void reshape(int width, int height)

17
Examples
Void mouse(int button, int state, int x, int y)
if(state GLUT_DOWN buttonGLUT_LEFT_BUTTO
N) exit(1) if(state GLUT_DOWN
buttonGLUT_RIGHT_BUTTON)
glutPostRedisplay()
Void key(char key) if(keyq keyQ
key \27) exit(0)
18
References
  • 1.Hearn baker, Computer Graphics width OpenGL,
    2004
  • 2.Edward Angel, Interactive Computer Graphics A
    Top-Down Approach with OpenGL, 2000
  • 3. Edward Angle, OpenGL A PRIMER, 2002
  • 4.OpenGL Red Book, http//www.opengl.org/documenta
    tion/red_book_1.0/
Write a Comment
User Comments (0)
About PowerShow.com