SlideShare a Scribd company logo
CHAPTER 4
GEOMETRY AND
LINE GENERATION
1. Introduction to Points and Lines Points
A point is a fundamental element in geometry, representing
a location in space.
In a 2D coordinate system, a point is defined by its
coordinates (x,y)(x,y).
Lines
 A line is a straight one-dimensional figure having no
thickness and extending infinitely in both directions.
 In computer graphics, a line is often represented by its
endpoints (x1,y1)(x1​
,y1​
) and (x2,y2)(x2​
,y2​
).
Line Drawing Algorithms
Digital Differential Analyzer (DDA): A simple
algorithm to draw lines by incrementing xx or yy by a
small step.
Bresenham’s Line Algorithm: An efficient
algorithm that uses integer arithmetic to draw
lines, avoiding floating-point calculations.
2. Bresenham’s Line Algorithm
Key Idea
 Bresenham’s algorithm determines the best pixel to plot
at each step to approximate a straight line between two
points.
 It uses decision parameters to choose between two
possible pixels at each step.
CHAPTER 4 &5 geoand trans.pptxGeometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics Geometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics
Advantages of Bresenham’s Algorithm:
 Works using only integer calculations (addition and
subtraction), making it faster than floating-point
operations.
 Avoids multiplication and division, ensuring efficiency.
 Produces a visually smooth and accurate line.
CHAPTER 4 &5 geoand trans.pptxGeometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics Geometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics
CHAPTER 4 &5 geoand trans.pptxGeometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics Geometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics
Generating Circles:
Concept:
 Circles are common geometric shapes that need to be
rendered in computer graphics.
 Efficient algorithms exist to generate circles on raster
displays.
Midpoint Circle Algorithm:
 Concept: An algorithm that uses the midpoint property of a
circle to determine the closest pixel to the true circle. It
leverages the eight-way symmetry of a circle.
 How it works: The algorithm calculates pixels for one octant
of the circle, and the other pixels are found by symmetry.
 Equation of a circle: (x - h)^2 + (y - k)^2 = r^2, where (h,
k) is the center and r is the radius.
Real-life application:
 GUI design: Drawing circular buttons, icons, and other UI
elements.
 Medical imaging: Generating circular regions of interest in
scans.
 Computer graphics: Creating circular shapes in various
applications.
4.2. Plotting General Curves
Concept:
 Beyond straight lines, many applications require the generation of
various curves.
 Curves can be represented mathematically in different ways.
 Parametric Curves:
 Concept:
 A curve where the x and y coordinates are defined as functions of a
parameter, usually denoted as 't'.
 Representation: x = f(t), y = g(t).
 Example:
 A spiral can be defined parametrically: x = t * cos(t), y = t * sin(t).
 Real-life application:
 Animation: Creating complex motion paths for characters and objects.
 CAD: Designing smooth and intricate curves for product design.
 Robotics: Defining the path of a robot arm.
Bézier Curves:
Concept:
 Curves defined by a set of control points. The curve passes
through the first and last control points, but not necessarily the
intermediate ones.
 The control points influence the shape of the curve.
Example:
 A quadratic Bézier curve is defined by three control points.
 A cubic Bézier curve is defined by four control points.
Real-life application:
 Font design: Designing smooth and scalable font characters.
 Vector graphics: Used in programs like Adobe Illustrator to
create and manipulate curves.
 3D modeling: Creating smooth surfaces for objects.
CHAPTER 4 &5 geoand trans.pptxGeometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics Geometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics
Spline Curves:
Concept:
 Piecewise polynomial curves that provide flexibility and
smoothness.
 B-splines are a type of spline that offers local control, meaning
changing one control point only affects a portion of the curve.
Example:
 A B-spline can be used to model the smooth surface of a car body.
Real-life application:
 CAD: Surface modeling and design.
 Computer animation: Creating smooth and natural-looking
movements.
 Industrial design: Designing products with complex curved
surfaces.
CHAPTER 4 &5 geoand trans.pptxGeometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics Geometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics
4.3. Line Thickness
Concept:
 The ability to vary the thickness of a line.
 Thicker lines can be used to emphasize certain features or improve
visibility.
Example:
 Drawing a thick line to represent a major highway on a map, and a thin
line to represent a minor road.
Real-life application:
 Technical drawings: Conveying different levels of importance or
