TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, Dwarka Institutional Area, New Delhi-75
Affiliated to Institution of G.G.S.IP.U, Delhi
Scan Conversion
Himja Sethi
Assistant Professor
Course BCA
Paper Title Computer Graphics
Paper Code BCA 303
Paper ID 20303
Quick Overview of Syllabus
Unit I Unit II
ļ‚— Applications of computer graphics
ļ‚— Video display technologies
ļ‚— Raster scan systems
ļ‚— Graphics related input and output
devices
ļ‚— Computer graphics related
software
ļ‚— Scan conversion of line, circle and
ellipse using algorithms, DDA,
Bresenham, mid-point
ļ‚— 2D and 3D geometric transformations
(Translation, Rotation, Scaling,
Shearing, Reflection)
ļ‚— Composite transformations and its
practical application through numericals
ļ‚— Homogenous coordinates
ļ‚— Antialiasing
ļ‚— Window to viewpoint transformation
ļ‚— Clipping algorithms (Cohen Sutherland,
Cyrus Beck, Midpoint Subdivision)
Quick Overview of Syllabus
Unit III Unit IV
ļ‚— Parametric Cubic Curve
Representation
ļ‚— Solid modelling
ļ‚— Types of surface representations
ļ‚— Wireframe
ļ‚— Sweep
ļ‚— Spatial Partitioning
ļ‚— Boundary
ļ‚— Octree
ļ‚— Comparison amongst all of the
above
ļ‚— User interfaces for solid
modelling
ļ‚— 3D objects and related concepts
ļ‚— Projection
ļ‚— Types of projection
ļ‚— Parallel
ļ‚— Orthographic
ļ‚— Oblique
ļ‚— Perspective
ļ‚— 3D clipping
ļ‚— Cohen Sutherland
ļ‚— Hidden surface removal
ļ‚— Depth buffer / z-buffer algo
ļ‚— Depth sorting algo
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, Dwarka Institutional Area, New Delhi-75
Course Books
TEXT BOOKS:
ļ‚— Foley,Van Dam, Feiner, Hughes, Computer Graphics Principles &
Practice, 2000, Pearson
ļ‚— Chennakesava R.Alavla ā€œComputer Graphicsā€, PHI Learning Pvt.
Limited
REFERENCES BOOKS:
ļ‚— D. Hearn & Baker: Computer Graphics with OpenGL, Pearson
Education,Third Edition,2009.
ļ‚— Foley, J.D. &Van Dam,A: Fundamentals of Interactive Computer
Graphics.
ļ‚— Rogers &Adams,ā€œMathematical Elements for Computer
Graphicsā€, McGraw Hill, 1989.
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, Dwarka Institutional Area, New Delhi-75
How to Attempt a Question?
ļ‚— Introduction
ļ‚— Definition
ļ‚— Point-wise description
ļ‚— Examples, if any
ļ‚— Conclusion
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, Dwarka Institutional Area, New Delhi-75
Marking Scheme
ļ‚— Internal
ļ‚—25 marks (10 marks I minor +10 marks II
minor + 5 marks internal assessment)
ļ‚— External
ļ‚—75 marks (Major semester exam)
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, Dwarka Institutional Area, New Delhi-75
Affiliated to Institution of G.G.S.IP.U, Delhi
Lets begin with…
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, Dwarka Institutional Area, New Delhi-75
Applications of Computer Graphics
around us
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, Dwarka Institutional Area, New Delhi-75
Yes, that’s right…
ļ‚— Gaming
ļ‚— Animation Movies
ļ‚— 3D object simulation for engineering, manufacturing etc
ļ‚— Virtual Reality Simulation for pilot training, surgical practice
etc
ļ‚— ComputerAided Design
ļ‚— And many more…
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, Dwarka Institutional Area, New Delhi-75
Computer Graphics
Types Of Computer Graphics
ļ‚— Raster Graphics
Primitive drawing using coordinate positions for each
pixel
ļ‚— Vector graphics
Primitive drawing using pre-defined mathematical
functions
Main focus of the course is Raster Graphics
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, Dwarka Institutional Area, New Delhi-75
Raster Graphics
Definition : Raster graphics, also called bitmap
graphics, are digital images that are composed of
tiny rectangular pixels that are arranged in a grid
(or raster) of x and y coordinates in such a way
that it forms an image.
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, Dwarka Institutional Area, New Delhi-75
Drawing a Line on the Computer
Screen
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, Dwarka Institutional Area, New Delhi-75
Solution
ļ‚— Three approaches for solution are :
ļ‚— Equation of line , y = mx + c
ļ‚— DDA algorithm, step increments in x / y
ļ‚— Bresenham’ s algorithm, using a decision variable to
find the right pixel
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, Dwarka Institutional Area, New Delhi-75
Equation of line
y= mx + c, where m = (y2 – y1) / x2 – x1)
Through an example we can see that ,it is
ļ‚— Quite expensive
ļ‚— Involves floating point multiplication for each and
every pixel
ļ‚— Requires large amount of memory space and
processing time.
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, Dwarka Institutional Area, New Delhi-75
Scan Conversion Algorithms
Raster scan or scan conversion of a line involves finding the
right pixels to plot on the computer screen. Following
algorithms are used to achieve the solution
ļ‚— Digital DifferentialAnalyzer Algorithm
ļ‚— Bresenham’sAlgorithm
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, Dwarka Institutional Area, New Delhi-75
DDA Algorithm
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, Dwarka Institutional Area, New Delhi-75
DDA Pseudocode
m = (y2-y1)/(x2-x1)
dx = x2 – x1
dy = y2 – y1
Putpixel (x1, y1)
X = x1
Y = y1
If (dx > dy)
steps = dx
Else
steps = dy
While(x <= x2 || y <= y2)
xinc = x + dx/steps
yinc = y + dy/steps
putpixel (x,y)
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, Dwarka Institutional Area, New Delhi-75
Analysis of DDA Algorithm
ļ‚— Advantages
ļ‚— Simple to understand
ļ‚— Easy to implement
ļ‚— Disadvantages
ļ‚— Expensive computation
ļ‚— Floating point division and addition
(i.e. slope m can be in decimal )
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, Dwarka Institutional Area, New Delhi-75
Analysis of DDA Algorithm
ļ‚— Advantages
ļ‚— Simple to understand
ļ‚— Easy to implement
ļ‚— Disadvantages
ļ‚— Expensive computation
ļ‚— Floating point division and addition
(i.e. slope m can be in decimal )
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, Dwarka Institutional Area, New Delhi-75
Bresenham’s Line Drawing Algorithm
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, Dwarka Institutional Area, New Delhi-75
Bresenham’s Pseudocode (for slope
|m| <1)
Dy = y2 – y1
Dx = x2 – x1
X = x1
Y=y1
Putpixel (x1, y1)
P = 2dy – dx // decision variable
While (x <= x2 || y <= y2)
x = x + 1
if (p< 0)
p = p + 2dy // plot east pixel
else
p = p + 2dy – 2dx
y = y +1 // plot north east pixel
Putpixel (x,y)
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, Dwarka Institutional Area, New Delhi-75
Analysis of Bresenham’s Algo
ļ‚— Advantages
ļ‚— Only integer computation
ļ‚— Disadvantages
ļ‚— Lacks precision
ļ‚— Aliasing / staircasing
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, Dwarka Institutional Area, New Delhi-75
Antialiasing
ļ‚— Removing the jaggies or staircase effect caused due to under-
sampling of information due to rounding off coordinate
values to pixel positions, is called anti-aliasing.
ļ‚— This can be achieved thorough super-sampling, area
sampling, higher resolution display systems and special
hardware configurations.
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, Dwarka Institutional Area, New Delhi-75
Clipping
ļ‚— Identifying portions of a picture that are inside or outside a
specified region of space is referred as clipping.
ļ‚— Algorithms used for line clipping are:
ļ‚— Cohen-Sutherland clipping
ļ‚— Cyrus Beck clipping
ļ‚— Midpoint subdivision algorithm
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, Dwarka Institutional Area, New Delhi-75
2D Transformations
ļ‚— Translation – change of co-ordinate position along a straight
line
ļ‚— Rotation – repositioning along a circular path w.r.t. origin or
a specific point
ļ‚— Scaling – change in size of an object
ļ‚— Shearing – distorts shape of an object along an axis
ļ‚— Reflection – mirror image of an object
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, Dwarka Institutional Area, New Delhi-75
2D Transformations
ļ‚— Translation – change of co-ordinate position along a straight
line
ļ‚— Rotation – repositioning along a circular path w.r.t. origin or
a specific point
ļ‚— Scaling – change in size of an object
ļ‚— Shearing – distorts shape of an object along an axis
ļ‚— Reflection – mirror image of an object
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, Dwarka Institutional Area, New Delhi-75
Thank You

