Docsity

Point Clipping - Computer Graphics - Lecture Slides, Slides of Computer Graphics

Partial preview of the text

Download Point Clipping - Computer Graphics - Lecture Slides and more Slides Computer Graphics in PDF only on Docsity!

Computer

Graphics

Lecture 27

Restricting the effect of

graphics primitives to a

sub-region of the canvas

Protecting other portions

of the canvas

CLIPPING

x (^) min <= x <= x (^) max

y (^) min <= y <= y (^) max

Point Clipping

Intersect that line with each of the four clip rectangle edges. if so, the line cuts the clip rectangle and is partially inside.

The Brute Force

Approach

More efficient;

Performs initial tests on a

line to determine whether

intersection calculations

can be avoided.

Cohen Sutherland

L ine C lipping A lgorithm

Faster line clippers based on analysis of the parametric equation of a line segment:

Liang-Barsky

Algorithm

More efficient; intersection calculations are reduced.

Conclusion

Polygon clipping - open polygons.

Example

Weiler-Atherton clipping algorithm

Weiler-Atherton clipping algorithm clips any polygon against any clip polygon. The polygons may even have holes.

Four Cases of Polygon Clipping Against One Edge

Case 2 : Exit visible region -

save the intersection point

Case 1 : Wholly inside

visible region save endpoint