0% found this document useful (0 votes)
350 views32 pages

THEORY FILE - Computer Graphics (5th Sem) .

Uploaded by

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

THEORY FILE - Computer Graphics (5th Sem) .

Uploaded by

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

THEORY FILE : Computer Graphics .

(FULL NOTES: BY SAHIL RAUNIYAR / PTU-CODER) .

SUBJECT CODE: UGCA: 1934

BACHELOR OF COMPUTER APPLICATIONS

MAINTAINED BY: TEACHER’S /MAM’:

IL
Sahil Kumar Prof.

COLLEGE ROLL NO: 226617

UNIVERSITY ROLL NO: 2200315


H
SA

DEPARTMENT OF COMPUTER SCIENCE ENGINEERING

BABA BANDA SINGH BAHADUR ENGINEERING

COLLEGE FATEGARH SAHIB


➖➖
1

Program BCA

Course Name ➖
Semester 5th.
Computer Graphics (Theory).

UNIT ➖01
● Introduction to Computer Graphics ➖
# Applications of Computer Graphics. Graphs and Types of Graphs ➖
# Introduction to Computer Graphics ➖

IL
Computer Graphics involves the creation, manipulation, and representation of visual images
using computers. This field encompasses both the hardware and software necessary to create
visual content.

# Applications of Computer Graphics

1. Entertainment ➖
I. Movies and Animation: Creating visual effects, animated films, and CGI
H
(Computer-Generated Imagery).
II. Video Games: Developing 2D and 3D graphics for interactive gameplay.

2. Design and Visualization ➖


I. CAD (Computer-Aided Design): Used in engineering, architecture, and product design to
create precise drawings and models.
II. Medical Imaging: Visualising complex structures within the human body, such as MRI and
SA
CT scans.

3.Education and Training ➖


I. Simulations: Training pilots, doctors, and other professionals through realistic simulations.
II. Educational Software: Creating interactive educational content.

4. Scientific Research ➖
I. Data Visualization: Representing scientific data graphically to identify patterns and insights.
II. Modelling and Simulation: Simulating physical processes and phenomena.

5. Business and Advertising ➖


I. Presentation Graphics: Creating slides and visual aids for presentations.
II. Marketing: Developing visual content for advertisements and promotional materials.

6. Virtual Reality (VR) and Augmented Reality (AR) ➖


I. VR: Creating immersive 3D environments for gaming, training, and simulations.
II. AR: Overlaying digital content onto the real world through devices like smartphones and
AR glasses.

2
# Graphs and Types of Graphs

Definition ➖
A graph is a diagrammatic representation of data, where data is displayed using points, lines,
bars, or other shapes to illustrate relationships, trends, or distributions.

Types of Graphs ➖
1. Line Graphs ➖
I. Description: Uses lines to connect data points, showing trends over time.
II. Use Case: Ideal for displaying data that changes continuously, like stock prices or
temperature changes.

IL
2. Bar Graphs
I. Description: Uses rectangular bars to represent data values. Bars can be vertical or
horizontal.
II. Use Case: Suitable for comparing discrete categories or groups, like sales figures for
different products.

3. Pie Charts ➖
of the whole.
H
I. Description: Circular chart divided into sectors, where each sector represents a proportion

II. Use Case: Useful for showing the relative proportions of different categories within a
whole.

4. Scatter Plots ➖
I. Description: Uses dots to represent data points on a two-dimensional plane, showing the
SA
relationship between two variables.
II. Use Case: Ideal for identifying correlations or patterns between variables.

5. Histograms ➖
I. Description: Similar to bar graphs, but used to represent the frequency distribution of
continuous data.
II. Use Case: Commonly used in statistics to show the distribution of data points across
different ranges.

6. Area Graphs ➖
I. Description: Similar to line graphs, but the area under the line is filled in.
II. Use Case: Useful for showing cumulative totals over time, such as revenue growth.

7. Box Plots (Box-and-Whisker Plots) ➖


I. Description: Displays the distribution of a dataset based on a five-number summary
(minimum, first quartile, median, third quartile, maximum).
II. Use Case: Used for identifying the spread and skewness of the data, as well as outliers.
3
Understanding these types of graphs and their applications in computer graphics can help
effectively visualise and interpret data across various fields.


● Input Devices: Light Pens, Graphic Tablets, Joysticks, Track Ball, Data Glove,
Digitizers, Image Scanner

# Input Devices in Computer Graphics ➖


# Light Pen ➖
I. Description: A pointing device that allows users to interact with the computer screen
directly.

II. Function: Detects light from the screen when the pen touches it, sending signals to the

IL
computer to move the cursor or select objects.

III. Uses: Used in CAD applications, graphic design, and interactive kiosks.

# Graphic Tablet :-
I. Description: A flat surface on which the user can draw or write with a stylus, translating the
movements into digital data.

II.

III.
H
Function: Captures hand-drawn images, signatures, and handwritten text.

Uses: Widely used by artists, designers, and architects for precise drawing and sketching.

# Joystick ➖
I. Description: A stick that pivots on a base and reports its angle or direction to the device it is
SA
controlling.

II. Function: Allows users to control the movement of an object on the screen by tilting the
stick in various directions.

III. Uses: Common in gaming, simulations, and controlling robotic devices.

# Trackball ➖
I. Description: A pointing device consisting of a ball held in a socket that can be rotated to
move the cursor on the screen.
II. Function: The user rolls the ball with their fingers or palm to navigate.
III. Uses: Used in CAD applications, video editing, and for users with limited desk space.

# Data Glove ➖
I. Description: A glove fitted with sensors that detect the movement and position of the hand
and fingers.
II. Function: Translates hand movements into digital signals for computer interaction.
III. Uses: Used in virtual reality, robotics, and for gesture-based control in various applications.

4
# Digitizer
I. Description: Converts analog information into a digital format.
II. Function: Used to capture the coordinates of points on a physical object, translating them
into digital data.
III. Uses: Common in CAD, mapping, and digital archiving of drawings and blueprints.

# Image Scanner ➖
I. Description: A device that captures images from photographic prints, posters, magazine
pages, and similar sources for computer editing and display.
II. Function: Converts physical documents and images into digital format.
III. Uses: Used in digitising documents, archiving photographs, and in graphic design for
image editing and manipulation.

IL
Understanding these input devices helps in choosing the appropriate tools for specific tasks in
computer graphics and related fields.

● Video Display Devices: Refresh Cathode Ray Tube, Raster Scan displays, Random
Scan displays, Color CRT - monitors and Color generating techniques (Shadow


Mask, Beam Penetration), Flat-Panel Displays; 3-D Viewing Devices, Graphics
H
monitors and workstations, Colour Models (RGB and CMY), Lookup Table

