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

Explain the acoustic properties of sound, Problem: (a) What is meant b...

Problem: (a) What is meant by ‘Time - Stretching ‘in relation to a sound data file? (b) Calculate the size of a 5 minutes mono sound file of CD quality and with a 16 -bit

What is graphics, What is Graphics It is a term that refers to any com...

What is Graphics It is a term that refers to any computer device or program which makes a computer able of displaying and manipulating pictures. The name also refers to the im

Uncompressed and common audio format, Uncompressed / Common Audio Format ...

Uncompressed / Common Audio Format There is one main uncompressed audio format: PCM. It is generally stored like a .wav on Windows. WAV is file format which is flexible and des

Curved surfaces, Build a program that allows: 1. using mouse or keyboard...

Build a program that allows: 1. using mouse or keyboard to move around on a set of 16 control points;  2. modify the value (drag along x, y, or z) of a point;  3. display

Word perfect graphic, WPG: It is word perfect graphic file that is used vi...

WPG: It is word perfect graphic file that is used via Word Perfect. It first came out with the release of word perfect 5.0. Such files can include bitmaps, line arts and vector gr

Transformation for 3-d shearing, 2-dimensional xy-shearing transformation, ...

2-dimensional xy-shearing transformation, as explained in equation (19), can also be simply extended to 3-dimensional case. All coordinates are translated as a function of displace

How to use illumination model to calculate vertex intensity, How to utilize...

How to utilize illumination model to calculate vertex intensity: For such we interpolate intensities beside the polygon edges, for all scan line the intensity at the intersecti

How many key frames does a one-minute animation film, How many key frames d...

How many key frames does a one-minute animation film order along with no duplications need? Solution : One minute = 60 seconds Number of frames needed per second=24 Numbe

Two point and three point perspective transformations, Two-Point and Three-...

Two-Point and Three-Point Perspective transformations The two-point perspective projection can be acquired by rotating about one of the principal axis only and projecting upon

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