different materials.
 Mapping: Distinguishing between different types of roads or boundaries.
 User interface design: Creating visually distinct borders for elements.
Techniques:
 Drawing multiple parallel lines.
 Using a thicker pixel mask or brush.
 Approximating with a filled rectangle.
4.4. Line Style
Concept:
 The appearance of a line can be modified by using different styles, such
as dashed, dotted, or a combination of dashes and dots.
 Different line styles can convey different meanings or improve visual
clarity.
Example:
 Using a dashed line to represent a hidden object or a boundary that is
not physically present.
Real-life application:
 Technical drawings: Representing hidden lines, center lines, or
phantom lines.
 Map design: Differentiating between different types of boundaries or
features.
 Computer networks: Showing different types of network connections.
Techniques:
 Using a repeating pattern (mask) of pixels to create the desired style.
4.5. Polygons
Concept:
 A polygon is a closed shape formed by a sequence of connected line
segments.
 Polygons are fundamental building blocks for representing 2D shapes.
Representation:
 Vertex list: A list of the coordinates of the polygon's vertices, in order.
 Example:
 A triangle, a rectangle, and a hexagon are all examples of polygons.
 Real-life application:
 2D graphics: Representing shapes in games, illustrations, and user
interfaces.
 CAD: Modeling the shapes of objects and parts.
 GIS: Representing areas such as buildings, parks, and administrative
regions on maps.
 Polygon types:
 Convex: All interior angles are less than 180 degrees.
 Concave: At least one interior angle is greater than 180 degrees.
 Simple: Edges do not intersect each other.
 Complex: Edges intersect each other.
4.6. Filling
 Concept:
 The process of coloring the interior of a polygon or a bounded region.
 Filling is essential for rendering solid shapes and creating visually complete
images.
 Scan-Line Algorithm:
 Concept: Fills a polygon by processing it one horizontal line (scan line) at
a time.
 How it works: The algorithm determines which pixels on each scan line
are inside the polygon and fills them with the desired color or pattern.
 Example: Filling a square or a circle on a computer screen.
Real-life application:
 Rendering filled shapes in 2D graphics.
 Image editing software.
 Drawing applications.
 Example: Filling an irregularly shaped area in an image with a solid color.
Real-life application:
 Image editing (e.g., the "paint bucket" tool).
 Interactive graphics applications.
 Game development.
CHAPTER 4 &5 geoand trans.pptxGeometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics Geometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics
Boundary-Fill Algorithm:
Concept: Fills a region that is enclosed by a
boundary of a specific color.
How it works: Starts from a point inside the
region and fills until it hits a pixel of the
boundary color.
Example: Filling the inside of a drawn circle,
where the circle outline is black.
Real-life application:
Image editing.
Graphics software.
4.7. Text and Characters
 Concept:
 The representation and display of text in computer graphics.
 Text is essential for providing information, labels, and user interfaces.
 Character representation:
 Bitmap fonts: Characters are stored as pixel patterns (arrays of bits).
 Vector fonts: Characters are defined by mathematical outlines (curves
and lines).
 Example:
 Displaying a sentence on a screen using a specific font and size.
 Real-life application:
 User interfaces: Displaying menus, buttons, and labels.
 Word processing: Rendering text in documents.
 Web browsers: Displaying text on web pages.
 Video games: Showing dialogue, scores, and other information.
Bitmapfo
nt
Vector
font
 Text rendering techniques:
 Rasterization: Converting vector font outlines into pixel
patterns for display on a raster device.
 Anti-aliasing: Techniques for smoothing the jagged edges
of text characters to improve readability.
 Text attributes:
 Font: The typeface or style of the text (e.g., Arial, Times
New Roman).
 Size: The height of the characters.
 Style: Variations such as bold, italic, and underline.
 Color: The color of the text.
 Alignment: How the text is positioned within a given area
(e.g., left-aligned, centered).
End Of Chapter 4
CHAPTER 4 &5 geoand trans.pptxGeometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics Geometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics
output
 Explanation:
 display():
 This function contains the drawing commands.
 glClear(GL_COLOR_BUFFER_BIT) clears the screen.
 glColor3f() sets the drawing color.
 glBegin() and glEnd() define the shapes to be drawn.
 glVertex2f() defines the coordinates of the vertices.
 The house is drawn using GL_QUADS for the body, door, and window, and