● Video Display Devices ➖


# Refresh Cathode Ray Tube (CRT) ➖
I. Description: A type of display device where an electron beam scans the screen in a
sequence to refresh the image.
SA
II. Function: The electron beam moves back and forth across the screen, illuminating
phosphor dots to create images.
III. Uses: Used in older computer monitors and television sets.

# Raster Scan Displays ➖


I. Description: Display device that scans the screen line by line from top to bottom.
II. Function: The electron beam moves horizontally across each line and then down to the
next line, refreshing the entire screen in a fixed pattern.
III. Uses: Commonly used in CRT monitors and modern display screens.

# Random Scan Displays ➖


I. Description: Also known as vector displays, these devices draw images by directing the
electron beam to draw directly on the screen.
II. Function: The beam moves to draw the outlines of images, refreshing only the lines that
form the image.
III. Uses: Used in applications requiring precise line drawings, such as oscilloscopes and older
graphics terminals.

5
● Color CRT Monitors and Color Generating Techniques

# Shadow Mask ➖
I. Description: A method used in colour CRT monitors where a metal sheet with tiny holes
aligns the electron beams with the correct phosphor dots.
II. Function: Three electron guns (red, green, blue) aim through the shadow mask to create
colour images by illuminating the correct phosphor dots.
III. Uses: Common in traditional colour CRT monitors.

# Beam Penetration ➖
I. Description: Technique used in older colour CRTs where the depth of electron beam
penetration into the phosphor coating determines the colour.

IL
II. Function: Different energy levels of the electron beam excite different phosphor layers to
produce various colours.

III. Uses: Used in some early colour display systems.

# Flat-Panel Displays ➖
I. Description: Modern display devices that use various technologies to produce images
H
without the bulk of CRTs.
II. Types: Includes LCD (Liquid Crystal Display), LED (Light Emitting Diode), OLED (Organic
LED), and plasma screens.
III. Uses: Widely used in computers, televisions, smartphones, and other digital devices.

# 3-D Viewing Devices ➖


I. Description: Devices that provide a stereoscopic view to create a three-dimensional effect.
SA
II. Types: Include anaglyph glasses, polarised glasses, and VR headsets.
III. Uses: Used in 3D movies, virtual reality applications, and advanced graphical simulations.

# Graphics Monitors and Workstations ➖


I. Description: High-resolution displays and powerful computers designed for
graphic-intensive tasks.
II. Uses: Used by professionals in fields like graphic design, video editing, CAD, and scientific
visualisation.



# Colour Models
1. RGB (Red, Green, Blue)
I. Description: Additive colour model where colours are created by combining red, green, and
blue light.
II. Uses: Used in digital displays, cameras, and scanners.

2. CMY (Cyan, Magenta, Yellow) ➖


I. Description: Subtractive colour model used in colour printing.
II. Function: Colours are created by subtracting varying percentages of light absorbed by
cyan, magenta, and yellow inks.
6
III. Uses: Used in colour printing processes.

3. Lookup Table (LUT) ➖


I. Description: A table used to map input values to desired output values, enhancing colour
and image processing.

II. Function: Allows for precise control over colour correction, gamma correction, and other
image adjustments.

III. Uses: Commonly used in graphics software, image processing, and digital displays for
colour management.

Understanding these video display devices and concepts is essential for anyone working with

IL
computer graphics, ensuring the selection of appropriate technology for various applications and
improving the quality of visual output.


● Introduction Virtual Reality & Environments: Applications in Engineering,
Architecture, Education, Medicine, Entertainment, Science, Training


H
# Introduction to Virtual Reality (VR) and Environments
Definition
Virtual Reality (VR) refers to a simulated experience that can be similar to or completely different
from the real world. It typically involves the use of VR headsets and other sensory equipment to
create an immersive environment.

# Components of VR Systems ➖
SA
I. Head-Mounted Displays (HMDs): Devices worn on the head that provide visual and
auditory immersion.
II. Motion Tracking: Sensors that track the movement of the user’s head and body to adjust
the virtual environment accordingly.
III. Haptic Feedback: Technology that simulates the sense of touch by applying forces,
vibrations, or motions to the user.
IV. Input Devices: Controllers, gloves, or other devices that allow users to interact with the
virtual environment.

# Applications of VR and Environments ➖


1. Engineering ➖
I. Virtual Prototyping: Creating and testing virtual models of products before physical
production, saving time and resources.
II. Simulation: Testing the performance of systems in virtual environments, such as stress
tests on bridges or aerodynamic testing in virtual wind tunnels.

7
2. Architecture
I. Virtual Tours: Allowing clients to explore virtual models of buildings before construction
begins.
II. Design Visualisation: Helping architects and designers visualise their concepts and make
adjustments in real-time.
III. Collaborative Design: Enabling multiple stakeholders to interact with and modify virtual
building models simultaneously.

3. Education ➖
I. Interactive Learning: Providing immersive learning experiences that enhance
understanding and retention of complex subjects.
II. Virtual Classrooms: Allowing remote students to participate in virtual lectures and group
activities.

IL
III. Historical Reenactments: Enabling students to experience historical events and locations in
a virtual setting.

4. Medicine➖
I. Surgical Training: Allowing medical professionals to practise surgical procedures in a
risk-free virtual environment.
II. Therapy and Rehabilitation: Using VR for physical therapy and mental health treatments,
H
such as exposure therapy for phobias.
III. Medical Visualisation: Helping doctors and students visualise and interact with complex
anatomical structures.

5.Entertainment ➖
I. Gaming: Creating immersive gaming experiences where players can interact with virtual
worlds.
SA
II. Virtual Theme Parks: Offering rides and experiences that are not possible in the physical
world.
III. Movies and Interactive Stories: Providing new forms of storytelling where viewers can
interact with the narrative.

6. Science➖
I. Scientific Visualisation: Allowing researchers to visualise complex data sets and
simulations in an immersive environment.
II. Virtual Laboratories: Enabling scientists to conduct experiments in a controlled virtual
setting.
III. Astronomical Exploration: Simulating space environments for educational and research
purposes.

7. Training ➖
I. Military Training: Simulating combat scenarios to train soldiers in a safe and controlled
environment.
II. Pilot Training: Using flight simulators to train pilots without the risks associated with real
flights.
8
III. Industrial Training: Teaching workers to operate machinery and handle hazardous
materials in a virtual environment.

By leveraging the power of VR, these applications enhance productivity, safety, and engagement
across various fields.

IL
H
SA
9

UNIT ➖ 02
● Scan-conversions ➖
# Process and need of Scan Conversion, Scan conversion algorithms for Line, Circle and
Ellipse using direct method, Bresenham's algorithms for line & circle and Midpoint Ellipse


