SlideShare a Scribd company logo
Unit-5
WINDOWING AND CLIPPING
MARKS:14
Windowing
• The method of selecting and enlarging a
portion of a drawing is called windowing.
• The area chosen for this display is called
a window.
• Viewport: An area on display device to which
a window is mapped [where it is to displayed].
...
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.
Types of Clipping:
• Point Clipping
• Line Clipping
• Area Clipping (Polygon)
• Curve Clipping
• Text Clipping
• Exterior Clipping
Some Basic Terms
• 1:A viewport defines in normalized coordinates a
rectangular area on the display device where the
image of the data appears.
• 2:The process of selecting and viewing the
picture with different views is called Windowing,
and
• a Process which divides each element of the
picture into its visible and invisible portions,
allowing the invisible portion to be discarded is
called Clipping.
CONTINUE..
• The method of selecting and enlarging a
portion of a drawing is called windowing.
• The area chosen for this display is called
a window.
• The window is selected by world-coordinate.
Almost all 2D and 3D graphics packages
provide means of defining viewport size on
the screen.
……
• The method of selecting and enlarging a portion of a
drawing is called windowing. The area chosen for this
display is called a window. The window is selected by
world-coordinate.
• Sometimes we are interested in some portion of the
object and not in full object. So we will decide on an
imaginary box. This box will enclose desired or
interested area of the object. Such an imaginary box is
called a window.
• Viewport: An area on display device to which a window
is mapped [where it is to displayed].
Viewing transformation
• Viewing Transformation is the mapping of
coordinates of points and lines that form the
picture into appropriate coordinates on the
display device. ... Mapping the window onto a
sub region of the display device called the
viewport is called the Viewing Transformation
Viewing transformation in several
steps:
• First, we construct the scene in world coordinate using the output
primitives and attributes.
• To obtain a particular orientation, we can set up a 2-D viewing
coordinate system in the window coordinate plane and define a
window in viewing coordinates system.
• Once the viewing frame is established, are then transform
description in world coordinates to viewing coordinates.
• Then, we define viewport in normalized coordinates (range from 0
to 1) and map the viewing coordinates description of the scene to
normalized coordinates.
• At the final step, all parts of the picture that (i.e., outside the
viewport are dipped, and the contents are transferred to device
coordinates).
•
DIAGRAM
Applications of clipping:
• 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.
Types of Lines:
• 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.
• Clipping can be applied through hardware as
well as software.
• In some computers, hardware devices
automatically do work of clipping.
• In a system where hardware clipping is not
available software clipping applied.
Following figure show before and after
clipping
Point Clipping:
• Point Clipping is used to determining, whether
the point is inside the window or not. For this
following conditions are checked.
• x ≤ xmax
• x ≥ xmin
• y ≤ ymax
• y ≥ ymin
(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.
Line Clipping:
• It is performed by using the line clipping
algorithm.
• The line clipping algorithms are:
• Cohen Sutherland Line Clipping Algorithm
• Midpoint Subdivision Line Clipping Algorithm
• Liang-Barsky Line Clipping Algorithm
Category of line
• There are three possible cases for any given line.
• Completely inside the given rectangle : Bitwise OR of region
of two end points of line is 0 (Both points are inside the
rectangle)
• Completely outside the given rectangle : Both endpoints
share at least one outside region which implies that the line
does not cross the visible region. (bitwise AND of endpoints !=
0).
• Partially inside the window : Both endpoints are in different
regions. In this case, the algorithm finds one of the two points
that is outside the rectangular region. The intersection of the
line from outside point and rectangular window becomes new
corner point and the algorithm repeats
Line 9 region code
Diagram
Mid Point Subdivision Line Clipping
Algorithm:
• It is used for clipping line.
• The line is divided in two parts. Mid points of
line is obtained by dividing it in two short
segments. Again division is done, by finding
midpoint. This process is continued until line
of visible and invisible category is obtained.
Let (xi,yi) are midpoint
Diagram
Diagram
Diagram
Explanation
• Midpoint subdivision algorithm is an extension of the Cyrus Beck
algorithm. This algorithm is mainly used to compute visible areas of lines
that are present in the view port are of the sector or the image.
• It follows the principle of the bisection method and works similarly to the
Cyrus Beck algorithm by bisecting the line in to equal halves.
• But unlike the Cyrus Beck algorithm, which only bisects the line once,
Midpoint Subdivision Algorithm bisects the line numerous times.
• Also the Sutherland Cohen subdivision line clipping algorithm requires the
calculation of the intersection of the line with the window edge. These
calculations can be avoided by repetitively subdividing the line at its
midpoint.
• Like other algorithm, initially the line is tested for visibility. If line is
completely visible it is drawn and if it is completely invisible it is rejected.
If line is partially visible then it is subdivided in two equal parts. The
visibility tests are then applied to each half. This subdivision process is
repeated until we get completely visible and completely invisible line
segments. This is illustrated in figure (k) below
….
• As shown in the figure (k), line P1 P2 is partially visible. It is
subdivided in two equal Parts P1 P3 and P3 P2 (see Fig. k (b)). Both
the line segments are tested for visibility and found to be partially
visible. Both line segments are then subdivided in two equal parts
to get midpoints P4 and P5 (see Fig. k (c)). It is observed that line
segments P1 P4 and P5 P2 are completely invisible and hence
rejected. However, line segment P3 P5 is completely visible and
hence drawn. The remaining line segment P4 P3 is still partially
visible. It is then subdivided to get midpoint P6. It is observed that
P6 P3 is completely visible whereas P4 P6 is partially visible. Thus
P6 P3 line segment is drawn and P4 P6 line segment is further
subdivided into equal parts to get midpoint P7. Now, it is observed
that line segment P4 P7 is completely invisible and line segment P7
P6 is completely visible (see Fig. k (f)), and there is no further
partially visible segment.
Advantage of midpoint subdivision Line Clipping:
It is suitable for machines in which multiplication and division operation is not
possible. Because it can be performed by introducing clipping divides in hardware
x5lie on point of intersection of boundary of
window.
Algorithm of midpoint subdivision Line
Clipping
• :
• Step1: Calculate the position of both endpoints of the line
• Step2: Perform OR operation on both of these endpoints
• Step3: If the OR operation gives 0000
• then
• Line is guaranteed to be visible
• else
• Perform AND operation on both endpoints.
• If AND ≠ 0000
• then the line is invisible
• else
• AND=6000
• then the line is clipped case.
• Step4: For the line to be clipped. Find midpoint
• Xm=(x1+x2)/2
• Ym=(y1+y2)/2
• Xmis midpoint of X coordinate.
• Ymis midpoint of Y coordinate.
• Step5: Check each midpoint, whether it nearest to the boundary of a window or not.
• Step6: If the line is totally visible or totally rejected not found then repeat step 1 to 5.
• Step7: Stop algorithm.
Cohen Sutherland Line Clipping
Algorithm
• Cohen Sutherland Algorithm is a line clipping
algorithm :that cuts lines to portions which
are within a rectangular area. It eliminates the
lines from a given set of lines and rectangle
area of interest (view port) which belongs
outside the area of interest and clip those
lines which are partially inside the area of
interest.
…
• There are 3 possibilities for the line:
• Line can be completely inside the window
(This line should be accepted).
• Line can be completely outside of the window
(This line will be completely removed from the
region).
• Line can be partially inside the window (We
will find intersection point and draw only that
portion of line that is inside region).
Algorithm
• The algorithm divides a two-dimensional
space into 9 regions (eight outside regions
and one inside region) and then efficiently
determines the lines and portions of lines that
are visible in the central region of interest (the
viewport).
• Following image illustrates the 9 regions:
Nine region code
……….
• As you seen each region is denoted by a 4 bit code like
0101 for the bottom right region
• Four Bit code is calculated by comparing extreme end point
of given line (x,y) by four co-ordinates x_min, x_max,
y_max, y_min which are the coordinates of the area of
interest (0000)
• Calculate the four bit code as follows:
• Set First Bit if 1 Points lies to left of window (x < x_min)
• Set Second Bit if 1 Points lies to right of window (x > x_max)
• Set Third Bit if 1 Points lies to bottom of window (y <
y_min)
• Set Fourth Bit if 1 Points lies to top of window (y > y_max)
….
The sequence for reading the codes' bits
is LRBT (Left, Right, Bottom, Top).
Diagram
Algorithm
• Step 1 : Assign a region code for two endpoints of given line
• Step 2 : If both endpoints have a region code 0000 then given line is
completely inside and we will keep this line
• Step 3 : If step 2 fails, perform the logical AND operation for both
region codes.
– Step 3.1 : If the result is not 0000, then given line is completely
outside.
– Step 3.2 : Else line is partially inside.
• Step 3.2.a : Choose an endpoint of the line that is outside the given rectangle.
• Step 3.2.b : Find the intersection point of the rectangular boundary (based on
region code).
• Step 3.2.c : Replace endpoint with the intersection point and update the
region code.
• Step 3.2.d : Repeat step 2 until we find a clipped line either trivially accepted
or rejected.
• Step 4 : Repeat step 1 for all lines
…..
• To find out intersection boundary if bit 1 is 1 ,line
intersect with line x=xmin(left boundary)
• To find out intersection boundary if bit 2 is 1 ,line
intersect with line x=xmin(right boundary)
• To find out intersection boundary if bit 3 is 1 ,line
intersect with line x=xmin(bottom boundary)
• To find out intersection boundary if bit 4 is 1 ,line
intersect with line x=xmin(top boundary)
…..
• Then find out coordinates of intersection point, once
line of interaction is known, then point of intersection
is calculated as,
• 1.If boundary line is vertical ,then
• Xa=xmin or xmax
• Ya=y1+m(xa-x1)
• 2.if boundary line is horizontal ,then
• Ya=ymin or ymax, xa=x1+(ya-y1)/m
• m is slope of line=(y2-y1)/(x2-x1).
• Replace end points with intersection points, display
new line joining two intersection points.
Liang-Barsky Line Clipping Algorithm:
• Liang and Barsky have established an
algorithm that uses floating-point arithmetic
but finds the appropriate endpoints with at
most four computations. This algorithm uses
the parametric equations for a line and solves
four inequalities to find the range of the
parameter for which the line is in the
viewport.
Diagram
Continue…..
• Let P(x1, y1), Q(x2, y2) is the line which we want
to study. The parametric equation of the line
segment from gives x-values and y-values for
every point in terms of a parameter that ranges
from 0 to 1. The equations are
• x=x1+(x2-x1 )*t=x1+dx*t and y=y1+(y2-
y1 )*t=y1+dy*t
• We can see that when t = 0, the point computed
is P(x1, y1); and when t = 1, the point computed
is Q(x2, y2).
Algorithm
• Algorithm of Liang-Barsky Line Clipping:
• 1. Set tmin=0 and tmax=1
• 2. Calculate the values tL,tR,tT and tB(tvalues).
If t<tmin or t<tmax? ignore it and go to the next edge
Otherwise classify the tvalue as entering or exiting value (using
inner product to classify)
If t is entering value set tmin=t if t is exiting value set
tmax=t.</t</t3. If tmin< tmax? then draw a line from (x1 + dx*tmin,
y1 + dy*tmin) to (x1 + dx*tmax?, y1 + dy*tmax? )
• 4. If the line crosses over the window, you will see (x1 + dx*tmin, y1 +
dy*tmin) and (x1 + dx*tmax? , y1 + dy*tmax?) are intersection
between line and edge.
Polygon Clipping
• Polygon is a representation of the surface. It is
primitive which is closed in nature. It is formed using a
collection of lines.
• It is also called as many-sided figure.
• The lines combined to form polygon are called sides or
edges. The lines are obtained by combining two
vertices.
• Triangle
• Rectangle
• Hexagon
• Pentagon
Convex Polygon
• A polygon is called convex of line joining any
two interior points of the polygon lies inside
the polygon.
Concave Polygon
• A concave polygon has one interior angle
greater than 180°. So that it can be clipped
into similar polygons.
•
Sutherland-Hodgeman Polygon
Clipping
• It is performed by processing the boundary of
polygon against each window corner or edge.
• First of all entire polygon is clipped against
one edge, then resulting polygon is
considered, then the polygon is considered
against the second edge, so on for all four
edges.
Four possible situations while
processing
• If the first vertex is an outside the window, the second
vertex is inside the window. Then second vertex is
added to the output list. The point of intersection of
window boundary and polygon side (edge) is also
added to the output line.
• If both vertexes are inside window boundary. Then only
second vertex is added to the output list.
• If the first vertex is inside the window and second is an
outside window. The edge which intersects with
window is added to output list.
• If both vertices are the outside window, then nothing is
added to output list.
…
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 in turn.
• beginning with the original set of polygon vertices, 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,
as shown in figure (l).
• At each step a new set of polygon vertices is generated and passed to the
next window boundary clipper.
• This is the fundamental idea used in the Sutherland - Hodgeman
algorithm.
•
• The output of the algorithm is a list of polygon
vertices all of which are on the visible side of a
clipping plane.
• Such each edge of the polygon is individually
compared with the clipping plane.
• This is achieved by processing two vertices of
each edge of the polygon around the clipping
boundary or plane.
• This results in four possible relationships
between the edge and the clipping boundary or
Plane.
…………
• If the first vertex of the edge is outside the window boundary and the second vertex of the edge is
inside then the intersection point of the polygon edge with the window boundary and the second
vertex are added to the output vertex list (See Fig. m (a)).
• If both vertices of the edge are inside the window boundary, only the second vertex is added to the
output vertex list. (See Fig. m (b)).
• If the first vertex of the edge is inside the window boundary and the second vertex of the edge is
outside, only the edge intersection with the window boundary is added to the output vertex list.
(See Fig. m (c)).
• If both vertices of the edge are outside the window boundary, nothing is added to the output list.
(See Fig. m (d)).
• Once all vertices are processed for one clip window boundary, the output list of vertices is clipped
against the next window boundary. Going through above four cases we can realize that there are
two key processes in this algorithm.
• Determining the visibility of a point or vertex (lnside - Outside test) and
• Determining the intersection of the polygon edge and the clipping plane.
• One way of determining the visibility of a point or vertex is described here. Consider that two
points A and B define the window boundary and point under consideration is V, then these three
points define a plane. Two vectors which lie in that plane are AB and AV. If this plane is considered
in the xy plane, then the vector cross product AV x AB has only a component given by
• The sign of the z component decides the position of Point V with respect to window boundary.
• If z is:
• Positive - Point is on the right side of the window boundary.
• Zero - Point is on the window boundary.
• Negative - Point is on the left side of the window boundary.
…
• Sutherland-Hodgeman Polygon Clipping Algorithm:-
• Read coordinates of all vertices of the Polygon.
• Read coordinates of the dipping window
• Consider the left edge of the window
• Compare the vertices of each edge of the polygon,
individually with the clipping plane.
• Save the resulting intersections and vertices in the new list
of vertices according to four possible relationships between
the edge and the clipping boundary.
• Repeat the steps 4 and 5 for remaining edges or the
clipping window. Each time the resultant list of vertices is
successively passed to process the next edge of the clipping
window.
• Stop.
…..
• Example :- For a polygon and clipping
window shown in figure below give the list
of vertices after each boundary clipping.
……
• Solution:- Original polygon vertices are V1,
V2, V3, V4, and V5. After clipping each
boundary the new vertices are as shown in
figure above
Text Clipping:
• Several methods are available for clipping of text.
• Clipping method is dependent on the method of
generation used for characters.
• A simple method is completely considered, or
nothing considers method.
• This method is also called as all or none.
• If all characters of the string are inside window,
then we will keep the string, if a string character
is outside then whole string will be discarded in
fig (a).
• Curve Clipping:
• Curve Clipping involves complex procedures as
compared to line clipping. Curve clipping
requires more processing than for object with
linear boundaries. Co
• Exterior Clipping:
• It is opposite to previous clipping. Here picture which is
outside the window is considered. The picture inside
the rectangle window is discarded. So part of the
picture outside the window is saved.
Uses of Exterior Clipping:
• It is used for displaying properly the pictures which
overlap each other.
• It is used in the concept of overlapping windows.
• It is used for designing various patterns of pictures.
• It is used for advertising purposes.

More Related Content

Similar to ch4.pptx

CAD/CAM/CAE - Notes
CAD/CAM/CAE - NotesCAD/CAM/CAE - Notes
CAD/CAM/CAE - Notes
Learn With GeekAlign
 
UNIT_3-Two-Dimensional-Geometric-Transformations.pdf
UNIT_3-Two-Dimensional-Geometric-Transformations.pdfUNIT_3-Two-Dimensional-Geometric-Transformations.pdf
UNIT_3-Two-Dimensional-Geometric-Transformations.pdf
VivekKumar148171
 
Unit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdfUnit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdf
Amol Gaikwad
 
Clipping
ClippingClipping
Clipping
nehrurevathy
 
UNIT-III
UNIT-IIIUNIT-III
UNIT-III
VarthiniRamesh
 
Cohen sutherland line clipping
Cohen sutherland line clippingCohen sutherland line clipping
Cohen sutherland line clipping
Mani Kanth
 
Unit 3
Unit 3Unit 3
Unit 3
ypnrao
 
Surface design and visible surfaces
Surface design and visible surfacesSurface design and visible surfaces
Surface design and visible surfaces
Arti Parab Academics
 
Hidden line removal algorithm
Hidden line removal algorithmHidden line removal algorithm
Hidden line removal algorithm
KKARUNKARTHIK
 
Windowing clipping
Windowing   clippingWindowing   clipping
Windowing clipping
Shweta Shah
 
Bhavesh window clipping slidshare
Bhavesh window clipping slidshareBhavesh window clipping slidshare
Bhavesh window clipping slidshare
Bhavesh Panchal
 
Computer Aided Design visual realism notes
Computer Aided Design visual realism notesComputer Aided Design visual realism notes
Computer Aided Design visual realism notes
KushKumar293234
 
Clipping
ClippingClipping
Clipping
Pooja Dixit
 
CAD
CAD CAD
Implementation
ImplementationImplementation
Implementation
Syed Zaid Irshad
 
Sutherlands Cohen and Hodgeman algorithms
Sutherlands Cohen and Hodgeman algorithmsSutherlands Cohen and Hodgeman algorithms
Sutherlands Cohen and Hodgeman algorithms
Rohit Jain
 
Unit 4 notes
Unit 4 notesUnit 4 notes
Unit 4 notes
Balamurugan M
 
kgv.pptx
kgv.pptxkgv.pptx
kgv.pptx
sandeshbhusal6
 
Clipping 22
Clipping 22Clipping 22
Clipping 22
lokesh503
 

Similar to ch4.pptx (20)

CAD/CAM/CAE - Notes
CAD/CAM/CAE - NotesCAD/CAM/CAE - Notes
CAD/CAM/CAE - Notes
 
UNIT_3-Two-Dimensional-Geometric-Transformations.pdf
UNIT_3-Two-Dimensional-Geometric-Transformations.pdfUNIT_3-Two-Dimensional-Geometric-Transformations.pdf
UNIT_3-Two-Dimensional-Geometric-Transformations.pdf
 
Unit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdfUnit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdf
 
Clipping
ClippingClipping
Clipping
 
UNIT-III
UNIT-IIIUNIT-III
UNIT-III
 
Cohen sutherland line clipping
Cohen sutherland line clippingCohen sutherland line clipping
Cohen sutherland line clipping
 
Clipping
ClippingClipping
Clipping
 
Unit 3
Unit 3Unit 3
Unit 3
 
Surface design and visible surfaces
Surface design and visible surfacesSurface design and visible surfaces
Surface design and visible surfaces
 
Hidden line removal algorithm
Hidden line removal algorithmHidden line removal algorithm
Hidden line removal algorithm
 
Windowing clipping
Windowing   clippingWindowing   clipping
Windowing clipping
 
Bhavesh window clipping slidshare
Bhavesh window clipping slidshareBhavesh window clipping slidshare
Bhavesh window clipping slidshare
 
Computer Aided Design visual realism notes
Computer Aided Design visual realism notesComputer Aided Design visual realism notes
Computer Aided Design visual realism notes
 
Clipping
ClippingClipping
Clipping
 
CAD
CAD CAD
CAD
 
Implementation
ImplementationImplementation
Implementation
 
Sutherlands Cohen and Hodgeman algorithms
Sutherlands Cohen and Hodgeman algorithmsSutherlands Cohen and Hodgeman algorithms
Sutherlands Cohen and Hodgeman algorithms
 
Unit 4 notes
Unit 4 notesUnit 4 notes
Unit 4 notes
 
kgv.pptx
kgv.pptxkgv.pptx
kgv.pptx
 
Clipping 22
Clipping 22Clipping 22
Clipping 22
 

Recently uploaded

special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 

Recently uploaded (20)

special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 

ch4.pptx

  • 2. Windowing • The method of selecting and enlarging a portion of a drawing is called windowing. • The area chosen for this display is called a window. • Viewport: An area on display device to which a window is mapped [where it is to displayed]. ...
  • 3. 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.
  • 4. Types of Clipping: • Point Clipping • Line Clipping • Area Clipping (Polygon) • Curve Clipping • Text Clipping • Exterior Clipping
  • 5. Some Basic Terms • 1:A viewport defines in normalized coordinates a rectangular area on the display device where the image of the data appears. • 2:The process of selecting and viewing the picture with different views is called Windowing, and • a Process which divides each element of the picture into its visible and invisible portions, allowing the invisible portion to be discarded is called Clipping.
  • 6. CONTINUE.. • The method of selecting and enlarging a portion of a drawing is called windowing. • The area chosen for this display is called a window. • The window is selected by world-coordinate. Almost all 2D and 3D graphics packages provide means of defining viewport size on the screen.
  • 7. …… • The method of selecting and enlarging a portion of a drawing is called windowing. The area chosen for this display is called a window. The window is selected by world-coordinate. • Sometimes we are interested in some portion of the object and not in full object. So we will decide on an imaginary box. This box will enclose desired or interested area of the object. Such an imaginary box is called a window. • Viewport: An area on display device to which a window is mapped [where it is to displayed].
  • 8. Viewing transformation • Viewing Transformation is the mapping of coordinates of points and lines that form the picture into appropriate coordinates on the display device. ... Mapping the window onto a sub region of the display device called the viewport is called the Viewing Transformation
  • 9.
  • 10. Viewing transformation in several steps: • First, we construct the scene in world coordinate using the output primitives and attributes. • To obtain a particular orientation, we can set up a 2-D viewing coordinate system in the window coordinate plane and define a window in viewing coordinates system. • Once the viewing frame is established, are then transform description in world coordinates to viewing coordinates. • Then, we define viewport in normalized coordinates (range from 0 to 1) and map the viewing coordinates description of the scene to normalized coordinates. • At the final step, all parts of the picture that (i.e., outside the viewport are dipped, and the contents are transferred to device coordinates). •
  • 12.
  • 13. Applications of clipping: • 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.
  • 14. Types of Lines: • 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.
  • 15.
  • 16. • Clipping can be applied through hardware as well as software. • In some computers, hardware devices automatically do work of clipping. • In a system where hardware clipping is not available software clipping applied.
  • 17. Following figure show before and after clipping
  • 18. Point Clipping: • Point Clipping is used to determining, whether the point is inside the window or not. For this following conditions are checked. • x ≤ xmax • x ≥ xmin • y ≤ ymax • y ≥ ymin
  • 19. (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.
  • 20. Line Clipping: • It is performed by using the line clipping algorithm. • The line clipping algorithms are: • Cohen Sutherland Line Clipping Algorithm • Midpoint Subdivision Line Clipping Algorithm • Liang-Barsky Line Clipping Algorithm
  • 21. Category of line • There are three possible cases for any given line. • Completely inside the given rectangle : Bitwise OR of region of two end points of line is 0 (Both points are inside the rectangle) • Completely outside the given rectangle : Both endpoints share at least one outside region which implies that the line does not cross the visible region. (bitwise AND of endpoints != 0). • Partially inside the window : Both endpoints are in different regions. In this case, the algorithm finds one of the two points that is outside the rectangular region. The intersection of the line from outside point and rectangular window becomes new corner point and the algorithm repeats
  • 24. Mid Point Subdivision Line Clipping Algorithm: • It is used for clipping line. • The line is divided in two parts. Mid points of line is obtained by dividing it in two short segments. Again division is done, by finding midpoint. This process is continued until line of visible and invisible category is obtained. Let (xi,yi) are midpoint
  • 28. Explanation • Midpoint subdivision algorithm is an extension of the Cyrus Beck algorithm. This algorithm is mainly used to compute visible areas of lines that are present in the view port are of the sector or the image. • It follows the principle of the bisection method and works similarly to the Cyrus Beck algorithm by bisecting the line in to equal halves. • But unlike the Cyrus Beck algorithm, which only bisects the line once, Midpoint Subdivision Algorithm bisects the line numerous times. • Also the Sutherland Cohen subdivision line clipping algorithm requires the calculation of the intersection of the line with the window edge. These calculations can be avoided by repetitively subdividing the line at its midpoint. • Like other algorithm, initially the line is tested for visibility. If line is completely visible it is drawn and if it is completely invisible it is rejected. If line is partially visible then it is subdivided in two equal parts. The visibility tests are then applied to each half. This subdivision process is repeated until we get completely visible and completely invisible line segments. This is illustrated in figure (k) below
  • 29. …. • As shown in the figure (k), line P1 P2 is partially visible. It is subdivided in two equal Parts P1 P3 and P3 P2 (see Fig. k (b)). Both the line segments are tested for visibility and found to be partially visible. Both line segments are then subdivided in two equal parts to get midpoints P4 and P5 (see Fig. k (c)). It is observed that line segments P1 P4 and P5 P2 are completely invisible and hence rejected. However, line segment P3 P5 is completely visible and hence drawn. The remaining line segment P4 P3 is still partially visible. It is then subdivided to get midpoint P6. It is observed that P6 P3 is completely visible whereas P4 P6 is partially visible. Thus P6 P3 line segment is drawn and P4 P6 line segment is further subdivided into equal parts to get midpoint P7. Now, it is observed that line segment P4 P7 is completely invisible and line segment P7 P6 is completely visible (see Fig. k (f)), and there is no further partially visible segment.
  • 30. Advantage of midpoint subdivision Line Clipping: It is suitable for machines in which multiplication and division operation is not possible. Because it can be performed by introducing clipping divides in hardware x5lie on point of intersection of boundary of window.
  • 31.
  • 32. Algorithm of midpoint subdivision Line Clipping • : • Step1: Calculate the position of both endpoints of the line • Step2: Perform OR operation on both of these endpoints • Step3: If the OR operation gives 0000 • then • Line is guaranteed to be visible • else • Perform AND operation on both endpoints. • If AND ≠ 0000 • then the line is invisible • else • AND=6000 • then the line is clipped case. • Step4: For the line to be clipped. Find midpoint • Xm=(x1+x2)/2 • Ym=(y1+y2)/2 • Xmis midpoint of X coordinate. • Ymis midpoint of Y coordinate. • Step5: Check each midpoint, whether it nearest to the boundary of a window or not. • Step6: If the line is totally visible or totally rejected not found then repeat step 1 to 5. • Step7: Stop algorithm.
  • 33. Cohen Sutherland Line Clipping Algorithm • Cohen Sutherland Algorithm is a line clipping algorithm :that cuts lines to portions which are within a rectangular area. It eliminates the lines from a given set of lines and rectangle area of interest (view port) which belongs outside the area of interest and clip those lines which are partially inside the area of interest.
  • 34.
  • 35. … • There are 3 possibilities for the line: • Line can be completely inside the window (This line should be accepted). • Line can be completely outside of the window (This line will be completely removed from the region). • Line can be partially inside the window (We will find intersection point and draw only that portion of line that is inside region).
  • 36. Algorithm • The algorithm divides a two-dimensional space into 9 regions (eight outside regions and one inside region) and then efficiently determines the lines and portions of lines that are visible in the central region of interest (the viewport). • Following image illustrates the 9 regions:
  • 38.
  • 39. ………. • As you seen each region is denoted by a 4 bit code like 0101 for the bottom right region • Four Bit code is calculated by comparing extreme end point of given line (x,y) by four co-ordinates x_min, x_max, y_max, y_min which are the coordinates of the area of interest (0000) • Calculate the four bit code as follows: • Set First Bit if 1 Points lies to left of window (x < x_min) • Set Second Bit if 1 Points lies to right of window (x > x_max) • Set Third Bit if 1 Points lies to bottom of window (y < y_min) • Set Fourth Bit if 1 Points lies to top of window (y > y_max)
  • 40. …. The sequence for reading the codes' bits is LRBT (Left, Right, Bottom, Top).
  • 42. Algorithm • Step 1 : Assign a region code for two endpoints of given line • Step 2 : If both endpoints have a region code 0000 then given line is completely inside and we will keep this line • Step 3 : If step 2 fails, perform the logical AND operation for both region codes. – Step 3.1 : If the result is not 0000, then given line is completely outside. – Step 3.2 : Else line is partially inside. • Step 3.2.a : Choose an endpoint of the line that is outside the given rectangle. • Step 3.2.b : Find the intersection point of the rectangular boundary (based on region code). • Step 3.2.c : Replace endpoint with the intersection point and update the region code. • Step 3.2.d : Repeat step 2 until we find a clipped line either trivially accepted or rejected. • Step 4 : Repeat step 1 for all lines
  • 43. ….. • To find out intersection boundary if bit 1 is 1 ,line intersect with line x=xmin(left boundary) • To find out intersection boundary if bit 2 is 1 ,line intersect with line x=xmin(right boundary) • To find out intersection boundary if bit 3 is 1 ,line intersect with line x=xmin(bottom boundary) • To find out intersection boundary if bit 4 is 1 ,line intersect with line x=xmin(top boundary)
  • 44. ….. • Then find out coordinates of intersection point, once line of interaction is known, then point of intersection is calculated as, • 1.If boundary line is vertical ,then • Xa=xmin or xmax • Ya=y1+m(xa-x1) • 2.if boundary line is horizontal ,then • Ya=ymin or ymax, xa=x1+(ya-y1)/m • m is slope of line=(y2-y1)/(x2-x1). • Replace end points with intersection points, display new line joining two intersection points.
  • 45. Liang-Barsky Line Clipping Algorithm: • Liang and Barsky have established an algorithm that uses floating-point arithmetic but finds the appropriate endpoints with at most four computations. This algorithm uses the parametric equations for a line and solves four inequalities to find the range of the parameter for which the line is in the viewport.
  • 47. Continue….. • Let P(x1, y1), Q(x2, y2) is the line which we want to study. The parametric equation of the line segment from gives x-values and y-values for every point in terms of a parameter that ranges from 0 to 1. The equations are • x=x1+(x2-x1 )*t=x1+dx*t and y=y1+(y2- y1 )*t=y1+dy*t • We can see that when t = 0, the point computed is P(x1, y1); and when t = 1, the point computed is Q(x2, y2).
  • 48. Algorithm • Algorithm of Liang-Barsky Line Clipping: • 1. Set tmin=0 and tmax=1 • 2. Calculate the values tL,tR,tT and tB(tvalues). If t<tmin or t<tmax? ignore it and go to the next edge Otherwise classify the tvalue as entering or exiting value (using inner product to classify) If t is entering value set tmin=t if t is exiting value set tmax=t.</t</t3. If tmin< tmax? then draw a line from (x1 + dx*tmin, y1 + dy*tmin) to (x1 + dx*tmax?, y1 + dy*tmax? ) • 4. If the line crosses over the window, you will see (x1 + dx*tmin, y1 + dy*tmin) and (x1 + dx*tmax? , y1 + dy*tmax?) are intersection between line and edge.
  • 49. Polygon Clipping • Polygon is a representation of the surface. It is primitive which is closed in nature. It is formed using a collection of lines. • It is also called as many-sided figure. • The lines combined to form polygon are called sides or edges. The lines are obtained by combining two vertices. • Triangle • Rectangle • Hexagon • Pentagon
  • 50.
  • 51.
  • 52. Convex Polygon • A polygon is called convex of line joining any two interior points of the polygon lies inside the polygon.
  • 53. Concave Polygon • A concave polygon has one interior angle greater than 180°. So that it can be clipped into similar polygons. •
  • 54. Sutherland-Hodgeman Polygon Clipping • It is performed by processing the boundary of polygon against each window corner or edge. • First of all entire polygon is clipped against one edge, then resulting polygon is considered, then the polygon is considered against the second edge, so on for all four edges.
  • 55. Four possible situations while processing • If the first vertex is an outside the window, the second vertex is inside the window. Then second vertex is added to the output list. The point of intersection of window boundary and polygon side (edge) is also added to the output line. • If both vertexes are inside window boundary. Then only second vertex is added to the output list. • If the first vertex is inside the window and second is an outside window. The edge which intersects with window is added to output list. • If both vertices are the outside window, then nothing is added to output list.
  • 56.
  • 57. … 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 in turn. • beginning with the original set of polygon vertices, 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, as shown in figure (l). • At each step a new set of polygon vertices is generated and passed to the next window boundary clipper. • This is the fundamental idea used in the Sutherland - Hodgeman algorithm. •
  • 58.
  • 59. • The output of the algorithm is a list of polygon vertices all of which are on the visible side of a clipping plane. • Such each edge of the polygon is individually compared with the clipping plane. • This is achieved by processing two vertices of each edge of the polygon around the clipping boundary or plane. • This results in four possible relationships between the edge and the clipping boundary or Plane.
  • 60.
  • 61. ………… • If the first vertex of the edge is outside the window boundary and the second vertex of the edge is inside then the intersection point of the polygon edge with the window boundary and the second vertex are added to the output vertex list (See Fig. m (a)). • If both vertices of the edge are inside the window boundary, only the second vertex is added to the output vertex list. (See Fig. m (b)). • If the first vertex of the edge is inside the window boundary and the second vertex of the edge is outside, only the edge intersection with the window boundary is added to the output vertex list. (See Fig. m (c)). • If both vertices of the edge are outside the window boundary, nothing is added to the output list. (See Fig. m (d)). • Once all vertices are processed for one clip window boundary, the output list of vertices is clipped against the next window boundary. Going through above four cases we can realize that there are two key processes in this algorithm. • Determining the visibility of a point or vertex (lnside - Outside test) and • Determining the intersection of the polygon edge and the clipping plane. • One way of determining the visibility of a point or vertex is described here. Consider that two points A and B define the window boundary and point under consideration is V, then these three points define a plane. Two vectors which lie in that plane are AB and AV. If this plane is considered in the xy plane, then the vector cross product AV x AB has only a component given by • The sign of the z component decides the position of Point V with respect to window boundary. • If z is: • Positive - Point is on the right side of the window boundary. • Zero - Point is on the window boundary. • Negative - Point is on the left side of the window boundary.
  • 62. … • Sutherland-Hodgeman Polygon Clipping Algorithm:- • Read coordinates of all vertices of the Polygon. • Read coordinates of the dipping window • Consider the left edge of the window • Compare the vertices of each edge of the polygon, individually with the clipping plane. • Save the resulting intersections and vertices in the new list of vertices according to four possible relationships between the edge and the clipping boundary. • Repeat the steps 4 and 5 for remaining edges or the clipping window. Each time the resultant list of vertices is successively passed to process the next edge of the clipping window. • Stop.
  • 63. ….. • Example :- For a polygon and clipping window shown in figure below give the list of vertices after each boundary clipping.
  • 64. …… • Solution:- Original polygon vertices are V1, V2, V3, V4, and V5. After clipping each boundary the new vertices are as shown in figure above
  • 65. Text Clipping: • Several methods are available for clipping of text. • Clipping method is dependent on the method of generation used for characters. • A simple method is completely considered, or nothing considers method. • This method is also called as all or none. • If all characters of the string are inside window, then we will keep the string, if a string character is outside then whole string will be discarded in fig (a).
  • 66.
  • 67. • Curve Clipping: • Curve Clipping involves complex procedures as compared to line clipping. Curve clipping requires more processing than for object with linear boundaries. Co
  • 68. • Exterior Clipping: • It is opposite to previous clipping. Here picture which is outside the window is considered. The picture inside the rectangle window is discarded. So part of the picture outside the window is saved. Uses of Exterior Clipping: • It is used for displaying properly the pictures which overlap each other. • It is used in the concept of overlapping windows. • It is used for designing various patterns of pictures. • It is used for advertising purposes.