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

UNIT 2- PART_II

The document outlines the syllabus for a course on Computer Graphics and Multimedia Applications, detailing course objectives such as constructing shapes, applying transformations, and analyzing animation fundamentals. It covers 2D viewing concepts, including window-viewport transformations, clipping techniques, and types of lines and clipping methods. Additionally, it introduces algorithms for line and polygon clipping, specifically the Cohen-Sutherland and Sutherland-Hodgman algorithms.

Uploaded by

dhanavarshini14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

UNIT 2- PART_II

The document outlines the syllabus for a course on Computer Graphics and Multimedia Applications, detailing course objectives such as constructing shapes, applying transformations, and analyzing animation fundamentals. It covers 2D viewing concepts, including window-viewport transformations, clipping techniques, and types of lines and clipping methods. Additionally, it introduces algorithms for line and polygon clipping, specifically the Cohen-Sutherland and Sutherland-Hodgman algorithms.

Uploaded by

dhanavarshini14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 44

Computer Graphics and

Multimedia Applications
SCSA1503
Unit 2
Syllabus

03/02/2025 2018 - 2022 2


Syllabus

03/02/2025 2018 - 2022 3


Course Objective(CO)
CO1: Construct lines and circles for the given input.
CO2: Apply 2D transformation techniques to transform
the shapes to fit them as per the picture definition.
CO3: Construct splines, curves and perform 3D
transformations
CO4: Apply colour and transformation techniques for
various applications.
CO5: Analyse the fundamentals of animation, virtual
reality, and underlying technologies.
CO6: Develop photo shop applications
03/02/2025 2018 - 2022 4
2D VIEWING
• The mapping of a 2D world coordinate system
to device coordinates is called a two-
dimensional viewing transformation.
• The clipping window is the section of the 2D
scene that is selected for viewing.
• The display window is where the scene will be
viewed.
• The viewport controls the placement of the
scene within the display window
2D VIEWING
• The process of mapping a part of the world
co-ordinate scene to device co-ordinate
system is known as viewing transformation.
• A world co-ordinate area selected for display
is called as a window and an area on display
device to which a window is mapped is called
as a view point.
• Window defines ‘What’ to be viewed and the
viewport defines ‘Where’ it is to be displayed
2D VIEWING
• A window-viewport transformation describes
the mapping of a (rectangular) window in one
coordinate system into another (rectangular)
window in another coordinate system.
• This transformation is defined by the section
of the original image that is transformed
(clipping window), the location of the
resulting window (viewport), and how the
window is translated, scaled or rotated
2D VIEWING
Clipping

• When we have to display a large portion of the picture, then


not only scaling & translation is necessary, the visible part of
picture is also identified. This process is not easy. Certain
parts of the image are inside, while others are partially
inside. The lines or elements which are partially visible will
be omitted.
• For deciding the visible and invisible portion, a particular
process called clipping is used. Clipping determines each
element into the visible and invisible portion. Visible portion
is selected. An invisible portion is discarded.

03/02/2025 12
Types of Lines

Lines are of three types:

• Visible: A line or lines entirely inside the window is


considered visible
• Invisible: A line entirely outside the window is
considered invisible
• Clipped: A line partially inside the window and
partially outside is clipped. For clipping point of
intersection of a line with the window is
determined.
03/02/2025 13
Example: Types of Lines

03/02/2025 14
Before and after clipping

• The window against which object is clipped


called a clip window. It can be curved or
rectangle in shape.

03/02/2025 15
Applications of clipping
Clipping can be applied to world co-ordinates. The
contents inside the window will be mapped to device co-
ordinates. Another alternative is a complete world co-
ordinates picture is assigned to device co-ordinates, and
then clipping of viewport boundaries is done.
• It will extract part we desire.
• For identifying the visible and invisible area in the 3D
object.
• For creating objects using solid modeling.
• For drawing operations.
• Operations related to the pointing of an object.
• For deleting, copying, moving part of an object.
03/02/2025 16
Types of Clipping

• Point Clipping
• Line Clipping
• Area Clipping (Polygon)
• Curve Clipping
• Text Clipping
• Exterior Clipping

03/02/2025 17
Point Clipping
• Point Clipping is used to
determining, whether the
point is inside the window or
not. For this following
conditions are checked.
xwmin ≤ x ≤ xwmax
Ywmin ≤ Y ≤ Ywmax
• The (x, y) is coordinate of the
point. If anyone from the
above inequalities is false,
then the point will fall outside
the window and will not be
considered to be visible.
03/02/2025 18
Text Clipping

• Various techniques are used to provide text