Algorithm along with their derivations, Area Filling Techniques, Flood Fill Techniques,
Character Generation

IL
Scan-Conversions

# Process and Need of Scan Conversion ➖


Scan conversion is the process of converting geometric data (e.g., lines, circles, polygons) into a
raster format, which consists of pixels on the screen. This process is essential for rendering
vector graphics on raster devices like monitors and printers.

# Scan Conversion Algorithms ➖


H
1. Line Scan Conversion

Direct Method

I. Description: Calculates the slope of the line and uses it to determine the intermediate
pixel positions.
SA
II. Algorithm: For a line with endpoints (x0,y0)(x_0, y_0)(x0​,y0​) and (x1,y1)(x_1, y_1)(x1​,y1​):
slope=m=y1−y0x1−x0\text{slope} = m = \frac{y_1 - y_0}{x_1 - x_0}slope=m=x1​−x0​y1​−y0​​
y=y0+m(x−x0)y = y_0 + m(x - x_0)y=y0​+m(x−x0​)
III. Limitations: Can be inefficient and produce jagged lines due to floating-point operations.

Bresenham's Line Algorithm

I. Description: An efficient algorithm that uses only integer arithmetic to determine the pixels
along a line.
II. Algorithm:
A. Initialise the decision parameter p0=2Δy−Δxp_0 = 2\Delta y - \Delta xp0​=2Δy−Δx.
B. For each xxx from x0x_0x0​to x1x_1x1​:
1. If pk<0p_k < 0pk​<0, the next point is (xk+1,yk)(x_{k+1}, y_k)(xk+1​,yk​).
2. Otherwise, the next point is (xk+1,yk+1)(x_{k+1}, y_{k+1})(xk+1​,yk+1​) and
update pk+1=pk+2(Δy−Δx)p_{k+1} = p_k + 2(\Delta y - \Delta
x)pk+1​=pk​+2(Δy−Δx).
2. Circle Scan Conversion

Direct Method

I. Description: Uses the parametric equations of a circle.


10
II. Algorithm: x=rcos⁡(θ)x = r \cos(\theta)x=rcos(θ) y=rsin⁡(θ)y = r \sin(\theta)y=rsin(θ)
III. Limitations: Inefficient due to trigonometric calculations.

Bresenham's Circle Algorithm

I. Description: Uses integer arithmetic to determine the pixels along a circle.


II. Algorithm:
A. Initialize x=0x = 0x=0, y=ry = ry=r, and the decision parameter p=3−2rp = 3 -
2rp=3−2r.
B. For each xxx from 0 to rrr:
1. Plot the symmetric points in all octants.
2. If p<0p < 0p<0, update p=p+4x+6p = p + 4x + 6p=p+4x+6.
3. Otherwise, update p=p+4(x−y)+10p = p + 4(x - y) + 10p=p+4(x−y)+10 and

IL
y=y−1y = y - 1y=y−1.
3. Ellipse Scan Conversion

Midpoint Ellipse Algorithm

I. Description: An efficient algorithm for plotting ellipses using integer arithmetic.


II. Algorithm:
A. For the region 1:
1. Initialize p1=b2−a2b+14a2p_1 = b^2 - a^2b + \frac{1}{4}a^2p1​=b2−a2b+41​a2.
H
2. Plot points and update decision parameter accordingly.
B. For the region 2:
1. Initialize p2=b2(x+12)2+a2(y−1)2−a2b2p_2 = b^2(x + \frac{1}{2})^2 +
a^2(y-1)^2 - a^2b^2p2​=b2(x+21​)2+a2(y−1)2−a2b2.
2. Plot points and update decision parameter accordingly.

# Area Filling Techniques ➖


SA
I. Scan-Line Filling: Fills polygons by determining intersections of the scan-line with the
polygon edges and filling the pixels between pairs of intersections.
II. Boundary Fill: Fills an area with a specified colour until it reaches a boundary color.
III. Flood Fill: Fills an area with a specified colour until it reaches a different color boundary.

# Flood Fill Techniques ➖


I. 4-Connected Flood Fill: Recursively fills the four neighbouring pixels (up, down, left, right).
II. 8-Connected Flood Fill: Recursively fills all eight neighbouring pixels (including
diagonals).

# Character Generation ➖
I. Bitmap Method: Uses a bitmap for each character where each bit represents a pixel.
II. Outline Method: Uses vector data to define the outlines of characters, which are then filled
to produce the characters.

By understanding these scan-conversion algorithms and techniques, you can efficiently render
various geometric shapes and fill areas in computer graphics applications.
➖ 03
11

UNIT

● 2 – Dimensional Graphics ➖
# Cartesian and need of Homogeneous co-ordinate system, Geometric transformations
(Translation, Scaling, Rotation, Reflection, Shearing), Viewing transformation and clipping


(line, polygon and text) using CohenSutherland, Sutherland Hodgeman and Liang Barsky
algorithm for clipping

2-Dimensional Graphics ➖

IL
# Cartesian and Homogeneous Coordinate Systems ➖
1. Cartesian Coordinate System: ➖
I. Description: A coordinate system that specifies each point uniquely in a plane by a pair of
numerical coordinates (x, y).
II. Need: Simplifies the representation and manipulation of geometric figures by using linear
algebra.


I.
H
2. Homogeneous Coordinate System:

Description: An extension of the Cartesian coordinate system, representing points in 2D


space using three coordinates (x, y, w), where w is a scaling factor.
II. Need: Facilitates the representation of geometric transformations, including translation,
using matrix multiplication.


SA
# Geometric Transformations

1. Translation
○ Formula: (x′y′1) = (10tx01ty001) (xy1) \begin{pmatrix} x' \\ y' \\ 1 \end{pmatrix} =
\begin{pmatrix} 1 & 0 & tx \\ 0 & 1 & ty \\ 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} x \\ y
\\ 1 \end{pmatrix}​x′y′1​​=​100​010​txty1​​xy1​​
○ Description: Moves every point of an object by a certain distance in a specified
direction.
2. Scaling
○ Formula: (x′y′1)=(sx000sy0001)(xy1)\begin{pmatrix} x' \\ y' \\ 1 \end{pmatrix} =
\begin{pmatrix} sx & 0 & 0 \\ 0 & sy & 0 \\ 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} x \\
y \\ 1 \end{pmatrix}​x′y′1​​=​sx00​0sy0​001​​xy1​​
○ Description: Changes the size of an object by a scale factor along the x and y axes.
3. Rotation
○ Formula: (x′y′1)=(cos⁡θ−sin⁡θ0sin⁡θcos⁡θ0001)(xy1)\begin{pmatrix} x' \\ y' \\ 1
\end{pmatrix} = \begin{pmatrix} \cos\theta & -\sin\theta & 0 \\ \sin\theta & \cos\theta &
0 \\ 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} x \\ y \\ 1
\end{pmatrix}​x′y′1​​=​cosθsinθ0​−sinθcosθ0​001​x​ y1​​
○ Description: Rotates an object around the origin by an angle θ.
12
4. Reflection
○ Formula for reflection across x-axis: (x′y′1)=(1000−10001)(xy1)\begin{pmatrix} x'
\\ y' \\ 1 \end{pmatrix} = \begin{pmatrix} 1 & 0 & 0 \\ 0 & -1 & 0 \\ 0 & 0 & 1
\end{pmatrix} \begin{pmatrix} x \\ y \\ 1 \end{pmatrix}​x′y′1​​=​100​0−10​001​​xy1​​
○ Description: Produces a mirror image of an object.
5. Shearing
○ Formula for x-shear: (x′y′1) = (1shx0010001) (xy1) \begin{pmatrix} x' \\ y' \\ 1
\end{pmatrix} = \begin{pmatrix} 1 & sh_x & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix}
\begin{pmatrix} x \\ y \\ 1 \end{pmatrix}​x′y′1​​=​100​shx​10​001​​xy1​​
○ Description: Distorts the shape of an object by shifting its vertices along the x or y
axis.

# Viewing Transformation and Clipping ➖

IL
1. Viewing Transformation
○ Description: Maps a portion of a world coordinate scene to device coordinates.
○ Steps: Involves windowing (selecting a part of the scene) and viewport
transformation (mapping the window to the device's viewport).
2. Line Clipping Algorithms
Cohen-Sutherland Algorithm
○ Description: Uses a divide-and-conquer approach with region codes for efficiently

○ Steps:
H
clipping lines.

1. Compute region codes for both endpoints.


2. Check if the line is completely inside, outside, or partially inside.
3. Use logical operations to iteratively clip the line.
3. Liang-Barsky Algorithm
○ Description: Uses parametric line equations and inequalities to find the
SA
intersections with clipping boundaries.
○ Steps:
1. Express the line in parametric form.
2. Determine entering and exiting points by solving inequalities.
3. Clip the line segment between the valid parameter ranges.
4. Polygon Clipping Algorithm
Sutherland-Hodgman Algorithm
○ Description: Clips polygons by processing vertices and edges against each clipping
boundary.
○ Steps:
1. Process each edge of the polygon against each boundary.
2. Retain vertices inside the boundary, clip edges, and add intersection points.

# Area Clipping and Text Clipping ➖


I. Area Clipping: Involves clipping areas and polygons to a defined window.
II. Text Clipping: Clips text strings by determining if the bounding box of each character lies
within the clipping region.
13

By understanding these concepts, you can manipulate and render 2D graphics efficiently,
enabling a wide range of applications in computer graphics and visualisation.

IL
H
SA
14

UNIT ➖ 04
● 3 – Dimensional Graphics Introduction to 3-dimensional Graphics: Geometric


Transformations (Translation, Scaling, Rotation), Mathematics of Projections
(Parallel & Perspective). Colour Shading. Introduction to Morphing techniques

# Introduction to 3-Dimensional Graphics ➖


3-Dimensional (3D) graphics involve creating and manipulating objects in a three-dimensional
space, allowing for the representation of objects with depth, in addition to height and width. This

IL
creates more realistic and visually rich images, as compared to 2D graphics.

Key Concepts in 3D Graphics

1. Coordinate Systems
○ 3D Cartesian Coordinate System: Uses three axes (x, y, and z) to define the position of
points in 3D space. The x-axis typically represents width, the y-axis represents
height, and the z-axis represents depth.
2. 3D Objects
H
○ Vertices: The points in 3D space that define the corners of the object.
○ Edges: The lines connecting the vertices.
○ Faces: The flat surfaces enclosed by the edges. Common types of 3D objects
include polygons, polyhedra, and more complex models like meshes.
3. Geometric Transformations
○ Transformations in 3D graphics are used to manipulate objects within the scene.
SA
These include translation, scaling, and rotation.
4. Projections
○ Parallel Projection: Maintains the relative proportions of objects but does not
provide a realistic sense of depth.
○ Perspective Projection: Simulates the way the human eye perceives the world,
where objects appear smaller as they get further away, creating a sense of depth.
5. Rendering Techniques
○ Shading: Determines the color and brightness of surfaces based on light sources
and their interaction with the object.
○ Texture Mapping: Applies images to the surfaces of 3D models to add detail.
○ Ray Tracing: A rendering technique that simulates the way light interacts with
objects to produce highly realistic images.
6. Lighting
○ Ambient Light: General lighting that is present everywhere in the scene.
○ Diffuse Light: Light that scatters in many directions, giving objects a matte
appearance.
○ Specular Light: Light that reflects in a single direction, creating highlights and
contributing to the shiny appearance of surfaces.
15

7. Shading Models
○ Flat Shading: Applies a single color to each polygon, resulting in a faceted look.
○ Gouraud Shading: Interpolates vertex colors across the surface of the polygon.
○ Phong Shading: Interpolates vertex normals and calculates the color for each pixel,
providing smoother shading.
8. Cameras
○ Defines the viewpoint from which the scene is rendered. The camera's position,
orientation, and field of view determine what is visible in the final image.

IL
H
SA
SA
H
IL
16
17

IL
# Colour Shading

I.

H
Flat Shading: Applies a single colour to each polygon.
II. Gouraud Shading: Interpolates vertex colours across the surface of the polygon.
III. Phong Shading: Interpolates vertex normals and calculates the colour for each pixel,
providing smoother shading.
SA
# Introduction to Morphing Techniques ➖
I. Definition: Morphing is a technique that transforms one image or shape into another
through a seamless transition.
II. Steps:
A. Feature Point Identification: Identifying corresponding points in the source and
destination images.
B. Warping: Distorting the source image so that its feature points match those of the
destination image.
C. Cross-dissolving: Gradually changing the pixel values from the source image to
those of the destination image.

By understanding these fundamental concepts, you can effectively work with 3D graphics,
creating realistic images and animations for various applications in computer graphics.
18

SOME PREVIOUS YEARS QUESTIONS PAPER AND THEIR SOLUTIONS OF


BCA FIFTH SEMESTER (PTU) ➖

Computer Graphics (5th Sem) May2016.pdf


SECTIONS : A

1) Write briefly :

IL
a) Explain the working of digitizer.

b) Differentiate between Flatbed and drum plotter.

c) Differentiate between LCD and Plasma displays.

d) Define aspect ratio.

f) Define Reflection.
H
e) Why is Bresenhem’s algorithm better than DDA?

