Computer graphics �subject code(22318)
BY A.I.MUSHRIF
Syllabus
Sr.no | Name of topics |
Unit 1 | Basics of computer graphics |
Unit 2 | Raster scan Graphics |
Unit 3 | Overview of Transformations |
Unit 4 | Windowing and clipping |
Unit 5 | Introduction to curves |
Weightage of marks
Sr.no | Topics | Marks |
1 | Basics of computer Graphics | 08 |
2 | Raster Scan Graphics | 18 |
3 | Overview of Transformations | 18 |
4 | Windowing and clipping | 14 |
5 | Introductions to Curves | 12 |
Total | 70 | |
Chapter 4�Windowing and Clipping
Contents
Clipping Concept
World Coordinates
Clipping Concept
wymax
wymin
wxmin
wxmax
Window or Clipping Region
World Coordinates
Clipping Concept
wymax
wymin
wxmin
wxmax
World Coordinates
Window or Clipping Region
Clipping
wymax
wymin
wxmin
wxmax
Window
P1
P2
P3
P6
P5
P7
P10
P9
P4
P8
Point Clipping
wymax
wymin
wxmin
wxmax
Window
P1
P2
P5
P7
P10
P9
P4
P8
Clipped
Points Within the Window are Not Clipped
Clipped
Clipped
Clipped
Easy - a point (x,y) is not clipped if:
Line Clipping
Situation | Solution | Example |
Both end-points inside the window | Don’t clip | |
One end-point inside the window, one outside | Must clip | |
Both end-points outside the window | Don’t know! | |
Cohen-Sutherland Clipping Algorithm
Dr. Ivan E. Sutherland co-developed the Cohen-Sutherland clipping algorithm. Sutherland is a graphics giant and includes amongst his achievements the invention of the head mounted display.
Cohen is something of a mystery – can anybody find out who he was?
Window to viewport transformation
Window to viewport transformation
Window to viewport transformation
Window to viewport transformation
Now the relative position of the object in Window and Viewport are same.
For x coordinate,
For y coordinate,
Window to viewport transformation
Window to viewport transformation
Cohen-Sutherland: World Division
1001 | 1000 | 1010 |
0001 | 0000 Window | 0010 |
0101 | 0100 | 0110 |
above
below
right
left
3
2
1
0
Region Code Legend
Cohen-Sutherland: Labelling
wymax
wymin
wxmin
wxmax
Window
P3 [0001]
P6 [0000]
P5 [0000]
P7 [0001]
P10 [0100]
P9 [0000]
P4 [1000]
P8 [0010]
P12 [0010]
P11 [1010]
P13 [0101]
P14 [0110]
Cohen-Sutherland: Lines In The Window
Lines completely contained within the window boundaries have region code [0000] for both end-points so are not clipped
The OR operation can efficiently check this
wymax
wymin
wxmin
wxmax
Window
P3 [0001]
P6 [0000]
P5 [0000]
P7 [0001]
P10 [0100]
P9 [0000]
P4 [1000]
P8 [0010]
P12 [0010]
P11 [1010]
P13 [0101]
P14 [0110]
Cohen-Sutherland: Lines Outside The Window
Any lines with a common set bit in the region codes of both end-points can be clipped
wymax
wymin
wxmin
wxmax
Window
P3 [0001]
P6 [0000]
P5 [0000]
P7 [0001]
P10 [0100]
P9 [0000]
P4 [1000]
P8 [0010]
P12 [0010]
P11 [1010]
P13 [0101]
P14 [0110]
AND operation and OR operation
Cohen-Sutherland: Other Lines
Cohen-Sutherland: Other Lines (cont…)
Cohen-Sutherland Examples
wymax
wymin
wxmin
wxmax
Window
P10 [0100]
P9 [0000]
P10’ [0000]
P9 [0000]
Cohen-Sutherland Examples (cont…)
wymax
wymin
wxmin
wxmax
Window
P7’ [0000]
P7 [0001]
P8 [0010]
P8’ [0000]
Cohen-Sutherland Examples (cont…)
wymax
wymin
wxmin
wxmax
Window
P7’ [0000]
P7 [0001]
P8 [0010]
P8’ [0000]
Cohen-Sutherland Worked Example
wymax
wymin
wxmin
wxmax
Window
Calculating Line Intersections
y = y1 + m (xboundary - x1)
where xboundary can be set to either wxmin or wxmax
Calculating Line Intersections (cont…)
x = x1 + (yboundary - y1) / m
where yboundary can be set to either wymin or wymax
Difference
Midpoint Subdivision Algorithm
Midpoint Subdivision Algorithm
Mid point subdivision
Mid point Subdivision Algorithm
Mid point Subdivision Algorithm
Mid point Subdivision Algorithm
Polygon clipping algorithm
Sutherland-Hodgeman polygon clipping algorithm�
Sutherland-Hodgeman polygon clipping algorithm�
Sutherland-Hodgeman polygon clipping algorithm�
Sutherland-Hodgeman polygon clipping algorithm�
Sutherland-Hodgeman polygon clipping algorithm�
Sutherland-Hodgeman polygon clipping algorithm�
�Sutherland-Hodgeman polygon clipping algorithm�
Sutherland-Hodgeman polygon clipping algorithm�
Sutherland-Hodgeman polygon clipping algorithm�
Text clipping
Text clipping
Text clipping
Text clipping
Text clipping
Text clipping