0% found this document useful (0 votes)
21 views

Ass 4 Model

This document contains a summary of a computer graphics assignment on clipping algorithms. It includes 5 questions with model answers on topics like: 1) Defining polygon clipping and window to viewport transformation. 2) Explaining the midpoint subdivision line clipping algorithm in 6 steps. 3) Applying the Cohen-Sutherland line clipping algorithm to a example line. 4) Briefly explaining 3 types of text clipping methods - all or none string clipping, all or none character clipping, and text clipping. Diagrams are included to illustrate the text clipping methods. The document provides details on implementing various clipping algorithms as part of the assignment.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Ass 4 Model

This document contains a summary of a computer graphics assignment on clipping algorithms. It includes 5 questions with model answers on topics like: 1) Defining polygon clipping and window to viewport transformation. 2) Explaining the midpoint subdivision line clipping algorithm in 6 steps. 3) Applying the Cohen-Sutherland line clipping algorithm to a example line. 4) Briefly explaining 3 types of text clipping methods - all or none string clipping, all or none character clipping, and text clipping. Diagrams are included to illustrate the text clipping methods. The document provides details on implementing various clipping algorithms as part of the assignment.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

JSPM’s

JAYAWANTRAO SAWANT POLYTECHNIC, Handewadi


Road, Hadapsar, Pune-28

Department of Information Technology

Academic Year 2023-24


ASSIGNMENT-IV MODEL ANSWER

Subject: Computer Graphics Subject Code: 22318


Course &Code: CO3I Class: SYCO
Semester: Third Name of the Faculty: Mrs.S.P.Sabat
Date:

CO 4: Implement Various Clipping Algorithms

CHAPTER 4: Windowing and Clipping

Question Marking
Model Answer scheme
No.
1 Define polygon clipping.
Any suitable
A set of connected lines are considered as polygon; polygons are clipped definition: 2
based on the window and the portion which is inside the window is kept M
as it is and the outside portions are clipped. OR Polygon clipping is
removal of part of an object outside a polygon.

2 What is Window to Viewport Transformation Defination - 2


M

Window to Viewport Transformation is the process of transforming


2D world-coordinate objects to device coordinates. Objects inside
the world or clipping window are mapped to the viewport which is
the area on the screen where world coordinates are mapped to be
displayed.
3 Explain midpoint subdivision line clipping algorithm Algorithm: 4
M

Step 1: Scan two end points for the line P1(x1, y1) and P2(x2, y2).

Step 2: Scan corners for the window as (Wx1, Wy1) and (Wx2, Wy2).
Step 3: Assign the region codes for endpoints P1 and P2 by initializing
code with 0000.

Bit 1 - if (x < Wx1)

Bit 2 - if (x > Wx2)

Bit 3 - if (y < Wy1)

Bit 4 - if (y > Wy2)

Step 4: Check for visibility of line P1, P2.

If region codes for both end points are zero then the line is visible, draw
it and jump to step 6.

If region codes for end points are not zero and the logical Anding
operation of them is also not zero then the line is invisible, reject it and
jump to step 6. If region codes for end points does not satisfies the
condition in 4 (i) and 4 (ii) then line is partly visible.

Step5: Find midpoint of line and divide it into two equal line segments
and repeat steps 3 through 5 for both subdivided line segments until you
get completely visible and completely invisible line segments.
Step 6: Exit

Use Cohen-Sutherland outcode algorithm to clip line PI (40, 15) -- P2 Proper result
(75. 45) against a window A (50, 10), B (80, 10). C(80, 40) & D(50,40) 4M

P1 (40, 15) - P2 (75, 45) Wxi = 50 Wy2 = 40 Wx2 = 80 Wy2 = 10 Point Endcode ANDing P1 0001

= 23.57 x1 = 1 𝑚 (yT – y ) + x = 7 6 (40-50)+40 = 69.16 y2 = m(xR –


x ) + y = 6 7 (80-40)+15 = 49.28 x2 = 1 𝑚 (yB – y ) + x = 7 6 (10-
4 15)+40 = 34.16

Hence: .

5 Explain differ types of Text clipping in brief. Explanation


of 3 methods
with diagrams
4 marks

Many techniques are used to provide text clipping in a computer graphics. It depends on the metho

1) All or none string clipping

2) All or none character clipping

3) Text clipping
The following figure shows all or none string clipping

This clipping method is based on characters rather than entire string. In this method if the string is e
This clipping method is based on characters rather than the entire string.
In this method if the string is entirely inside the clipping window, then
we keep it. If it is partially outside the window, then you reject only the
portion of string being outside. If the character is on the boundary of the
clipping window, then we discard only that portion of character that is
outside of the clipping window.

Subject teacher HOD

You might also like