g) What do you mean by 2D line clipping?

h) What are various steps required to perform 3d viewing transformations?


SA
i) What do you mean by parallel projections?

j) Discuss any area filling techniques ?

SECTION A (ANSWERS)

1) Write briefly:

a) Explain the working of digitizer.

A digitizer is an input device that converts analog signals or physical drawings into digital format.
It typically consists of a flat surface and a stylus or puck. When the stylus or puck is moved over
the surface, sensors detect its position and movements. These movements are then converted
into digital coordinates that can be processed by a computer. Digitizers are often used for
creating precise digital drawings or for capturing hand-drawn designs.
19
b) Differentiate between Flatbed and Drum Plotter.

I. Flatbed Plotter:
A. Structure: Consists of a flat, stationary bed where the paper is placed.
B. Movement: The pen moves in both the X and Y directions over the paper.
C. Use: Suitable for plotting on large sheets of paper and for detailed, accurate
drawings.
D. Size Limitation: Limited by the size of the flatbed.
II. Drum Plotter:
A. Structure: Paper is wrapped around a rotating drum.
B. Movement: The drum rotates to move the paper along one axis, while the pen
moves along the other axis.
C. Use: Capable of plotting on continuous rolls of paper, suitable for long drawings.

IL
D. Size Limitation: Can handle longer lengths of paper than flatbed plotters.

c) Differentiate between LCD and Plasma displays.

I. LCD (Liquid Crystal Display):


A. Technology: Uses liquid crystals that align to block or pass light.
B. Backlight: Requires a backlight (LED or fluorescent) to produce images.
C. Brightness: Typically brighter than plasma displays.

II. Plasma Display:


H
D. Energy Consumption: Generally consumes less power.
E. Burn-in: Less susceptible to screen burn-in.

A. Technology: Uses small cells containing electrically charged ionized gases


(plasma).
B. Backlight: Self-emissive, does not require a backlight.
C. Brightness: Can achieve deeper blacks and better contrast ratios.
SA
D. Energy Consumption: Usually consumes more power.
E. Burn-in: More susceptible to screen burn-in.

d) Define aspect ratio.

The aspect ratio of a display screen is the ratio of its width to its height. It is typically expressed
as two numbers separated by a colon (e.g., 16:9). The aspect ratio is important for ensuring that
images and videos are displayed correctly without distortion.

e) Why is Bresenham’s algorithm better than DDA?

Bresenham’s algorithm is better than the Digital Differential Analyzer (DDA) algorithm because:

I. Efficiency: Bresenham’s algorithm uses integer arithmetic instead of floating-point, making


it faster and more efficient.
II. Accuracy: It minimizes rounding errors and produces more accurate pixel placement.
III. Performance: Bresenham’s algorithm is computationally less expensive, which is
particularly important for real-time graphics applications.
20
f) Define Reflection.

Reflection in computer graphics is the transformation that produces a mirror image of an object
relative to a specific line (in 2D) or plane (in 3D). It involves flipping the object over the line or
plane, creating a symmetric image.

g) What do you mean by 2D line clipping?

2D line clipping is the process of removing portions of lines that lie outside a specified
rectangular area (the clipping window). Algorithms such as Cohen-Sutherland, Liang-Barsky, and
Cyrus-Beck are used to determine which parts of the line are inside the clipping window and
should be displayed.

h) What are various steps required to perform 3D viewing transformations?

IL
The steps required to perform 3D viewing transformations include:

1. Modeling Transformation: Convert object coordinates to world coordinates.


2. Viewing Transformation: Convert world coordinates to viewing coordinates.
3. Projection Transformation: Project the 3D viewing coordinates onto a 2D plane using
perspective or parallel projection.
4. Viewport Transformation: Map the 2D projected coordinates to screen coordinates.
H
i) What do you mean by parallel projections?

Parallel projections are a type of projection where the lines of sight from the object to the
projection plane are parallel to each other. They maintain the relative proportions of objects but
do not provide a realistic sense of depth. Types of parallel projections include orthographic
projection and oblique projection.
SA
j) Discuss any area filling techniques.

Area filling techniques are used to fill the interior of polygons with colors or patterns. Some
common techniques include:

I. Flood Fill: Starts from a seed point inside the area and spreads outwards until it
encounters the boundary of the area. There are two main types:
A. 4-connected: Fills in four directions (up, down, left, right).
B. 8-connected: Fills in eight directions (up, down, left, right, and diagonals).
II. Boundary Fill: Similar to flood fill but fills until it reaches a specified boundary color.
III. Scan-Line Fill: Processes each horizontal line (scan-line) of the polygon, determining
which segments of the line are inside the polygon and filling them.
IV. Seed Fill: Also known as flood fill; starts from a seed point and fills connected pixels until
the boundary is reached.
21
SECTION-B

2) Explain different types of printers in detail.

3) Explain flat panel displays in detail.

4) What are random scan displays? Compare and contrast raster scan and random scan

displays.

5) Discuss midpoint circle generation algorithm with example.

6) Explain various 2D geometric transformations in detail.

7) Define Projection. Discuss various types of perspective projection in detail.

IL
SECTION B (ANSWERS)

2) Explain different types of printers in detail.

Printers are devices used to produce hard copies of digital documents or images. They can be
categorized into several types based on their printing technology:

I. Inkjet Printers:
H
A. Technology: Spray tiny droplets of ink onto paper.
B. Advantages: High-quality color printing, relatively low cost.
C. Disadvantages: Slower printing speed, higher cost per page compared to laser
printers.
SA
II. Laser Printers:
A. Technology: Use laser beams to draw images on a drum, toner (powdered ink) is
then fused onto paper.
B. Advantages: Fast printing speed, high-quality text and graphics, lower cost per
page compared to inkjet.
C. Disadvantages: Higher initial cost, generally larger and heavier.
III. Dot Matrix Printers:
A. Technology: Use a print head with pins that strike an inked ribbon to form
characters.
B. Advantages: Suitable for carbon copy printing, low cost per page.
C. Disadvantages: Noisy operation, low print quality compared to inkjet and laser
printers.
IV. Thermal Printers:
A. Technology: Use heat to transfer color dye or ink onto paper.
B. Advantages: Silent operation, fast printing speed, low maintenance.
C. Disadvantages: Limited color reproduction, can be expensive per page.
V. 3D Printers:
A. Technology: Build objects layer by layer using materials like plastic, metal, or resin.
22
B. Advantages: Can create complex 3D shapes, used in prototyping and
manufacturing.
C. Disadvantages: Limited materials and resolution, can be slow for large objects.
VI. Plotter Printers:
A. Technology: Used for printing vector graphics, such as architectural drawings or
engineering designs.
B. Advantages: High precision and accuracy for large-format printing.
C. Disadvantages: Expensive, limited to specific types of printing tasks.

