Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
COMPUTER GRAPHICS
Contents
The Viewing Pipeline Viewing Coordinate Reference Frame Window-To-Viewport Coordinate Transformation Clipping Operations Point Clipping Line Clipping Polygon Clipping
2
A viewing transformation using standard rectangles for the window and viewport
ywmax ywmin xvmin xvmax World Coordinates ywmax ywmin xvmin xvmax 4 Device Coordinate
DC
Viewpoint
x0
x world
World Coordinates
WC ,VC R
R: rotation matrix T: translation matrix
7
xv xvmin ( xw xwmin ) sx
yv yvmin ( yw ywmin ) sy
10
sx
sy
Conversion sequence of transformation 1. Perform a scaling transformation using a fixed-point position of (xwmin, ywmin) that scales the window area to the size of the viewport 2. Translate the scaled window area to the position of the viewport 11
13
Clipping Operations
Clipping
Any procedure that identifies those portions of a picture that are either inside or outside of a specified region of space
14
Clipping application
Extracting the part of a defined scene for veiwing. Identify visible surface in 3 dimensional Antialiasing line segment or object boundries Creating objects using solid modelling procedure Dispalying a multiwindow environment and drawing and painting operation
15
Point Clipping
Assuming that the clip window is a rectangle in standard position Saving a point P=(x, y) for display
xwmin x xwmax ywmin y ywmax Appling Fields
Particles (explosion, sea foam)
16
a) Before Clipping
b) After Clipping
17
0 u 1
20
Not 0000
Completely outside the clipping region!!
Lines that cannot be identified as completely inside or outside a clip window by this test
23
y y1 m( x x1 )
Horizontal Boundary
m ( y2 y1 ) /( x2 x1 )
24
y y1 x x1 m
x x2 x1
0 u 1
y y1 uy, y y2 y1
k = 1, 2, 3, 4
q1 x1 xwmin q2 xwmax x1
Definition of parameter p, q
p1 x, p2 x,
p3 y, q3 y1 ywmin p4 y q4 ywmax y1
28
pk < 0
Line proceeds from outside to inside
pk > 0
Line proceeds from inside to outside
29
pk > 0
t2 = min(t)
qk t pk
t1 > t2
Rejection
t1 < t2 or t1 = t2
Draw
30
34
35
or
yT y1 y2 y1 yT y1 xR x1 x2 x1 xL x1
u ( xL x1 ) /( x2 x1 ) Top Boundary y yT u ( yT y1 ) /( y2 y1 )
y2 y1 y y1 ( xL x1 ) x2 x1 x2 x1 x x1 ( yT y1 ) y2 y1
37
38
Sutherland-Hodgeman Polygon Clipping Four case 1: if first vertex outside and second inside then intersection point with the windows boundary 2: both vertex are inside save the second point 3: if first vertex inside and second outside then intersection point with the windows boundary 40 4: both vertex are outside do not save point
Successive processing of pairs of polygon vertices against the left window boundary
41
42
Algorithm : 1. Read coordinates of all vertices of polygon 2. Read coordinates of clipping windows 3.Consider the left edges 4. Compare the vertices of each of the polygon individually with clipping plane 5. Save the resulting intersection and vertices in the new list of vertices according to four possible relationship between the edge and the clipping boundary
6. Repeate the steps 4 and 5 for remaining edges of the clipping windows . 7 stops
??
45
For an outside-to-inside pair of vertices, follow the polygon boundary For an inside-to-outside pair of vertices, follow the window boundary in clockwise direction
Correct Result
46