GL_TRIANGLES for the roof.
 reshape():
 This function handles window resizing and sets up the orthographic projection.
 main():
 This function initializes GLUT, creates the window, sets the background color,
and starts the main loop.
 Key Improvements:
QUIZ (10%)
1. Exact output 6%
2. Modification 8-10pt(it
dependence)
CHAPTER 4 &5 geoand trans.pptxGeometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics Geometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics
CHAPTER 4 &5 geoand trans.pptxGeometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics Geometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics
CHAPTER 4 &5 geoand trans.pptxGeometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics Geometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics
CHAPTER 4 &5 geoand trans.pptxGeometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics Geometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics
CHAPTER 4 &5 geoand trans.pptxGeometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics Geometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics
CHAPTER 4 &5 geoand trans.pptxGeometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics Geometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics
CHAPTER 5
GEOMETRICAL TRANSFORMATIONS
Introduction:
3D geometrical transformations are
fundamental operations that manipulate the
position, orientation, and size of 3D objects
in a virtual space. They are essential in
computer graphics, animation, robotics,
virtual reality, and many other fields.
5.1 3D Transformation
3D transformations manipulate objects in three-dimensional
space (x, y, z).
Common 3D transformations include:
 Translation: Moving an object in 3D space.
 Scaling: Changing an object's size along x, y, or z-axis.
 Rotation: Rotating an object around an axis.
 Reflection: Mirroring an object over a plane.
 Shearing: Skewing an object along an axis.
CHAPTER 4 &5 geoand trans.pptxGeometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics Geometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics
Translation:
A translation transform simply moves every point by a certain
amount horizontally and a certain amount vertically. If (x,y, z ) is
the original point and (x1,y1 z1) is the transformed point, then the
formula for a translation is
Real-life application: Robot arm movement, moving
a point cloud in 3D scanning.
Rotation:
Rotating an object around a specified axis (x, y, or z).
Example: Rotating a satellite to point its antenna.
Real-life application: Flight simulator controls, rotating
surgical instruments in virtual surgery
Scaling:
Changing the size of an object along the x, y, and z axes.
Example: Resizing a 3D model of a building.
Real life application: 3D printing of objects at varying sizes,
adjusting the size of a virtual object in a game.
Shearing:
Distorting the shape of an object by shifting its
coordinates along one axis relative to another.
Example: Creating a slanted appearance for a building.
Real life application: Used in image processing to correct
distortions, creating special effects in animation.
Reflection:
Mirroring an object across a plane.
Example: Creating a reflection of a
building in water.
Real life application: Simulating reflections
in virtual environments, creating
symmetrical designs in CAD.
CHAPTER 4 &5 geoand trans.pptxGeometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics Geometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics
OpenGl code that demonstrate
rotation, translation, scaling, reflection
and shearing using codeblock
CHAPTER 4 &5 geoand trans.pptxGeometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics Geometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics
CHAPTER 4 &5 geoand trans.pptxGeometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics Geometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics
CHAPTER 4 &5 geoand trans.pptxGeometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics Geometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics
Output
CHAPTER 4 &5 geoand trans.pptxGeometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics Geometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics
CHAPTER 4 &5 geoand trans.pptxGeometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics Geometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics
CHAPTER 4 &5 geoand trans.pptxGeometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics Geometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics
CHAPTER 4 &5 geoand trans.pptxGeometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics Geometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics
CHAPTER 4 &5 geoand trans.pptxGeometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics Geometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics
CHAPTER 4 &5 geoand trans.pptxGeometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics Geometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics

More Related Content

PDF
PPT
Introduction to Computer Graphics elements
PPT
Unit I-cg.ppt Introduction to Computer Graphics elements
PPT
Introduction to Computer Graphics computer
PDF
ED4153_COMPUTER_APPLICATION_IN_DESIGN_Unit_1_5.pdf
PDF
Cg lab cse-v (1) (1)
DOCX
Computer Graphics Practical
PDF
Fundamentals of Multimedia - Vector Graphics.pdf
Introduction to Computer Graphics elements
Unit I-cg.ppt Introduction to Computer Graphics elements
Introduction to Computer Graphics computer
ED4153_COMPUTER_APPLICATION_IN_DESIGN_Unit_1_5.pdf
Cg lab cse-v (1) (1)
Computer Graphics Practical
Fundamentals of Multimedia - Vector Graphics.pdf

