Determine the steps uses in cohen sutherland line clipping, Computer Graphics

Steps uses in the Cohen Sutherland Line Clipping Algorithm are:

217_Determine the Steps uses in Cohen Sutherland Line Clipping.png

Figure: Steps for Cohen Sutherland Line Clipping

STEP 1:

Input:

 xL , xR , yT , yB , P1 ( x1 , y1 ), P2 ( x2 , y2 )

 Initialize i = 1

While i <= 2

if xi  < xL  then bit 1 of code -Pi = 1 else 0

 if xi > xR then bit 2 of code -Pi =1 else 0         

: The endpoint codes of the line are then set

 if  yi  < yB then bit 3 of code -Pi = 1 else 0

if  yi  > yT then bit 4 of code -Pi = 1 else 0

i = i +1

end while

 i = 1

STEP 2:

Initialize j = 1

While j <= 2

 if xj   < xL then Cj left = 1 else Cj left = 0

 if x j > x R   then C j right = 1 else C j right   = 0

 : Set flags as per to the position of the line endpoints with respect to window

if  yj  < yB   then Cj bottom  = 1 else Cj bottom  = 0 edges

if  y j  > yT then Cj top = 1 else C jtop  = 0

 end while

STEP 3: If codes of P1and P2 are both equivalent to zero then draw P1P2 are wholly visible

STEP 4: If logical intersection or AND operation of code -P1 and code -P2 is not equivalent to zero then avoid P1P2 are wholly invisible

STEP 5: If code -P1= 0 then swap P1 and P2 with their flags and also set i = 1

STEP 6: If code -P1 < > 0 then

for i = 1,

{if C1 left = 1 then

find intersection ( xL , y'L )

assign code to ( xL , y'L )

P1 = ( xL , y'L )

end if

i = i + 1;

go to 3

}

with left edge vide eqn. (C)

 for i = 2,

{if C1 right = 1 then

find intersection ( xR , y'R ) with right edge vide eqn. (D)

assign code to ( xR , y'R )

P1 = ( xR , y'R )

end if

i = i + 1 go to 3

}

for i = 3

{if C1 bottom = 1 then

find intersection ( x 'B , yB ) with bottom edge vide eqn. (B)

assign code to ( x 'B , yB )

P1 = ( x 'B , yB )

end if

i = i + 1 go to 3

}

for i = 4,

{if C1 top = 1 then

find intersection ( x 'T , yT ) vide eqn. (A) with top edge assign code to ( x 'T , yT )

P1 = ( x 'T , yT )

end if

i = i + 1 go to 3

}

end

 

Posted Date: 4/3/2013 3:05:36 AM | Location : United States







Related Discussions:- Determine the steps uses in cohen sutherland line clipping, Assignment Help, Ask Question on Determine the steps uses in cohen sutherland line clipping, Get Answer, Expert's Help, Determine the steps uses in cohen sutherland line clipping Discussions

Write discussion on Determine the steps uses in cohen sutherland line clipping
Your posts are moderated
Related Questions
As we already seen that the scaling process is mainly utilized to change the size of an object. The scale factors find out whether the scaling is a magnification as s>1 or a red

What is an axonometric orthographic projection and cabinet projection? The orthographic projection can show more than one face of an object.  Such an orthographic projection i

Negative Accelerations - computer animation In order to incorporate decreasing speed in an animation the time spacing between the frames must decrease, thus there exists lesser

What are the various representation schemes used in three dimensional objects?  Boundary representation (B-res) - explain the 3 dimensional objects as a set of surfaces that se

Alias Wavefront - Softwares for Computer Animation Alias is one of the highest computer animation packages out there. Alias was formed by the company which used to be Alias, a

Properties of Perspective projections - Transformation 1) Faraway objects seem smaller. 2) Straight lines are projected to straight lines. 3) Let line 1 and 2 is two s


Question 1: (a) How can you select and manipulate individual objects in a group? (b) How do you resize an object? Explain how you determine the point from which the object r

what type of animation is produced by the line y=mx+c?

What is Polygon mesh?  Polygon mesh is a method to show the polygon, when the object surfaces are tiled, it is more convenient to state the surface facets with a mesh function.