SlideShare a Scribd company logo
1 of 36
UNIT - III
❖Basic transformation
❖Matrix representations
❖Composite transformations
❖Window to view port Co-ordinate transformation
❖Clipping
❖Point clipping
❖Line clipping
❖Cohen-Sutherland line clipping
❖Liang Barsky line clipping algorithm
❖Polygon clipping
BASIC TRANSFORMATION
❖Transformation means changing some graphics into something else by applying rules.
❖We can have various types of transformations such as translation, scaling up or down, rotation,
shearing, etc.
❖When a transformation takes place on a 2D plane, it is called 2D transformation.
❖Two essential aspects of transformation are given below:
❖Each transformation is a single entity. It can be denoted by a unique name or symbol.
❖It is possible to combine two transformations, after connecting a single transformation is
obtained, e.g., A is a transformation for translation. The B transformation performs scaling.
The combination of two is C=AB. So C is obtained by concatenation property.
BASIC TRANSFORMATION
We can reposition and resize two-dimensional objects by applying:
TWO-DIMENSIONAL GEOMETRIC TRANSFORMATIONS
Basic Transformations
❖ Translation
❖ Rotation
❖Scaling
Composite Transformations
Other Transformations
❖Reflection
❖Shear
BASIC 2D TRANSFORMATION
Translation:
Simply moves an object from one position to another
2D TRANSLATION
❖ One of rigid-body transformation, which moves object without deformation.
❖ Translate an object by adding offsets to coordinates to generate new coordinates
positions.
❖ P’=P+T
❖ Translation moves the object without deformation.
SCALING
❖ A Scaling transformation alters the size of an objects.
❖ This operations can be carried out for polygons by multiplying the coordinate
values(x , y) of each vertex by scaling factors sx and sy to produce the
transformed coordinates(x’ , y’):
❖ Scaling factors sx scales objects in the x direction, and sy in the y direction
❖ A two-dimension rotation is applied to an object
by re positioning it along a circular path in the xy
plane.
❖ To generate a rotation, we specify a rotation
angle θ and the position (x , y) of the rotation
point (or pivot point) about which the object is to
be rotated.
❖ Positive values for the rotation angle define
counter clockwise rotation about the pivot point.
❖ Negative values rotate objects in the clock
direction.
SCALING
Distorts the shape of an object such that the transformed shape
Appears as if the object were composed of internal layers that had been
caused to slide over each other.
OTHER TRANSFORMATIONS: SHEAR
OTHER TRANSFORMATIONS: REFLECTION
MATRIX REPRESENTATIONS
❖Matrix representation is a method used by a computer language to store matrices of
more than one dimension in memory. ... Fortran uses "Column Major", in which all the
elements for a given column are stored contiguously in memory. C uses "Row Major",
which stores all the elements for a given row contiguously in memory.
❖Homogeneous coordinates are ubiquitous in computer graphics because they allow
common vector operations such as translation, rotation, scaling and perspective
projection to be represented as a matrix by which the vector is multiplied.
WINDOW TO VIEW PORT CO-ORDINATE
TRANSFORMATION
❖Window to Viewport
Transformation is the
process of transforming a
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.
GENERAL TERMS:
❖World coordinate – It is the Cartesian coordinate w.r.t which we define the diagram,
like Xwmin, Xwmax, Ywmin, Ywmax
❖Device Coordinate –It is the screen coordinate where the objects is to be displayed,
like Xvmin, Xvmax, Yvmin, Yvmax
❖Window –It is the area on world coordinate selected for display.
❖ViewPort –It is the area on device coordinate where graphics is to be displayed.
MATHEMATICAL CALCULATION OF WINDOW TO VIEWPORT:
❖It may be possible that the size of the Viewport is much smaller or
greater than the Window. In these cases, we have to increase or decrease
the size of the Window according to the Viewport and for this, we need
some mathematical calculations.
❖(xw, yw): A point on Window
❖ (xv, yv): Corresponding point on Viewport
❖we have to calculate the point (xv, yv)
CLIPPING
❖Clipping Any Procedure that identifies those portions of a picture that are either inside or outside of a specified
region of a space is referred to as a Clipping algorithm or simply Clipping . The region against which an object is
to clipped is called a Clip Window.
❖Types of Clipping:
❖Point Clipping.
❖Line Clipping.
❖Area Clipping (Polygon)
❖Curve Clipping.
❖Text Clipping.
❖Exterior 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 ≤ x max
❖x ≥ x min
❖y ≤ y max
❖y ≥ y min
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
COHEN–SUTHERLAND ALGORITHM
❖The Cohen–Sutherland algorithm is a computer-graphics algorithm used
for line clipping. The algorithm divides a two-dimensional space into 9 regions and
then efficiently determines the lines and portions of lines that are visible in the
central region of interest (the viewport).
❖The algorithm was developed in 1967 during flight-simulator work by Danny
Cohen and Ivan Sutherland.
ALGORITHM
❖The algorithm includes, excludes or partially includes the line based on whether:
❖Both endpoints are in the viewport region (bitwise OR of endpoints = 00): trivial accept.
❖Both endpoints share at least one non-visible region, which implies that the line does not cross the
visible region. (bitwise AND of endpoints ≠ 0): trivial reject.
❖Both endpoints are in different regions: in case of this nontrivial situation the algorithm finds one of the
two points that is outside the viewport region (there will be at least one point outside). The intersection of
the outpoint and extended viewport border is then calculated (i.e. with the parametric equation for the line),
and this new point replaces the outpoint. The algorithm repeats until a trivial accept or reject occurs.
❖The Cohen–Sutherland algorithm can be used only on a rectangular clip window.
❖The numbers in the figure below are called out
codes. An out code is computed for each of the two
points in the line. The out code will have 4 bits for
two-dimensional clipping, or 6 bits in the three-
dimensional case. The first bit is set to 1 if the point
is above the viewport. The bits in the 2D out code
represent: top, bottom, right, left. For example, the
out code 1010 represents a point that is top-right of
the viewport.
LIANG BARSKY LINE CLIPPING
❖In computer graphics, the Liang–Barsky algorithm (named after You-Dong Liang and Brian A. Barsky)
is a line clipping algorithm.
❖The Liang–Barsky algorithm uses the parametric equation of a line and inequalities describing the range of
the clipping window to determine the intersections between the line and the clip window.
❖With these intersections it knows which portion of the line should be drawn. This algorithm is significantly
more efficient than Cohen–Sutherland.
❖The idea of the Liang–Barsky clipping algorithm is to do as much testing as possible before computing line
intersections.
POLYGON CLIPPING
❖A set of connected lines are considered as polygon;
❖polygons are clipped based on the window and the portion which is inside the window is kept as it is and the
outside portions are clipped.
❖The polygon clipping is required to deal different cases.
❖The clip boundary determines the visible and invisible regions of polygon clipping and it is categorized as four.
• Visible region is wholly inside the clip window – saves endpoint
• Visible exits the clip window – Save the interaction
• Visible region is wholly outside the clip window – nothing to save
• Visible enters the clip window – save endpoint and intersection
SUTHERLAND–HODGMAN POLYGON CLIPPING
❖Sutherland Hodgeman polygon clipping algorithm is used for polygon clipping. In
this algorithm, all the vertices of the polygon are clipped against each edge of
the clipping window.
❖First the polygon is clipped against the left edge of the polygon window to get new
vertices of the polygon.
❖A convex polygon and a convex clipping area are given. The task is to clip
polygon edges using the Sutherland–Hodgman Algorithm. Input is in the form
of vertices of the polygon in clockwise order.
We illustrate this algorithm by processing the area in
figure against the left window boundary.
❖ Vertices 1 and 2 are outside of the boundary.
❖ Vertex 3, which is inside, 1' and vertex 3 are
saved.
❖ Vertex 4 and 5 are inside, and they also saved.
❖ Vertex 6 is outside, 5' is saved. Using the five
saved points, we would repeat the process for the
next window boundary.
SUTHERLAND-HODGMAN POLYGON CLIPPING (EXAMPLE)
❖Clip a polygon by processing the polygon boundary against each window edge. (Left, Top, Bottom,
Right).
❖ Apply four cases to process all polygon edges to produce sequence of vertices. This sequence of
vertices will make a bounded area.
❖Beginning with the initial 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 be
successively passed to a right boundary clipper, a bottom boundary clipper. and a top boundary
clipper.
STEPS TO SOLVE POLYGON CLIPPING
CURVE CLIPPING
❖Curve Clipping involves complex procedures as compared to lineclipping. Curve
clipping requires more processing than for object with linear boundaries. Consider
window which is rectangular in shape. The circle is to consider against rectangle
window.
❖The bounding rectangle for a circle Or other curved object can be used first to test for
overlap with a rectangular clip Window
❖If the rectangle is determined to be completely outside the window, we discard the
object
If both the above tests fails we use other computation saving
approaches depending upon type of object
• Circle: Use coordinate extent of individual quadrant, then octant if required.
• Ellipse: Use coordinate extent of individual quadrant.
• Point: Use point clipping
CURVE CLIPPING
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).
❖Another method is discarded those characters not completely inside the window. If
a character overlap boundary of window. Those will be discarded in fig (b).
❖In fig (c) individual character is treated. Character lies on boundary is discarded as
which it is outside the window.
THANK YOU

