ME 521 Computer Aided Design 14 Perspective Depth
- Slides: 19
ME 521 Computer Aided Design 14 -Perspective Depth Assoc. Prof. Dr. Ahmet Zafer Şenalp e-mail: azsenalp@gmail. com Mechanical Engineering Department Gebze Technical University
Introduction • • 14 -Perspective Depth Operation of removing hidden lines or surfaces require perspective transformations with special properties. Depth of each point in the perspective image must be available for making decisions about hidden lines and surfaces. The screen coordinate system in increased to 3 -D: xs ys increased to zs. zs will be calculated to find the depth information without altering the interpretation of xs , ys values. Images of P and Q are identical (xs , ys ). depth of P=0. 3 depth of Q=0. 6 Dr. Ahmet Zafer Şenalp ME 521 Mechanical Engineering Department, GTU 2
14 -Perspective Depth • • • We need to calculate the depth of a line not only at end points but also at any intermediate point for the purposes of hidden line algorithm. We remember the fact that straight lines and planes in the eye coordinate system, transform into straight lines and planes respectively in the screen coordinate system. Using the plane equations (plane eqn. in eye coordinates transform into plane eqn. in screen coord. ): a xe +b ye +c ze + d = 0 a' xs +b' ys +c' zs + d' = 0 As shown before: Assuming D/S=1, Vsx=Vsy=1, Vcx=Vxy=0 for given values of xs and ys from the plane equation, will satisfy the plane equation. a or b can be arbitrary, however b < 0 gives a better intuitive notion such that if ze is larger, zs is also larger. a & b can be chosen to increase the depth precision. Dr. Ahmet Zafer Şenalp ME 521 Mechanical Engineering Department, GTU 3
14 -Perspective Depth • If depth resolution can be maximized so that ze =D then ze =D maps into smallest zs, ze =D magnifies into largest zs for zs convention is adopted: • Dr. Ahmet Zafer Şenalp ME 521 Mechanical Engineering Department, GTU 4
14 -Perspective Depth These connections modify the viewing pyramid by adding plans to limit the z e values as shown. Here; These can be transformed to hardware coordinates by viewpoint transformation The perspective transformation are now: Dr. Ahmet Zafer Şenalp ME 521 Mechanical Engineering Department, GTU 5
14 -Perspective Depth w is related to depth. point lying on plane of viewpoint w=0, w > 0 lie in front, w < 0 lie in behind. w can be regarded as a fourth coordinate. These equations can also be represented in matrix form: , Clipping must be performed before the above equation. Dr. Ahmet Zafer Şenalp ME 521 Mechanical Engineering Department, GTU 6
14 -Perspective Depth Clipping algorithm similar to those discussed before is used, The point of intersection on a line with a plane x = -w is calculated by: t is the distance along the line; t = 0 at x 1 , t = 1 at x 2. At intersection, x = t (x 2 - x 1) + x 1 Dr. Ahmet Zafer Şenalp ME 521 Mechanical Engineering Department, GTU 7
Properties of The Screen Coordinate System 14 -Perspective Depth The viewpoint ze = 0 is undefined in the screen coordinates, but can be imagined as being at infinity along -zs. Thus rays emanating from the eye are all parallel to the zs axis. Figure shows that Q hides P. Dr. Ahmet Zafer Şenalp ME 521 Mechanical Engineering Department, GTU 8
Properties of The Screen Coordinate System 14 -Perspective Depth Procedure: We compare zs coordinates of P (zs=e) and the intersection of a line from P to the viewpoint with plane Q ( zs = zd ) if plane equation of Q is known in the screen coordinate system. a xs + b y s + c z s + d = 0 Substituting xs =g , ys = d solve for zd. Here all rays are parallel, in eye coordinates the same calculations are more difficult. Dr. Ahmet Zafer Şenalp ME 521 Mechanical Engineering Department, GTU 9
14 -Perspective Depth Example: Perspective of a cube Consider a cube centered at the origin of the world coordinate system, defined by the following points and lines: Dr. Ahmet Zafer Şenalp ME 521 Mechanical Engineering Department, GTU 10
14 -Perspective Depth Example : Five steps in establishing the viewing transformation: a) translation, b) rotation about the x axis, c) rotation about the y axis, d) rotation about the x axis, e) inverting the z axis We shall observe this cube from a point (6, 8, 7. 5), with the viewing axis z e pointed directly at the origin of the world coordinate system. There is still one degree of freedom left, namely an arbitrary rotation about the ze axis: we shall assume that the xe axis lies in the z = 7. 5 plane. The viewing transformation is established by a sequence of changes of coordinate systems. Recall that a transformation that moves a coordinate system is the inverse of the corresponding transformation that moves points. Dr. Ahmet Zafer Şenalp ME 521 Mechanical Engineering Department, GTU 11
14 -Perspective Depth Example : Dr. Ahmet Zafer Şenalp ME 521 Mechanical Engineering Department, GTU 12
14 -Perspective Depth Example : 1. The coordinate system is translated to (6, 8, 7. 5), as shown in the figure a. The point(6, 8, 7. 5) in the original coordinate systems becomes the origin: 2. Rotate the coordinate system about the x' axis by 90°, as shown in figure b. Because we require the inverse transformation, we substitute q =-90° into equation: Dr. Ahmet Zafer Şenalp ME 521 Mechanical Engineering Department, GTU 13
14 -Perspective Depth Example : 3. Rotate about the y' axis by an angle so that the point (0, 0, 7. 5) will lie on the z' axis, as shown in figure c. We have using 6 -8 -10 triangle: As inverse transform is required q= -143. 13° is used: 4. - Rotate about the x' axis by an angle so that the origin of the original coordinate system will lie on the z' axis, as shown in figure d. AS shown in figure d the angle is calculated from 7. 5 -10 -12. 5 triangle: As inverse transform is required q = 36. 87° is used: Dr. Ahmet Zafer Şenalp ME 521 Mechanical Engineering Department, GTU 14
14 -Perspective Depth Example : 5. Finally, reverse the sense of the z' axis in order to create a left-handed coordinate system that conforms to the conventions of the eye coordinate system, as shown in figure e. A scaling matrix is used: This completes the five primitive transformations needed to establish the viewing transformation V=T 5 T 4 T 3 T 2 T 1 Dr. Ahmet Zafer Şenalp ME 521 Mechanical Engineering Department, GTU 15
14 -Perspective Depth Example : Suppose that we wish to fill a 30 by 30 centimeter display screen, designed to be viewed from 60 centimeters away, and that the coordinate system of the screen runs from 0 to 1023. Thus, D=60, S=15, and Vsx=Vcx=Vsy=Vcy=1023/2. D=60, S=15, Vsx=Vcx=Vsy=Vcy=1023/2 The transformation is therefore: To calculate the screen coordinates: xs = 511. 5 (xc/zc) + 511. 5 , ys = 511. 5 (yc/zc) + 511. 5 Dr. Ahmet Zafer Şenalp ME 521 Mechanical Engineering Department, GTU 16
14 -Perspective Depth Example : Total transformation matrix= NV= NT 5 T 4 T 3 T 2 T 1 or: Each vertex of the cube is transformed by the matrix NV, clipped, and converted to screen coordinates using equation (xc=NVx, yc=NVy, zc=NVz) Dr. Ahmet Zafer Şenalp ME 521 xc yc zc A 5. 6 -3. 68 12. 94 B -0. 8 -6. 56 11. 98 C -5. 6 -2. 72 13. 26 D 0. 8 0. 16 14. 22 E 5. 6 2. 72 11. 74 F -0. 8 -0. 16 10. 78 G -5. 6 3. 68 12. 06 H 0. 8 6. 56 13. 02 Mechanical Engineering Department, GTU 17
14 -Perspective Depth Example : Although the clipping routine must be applied to each line in the cube, it is apparently from the table that all of the vertices lie within the viewing pyramid, and the clipping algorithm will trivially accept each line. The screen coordinates of the line endpoints are calculated with the below equation xs = 511. 5 (xc/zc) + 511. 5 , ys = 511. 5 (yc/zc) + 511. 5 Dr. Ahmet Zafer Şenalp ME 521 Mechanical Engineering Department, GTU 18
14 -Perspective Depth Example : The lines are drawn as shown in the below figure. Dr. Ahmet Zafer Şenalp ME 521 Mechanical Engineering Department, GTU 19
- Computer-aided design integrator
- Computer-aided drug design lecture notes
- Bzier
- Cadd drug design
- Total internal reflection in a semicircular glass block
- Texas transportation code driving while license invalid
- Cis521
- Cse 521
- Zemax tutorial
- Ley 24 195
- Opti 521
- Computer aided embroidery
- Computer aided learning
- Objectives of computer aided quality control
- Computer aided manufacturing definition
- "computer aided software engineering" category?id= site:com
- Computer aided medical procedures
- Computer aided medical procedures
- Types of caats
- Computer aided software engineering tools examples