Presentation is loading. Please wait.

Presentation is loading. Please wait.

12-Perspective Depth Assoc.Dr. Ahmet Zafer Şenalp Mechanical Engineering Department Gebze Technical.

Similar presentations


Presentation on theme: "12-Perspective Depth Assoc.Dr. Ahmet Zafer Şenalp Mechanical Engineering Department Gebze Technical."— Presentation transcript:

1 12-Perspective Depth e-mail: Assoc.Dr. Ahmet Zafer Şenalp e-mail: azsenalp@gmail.comazsenalp@gmail.com Mechanical Engineering Department Gebze Technical University ME 521 Computer Aided Design

2 12-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: x s y s increased to z s. z s will be calculated to find the depth information without altering the interpretation of x s, y s values. Images of P and Q are identical (x s, y s ). depth of P=0.3 depth of Q=0.6 Dr. Ahmet Zafer Şenalp ME 521 2 Mechanical Engineering Department, GTU Introduction

3 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 x e +b y e +c z e + d = 0 a' x s +b' y s +c' z s + d' = 0 As shown before: Assuming D/S=1, V sx =V s y=1, V cx =V xy =0 for given values of x s and y s from the plane equation, will satisfy the plane equation.  or  can be arbitrary, however  < 0 gives a better intuitive notion such that if z e is larger, z s is also larger.  &  can be chosen to increase the depth precision. Dr. Ahmet Zafer Şenalp ME 521 3 Mechanical Engineering Department, GTU 12-Perspective Depth

4 If depth resolution can be maximized so that z e =D then z e =D maps into smallest z s, z e =D magnifies into largest z s for z s convention is adopted: Dr. Ahmet Zafer Şenalp ME 521 4 Mechanical Engineering Department, GTU 12-Perspective Depth

5 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 5 Mechanical Engineering Department, GTU 12-Perspective Depth

6 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 6 Mechanical Engineering Department, GTU 12-Perspective Depth

7 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 7 Mechanical Engineering Department, GTU 12-Perspective Depth

8 Properties of The Screen Coordinate System The viewpoint z e = 0 is undefined in the screen coordinates, but can be imagined as being at infinity along -z s. Thus rays emanating from the eye are all parallel to the z s axis. Figure shows that Q hides P. Dr. Ahmet Zafer Şenalp ME 521 8 Mechanical Engineering Department, GTU 12-Perspective Depth

9 Properties of The Screen Coordinate System Procedure: We compare z s coordinates of P (z s =  ) and the intersection of a line from P to the viewpoint with plane Q ( z s = z d ) if plane equation of Q is known in the screen coordinate system. a x s + b y s + c z s + d = 0 Substituting x s = , y s =  solve for z d. Here all rays are parallel, in eye coordinates the same calculations are more difficult. Dr. Ahmet Zafer Şenalp ME 521 9 Mechanical Engineering Department, GTU 12-Perspective Depth

10 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 10 Mechanical Engineering Department, GTU 12-Perspective Depth

11 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 z e axis: we shall assume that the x e 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 11 Mechanical Engineering Department, GTU 12-Perspective Depth

12 Example : Dr. Ahmet Zafer Şenalp ME 521 12 Mechanical Engineering Department, GTU 12-Perspective Depth

13 Example : Dr. Ahmet Zafer Şenalp ME 521 13 Mechanical Engineering Department, GTU 12-Perspective Depth 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  =-90° into equation:

14 Example : Dr. Ahmet Zafer Şenalp ME 521 14 Mechanical Engineering Department, GTU 12-Perspective Depth 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  = -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.5triangle: As inverse transform is required  = 36.87° is used:

15 Example : Dr. Ahmet Zafer Şenalp ME 521 15 Mechanical Engineering Department, GTU 12-Perspective Depth 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

16 Example : Dr. Ahmet Zafer Şenalp ME 521 16 Mechanical Engineering Department, GTU 12-Perspective Depth 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 V sx =V cx =V sy =V cy =1023/2. D=60, S=15, V sx =V cx =V sy =V cy =1023/2 The transformation is therefore: To calculate the screen coordinates: x s = 511.5 (x c /z c ) + 511.5, y s = 511.5 (y c /z c ) + 511.5

17 Example : Dr. Ahmet Zafer Şenalp ME 521 17 Mechanical Engineering Department, GTU 12-Perspective Depth 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 (x c =NVx, y c =NVy, z c =NVz) xcxc ycyc zczc A5.6-3.6812.94 B-0.8-6.5611.98 C-5.6-2.7213.26 D0.80.1614.22 E5.62.7211.74 F-0.8-0.1610.78 G-5.63.6812.06 H0.86.5613.02

18 Example : Dr. Ahmet Zafer Şenalp ME 521 18 Mechanical Engineering Department, GTU 12-Perspective Depth 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 x s = 511.5 (x c /z c ) + 511.5, y s = 511.5 (y c /z c ) + 511.5

19 Example : Dr. Ahmet Zafer Şenalp ME 521 19 Mechanical Engineering Department, GTU 12-Perspective Depth The lines are drawn as shown in the below figure.


Download ppt "12-Perspective Depth Assoc.Dr. Ahmet Zafer Şenalp Mechanical Engineering Department Gebze Technical."

Similar presentations


Ads by Google