More Related Content

What's hot

visual realism Unit iii
 visual realism Unit iii visual realism Unit iii
visual realism Unit iiiArun Prakash
 
Visible surface determination
Visible  surface determinationVisible  surface determination
Visible surface determinationPatel Punit
 
Computer Graphics (Hidden surfaces and line removal, Curves and surfaces, Sur...
Computer Graphics (Hidden surfaces and line removal, Curves and surfaces, Sur...Computer Graphics (Hidden surfaces and line removal, Curves and surfaces, Sur...
Computer Graphics (Hidden surfaces and line removal, Curves and surfaces, Sur...rohitjasudkar
 
Hidden Surface Removal using Z-buffer
Hidden Surface Removal using Z-bufferHidden Surface Removal using Z-buffer
Hidden Surface Removal using Z-bufferRaj Sikarwar
 
Hidden surface removal
Hidden surface removalHidden surface removal
Hidden surface removalPunyajoy Saha
 
Visible Surface Detection
Visible Surface DetectionVisible Surface Detection
Visible Surface DetectionAmitBiswas99
 
Back face detection
Back face detectionBack face detection
Back face detectionPooja Dixit
 
Computer graphics curves and surfaces (1)
Computer graphics curves and surfaces (1)Computer graphics curves and surfaces (1)
Computer graphics curves and surfaces (1)RohitK71
 
Computer graphics iv unit
Computer graphics iv unitComputer graphics iv unit
Computer graphics iv unitaravindangc
 
visual realism in geometric modeling
visual realism in geometric modelingvisual realism in geometric modeling
visual realism in geometric modelingsabiha khathun
 
Visual realism -HIDDEN REMOVAL METHODS
Visual realism -HIDDEN REMOVAL METHODSVisual realism -HIDDEN REMOVAL METHODS
Visual realism -HIDDEN REMOVAL METHODSviswaaswaran
 

What's hot (20)

visual realism Unit iii
 visual realism Unit iii visual realism Unit iii
visual realism Unit iii
 
Visible surface determination
Visible  surface determinationVisible  surface determination
Visible surface determination
 
Computer Graphics (Hidden surfaces and line removal, Curves and surfaces, Sur...
Computer Graphics (Hidden surfaces and line removal, Curves and surfaces, Sur...Computer Graphics (Hidden surfaces and line removal, Curves and surfaces, Sur...
Computer Graphics (Hidden surfaces and line removal, Curves and surfaces, Sur...
 
Hidden Surface Removal using Z-buffer
Hidden Surface Removal using Z-bufferHidden Surface Removal using Z-buffer
Hidden Surface Removal using Z-buffer
 
Hidden surface removal
Hidden surface removalHidden surface removal
Hidden surface removal
 
Visible Surface Detection
Visible Surface DetectionVisible Surface Detection
Visible Surface Detection
 
Back face detection
Back face detectionBack face detection
Back face detection
 
3 d display methods
3 d display methods3 d display methods
3 d display methods
 
3 d viewing
3 d viewing3 d viewing
3 d viewing
 
3 d display-methods
3 d display-methods3 d display-methods
3 d display-methods
 
Computer graphics curves and surfaces (1)
Computer graphics curves and surfaces (1)Computer graphics curves and surfaces (1)
Computer graphics curves and surfaces (1)
 
Windows and viewport
Windows and viewportWindows and viewport
Windows and viewport
 
Computer graphics iv unit
Computer graphics iv unitComputer graphics iv unit
Computer graphics iv unit
 
Clipping
ClippingClipping
Clipping
 
visual realism in geometric modeling
visual realism in geometric modelingvisual realism in geometric modeling
visual realism in geometric modeling
 
Three dimensional concepts - Computer Graphics
Three dimensional concepts - Computer GraphicsThree dimensional concepts - Computer Graphics
Three dimensional concepts - Computer Graphics
 
Z buffer
Z bufferZ buffer
Z buffer
 
Visual realism -HIDDEN REMOVAL METHODS
Visual realism -HIDDEN REMOVAL METHODSVisual realism -HIDDEN REMOVAL METHODS
Visual realism -HIDDEN REMOVAL METHODS
 
Visual realism
Visual realismVisual realism
Visual realism
 
Shading
ShadingShading
Shading
 

Similar to UNIT-III (20)

Unit 4 notes
Unit 4 notesUnit 4 notes
Unit 4 notes
 
Clipping
ClippingClipping
Clipping
 
Unit 3
Unit 3Unit 3
Unit 3
 
Windowing clipping
Windowing   clippingWindowing   clipping
Windowing clipping
 
Lecture 2d point,curve,text,line clipping
Lecture   2d point,curve,text,line clippingLecture   2d point,curve,text,line clipping
Lecture 2d point,curve,text,line clipping
 
Clipping
ClippingClipping
Clipping
 
ch4.pptx
ch4.pptxch4.pptx
ch4.pptx
 
99995327.ppt
99995327.ppt99995327.ppt
99995327.ppt
 
lecture8 clipping
lecture8 clippinglecture8 clipping
lecture8 clipping
 
Clipping CG ppt.pptx
Clipping CG ppt.pptxClipping CG ppt.pptx
Clipping CG ppt.pptx
 
Clipping
ClippingClipping
Clipping
 
Notes04.pdf
Notes04.pdfNotes04.pdf
Notes04.pdf
 
Computer Graphics
Computer GraphicsComputer Graphics
Computer Graphics
 
projections - engineering drawing
projections - engineering drawing projections - engineering drawing
projections - engineering drawing
 
Clipping
ClippingClipping
Clipping
 
CAD
CAD CAD
CAD
 
Comparison of Various Line Clipping Algorithm for Improvement
Comparison of Various Line Clipping Algorithm for ImprovementComparison of Various Line Clipping Algorithm for Improvement
Comparison of Various Line Clipping Algorithm for Improvement
 
3 d graphics with opengl part 2
3 d graphics with opengl  part 23 d graphics with opengl  part 2
3 d graphics with opengl part 2
 
UNIT2.pptx
UNIT2.pptxUNIT2.pptx
UNIT2.pptx
 
06 image features
06 image features06 image features
06 image features
 

Recently uploaded

भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 

Recently uploaded (20)

भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 

UNIT-III

  • 1. UNIT - III ❖Basic transformation ❖Matrix representations ❖Composite transformations ❖Window to view port Co-ordinate transformation ❖Clipping ❖Point clipping ❖Line clipping ❖Cohen-Sutherland line clipping ❖Liang Barsky line clipping algorithm ❖Polygon clipping
  • 2. BASIC TRANSFORMATION ❖Transformation means changing some graphics into something else by applying rules. ❖We can have various types of transformations such as translation, scaling up or down, rotation, shearing, etc. ❖When a transformation takes place on a 2D plane, it is called 2D transformation. ❖Two essential aspects of transformation are given below: ❖Each transformation is a single entity. It can be denoted by a unique name or symbol. ❖It is possible to combine two transformations, after connecting a single transformation is obtained, e.g., A is a transformation for translation. The B transformation performs scaling. The combination of two is C=AB. So C is obtained by concatenation property.
  • 3. BASIC TRANSFORMATION We can reposition and resize two-dimensional objects by applying:
  • 4. TWO-DIMENSIONAL GEOMETRIC TRANSFORMATIONS Basic Transformations ❖ Translation ❖ Rotation ❖Scaling Composite Transformations Other Transformations ❖Reflection ❖Shear
  • 5. BASIC 2D TRANSFORMATION Translation: Simply moves an object from one position to another
  • 6. 2D TRANSLATION ❖ One of rigid-body transformation, which moves object without deformation. ❖ Translate an object by adding offsets to coordinates to generate new coordinates positions. ❖ P’=P+T ❖ Translation moves the object without deformation.
  • 7. SCALING ❖ A Scaling transformation alters the size of an objects. ❖ This operations can be carried out for polygons by multiplying the coordinate values(x , y) of each vertex by scaling factors sx and sy to produce the transformed coordinates(x’ , y’): ❖ Scaling factors sx scales objects in the x direction, and sy in the y direction
  • 8. ❖ A two-dimension rotation is applied to an object by re positioning it along a circular path in the xy plane. ❖ To generate a rotation, we specify a rotation angle θ and the position (x , y) of the rotation point (or pivot point) about which the object is to be rotated. ❖ Positive values for the rotation angle define counter clockwise rotation about the pivot point. ❖ Negative values rotate objects in the clock direction. SCALING
  • 9. Distorts the shape of an object such that the transformed shape Appears as if the object were composed of internal layers that had been caused to slide over each other. OTHER TRANSFORMATIONS: SHEAR
  • 11. MATRIX REPRESENTATIONS ❖Matrix representation is a method used by a computer language to store matrices of more than one dimension in memory. ... Fortran uses "Column Major", in which all the elements for a given column are stored contiguously in memory. C uses "Row Major", which stores all the elements for a given row contiguously in memory. ❖Homogeneous coordinates are ubiquitous in computer graphics because they allow common vector operations such as translation, rotation, scaling and perspective projection to be represented as a matrix by which the vector is multiplied.
  • 12.
  • 13.
  • 14.
  • 15. WINDOW TO VIEW PORT CO-ORDINATE TRANSFORMATION ❖Window to Viewport Transformation is the process of transforming a 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.
  • 16. GENERAL TERMS: ❖World coordinate – It is the Cartesian coordinate w.r.t which we define the diagram, like Xwmin, Xwmax, Ywmin, Ywmax ❖Device Coordinate –It is the screen coordinate where the objects is to be displayed, like Xvmin, Xvmax, Yvmin, Yvmax ❖Window –It is the area on world coordinate selected for display. ❖ViewPort –It is the area on device coordinate where graphics is to be displayed.
  • 17. MATHEMATICAL CALCULATION OF WINDOW TO VIEWPORT: ❖It may be possible that the size of the Viewport is much smaller or greater than the Window. In these cases, we have to increase or decrease the size of the Window according to the Viewport and for this, we need some mathematical calculations. ❖(xw, yw): A point on Window ❖ (xv, yv): Corresponding point on Viewport ❖we have to calculate the point (xv, yv)
  • 18.
  • 19. CLIPPING ❖Clipping Any Procedure that identifies those portions of a picture that are either inside or outside of a specified region of a space is referred to as a Clipping algorithm or simply Clipping . The region against which an object is to clipped is called a Clip Window. ❖Types of Clipping: ❖Point Clipping. ❖Line Clipping. ❖Area Clipping (Polygon) ❖Curve Clipping. ❖Text Clipping. ❖Exterior Clipping.
  • 20. POINT CLIPPING: ❖Point Clipping is used to determining, whether the point is inside the window or not. For this following conditions are checked. ❖x ≤ x max ❖x ≥ x min ❖y ≤ y max ❖y ≥ y min
  • 21. 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
  • 22. COHEN–SUTHERLAND ALGORITHM ❖The Cohen–Sutherland algorithm is a computer-graphics algorithm used for line clipping. The algorithm divides a two-dimensional space into 9 regions and then efficiently determines the lines and portions of lines that are visible in the central region of interest (the viewport). ❖The algorithm was developed in 1967 during flight-simulator work by Danny Cohen and Ivan Sutherland.
  • 23. ALGORITHM ❖The algorithm includes, excludes or partially includes the line based on whether: ❖Both endpoints are in the viewport region (bitwise OR of endpoints = 00): trivial accept. ❖Both endpoints share at least one non-visible region, which implies that the line does not cross the visible region. (bitwise AND of endpoints ≠ 0): trivial reject. ❖Both endpoints are in different regions: in case of this nontrivial situation the algorithm finds one of the two points that is outside the viewport region (there will be at least one point outside). The intersection of the outpoint and extended viewport border is then calculated (i.e. with the parametric equation for the line), and this new point replaces the outpoint. The algorithm repeats until a trivial accept or reject occurs. ❖The Cohen–Sutherland algorithm can be used only on a rectangular clip window.
  • 24. ❖The numbers in the figure below are called out codes. An out code is computed for each of the two points in the line. The out code will have 4 bits for two-dimensional clipping, or 6 bits in the three- dimensional case. The first bit is set to 1 if the point is above the viewport. The bits in the 2D out code represent: top, bottom, right, left. For example, the out code 1010 represents a point that is top-right of the viewport.
  • 25. LIANG BARSKY LINE CLIPPING ❖In computer graphics, the Liang–Barsky algorithm (named after You-Dong Liang and Brian A. Barsky) is a line clipping algorithm. ❖The Liang–Barsky algorithm uses the parametric equation of a line and inequalities describing the range of the clipping window to determine the intersections between the line and the clip window. ❖With these intersections it knows which portion of the line should be drawn. This algorithm is significantly more efficient than Cohen–Sutherland. ❖The idea of the Liang–Barsky clipping algorithm is to do as much testing as possible before computing line intersections.
  • 26.
  • 27. POLYGON CLIPPING ❖A set of connected lines are considered as polygon; ❖polygons are clipped based on the window and the portion which is inside the window is kept as it is and the outside portions are clipped. ❖The polygon clipping is required to deal different cases. ❖The clip boundary determines the visible and invisible regions of polygon clipping and it is categorized as four. • Visible region is wholly inside the clip window – saves endpoint • Visible exits the clip window – Save the interaction • Visible region is wholly outside the clip window – nothing to save • Visible enters the clip window – save endpoint and intersection
  • 28.
  • 29. SUTHERLAND–HODGMAN POLYGON CLIPPING ❖Sutherland Hodgeman polygon clipping algorithm is used for polygon clipping. In this algorithm, all the vertices of the polygon are clipped against each edge of the clipping window. ❖First the polygon is clipped against the left edge of the polygon window to get new vertices of the polygon. ❖A convex polygon and a convex clipping area are given. The task is to clip polygon edges using the Sutherland–Hodgman Algorithm. Input is in the form of vertices of the polygon in clockwise order.
  • 30. We illustrate this algorithm by processing the area in figure against the left window boundary. ❖ Vertices 1 and 2 are outside of the boundary. ❖ Vertex 3, which is inside, 1' and vertex 3 are saved. ❖ Vertex 4 and 5 are inside, and they also saved. ❖ Vertex 6 is outside, 5' is saved. Using the five saved points, we would repeat the process for the next window boundary. SUTHERLAND-HODGMAN POLYGON CLIPPING (EXAMPLE)
  • 31. ❖Clip a polygon by processing the polygon boundary against each window edge. (Left, Top, Bottom, Right). ❖ Apply four cases to process all polygon edges to produce sequence of vertices. This sequence of vertices will make a bounded area. ❖Beginning with the initial 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 be successively passed to a right boundary clipper, a bottom boundary clipper. and a top boundary clipper. STEPS TO SOLVE POLYGON CLIPPING
  • 32. CURVE CLIPPING ❖Curve Clipping involves complex procedures as compared to lineclipping. Curve clipping requires more processing than for object with linear boundaries. Consider window which is rectangular in shape. The circle is to consider against rectangle window. ❖The bounding rectangle for a circle Or other curved object can be used first to test for overlap with a rectangular clip Window ❖If the rectangle is determined to be completely outside the window, we discard the object
  • 33. If both the above tests fails we use other computation saving approaches depending upon type of object • Circle: Use coordinate extent of individual quadrant, then octant if required. • Ellipse: Use coordinate extent of individual quadrant. • Point: Use point clipping CURVE CLIPPING
  • 34. 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). ❖Another method is discarded those characters not completely inside the window. If a character overlap boundary of window. Those will be discarded in fig (b). ❖In fig (c) individual character is treated. Character lies on boundary is discarded as which it is outside the window.
  • 35.