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

Assignment Help:

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

 


Related Discussions:- Determine the steps uses in cohen sutherland line clipping

How many times will vertex appear in the intersection points, 1. For the po...

1. For the polygon shown in Figure on the next page, how many times will the vertex V 1 appear in the set of intersection points for the scan line passing through that point?  How

Definitions of hypertext, Definitions of Hypertext A manner of pre...

Definitions of Hypertext A manner of presenting information online along with links among one piece of information and the other. These links are termed as hypertext links

Simple graphical user interface, The RIA should consist of: i) A simple ...

The RIA should consist of: i) A simple Graphical User Interface (GUI) constructed from a simple navigation system (comprising of around 5 key frames) making use of the Flash tim

Draw line segment - digital differential analyzer algorithm, Example 1: Dr...

Example 1: Draw line segment from point (2, 4) to (9, 9) by using Digital Differential Analyzer algorithm. Solution: We know usual equation of line is specified via y = mx

Proof of subsequent properties of bezier curves, Proof of subsequent proper...

Proof of subsequent properties of Bezier curves Note: Proof of subsequent properties of Bezier curves is left as a work out for the students P' (0) = n (p 1 - p 0 ) P

3-dimentional, expalin 3-dimentional display methods

expalin 3-dimentional display methods

What are the disadvantages of CAD, Disadvantages of CAD - Risk of deski...

Disadvantages of CAD - Risk of deskilling - High training costs to use packages - Can move work overseas     One CAD operator can do work of 5 manual draftsmen

Vertical retrace - display devices, Vertical retrace - Display Devices ...

Vertical retrace - Display Devices In a refresh CRT monitor, the time it takes for an electron beam to return to the top, left most point on the monitor after refreshing all ho

Mathematics-applications for computer animation, Mathematics: There are so...

Mathematics: There are some area like Probability, combination, permutation, etc.,that can be well explained along with the help of animation, that helps in enhancing the learning

Data set, In this project, the image data set consists of 320 training imag...

In this project, the image data set consists of 320 training images and 285 test images. Table 1 shows the image data set in details. In addition to the original images, th

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd