Cyrus Beck
-
Upload
rakesh-kumar -
Category
Documents
-
view
40 -
download
0
Transcript of Cyrus Beck
ClippingCyrus Beck Line Clipping(Liang and Barsky)
• Any convex region as window
Parametric line (input line AB):
)1,0(;)()( ∈∈−−++== ttABAtL
A
B
ClippingCyrus Beck Line Clipping(Liang and Barsky)
P n
• Q
Implicit line (window edge):
Tells us on which side of the line the point Q is.
nPQQl ).()( −−==
ClippingCyrus Beck Line Clipping(Liang and Barsky)
P n
• Q
nPQQl ).()( −−==Evaluate
If > 0 inside halfspace of line (plane)If < 0 outside halfspace of line (plane)If = 0 on the line
Should give indications for trivial accept and reject cases.Inside
Outside
ClippingCyrus Beck Line Clipping(Liang and Barsky)
P n
• Q
nPQQl ).()( −−==
Inside
Outside
)()( ABtAtL −−++==
Window edge
Line segment
0)( AND0)( <<<< BlAl
0)( AND0)( >>>> BlAl
Trivial Reject
Trivial Accept
ClippingCyrus Beck Line Clipping(Liang and Barsky)
P
n
ClippingCyrus Beck Line Clipping(Liang and Barsky)
P n
A B
tABAtL )()( −−++==
t for solve;0))(( ==tLl
nPQQl ).()( −−==
0).().(0).)((
0).)((
==−−++−−==−−−−++
==−−
nABtnPAnPABtA
nPtL
ClippingCyrus Beck Line Clipping(Liang and Barsky)
P n
A B
nPBnPAnPA
t
nBAnPA
t
).().().(
).().(
−−−−−−−−==
−−−−==
Clipping
B
n Which ‘t’ to select ?
(t=0)
(t=1)
Cyrus Beck Line Clipping(Liang and Barsky)
A
Clipping
A
B
n
(t=0)
(t=1)
Cyrus Beck Line Clipping(Liang and Barsky)
nABDnAB
nPAt
).().(
).(
−−==−−−−
−−==
D > 0 label t as tEEntering
Clipping
A
B
n
(t=0)
(t=1)
Cyrus Beck Line Clipping(Liang and Barsky)
nABDnAB
nPAt
).().(
).(
−−==−−−−
−−==
D < 0 label t as tLLeaving
Clipping
A
B
n
(t=0)
(t=1)
Cyrus Beck Line Clipping(Liang and Barsky)
t of interest: largest tE smallest tL
maxEtminLt
Clipping
If
Cyrus Beck Line Clipping(Liang and Barsky)
minmaxLE tt >>
Reject
Clipping
Arbitrary Convex Window
P1
V1
Cyrus Beck Line Clipping(Liang and Barsky)
V2
V3
V4
V5V6
V7
V8
P2
E1
E2
E3
E4
E5E6
E7
E8
Clipping
Arbitrary Convex Window
P1
V1
Cyrus Beck Line Clipping(Liang and Barsky)
V2
V3
V4
V5V6
V7
V8
P2
E1
E2
E3
E4
E5E6
E7
E8
Polygon is convex if for alladjacent edges the sign of cross product is same.
positivexEEpositivexEE
::
32
21
.
.
.
Clipping
Arbitrary Window
Cyrus Beck Line Clipping(Liang and Barsky)
Polygon is non-convex
negativexEEpositivexEEpositivexEE
:::
43
32
21
.
.
.
V1 V2
V3
V4
V5V6
E1
E2
E3
E4
Clipping
Arbitrary Window
Cyrus Beck Line Clipping(Liang and Barsky)
V1 V2
V3
V4
V5V6
E1
E2
E3
E4
Make the polygon convex by adding the edge V3V5
Clip against the convex polygon=> P3P4
P1
P2
P3
P4
Clipping
Arbitrary Window
Cyrus Beck Line Clipping(Liang and Barsky)
V3
V4
V5
Clip against the triangle=> P5P4
Subtract P5P4 from P3P4=> P3P5P3
P4
P5