Similar to CHAPTER 4 &5 geoand trans.pptxGeometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics Geometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics (20)

PPTX
CG-Lecture3.pptx
PPTX
Computer Graphics Unit 1
PPTX
computer graphics-C/C++-dancingdollcode
DOCX
Computer graphics
DOCX
Computer graphics
PPTX
B. SC CSIT Computer Graphics Lab By Tekendra Nath Yogi
PPTX
UNIT-1.pptx
PDF
Computer graphics 9068
PPTX
Computer Graphics
PDF
Computer Graphics C Version - Hearn & Baker.pdf
PDF
Computer Graphics in Mechanical engineering
DOCX
Coding io1-materials for students-group3
PPTX
line drawing algorithms COMPUTER GRAPHICS & Graphical Programming
PPTX
CSE-501-introduction.how.to calim.bio.pptx
DOCX
Unit 2 notes
PPT
1536 graphics & graphical programming
PPTX
Computer Graphics Unit 1 for BCA IV SEM.pptx
PPTX
Unit 1 computer graphicss introduction .pptx
PDF
Computer Graphics Notes 2.pdf
PPT
CS 354 Interaction
CG-Lecture3.pptx
Computer Graphics Unit 1
computer graphics-C/C++-dancingdollcode
Computer graphics
Computer graphics
B. SC CSIT Computer Graphics Lab By Tekendra Nath Yogi
UNIT-1.pptx
Computer graphics 9068
Computer Graphics
Computer Graphics C Version - Hearn & Baker.pdf
Computer Graphics in Mechanical engineering
Coding io1-materials for students-group3
line drawing algorithms COMPUTER GRAPHICS & Graphical Programming
CSE-501-introduction.how.to calim.bio.pptx
Unit 2 notes
1536 graphics & graphical programming
Computer Graphics Unit 1 for BCA IV SEM.pptx
Unit 1 computer graphicss introduction .pptx
Computer Graphics Notes 2.pdf
CS 354 Interaction
Ad

Recently uploaded (20)

PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
cuic standard and advanced reporting.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Spectroscopy.pptx food analysis technology
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Empathic Computing: Creating Shared Understanding
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Reach Out and Touch Someone: Haptics and Empathic Computing
Diabetes mellitus diagnosis method based random forest with bat algorithm
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Machine learning based COVID-19 study performance prediction
cuic standard and advanced reporting.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
The AUB Centre for AI in Media Proposal.docx
Spectroscopy.pptx food analysis technology
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
The Rise and Fall of 3GPP – Time for a Sabbatical?
20250228 LYD VKU AI Blended-Learning.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Empathic Computing: Creating Shared Understanding
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Spectral efficient network and resource selection model in 5G networks
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Ad