clipping in a computer graphics. It depends on
the methods used to generate characters and
the requirements of a particular application.
There are three methods for text clipping which
are listed below −
• All or none string clipping
• All or none character clipping
• Text clipping
03/02/2025 19
All or None String Clipping
All or None Character Clipping
Text clipping
(using a bounding rectangle about individual
characters)
Text clipping
(performed on the components of individual
characters)
Curve Clipping, Polygon and Exterior Clipping

Curve Clipping: Exterior Clipping:


• Curve Clipping involves complex procedures as • It is opposite to previous clipping. Here picture
compared to line clipping. Curve clipping which is outside the window is considered. The
requires more processing than for object with picture inside the rectangle window is discarded.
linear boundaries. Consider window which is So part of the picture outside the window is saved.
rectangular in shape. The circle is to consider Uses of Exterior Clipping:
against rectangle window. If circle is completely • It is used for displaying properly the pictures which
inside boundary of the window, it is considered overlap each other.
visible. So save the circle. If a circle is in outside • It is used in the concept of overlapping windows.
window, discard it. If circle cut the boundary
• It is used for designing various patterns of pictures.
then consider it to be clipping case
• It is used for advertising purposes.
Polygon Clipping:
• It is suitable for publishing.
• Polygon clipping is applied to the polygons. The
term polygon is used to define objects having • For designing and displaying of the number of
outline of solid. These objects should maintain maps and charts, it is also used.
property and shape of polygon after clipping..

03/02/2025 24
LINE CLIPPING & POLYGON CLIPPING
ALGORITHMS
• Line clipping algorithms:
– Cohen–Sutherland
– Liang–Barsky
– Nicholl–Lee–Nicholl

• Polygon clipping algorithms:


– Sutherland–Hodgman
– Weiler–Atherton

03/02/2025 25
COHEN-SUTHERLAND LINE CLIPPING ALGORITHM

03/02/2025 26
Bit 4, Bit 3, Bit 2, Bit 1 =
Top, Bottom, Right, Left.
1 0 0 1
Pseudocode
Pseudocode
COHEN-SUTHERLAND LINE CLIPPING ALGORITHM

For P1(150,150):

(From Right to Left)


Bit 1 : x - xmin = 150 - 100 = 50
=>set the bit to 0 (zero - as sign of 50 is +)
Bit 2: xmax – x = 300 – 150 = 150
=> set the bit to 0
Bit 3: y - ymin = 150 - 100 = 50
=> set the bit to 0
Bit 4: ymax – y = 200 – 150 = 50
=> set the bit to 0
So, the region code for P1 is 0000.
That implies P1 is inside the Clip
03/02/2025 30
Window.
COHEN-SUTHERLAND LINE CLIPPING ALGORITHM

For P2(400,300):

(From Right to Left)


Bit 1 : x - xmin = 400 - 100 = 300
=>set the bit to 0 (zero, as sign of 300 is +)
Bit 2: xmax – x = 300 – 400 = - 100
=> set the bit to 1 (one, as sign of 100 is -)
Bit 3: y - ymin = 300 - 100 = 0
=> set the bit to 0
Bit 4: ymax – y = 200 – 300 = - 100
=> set the bit to 1
So, the region code for P2 is 1010.
That implies P2 is in the top and above the Clip
Window.

03/02/2025 31
Intersection Point
• Region code of P1 is 0000.
• Region code of P2 is 1010.
COHEN-SUTHERLAND LINE CLIPPING ALGORITHM

• To find the intersection point:


y = y1 + m ( xboundary - x1)
where xboundary is set either to xmin or xmax

x = x1 + ( yboundary - y1) / m
Where yboundary is set either to ymin or ymax

m= (y1-y0) / (x1-x0)
Therefore,
m = (300-150) / ( 400-150) = 0.6
x = x1 + ( yboundary - y1) / m
Therefore,
x = 400 + (200 – 300) / 0.6 = 233
Here, yboundary is the Ymax,
Therefore, the intersection point is,
(x, ymax) =(233, 200)
03/02/2025 33
COHEN-SUTHERLAND LINE CLIPPING ALGORITHM

03/02/2025 34
Example 2
Example 2
Example 2
Example 2
Example 2
Pseudocode
Example 2
Example 2
Thank You
SUTHERLAND HODGEMAN POLYGON CLIPPING ALGORITHM

A polygon can be clipped by processing its boundary as a


whole against each window edge.
This is achieved by processing all polygon vertices against
each clip rectangle boundary

we could first clip the polygon against the left rectangle


boundary to produce a new sequence of vertices.
The new set of vertices could then be successively passed to
a right boundary clipper, a top boundary clipper and a
bottom boundary clipper

03/02/2025 44

You might also like