3) Explain flat panel displays in detail.

Flat panel displays refer to a class of displays that are thin and use technologies such as LCD
(Liquid Crystal Display), LED (Light Emitting Diode), or OLED (Organic Light Emitting Diode).

IL
These displays are commonly used in televisions, computer monitors, and handheld devices.

I. LCD (Liquid Crystal Display):


A. Technology: Use liquid crystals that block or pass light to create images.
B. Advantages: Thin, light, consume less power, suitable for large screens.
C. Disadvantages: Limited viewing angles, slower response time compared to other
technologies.
II. LED (Light Emitting Diode):

III.
H
A. Technology: Use an array of LEDs as backlighting for LCD panels.
B. Advantages: Better contrast, thinner than traditional LCDs, energy-efficient.
C. Disadvantages: Can still suffer from limited viewing angles, higher cost.
OLED (Organic Light Emitting Diode):
A. Technology: Each pixel emits its own light when an electric current is applied.
B. Advantages: Excellent contrast ratio, faster response time, flexible and thinner
displays possible.
SA
C. Disadvantages: Expensive, susceptible to burn-in (though less than plasma
displays).

4) What are random scan displays? Compare and contrast raster scan and random scan
displays.

I. Random Scan Displays:


A. Technology: Use a point-by-point drawing system where the electron beam is
directed only to the parts of the screen where a picture is to be drawn.
B. Advantages: More efficient use of display memory, capable of producing smooth,
continuous lines.
C. Disadvantages: Expensive, limited by the speed of the beam.
II. Raster Scan Displays:
A. Technology: Use a frame buffer to store the pixel values for the entire screen,
scanned line by line by an electron beam.
B. Advantages: Simple design, suitable for most computer graphics applications.
C. Disadvantages: Requires more memory for higher resolutions, can produce flicker
on interlaced displays.
23
Comparison:

I. Memory Usage: Raster scan uses more memory due to the frame buffer, while random
scan is more memory-efficient.
II. Speed: Random scan can potentially be faster for drawing complex images due to direct
addressing, while raster scan is limited by the scanning speed.
III. Cost: Random scan displays tend to be more expensive due to the complexity of the
technology, whereas raster scan displays are more cost-effective.

5) Discuss midpoint circle generation algorithm with example.

The midpoint circle generation algorithm is used to draw a circle on a raster screen. It is more
efficient than other algorithms like the naive approach or the Bresenham's algorithm for circles.

IL
Here's how it works:

I. Algorithm:
A. Begin with the circle centered at (0, r) with radius r.
B. Calculate the initial decision parameter P=1−rP = 1 - rP=1−r.
C. At each step, determine the next pixel position based on the current decision
parameter:
1. If P<0P < 0P<0, move in the horizontal direction.
2. If P≥0P \geq 0P≥0, move diagonally.
II.
H
Example: Suppose we want to draw a circle with radius r = 5.
A. Initialization: Start at (0, 5).
B. Iteration Steps:
1. Calculate P=1−r=1−5=−4P = 1 - r = 1 - 5 = -4P=1−r=1−5=−4.
2. Depending on the value of P, move to the next pixel position.
3. Update PPP based on the chosen path.
SA
C. Continue iterating until the circle is complete.

6) Explain various 2D geometric transformations in detail.

2D geometric transformations involve changing the position, size, or orientation of objects in a 2D


plane. Common transformations include:

I. Translation: Moves an object by adding or subtracting a constant value to its coordinates.


II. Scaling: Enlarges or reduces the size of an object by multiplying its coordinates by a
scaling factor.
III. Rotation: Rotates an object around a fixed point (usually the origin) by a specified angle.
IV. Reflection: Produces a mirror image of an object relative to a specified axis.
V. Shearing: Skews an object along one axis, causing it to stretch in one direction.

Each transformation can be represented by a matrix operation, allowing multiple transformations


to be combined into a single matrix for efficient computation.
24
7) Define Projection. Discuss various types of perspective projection in detail.

Projection in computer graphics refers to the process of transforming 3D points onto a 2D plane
for display or rendering. It simulates how a 3D scene is projected onto a 2D surface, such as a
computer screen or a piece of paper.

Types of Perspective Projection:

1. One-Point Perspective:
○ Description: Objects appear smaller as they move farther away from the viewer. All
lines converge to a single vanishing point on the horizon.
○ Application: Often used in architectural drawings and urban planning.
2. Two-Point Perspective:

IL
○ Description: Similar to one-point perspective but with two vanishing points on the
horizon line, each for the horizontal lines of the object.
○ Application: Commonly used in interior design and cityscape drawings.
3. Three-Point Perspective:
○ Description: Includes a third vanishing point not on the horizon line, typically used
for objects viewed from extreme angles.
○ Application: Useful for dramatic and dynamic compositions in art and animation.
H
Perspective projection involves transforming the 3D coordinates of objects into 2D coordinates
that take into account perspective effects, such as foreshortening and depth perception, to create
a realistic representation of a 3D scene on a 2D surface.
SA
25

COMPUTER GRAPHICS (6th SEM) May2019.pdf


SECTION-A

1. Answer briefly :

a) Give the introduction of passive graphics.

b) Explain Random Scan display.

c) What are flat panel devices?

IL
d) What is function of lookup table?

e) What are flood fill techniques?

f) What is use of Sutherland algorithm?

g) Write about windows and view port.

h) Define shearing.
H
i) Discuss about graphic tablets.

j) Write the color models available in graphics

SECTION A (ANSWERS)

1) Answer briefly:
SA
a) Give the introduction of passive graphics.

Passive graphics refers to a type of computer graphics system where the display device does not
have its own internal processor. Instead, it relies on the main computer's CPU for all processing
tasks, including generating and refreshing the display. This approach contrasts with active
graphics systems, where the display device has its own processor (such as in modern GPUs) to
handle graphics rendering independently.

b) Explain Random Scan display.

Random Scan display is a type of display technology where the electron beam directly draws the
image on the screen point by point, following the commands sent by the computer's display
processor. It does not scan the entire screen sequentially like raster scan displays but rather
scans only the areas where changes occur. This method allows for more efficient use of display
memory and is capable of producing smoother, continuous lines compared to raster scan
displays.
26
c) What are flat panel devices?

Flat panel devices refer to display technologies that are thin and flat, as opposed to traditional
cathode ray tube (CRT) displays. Common types include:

I. LCD (Liquid Crystal Display): Uses liquid crystals to modulate light.


