1 / 31

5.1 3D Coordinates System

5.1 3D Coordinates System. Right-handed Coordinates System. X. Y. Y. X. Y. X. Left-handed Coordinates System. X. Y. Y. X. X. Y. We will use vight-handed Coordinates System in our class. 5.2 3D Geometry. Y. (0,2,0). (0,0,0). X. (3,0,0). (0,0,1). Z. [ ].

libba
Download Presentation

5.1 3D Coordinates System

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

Presentation Transcript


  1. 5.1 3D Coordinates System Right-handed Coordinates System X Y Y X Y X Left-handed Coordinates System X Y Y X X Y We will use vight-handed Coordinates System in our class.

  2. 5.2 3D Geometry Y (0,2,0) (0,0,0) X (3,0,0) (0,0,1) Z [ ] 0 0 0 3 0 0 0 2 0 0 0 1 We can use the way to represent 3D points and polyhedras as the way to represent 2D points and polygons. For example: represents a tetrahedron In homogenlous coordinates system represents the same tetrahedron

  3. 5.3 3D Transformations Let's discuss 3D transformations, going directly to matrix and functional forms: (1) Translation: [x' y' z' 1] = [x y z 1] * [] (2) Scaling: [x' y' z' 1] = [x y z 1] * [] (3) Rotation: • Rotating about X(Y or Z) does not change X's. • The value of Y' and Z' does not depend on X. • Row 4 and column 4 are always the same. • The problem is to locate sin, -sin and cos.

  4. Y X Z [y' z' 1] = [y z 1] *[] cosq sinq0 -sinq cosq0 0 0 1 cosq sinq0 0 -sinq cosq0 0 0 0 1 0 0 0 0 1 [x' y' z' 1] = [x y z 1] *[] Y X Z (a) Rotate about Z: (b) Rotate about Y: Eye X Z

  5. [z' x' 1] = [z x 1] *[] cosq sinq 0 -sinq cosq0 0 0 1 [x' z' 1] = [x z 1] *[] cosq -sinq 0 sinq cosq0 0 0 1 cosq 0 -sinq 0 0 1 0 0 sinq 0 cosq0 0 0 0 1 [x' y' z' 1] = [x y z 1] *[] Y X Z [y' z' 1] = [y z 1] *[] cosq sinq0 -sinq cosq0 0 0 1 1 0 0 0 0 cosq sinq0 0 -sinq cosq0 0 0 0 1 [x' y' z' 1] = [x y z 1] *[] (c) Rotate about X:

  6. Y Y X X Z Z Y Y X X Z Z Homework: Rotate the block counterwisely p/2 degree about X, Y, Z axis respectively. Find new coordinate for each vertex. Rotate about X (0,3,0) (1,0,0) (0,0,2) Rotate about Y Rotate about Z

  7. 6.1 Projection Different eye position has different view.

  8. After the projection, the distance between your eyes and the object vertices is unknown. With the help of hidden-line removal algorithm, you can know which vertex is closer to you.

  9. Orthgraphic Parallel Projections vs. Perspective Projections Orthgraphic Parallel Projections: The center of projection is located at infinity and the projectors are prependicular to the projection plane . Perspective projections: The center of projection is located at a finite distance from the projection plane.

  10. Y [x,y,z] [x,y,0] X Z Orthgraphic parallel Projection : Projection Plane : XY-Plane (Z=0) Projector : parallel to Z axis The Problem for finding projection point are simple: project to [ x y 0 ] [ x y z ] will

  11. Perspective Projection : How to get a picture? (1) Freeze the scene. (2) Freeze you head (eyes). Perspective:

  12. What information we need to project a picture into a projection plane via perspective projection? (1) eye position (2) object position (3) picture plane Anything else? (4) Up direction

  13. Y X Z Up1 = [ ] Up2 = [ ] Up3 = [ ] 0 1 0 1 0 0 1 1 0

  14. Ye [x y z] [xp yp 0] Xe Ze [0 0 d] = Eye Position Consider the eye coordinate system: Projection plane: XY-plane (Z=0) Eye position: [0 0 d] Projector: the line from [x y z] to a given eye position. The problem for finding projection point becomes: Find the intersection point for projcetion plane and projector.

  15. Ye [x y z] [xp yp 0] Xe Ze [0 0 d] = Eye Position x Ye (x,y,z) xp -z [x y z] Xe [xp yp 0] Xe Ze [0 0 d] = Eye Position d Ze (1) Look alone the -Xe direction: (2) Look alone the -Ye direction: Ye (x,y,z) y yp Ze -z d yp : y = d : d-z yp= (d/(d-z)) * y xp : x = d : d-z xp= (d/(d-z)) * x

  16. [xp yp 0 1]=[x y z 1][] d/(d-z) 0 0 0 0 d/(d-z) 0 0 0 0 0 0 0 0 0 1 [xp yp 0 1] = [dx/(d-z) dy/(d-z) 0 1] = [x y 0 1-(z/d)] =[x y z 1][] 1 0 0 0 0 1 0 0 0 0 0 -1/d 0 0 0 1 (3) Represented in matrix form : xp = (d/(d-z)) * x yp= (d/(d-z)) * y In homogeneous coordinates system, the points [ x y z 1] and [wx wy wz w] (w*0) represents the same points. So, the point

  17. (4) Questions : (a) How to draw a 3D line into the picture plane ? (b) What happens when Z (c) What about d Y [xt yt zt] . [x't y't 0] [xf yf zf] [x'f y'f 0] X Z

  18. Exercise: (1) Draw The rectangle whose vertices are P=(10,10,-10), Q=(-10,10,-10) R=(-10,10,10), S=(10,10,10) and XY plane is projection plane, (0,0,15) is the eye position. Y Y 1 Q P 2 4 X S R 3 . X . . (0,0,5) Z (0,0,15)

  19. (2) Move your eye from (0,0,15) to ((0,0,15), what you will see? Y Y 1 Q P 2 4 S R 3 . X X . . (0,0,5) Z (0,0,15)

  20. Y X Z (d) How about z > d (i.e., point is behind the eye) ? (e) How about z d (i.e., point is near the eye) ? Y Y X X Z Z

  21. 6.2 View Transformation In general, we may want to observe object from some other position (in stead of (0,0,d)) and direction (in stead of - Ze), say from point (xf , yf ,zf ) to point (xt ,yt ,zt ). Notice that the world data and view vector now are given in world coordinates, not eye coordinates. Yw (Xf ,Yf ,Zf ) view vector (Xt ,Yt ,Zt ) Xw world data representing object Zw

  22. We must transform the object data from world coordinates into eye coordinates before we can perform orthographic parallel or perspective projection . This transformation called viewing transformation. Where is the eye coordinate system? We make the arbitrary Ye (Up direction) which perpedicular to Ze Ye Yw Xe Ze Xw world data Zw

  23. We want a "neat" viewing transformation, V, such that [xe ye ze 1] = [xw yw zw 1] * V i.e., multiply all world points by V and it will be just as if the eye was at (0,0,d) or (0,0,), depend on perspeative or orthographic parallel projection, looking at (0,0,0). Visualize the process as transforming the Ze and Ye axes to Zw and Yw axes. This is accomplished using four basic transformations: 1. Translate the vector so that (xt , yt , zt ) = (0, 0, 0). 2. Rotate the result so that the transformed (xf , yf , zf )' swings into the Yw-Zw plane. 3. Rotate the result so that (xf , yf , zf )'' swings down onto the Zw axis. 4. Rotate this result so that Ye swings down onto the Yw axis.

  24. Step 1. The first step is just a simple translation. Yw Ye Xe Ze Xw Zw T1 = = [ ]

  25. Step 2. Rotate a degrees about Yw to swing eye' into the Yw-Zw plane. tan(2p- a)=X'/Z'=tan(- a) a = Check the sign (check rotation direction) Step 3. Swing eye'' down by b degrees to (0,0,d) by rotating eye'' about Xw. b = Yw eye'' eye' Xw b a Zw

  26. Now, the eye coordinate system and world coordinate system are shown in the following picture. Step 4. Rotate Xe about Zwq degrees. (asswne Xe = (X3, Y3, 0)) q = -tan-1 Y3'/X3' Yw Ye Xe q q Xw Ze Zw

  27. Yw (0,1,0)w Xw (1,0,0)w (0,0,1)w Zw Our transformation equation becomes: [xe ye ze 1] = [xw yw zw 1] T1 R2 R3 R4 To check your transformatios, try: eye = (0,1,0) aim = (0,0,0) Ye = (1,0,0) Ze Ye Xe

  28. Homework: Try again with Ye = (0,0,1) and other values are the same. Yw (0,1,0)w (0,0,1)e (0,0,0)w (0,0,0)e Xw (1,0,0)w (-1,0,0)e (0,0,1)w (0,1,0)e Zw

  29. 6.3 View Volume We saw that as z -> d, severe distortion occures, like a "fisheye" lens. Also, data far from the observer (z << 0) becomes dots! To eliminate these effects, we'll introduce two clipping planes, parallel to the Xe-Ye plane: (1) A front clipping plane at z=zfront (2) A back clipping plane at z=zback This creates a viewing volume, which is a pyramid, and is now a 6-sided frustum. Ye Back Clipping Plane Xe Ze Projection Plane Front Clipping Plane

  30. 6.3 Z-Clipping Now the full clipping procedure becomes: (1) Clip on front and back planes. (2) Perspective projection to 2D window. (3) Clip on the 2D window. To determine the visibility of a point P(x,y,z), just test its z value: If ((z > zfront) or (z<zback)) then "Invisible", else "Visible". (1) Under what conditions that a line segment will not be clipped? P1 = (X1, Y1, Z1) P2 = (X2, Y2, Z2) ZbackZ1, Z2Zfront (2) How to clip a line segment using Z-clipping? (1) Z = Z1 + (Z2-Z1)t (2)replace Z = Zfront or Zend , find t (3)find (X Y Z) = (X1 Y1 Z1) + t(X2-X1, Y2-Y1, Z2-Z1)

  31. Three types of perspective projections: (1) one-point (2) two-point (3) three-point

More Related