SlideServe
Menu
Preferences
© SlideServe · v2026

Three-Dimensional Graphics

jana avatar
12 slides · 688 Views · 130 likes · Feb 01, 2012

Three-Dimensional Graphics. A 3D point (x,y,z) – x,y, and Z coordinates We will still use column vectors to represent points Homogeneous coordinates of a 3D point (x,y,z,1) Transformation will be performed using 4x4 matrix. T. y. x. z. Right hand coordinate system.

Three-Dimensional Graphics - slide 1
01 / 12Three-Dimensional Graphics
1 / 17

Download Presentation

Three-Dimensional Graphics
An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

More Related Content

Presentation Transcript
  1. Three-Dimensional Graphics • A 3D point (x,y,z) – x,y, and Z coordinates • We will still use column vectors to represent points • Homogeneous coordinates of a 3D point (x,y,z,1) • Transformation will be performed using 4x4 matrix T y x z

  2. Right hand coordinate system • Xx Y = Z ; Y x Z = X; Z x X = Y; Y y z x +z x Left hand coordinate system Right hand coordinate system

  3. 3D transformation • Very similar to 2D transformation • Translation x’ = x + tx; y’ = y + ty; z’ = z + tz X’ 1 0 0 tx X Y’ 0 1 0 ty Y Z’ 0 0 1 tz Z 1 0 0 0 1 1 • OpenGL - glTranslated(tx, ty, tz); = homogeneous coordinates

  4. 3D transformation • Scaling X’ = X * Sx; Y’ = Y * Sy; Z’ = Z * Sz X’ Sx 0 0 0 X Y’ 0 Sy 0 0 Y Z’ 0 0 Sz 0 Z 1 0 0 0 1 1 • OpenGL - glScaled(Sx, Sy, Sz); =

  5. y + x z 3D transformation • 3D rotation is done around a rotation axis • Fundamental rotations – rotate about x, y, or z axes • Counter-clockwise rotation is referred to as a positive rotation (when you look down negative axis)

  6. 3D transformation • Rotation about Z – similar to 2D rotation x’ = x cos(q) – y sin(q) y’ = x sin(q) + y cos(q) z’ = z y x + cos(q) -sin(q) 0 0 sin(q) cos(q) 0 0 0 0 1 0 0 0 0 1 z • OpenGL - glRotatef(q, 0,0,1)

  7. x y x z + + z y 3D transformation • Rotation about y z’ = z cos(q) – x sin(q) x’ = z sin(q) + x cos(q) y’ = y cos(q) 0 sin(q) 0 0 1 0 0 -sin(q) 0 cos(q) 0 0 0 0 1 • OpenGL - glRotatef(q, 0,1,0)

  8. z y x y + + z x 3D transformation • Rotation about x y’ = y cos(q) – z sin(q) z’ = y sin(q) + z cos(q) x’ = x 1 0 0 0 0 cos(q) -sin(q) 0 0 sin(q) cos(q) 0 0 0 0 1 • OpenGL - glRotatef(q, 1,0,0)

  9. (rx, ry, rz) y x z 3D transformation • Arbitrary rotation axis (rx,ry,rz) • Text pp. 193 explains how to do it • We omit the detail here • Use OpenGL: glRotatef(angle, rx, ry, rz) • Can fill in all 9 entriesof the rotation matrix.

  10. OpenGL Transformation Composition • A global modeling transformation matrix (GL_MODELVIEW, called it M here) glMatrixMode(GL_MODELVIEW) • The useris responsible to reset it if necessary glLoadIdentity() -> M = 1 0 0 0 1 0 0 0 1

  11. OpenGL Transformation Composition • Matrices for performing user-specified transformations are multiplied to the current matrix • For example, 1 0 1 glTranslated(1,1 0); M = M x 0 1 1 0 0 1 • All the vertices defined within glBegin() / glEnd() will first go through the transformation (modeling transformation) P’ = M x P

  12. Object Local Coordinates Object World Coordinates Transformation Pipeline Modeling transformation …