II. LED (Light Emitting Diode) Displays: Use LEDs for backlighting in LCD panels or as
self-emitting pixels in OLED displays.
III. Plasma Displays: Use ionized gases to emit light.

These displays are widely used in modern televisions, computer monitors, laptops, tablets, and
smartphones due to their space-saving design and energy efficiency.

d) What is the function of a lookup table?

IL
A lookup table (LUT) is a mechanism used in computer graphics to transform input data into
output values according to a predefined set of rules or mapping. In graphics, it is commonly used
for color correction, grayscale conversion, gamma correction, and various other transformations.
It allows for efficient processing by replacing complex calculations with simple table lookups.

e) What are flood fill techniques?

Flood fill techniques are used in computer graphics to fill closed areas of an image with color or
H
pattern. The basic idea is to start from a seed point (a specified starting point inside the area to
be filled) and recursively fill neighboring pixels that have the same color or meet specific criteria
until the entire area is filled. Common flood fill algorithms include:

I. 4-connected: Fills in four directions (up, down, left, right).


II. 8-connected: Fills in eight directions (including diagonals).
SA
f) What is the use of the Sutherland algorithm?

The Sutherland algorithm, specifically the Sutherland-Hodgman clipping algorithm, is used for
polygon clipping against a rectangular clipping window. It determines which parts of the polygon
lie inside the window and outputs the clipped polygon. This algorithm is crucial in computer
graphics for ensuring that only the visible parts of objects are displayed on the screen, improving
rendering efficiency and visual clarity.

g) Write about windows and viewport.

I. Window: In computer graphics, a window defines a rectangular area of the world


coordinate system that is visible to the user. It acts as a frame that specifies which part of
the scene should be displayed on the screen. Windows are defined by their boundaries in
terms of minimum and maximum coordinates.
II. Viewport: The viewport is the rectangular area on the screen where the contents of the
window are displayed after applying projection and scaling transformations. It represents
the final image that the user sees on the display device. The viewport is typically defined
by its dimensions in pixels or normalized device coordinates.
27
h) Define shearing.

Shearing is a transformation in computer graphics that distorts the shape of an object along an
axis. It displaces each point in the object by an amount proportional to its distance from an axis
or plane. Shearing is commonly used to create 3D effects, simulate slanted shapes, or perform
transformations that tilt or skew objects.

i) Discuss about graphic tablets.

Graphic tablets, also known as digitizing tablets or pen tablets, are input devices used to create
digital drawings and graphics. They consist of a flat surface (tablet) and a stylus (pen) that allows
users to draw directly on the tablet. The tablet detects the position of the stylus and sends this
information to the computer, where it can be used in graphic design, digital art, handwriting

IL
recognition, and other applications requiring precise input.

j) Write the color models available in graphics.

Color models, also known as color spaces, define how colors are represented and manipulated
in computer graphics and imaging. Common color models include:

I. RGB (Red, Green, Blue): Uses additive color mixing to create colors by combining varying
intensities of red, green, and blue light.
II.

III.
H
CMYK (Cyan, Magenta, Yellow, Key/Black): Used in printing, where colors are created
by subtractive color mixing using ink.
HSV (Hue, Saturation, Value): Represents colors based on their perceptual attributes of
hue (color), saturation (purity), and value (brightness).
IV. HSL (Hue, Saturation, Lightness): Similar to HSV but uses lightness instead of value.

These color models provide different ways to represent and manipulate colors, each suited for
SA
specific applications in computer graphics, photography, printing, and digital imaging.

SECTION-B

2. What is function of image scanning in graphics? Discuss types of graphs.

3. Explain Bresenham’s line drawing algorithms along with their derivations.

4. a) Write a short note on Midpoint circle Algorithm.

b) With suitable examples explain all 3D transformations.

5. Why clipping is used in graphics? Discuss text clipping.

6. Describe the 2-D transformation matrix for rotation about arbitrary point.

7. What are different types of projections in computer graphics? Explain with example.
28
SECTION B (ANSWERS)

2) What is the function of image scanning in graphics? Discuss types of graphs.

Function of Image Scanning in Graphics: Image scanning in graphics refers to the process of
converting a physical image or document into a digital format. This is essential for computer
processing, manipulation, storage, and display of images. The main functions include:

I. Digitization: Converting analog images (such as photographs, drawings, or printed


documents) into digital form.
II. Enhancement: Improving image quality through processes like noise reduction,
sharpening, or color correction.
III. Storage: Storing images in digital formats that are efficient for retrieval and transmission.

IL
IV. Manipulation: Editing images through operations like scaling, cropping, or applying filters.
V. Analysis: Analyzing image data for various applications, such as medical imaging, remote
sensing, or computer vision.

Types of Graphs: Graphs in computer graphics refer to mathematical representations used to


describe shapes, curves, and surfaces. Common types include:

I. Linear Graphs: Represented by linear equations like y=mx+cy = mx + cy=mx+c. These


can describe straight lines in 2D or 3D space.
II.

III.
H
Quadratic Graphs: Represented by equations of the form y=ax2+bx+cy = ax^2 + bx +
cy=ax2+bx+c. These describe parabolic curves in 2D or quadratic surfaces in 3D.
Cubic Graphs: Represented by equations involving cubic polynomials. They describe
more complex curves and surfaces.
IV. Parametric Graphs: Defined by parametric equations x=f(u)x = f(u)x=f(u) and y=g(u)y =
g(u)y=g(u), where uuu is a parameter. These are used to describe curves and surfaces by
SA
varying the parameter.
V. Implicit Graphs: Defined by equations like f(x,y)=0f(x, y) = 0f(x,y)=0. These describe
curves or surfaces implicitly defined by a relationship between variables.
VI. Explicit Graphs: Defined explicitly as y=f(x)y = f(x)y=f(x), where xxx and yyy are directly
related by a function. These are used for simpler curves and surfaces.

3) Explain Bresenham’s line drawing algorithm along with its derivation.

Bresenham's line drawing algorithm is used to draw a line between two points in a raster grid. It
is efficient because it only uses integer arithmetic and avoids floating-point calculations.

Algorithm: Given two points (x1,y1)(x_1, y_1)(x1​,y1​) and (x2,y2)(x_2, y_2)(x2​,y2​):

1. Calculate the differences dx=x2−x1dx = x_2 - x_1dx=x2​−x1​and dy=y2−y1dy = y_2 -


y_1dy=y2​−y1​.
2. Initialize decision parameters based on the slope m=dydxm = \frac{dy}{dx}m=dxdy​:
○ For slopes ∣m∣≤1|m| \leq 1∣m∣≤1, use P=2⋅dy−dxP = 2 \cdot dy - dxP=2⋅dy−dx.
○ For slopes ∣m∣>1|m| > 1∣m∣>1, use P=2⋅dx−dyP = 2 \cdot dx - dyP=2⋅dx−dy.
3. Start plotting pixels from (x1,y1)(x_1, y_1)(x1​,y1​) to (x2,y2)(x_2, y_2)(x2​,y2​):
○ If P<0P < 0P<0, move horizontally and update PPP.
29
○ If P≥0P \geq 0P≥0, move diagonally and update PPP.

