Computer Science, asked by ejaymalyas, 8 months ago

b) Apply the Cohen Sutherland line clipping algorithm to clip the line segment with coordinates
P (30, 60) and Q (60, 25) against the window with diagonals (10, 10) and (50, 50).​

Answers

Answered by dhezmaejamjahari
0

Answer:

Buwi nu answer nu mayyu sorry don't not answer you sorry

Answered by dreamrob
2

Given :

P = (30 , 60)

Q = (60 , 25)

(Xmin , Ymin) = (10 , 10)

(Xmax , Ymax) = (50 , 50)

Solution :

Slope of line PQ

m =  (y₂ – y₁)  

        (x₂ – x₁)

m =  (25-60)  

       (60-30)

m = -35/30

m = -1.16

x = x₁ + (y – y₁) / m

x = 30 + (50 - 60) / (-1.16)

x = 30 + (-10) / (-1.16)

x = 30 + 8.6

x = 38.6

The coordinate of intersection point is P⁻ (38.6 , 50).

y = y₁ + m(x – x₁)

y = 25 + (-1.16)(50 - 60)

y = 25 + 11.6

y = 36.6  

The coordinate of intersection point is Q⁻ (50 , 36.6).

Similar questions