Three-Dimensional Viewing Clipping by mpe18147

VIEWS: 16 PAGES: 14

									Three-Dimensional Viewing
        Clipping

  Computer Graphics C Version
        (456p - 462p)
Objectives of this Chapter
General Ideas
   How clipping could be performed using
    the view volume


Normalized view volume

Homogeneous coordinates
General Ideas for 3D
Clipping
A Point of Similarity
   Accomplished with extensions of 2D
    clipping method


A Point of Difference
   Clipping against boundary planes of
    view volume instead of boundary edge
Line Clipping - 1
View volume’s boundary plane Eq
   Ax + By + Cz + d = 0


If point is (x, y, z)
 Inside boundary: Ax + By + Cz + d < 0
 Outside boundary: Ax + By + Cz + d > 0
Line Clipping - 2
Cases of 2 end points’ position
   All inside
        Saved
   All outside
        Discard
        Leaving intersection
   One inside, one outside
        Leaving intersection
Intersection coordinate (xi, yi, zi)
Axi + Byi + Czi + d = 0
Viewing Transformation - 1
Expanded PHIGS transformation
pipeline
Viewing Transformation - 1
View Volume Clipping

Rectangular parallelepiped view
volume Clipping

Unit cube clipping
Viewing Transformation - 1
Viewing Transformation - 2
View Volume Clipping
   Needs to obtain all 6 planes equations
Rectangular parallelepiped view volume
Clipping
   Each surface is perpendicular to one
    coordinate axes
   Converting to Rect parallelepiped view volume
     Orthographic view volume
     Oblique view volume
     Perspective view volume
Viewing Transformation - 3
Unit cube clipping
 Providing standard shape for
  representing any sized view volume
 Providing simplified clipping procedure

 Providing simplified depth cueing and
  visible-surface determination
->Normalized view volume
Normalized View Volume
Dimensions of the view volume and
3D viewport
 Normalized View Volume


 Dx 0   0    Kx          XV max       XV min
                                                                       ZV min
 0 Dy   0    Ky 
                     Dx=   XW max       XW min        Dz=   ZV max
                                                             ZW max    ZW min
                
0   0   Dz   Kz    Dy=   YV max    YV min
                                     YW min
                
                           YW max

0   0   0    1 

                     Kx=   XV min       XW min   Dx


                     Ky=   YV min    YW min      Dy


                     Kz=   ZV min    ZW min      Dz
Viewport Clipping
Cohen Sutherland (6 Bit code)
      Bit   1   =1   x<XVmin (left)
      Bit   2   =1   x<XVmax (right)
      Bit   3   =1   y<YVmin (below)
      Bit   4   =1   y>YVmin (above)
      Bit   5   =1   z<ZVmin (front)
      Bit   6   =1   z>ZVmax (back)
Cyrus-Beck or Liang-Barsky
      X = X1 + (X2 - X1)u         0  u  1
      Y = Y2 + (Y2 - Y1)u
      Z = Z3 + (Z2 – Z1)u
Clipping in Homogeneous
Coordinates
Conversion
    (x, y, z) -> (x, y, z, 1)

                                                Xh       Yh            Zh
 Xh       a11   a12   a13 a14    X    X’=
                                                h    Y’=
                                                         h       Z’=
                                                                       h
 Yh      a 21                     Y 
                a 22 a 23 a 24
                                                       Xh
 Zh  =    a31   a32 a33 a34      Z 
                                              XV min 
                                                          h
                                                              XV max

                                                    Yh
h        a 41   a 42 a 43 a 45            YV min        YV max
                                     h                   h

                                                          Zh
                                              ZV min        ZV max
                                                          h

								
To top