Derivation: Bresenham's algorithm optimizes the drawing of lines by choosing the next pixel
closest to the ideal line path based on the current decision parameter PPP. It ensures that the
line drawn is as close as possible to the true line, using only integer operations.

4) :->

a) Write a short note on Midpoint circle Algorithm.


The Midpoint circle algorithm is used to draw circles on a raster display device. It is similar to
Bresenham's line drawing algorithm but adapted for circles.

Algorithm: Given a circle centered at (0,0)(0, 0)(0,0) with radius rrr:

IL
1. Start plotting points from the top of the circle (0,r)(0, r)(0,r).
2. Calculate the initial decision parameter P=1−rP = 1 - rP=1−r.
3. At each step, decide the next pixel position based on PPP:
○ If P<0P < 0P<0, move horizontally.
○ If P≥0P \geq 0P≥0, move diagonally.
4. Update PPP accordingly and continue until reaching the starting point.
H
b) With suitable examples, explain all 3D transformations.

3D transformations are used to manipulate objects in three-dimensional space. Common


transformations include:

I. Translation: Moves an object by adding a translation vector to its coordinates.


II. Scaling: Enlarges or reduces the size of an object by multiplying its coordinates by scaling
SA
factors along each axis.
III. Rotation: Rotates an object around a specified axis or point by a certain angle.
IV. Shearing: Skews an object along one axis, stretching or compressing it in that direction.
V. Reflection: Creates a mirror image of an object relative to a plane.
VI. Projection: Converts 3D coordinates into 2D coordinates for display or rendering.

Example:

I. Translation: Move a cube along the x-axis by tx=2t_x = 2tx​=2, y-axis by ty=−1t_y =
-1ty​=−1, and z-axis by tz=3t_z = 3tz​=3.
II. Scaling: Enlarge a sphere by scaling factors sx=1.5s_x = 1.5sx​=1.5, sy=1.5s_y =
1.5sy​=1.5, and sz=1.5s_z = 1.5sz​=1.5.
III. Rotation: Rotate a pyramid 45 degrees around the y-axis.

These transformations are represented using matrices and applied sequentially to transform
vertices of objects in 3D computer graphics.

5) Why is clipping used in graphics? Discuss text clipping.

Clipping in Graphics: Clipping is used in computer graphics to ensure that only the portions of
objects or images that are visible within a specified region (such as a window or viewport) are
30
displayed. It improves rendering efficiency and eliminates unnecessary calculations for invisible
parts of objects.

Text Clipping: Text clipping specifically deals with ensuring that only the visible portions of text
(characters or strings) are displayed on the screen or within a defined area. It involves checking
whether each character or part of text lies within the clipping region defined by a window or
viewport. Various algorithms, such as Cohen-Sutherland or Sutherland-Hodgman, are used for
text clipping based on the application requirements and performance considerations.

6) Describe the 2-D transformation matrix for rotation about an arbitrary point.

Rotation about an arbitrary point in 2D involves translating the rotation center to the origin,
applying rotation, and then translating back. Let (x,y)(x, y)(x,y) be the point to be rotated around a

IL
pivot point (xc,yc)(x_c, y_c)(xc​,yc​) by angle θ\thetaθ:

1. Translate the point (x,y)(x, y)(x,y) to the origin:


[x′y′]=[x−xcy−yc]\begin{bmatrix} x' \\ y' \end{bmatrix} = \begin{bmatrix} x - x_c \\ y - y_c
\end{bmatrix}[x′y′​]=[x−xc​y−yc​​]
2. Apply rotation θ\thetaθ around the origin:
[x′′y′′]=[cos⁡(θ)−sin⁡(θ)sin⁡(θ)cos⁡(θ)][x′y′]\begin{bmatrix} x'' \\ y'' \end{bmatrix} =
\begin{bmatrix} \cos(\theta) & -\sin(\theta) \\ \sin(\theta) & \cos(\theta) \end{bmatrix}
\begin{bmatrix} x' \\ y' \end{bmatrix}[x′′y′′​]=[cos(θ)sin(θ)​−sin(θ)cos(θ)​][x′y′​]
H
3. Translate back to the original position:
[x′′′y′′′]=[x′′+xcy′′+yc]\begin{bmatrix} x''' \\ y''' \end{bmatrix} = \begin{bmatrix} x'' + x_c \\ y'' +
y_c \end{bmatrix}[x′′′y′′′​]=[x′′+xc​y′′+yc​​]

The combined transformation matrix for rotation around an arbitrary point (xc,yc)(x_c, y_c)(xc​,yc​)
by angle θ\thetaθ is:
SA
[cos⁡(θ)−sin⁡(θ)(1−cos⁡(θ))⋅xc+sin⁡(θ)⋅ycsin⁡(θ)cos⁡(θ)−sin⁡(θ)⋅xc+(1−cos⁡(θ))⋅yc001]\begin{bmatrix}
\cos(\theta) & -\sin(\theta) & (1-\cos(\theta)) \cdot x_c + \sin(\theta) \cdot y_c \\ \sin(\theta) &
\cos(\theta) & -\sin(\theta) \cdot x_c + (1-\cos(\theta)) \cdot y_c \\ 0 & 0 & 1
\end{bmatrix}​cos(θ)sin(θ)0​−sin(θ)cos(θ)0​(1−cos(θ))⋅xc​+sin(θ)⋅yc​−sin(θ)⋅xc​+(1−cos(θ))⋅yc​1​

7) What are different types of projections in computer graphics? Explain with example.

Types of Projections:

1. Orthographic Projection:
○ Parallel lines remain parallel after projection. It is commonly used in engineering and
architectural drawings where maintaining accurate dimensions is crucial.
○ Example: Top-down view of a building plan.
2. Perspective Projection:
○ Emulates the way human eyes see objects in space, where objects farther away
appear smaller.
○ Example: Three-point perspective drawing of a cityscape.
31
3. Oblique Projection:
○ Combines orthographic and perspective projections to show more depth than
orthographic and more realism than pure perspective.
○ Example: Cabinet projection used in technical drawings of furniture.

Each type of projection has its application in different fields, depending on the need for accurate
representation of spatial relationships or realistic visual effects in computer graphics and
visualisation.

😀😀

IL
BY : SAHIL RAUNIYAR / PTU-CODER !

H
SA

You might also like