CHAPTER 4 &5 geoand trans.pptxGeometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics Geometry chapter 4 and 5 transformation ,translation ,animation,openGl graphics

  • 2. 1. Introduction to Points and Lines Points A point is a fundamental element in geometry, representing a location in space. In a 2D coordinate system, a point is defined by its coordinates (x,y)(x,y). Lines  A line is a straight one-dimensional figure having no thickness and extending infinitely in both directions.  In computer graphics, a line is often represented by its endpoints (x1,y1)(x1​ ,y1​ ) and (x2,y2)(x2​ ,y2​ ).
  • 3. Line Drawing Algorithms Digital Differential Analyzer (DDA): A simple algorithm to draw lines by incrementing xx or yy by a small step. Bresenham’s Line Algorithm: An efficient algorithm that uses integer arithmetic to draw lines, avoiding floating-point calculations.
  • 4. 2. Bresenham’s Line Algorithm Key Idea  Bresenham’s algorithm determines the best pixel to plot at each step to approximate a straight line between two points.  It uses decision parameters to choose between two possible pixels at each step.
  • 6. Advantages of Bresenham’s Algorithm:  Works using only integer calculations (addition and subtraction), making it faster than floating-point operations.  Avoids multiplication and division, ensuring efficiency.  Produces a visually smooth and accurate line.
  • 9. Generating Circles: Concept:  Circles are common geometric shapes that need to be rendered in computer graphics.  Efficient algorithms exist to generate circles on raster displays. Midpoint Circle Algorithm:  Concept: An algorithm that uses the midpoint property of a circle to determine the closest pixel to the true circle. It leverages the eight-way symmetry of a circle.  How it works: The algorithm calculates pixels for one octant of the circle, and the other pixels are found by symmetry.  Equation of a circle: (x - h)^2 + (y - k)^2 = r^2, where (h, k) is the center and r is the radius.
  • 10. Real-life application:  GUI design: Drawing circular buttons, icons, and other UI elements.  Medical imaging: Generating circular regions of interest in scans.  Computer graphics: Creating circular shapes in various applications.
  • 11. 4.2. Plotting General Curves Concept:  Beyond straight lines, many applications require the generation of various curves.  Curves can be represented mathematically in different ways.  Parametric Curves:  Concept:  A curve where the x and y coordinates are defined as functions of a parameter, usually denoted as 't'.  Representation: x = f(t), y = g(t).  Example:  A spiral can be defined parametrically: x = t * cos(t), y = t * sin(t).  Real-life application:  Animation: Creating complex motion paths for characters and objects.  CAD: Designing smooth and intricate curves for product design.  Robotics: Defining the path of a robot arm.
  • 12. Bézier Curves: Concept:  Curves defined by a set of control points. The curve passes through the first and last control points, but not necessarily the intermediate ones.  The control points influence the shape of the curve. Example:  A quadratic Bézier curve is defined by three control points.  A cubic Bézier curve is defined by four control points. Real-life application:  Font design: Designing smooth and scalable font characters.  Vector graphics: Used in programs like Adobe Illustrator to create and manipulate curves.  3D modeling: Creating smooth surfaces for objects.
  • 14. Spline Curves: Concept:  Piecewise polynomial curves that provide flexibility and smoothness.  B-splines are a type of spline that offers local control, meaning changing one control point only affects a portion of the curve. Example:  A B-spline can be used to model the smooth surface of a car body. Real-life application:  CAD: Surface modeling and design.  Computer animation: Creating smooth and natural-looking movements.  Industrial design: Designing products with complex curved surfaces.
  • 16. 4.3. Line Thickness Concept:  The ability to vary the thickness of a line.  Thicker lines can be used to emphasize certain features or improve visibility. Example:  Drawing a thick line to represent a major highway on a map, and a thin line to represent a minor road. Real-life application:  Technical drawings: Conveying different levels of importance or different materials.  Mapping: Distinguishing between different types of roads or boundaries.  User interface design: Creating visually distinct borders for elements. Techniques:  Drawing multiple parallel lines.  Using a thicker pixel mask or brush.  Approximating with a filled rectangle.
  • 17. 4.4. Line Style Concept:  The appearance of a line can be modified by using different styles, such as dashed, dotted, or a combination of dashes and dots.  Different line styles can convey different meanings or improve visual clarity. Example:  Using a dashed line to represent a hidden object or a boundary that is not physically present. Real-life application:  Technical drawings: Representing hidden lines, center lines, or phantom lines.  Map design: Differentiating between different types of boundaries or features.  Computer networks: Showing different types of network connections. Techniques:  Using a repeating pattern (mask) of pixels to create the desired style.
  • 18. 4.5. Polygons Concept:  A polygon is a closed shape formed by a sequence of connected line segments.  Polygons are fundamental building blocks for representing 2D shapes. Representation:  Vertex list: A list of the coordinates of the polygon's vertices, in order.  Example:  A triangle, a rectangle, and a hexagon are all examples of polygons.  Real-life application:  2D graphics: Representing shapes in games, illustrations, and user interfaces.  CAD: Modeling the shapes of objects and parts.  GIS: Representing areas such as buildings, parks, and administrative regions on maps.
  • 19.  Polygon types:  Convex: All interior angles are less than 180 degrees.  Concave: At least one interior angle is greater than 180 degrees.  Simple: Edges do not intersect each other.  Complex: Edges intersect each other.
  • 20. 4.6. Filling  Concept:  The process of coloring the interior of a polygon or a bounded region.  Filling is essential for rendering solid shapes and creating visually complete images.  Scan-Line Algorithm:  Concept: Fills a polygon by processing it one horizontal line (scan line) at a time.  How it works: The algorithm determines which pixels on each scan line are inside the polygon and fills them with the desired color or pattern.  Example: Filling a square or a circle on a computer screen. Real-life application:  Rendering filled shapes in 2D graphics.  Image editing software.  Drawing applications.  Example: Filling an irregularly shaped area in an image with a solid color. Real-life application:  Image editing (e.g., the "paint bucket" tool).  Interactive graphics applications.  Game development.
  • 22. Boundary-Fill Algorithm: Concept: Fills a region that is enclosed by a boundary of a specific color. How it works: Starts from a point inside the region and fills until it hits a pixel of the boundary color. Example: Filling the inside of a drawn circle, where the circle outline is black. Real-life application: Image editing. Graphics software.
  • 23. 4.7. Text and Characters  Concept:  The representation and display of text in computer graphics.  Text is essential for providing information, labels, and user interfaces.  Character representation:  Bitmap fonts: Characters are stored as pixel patterns (arrays of bits).  Vector fonts: Characters are defined by mathematical outlines (curves and lines).  Example:  Displaying a sentence on a screen using a specific font and size.  Real-life application:  User interfaces: Displaying menus, buttons, and labels.  Word processing: Rendering text in documents.  Web browsers: Displaying text on web pages.  Video games: Showing dialogue, scores, and other information.
  • 25.  Text rendering techniques:  Rasterization: Converting vector font outlines into pixel patterns for display on a raster device.  Anti-aliasing: Techniques for smoothing the jagged edges of text characters to improve readability.  Text attributes:  Font: The typeface or style of the text (e.g., Arial, Times New Roman).  Size: The height of the characters.  Style: Variations such as bold, italic, and underline.  Color: The color of the text.  Alignment: How the text is positioned within a given area (e.g., left-aligned, centered).
  • 28. output  Explanation:  display():  This function contains the drawing commands.  glClear(GL_COLOR_BUFFER_BIT) clears the screen.  glColor3f() sets the drawing color.  glBegin() and glEnd() define the shapes to be drawn.  glVertex2f() defines the coordinates of the vertices.  The house is drawn using GL_QUADS for the body, door, and window, and GL_TRIANGLES for the roof.  reshape():  This function handles window resizing and sets up the orthographic projection.  main():  This function initializes GLUT, creates the window, sets the background color, and starts the main loop.  Key Improvements: QUIZ (10%) 1. Exact output 6% 2. Modification 8-10pt(it dependence)
  • 35. CHAPTER 5 GEOMETRICAL TRANSFORMATIONS Introduction: 3D geometrical transformations are fundamental operations that manipulate the position, orientation, and size of 3D objects in a virtual space. They are essential in computer graphics, animation, robotics, virtual reality, and many other fields.
  • 36. 5.1 3D Transformation 3D transformations manipulate objects in three-dimensional space (x, y, z). Common 3D transformations include:  Translation: Moving an object in 3D space.  Scaling: Changing an object's size along x, y, or z-axis.  Rotation: Rotating an object around an axis.  Reflection: Mirroring an object over a plane.  Shearing: Skewing an object along an axis.
  • 38. Translation: A translation transform simply moves every point by a certain amount horizontally and a certain amount vertically. If (x,y, z ) is the original point and (x1,y1 z1) is the transformed point, then the formula for a translation is Real-life application: Robot arm movement, moving a point cloud in 3D scanning.
  • 39. Rotation: Rotating an object around a specified axis (x, y, or z). Example: Rotating a satellite to point its antenna. Real-life application: Flight simulator controls, rotating surgical instruments in virtual surgery
  • 40. Scaling: Changing the size of an object along the x, y, and z axes. Example: Resizing a 3D model of a building. Real life application: 3D printing of objects at varying sizes, adjusting the size of a virtual object in a game.
  • 41. Shearing: Distorting the shape of an object by shifting its coordinates along one axis relative to another. Example: Creating a slanted appearance for a building. Real life application: Used in image processing to correct distortions, creating special effects in animation.
  • 42. Reflection: Mirroring an object across a plane. Example: Creating a reflection of a building in water. Real life application: Simulating reflections in virtual environments, creating symmetrical designs in CAD.
  • 44. OpenGl code that demonstrate rotation, translation, scaling, reflection and shearing using codeblock