Академический Документы
Профессиональный Документы
Культура Документы
clipping)
Dr. Tathagata Ray
Assistant Professor, BITS Pilani, Hyderabad Campus
BITS Pilani
Hyderabad Campus rayt@hyderabad.bits-pilani.ac.in
Clipping
• For the example window below consider which lines and points should
be kept and which ones should be clipped.
• Lines intersecting a rectangular clip regions are always clipped to a
single line segment.
• Lines lying in the clip rectangle’s border are considered inside and
hence are displayed.
P4
Window
wymax
P3 P
P1
P5 6
P7
P9
P8
wymin
P10
P2
wxmin wxmax
BITS Pilani, Hyderabad Campus
Point Clipping
Window P2
wymax
P4
P1
Points Within the Window
are Not Clipped
wymin
wxmin wxmax 3
BITS Pilani, Hyderabad Campus
Line Clipping
• Only consider the end-points of each line to see if they are
in the window or not
Situation Solution Example
6
BITS Pilani, Hyderabad Campus
How to test whether two lines
segments intersect
Approach 1:
– Take the two infinite lines that contain the original line
segments say <edge, line> pair.
b
c
a d a d
d
a
8
BITS Pilani, Hyderabad Campus
Signed Area Test