Cyrus Beck - II
Cyrus Beck - II
convex polygons.
It allows line clipping for non-rectangular windows, unlike
Cohen Sutherland .
It also removes the repeated clipping needed in
Cohen Sutherland.
Input
clipping
2. Coordinates (-1, -1) which is the Rejected clipping
Algorithm
and one selected end point of the clipping line and the
normal of the edge is calculated (for all edges).
Dot product between the vector of the clipping line and the
Case 3:
The line is completely outside the window:
tL < t E
Pseudocode
(P0P1).
Here the parametric equation of a line in the view plane is
p ( t ) = p0 + t( p1 − p0 )
where 0 ≤ t ≤ 1
Verification
N2, etc.
Ni
i=edge no
Now for each edge choose PEi (i -> ith edge) (choose any of the
vertices of the corresponding edge,
eg.:
For polygon ABCD, for side AB, PEi can be either point A or
point B) and calculate
Pei
i={1,2,3,4…….}
Dot product
Ni.(p(t)-pei)
if < 0, p(t) vector pointed towards interior;
if = 0, p(t) vector pointed parallel to plane containing p;
if > 0, vector pointed away from interior.
By using Ni.(p(t)-pei)
Put p(t)=p0+t(p1-p0)
Ni.(p(t)-pei)
Ni.(p0+t(p1-p0)-pei)=0
Ni.p0+Ni.tp1-Ni.tp0-Ni.pei=0
Ni.tp1-Ni.tp0=Ni.pei-Ni.p0
t( Ni.p1-Ni.p0)=Ni.(pei-p0)
Then calculate
Ni . ( pei - p0 )
ti= Ni . ( p1 - p0 )
Then club the ‘t’ values for which the Ni . (P1 – P0) came out to be
Similarly club all the ‘t’ values for which the Ni . (P1 – P0) came out to be
positive and take the maximum of all of the clubbed ‘t’ values and 0.
D=Ni .(p1-p0)
the parametric form of the ‘to be clipped’ line and the resulting two
points obtained are the clipped points.
Put value of t in eq
P(t)=p0+t(p1-p0)
Example
(35,60)
(35,50)
(55,20)
(20,10) (50,10)
Draw Normal Vectors
(35,60)
(30,60)
(60,25)
(20,10) (50,10)