Computer Graphics

  • 1.
    TRINITY INSTITUTE OFPROFESSIONAL STUDIES Sector – 9, Dwarka Institutional Area, New Delhi-75 Affiliated to Institution of G.G.S.IP.U, Delhi Scan Conversion Himja Sethi Assistant Professor Course BCA Paper Title Computer Graphics Paper Code BCA 303 Paper ID 20303
  • 2.
    Quick Overview ofSyllabus Unit I Unit II ļ‚— Applications of computer graphics ļ‚— Video display technologies ļ‚— Raster scan systems ļ‚— Graphics related input and output devices ļ‚— Computer graphics related software ļ‚— Scan conversion of line, circle and ellipse using algorithms, DDA, Bresenham, mid-point ļ‚— 2D and 3D geometric transformations (Translation, Rotation, Scaling, Shearing, Reflection) ļ‚— Composite transformations and its practical application through numericals ļ‚— Homogenous coordinates ļ‚— Antialiasing ļ‚— Window to viewpoint transformation ļ‚— Clipping algorithms (Cohen Sutherland, Cyrus Beck, Midpoint Subdivision)
  • 3.
    Quick Overview ofSyllabus Unit III Unit IV ļ‚— Parametric Cubic Curve Representation ļ‚— Solid modelling ļ‚— Types of surface representations ļ‚— Wireframe ļ‚— Sweep ļ‚— Spatial Partitioning ļ‚— Boundary ļ‚— Octree ļ‚— Comparison amongst all of the above ļ‚— User interfaces for solid modelling ļ‚— 3D objects and related concepts ļ‚— Projection ļ‚— Types of projection ļ‚— Parallel ļ‚— Orthographic ļ‚— Oblique ļ‚— Perspective ļ‚— 3D clipping ļ‚— Cohen Sutherland ļ‚— Hidden surface removal ļ‚— Depth buffer / z-buffer algo ļ‚— Depth sorting algo
  • 4.
    TRINITY INSTITUTE OFPROFESSIONAL STUDIES Sector – 9, Dwarka Institutional Area, New Delhi-75 Course Books TEXT BOOKS: ļ‚— Foley,Van Dam, Feiner, Hughes, Computer Graphics Principles & Practice, 2000, Pearson ļ‚— Chennakesava R.Alavla ā€œComputer Graphicsā€, PHI Learning Pvt. Limited REFERENCES BOOKS: ļ‚— D. Hearn & Baker: Computer Graphics with OpenGL, Pearson Education,Third Edition,2009. ļ‚— Foley, J.D. &Van Dam,A: Fundamentals of Interactive Computer Graphics. ļ‚— Rogers &Adams,ā€œMathematical Elements for Computer Graphicsā€, McGraw Hill, 1989.
  • 5.
    TRINITY INSTITUTE OFPROFESSIONAL STUDIES Sector – 9, Dwarka Institutional Area, New Delhi-75 How to Attempt a Question? ļ‚— Introduction ļ‚— Definition ļ‚— Point-wise description ļ‚— Examples, if any ļ‚— Conclusion
  • 6.
    TRINITY INSTITUTE OFPROFESSIONAL STUDIES Sector – 9, Dwarka Institutional Area, New Delhi-75 Marking Scheme ļ‚— Internal ļ‚—25 marks (10 marks I minor +10 marks II minor + 5 marks internal assessment) ļ‚— External ļ‚—75 marks (Major semester exam)
  • 7.
    TRINITY INSTITUTE OFPROFESSIONAL STUDIES Sector – 9, Dwarka Institutional Area, New Delhi-75 Affiliated to Institution of G.G.S.IP.U, Delhi Lets begin with…
  • 8.
    TRINITY INSTITUTE OFPROFESSIONAL STUDIES Sector – 9, Dwarka Institutional Area, New Delhi-75 Applications of Computer Graphics around us
  • 9.
    TRINITY INSTITUTE OFPROFESSIONAL STUDIES Sector – 9, Dwarka Institutional Area, New Delhi-75 Yes, that’s right… ļ‚— Gaming ļ‚— Animation Movies ļ‚— 3D object simulation for engineering, manufacturing etc ļ‚— Virtual Reality Simulation for pilot training, surgical practice etc ļ‚— ComputerAided Design ļ‚— And many more…
  • 10.
    TRINITY INSTITUTE OFPROFESSIONAL STUDIES Sector – 9, Dwarka Institutional Area, New Delhi-75 Computer Graphics Types Of Computer Graphics ļ‚— Raster Graphics Primitive drawing using coordinate positions for each pixel ļ‚— Vector graphics Primitive drawing using pre-defined mathematical functions Main focus of the course is Raster Graphics
  • 11.
    TRINITY INSTITUTE OFPROFESSIONAL STUDIES Sector – 9, Dwarka Institutional Area, New Delhi-75 Raster Graphics Definition : Raster graphics, also called bitmap graphics, are digital images that are composed of tiny rectangular pixels that are arranged in a grid (or raster) of x and y coordinates in such a way that it forms an image.
  • 12.
    TRINITY INSTITUTE OFPROFESSIONAL STUDIES Sector – 9, Dwarka Institutional Area, New Delhi-75 Drawing a Line on the Computer Screen
  • 13.
    TRINITY INSTITUTE OFPROFESSIONAL STUDIES Sector – 9, Dwarka Institutional Area, New Delhi-75 Solution ļ‚— Three approaches for solution are : ļ‚— Equation of line , y = mx + c ļ‚— DDA algorithm, step increments in x / y ļ‚— Bresenham’ s algorithm, using a decision variable to find the right pixel
  • 14.
    TRINITY INSTITUTE OFPROFESSIONAL STUDIES Sector – 9, Dwarka Institutional Area, New Delhi-75 Equation of line y= mx + c, where m = (y2 – y1) / x2 – x1) Through an example we can see that ,it is ļ‚— Quite expensive ļ‚— Involves floating point multiplication for each and every pixel ļ‚— Requires large amount of memory space and processing time.
  • 15.
    TRINITY INSTITUTE OFPROFESSIONAL STUDIES Sector – 9, Dwarka Institutional Area, New Delhi-75 Scan Conversion Algorithms Raster scan or scan conversion of a line involves finding the right pixels to plot on the computer screen. Following algorithms are used to achieve the solution ļ‚— Digital DifferentialAnalyzer Algorithm ļ‚— Bresenham’sAlgorithm
  • 16.
    TRINITY INSTITUTE OFPROFESSIONAL STUDIES Sector – 9, Dwarka Institutional Area, New Delhi-75 DDA Algorithm
  • 17.
    TRINITY INSTITUTE OFPROFESSIONAL STUDIES Sector – 9, Dwarka Institutional Area, New Delhi-75 DDA Pseudocode m = (y2-y1)/(x2-x1) dx = x2 – x1 dy = y2 – y1 Putpixel (x1, y1) X = x1 Y = y1 If (dx > dy) steps = dx Else steps = dy While(x <= x2 || y <= y2) xinc = x + dx/steps yinc = y + dy/steps putpixel (x,y)
  • 18.
    TRINITY INSTITUTE OFPROFESSIONAL STUDIES Sector – 9, Dwarka Institutional Area, New Delhi-75 Analysis of DDA Algorithm ļ‚— Advantages ļ‚— Simple to understand ļ‚— Easy to implement ļ‚— Disadvantages ļ‚— Expensive computation ļ‚— Floating point division and addition (i.e. slope m can be in decimal )
  • 19.
    TRINITY INSTITUTE OFPROFESSIONAL STUDIES Sector – 9, Dwarka Institutional Area, New Delhi-75 Analysis of DDA Algorithm ļ‚— Advantages ļ‚— Simple to understand ļ‚— Easy to implement ļ‚— Disadvantages ļ‚— Expensive computation ļ‚— Floating point division and addition (i.e. slope m can be in decimal )
  • 20.
    TRINITY INSTITUTE OFPROFESSIONAL STUDIES Sector – 9, Dwarka Institutional Area, New Delhi-75 Bresenham’s Line Drawing Algorithm
  • 21.
    TRINITY INSTITUTE OFPROFESSIONAL STUDIES Sector – 9, Dwarka Institutional Area, New Delhi-75 Bresenham’s Pseudocode (for slope |m| <1) Dy = y2 – y1 Dx = x2 – x1 X = x1 Y=y1 Putpixel (x1, y1) P = 2dy – dx // decision variable While (x <= x2 || y <= y2) x = x + 1 if (p< 0) p = p + 2dy // plot east pixel else p = p + 2dy – 2dx y = y +1 // plot north east pixel Putpixel (x,y)
  • 22.
    TRINITY INSTITUTE OFPROFESSIONAL STUDIES Sector – 9, Dwarka Institutional Area, New Delhi-75 Analysis of Bresenham’s Algo ļ‚— Advantages ļ‚— Only integer computation ļ‚— Disadvantages ļ‚— Lacks precision ļ‚— Aliasing / staircasing
  • 23.
    TRINITY INSTITUTE OFPROFESSIONAL STUDIES Sector – 9, Dwarka Institutional Area, New Delhi-75 Antialiasing ļ‚— Removing the jaggies or staircase effect caused due to under- sampling of information due to rounding off coordinate values to pixel positions, is called anti-aliasing. ļ‚— This can be achieved thorough super-sampling, area sampling, higher resolution display systems and special hardware configurations.
  • 24.
    TRINITY INSTITUTE OFPROFESSIONAL STUDIES Sector – 9, Dwarka Institutional Area, New Delhi-75 Clipping ļ‚— Identifying portions of a picture that are inside or outside a specified region of space is referred as clipping. ļ‚— Algorithms used for line clipping are: ļ‚— Cohen-Sutherland clipping ļ‚— Cyrus Beck clipping ļ‚— Midpoint subdivision algorithm
  • 25.
    TRINITY INSTITUTE OFPROFESSIONAL STUDIES Sector – 9, Dwarka Institutional Area, New Delhi-75 2D Transformations ļ‚— Translation – change of co-ordinate position along a straight line ļ‚— Rotation – repositioning along a circular path w.r.t. origin or a specific point ļ‚— Scaling – change in size of an object ļ‚— Shearing – distorts shape of an object along an axis ļ‚— Reflection – mirror image of an object
  • 26.
    TRINITY INSTITUTE OFPROFESSIONAL STUDIES Sector – 9, Dwarka Institutional Area, New Delhi-75 2D Transformations ļ‚— Translation – change of co-ordinate position along a straight line ļ‚— Rotation – repositioning along a circular path w.r.t. origin or a specific point ļ‚— Scaling – change in size of an object ļ‚— Shearing – distorts shape of an object along an axis ļ‚— Reflection – mirror image of an object
  • 27.
    TRINITY INSTITUTE OFPROFESSIONAL STUDIES Sector – 9, Dwarka Institutional Area, New Delhi-75 Thank You