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

Practice Labsheet Computer Graphics Rishi

The document outlines a lab assessment for a Computer Graphics course, detailing various experiments related to line, circle, and ellipse drawing algorithms. It includes comparisons between algorithms like DDA and Bresenham, as well as explanations of raster scan versus random scan displays and the concept of frame buffers. Additionally, it covers decision parameters used in graphics algorithms to enhance efficiency in pixel selection.

Uploaded by

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

Practice Labsheet Computer Graphics Rishi

The document outlines a lab assessment for a Computer Graphics course, detailing various experiments related to line, circle, and ellipse drawing algorithms. It includes comparisons between algorithms like DDA and Bresenham, as well as explanations of raster scan versus random scan displays and the concept of frame buffers. Additionally, it covers decision parameters used in graphics algorithms to enhance efficiency in pixel selection.

Uploaded by

Rishi Raj
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

COLLEGE OF SMART COMPUTING

Lab Assessment
File
Submitted By: Rishi Raj

Submitted To: Mrs. Neetu


Department: [Link] CSE
Semester: 6th Sem
Academic Session: 2025 - 2026
Subject name: Computer
Graphics Lab Subject code:
BTCS683
7th K.M. on Roorkee Haridwar Road (NH-58), Post Box No. 27,
Vardhmanpuram, Roorkee- 247667 District. Haridwar (Uttarakhand)
Website: [Link]
LAB SHEET – 1
Experiment Aim:
To understand raster scan concepts and implement basic line drawing
algorithms.
Programming Questions
1. Implement DDA Line Drawing Algorithm.
Output:
2. Implement Bresenham’s Line Drawing Algorithm.
Output:
3. Compare DDA and Bresenham algorithms.

Basis of Comparison Digital Differential Bresenham’s Line


Analyzer Algorithm
Developed By Based on incremental Developed by Jack
calculation method Bresenham (1962)
Type of Arithmetic Uses floating-point Uses integer arithmetic
arithmetic only
Computational Speed Slower due to floating- Faster due to integer
point operations calculations
Accuracy Less accurate (rounding More accurate (no
errors may occur) rounding errors)
Rounding Required Yes No

Use of Required Not required (only


Multiplication/Division addition & subtraction)
Decision Parameter No decision parameter Uses decision parameter
to choose next pixel
Efficiency Less efficient Highly efficient

Hardware Implementation More complex Easy and suitable for


hardware implementation
Suitability Educational purposes, Real-time systems, games,
simple graphics CAD applications
Memory Requirement Slightly higher Slightly lower

Overall Performance Moderate High


4. Draw horizontal, vertical, and diagonal lines.
Output:
5. Draw a grid using line drawing algorithm.
Output:
6. Modify program to draw thick lines.
Output:
7. Draw dashed and dotted lines.
Output:
8. Explain raster scan vs random scan displays.
Basis of Random Scan Display
Raster Scan Display
Comparison
Image is displayed by Image is displayed by
scanning the screen line drawing lines directly
Definition between specified
by line from top to
bottom. points.

Electron beam moves Electron beam moves


Working only to required
sequentially across the
Principle positions to draw lines.
screen pixel by pixel.

Drawing Uses pixels to form Uses vectors (lines) to


Method images. form images.

Entire screen is refreshed Only the required parts


Image of the image are
regardless of image
Formation refreshed.
content.

Resolution Resolution depends on Resolution depends on


Dependency number of pixels. beam accuracy.

Suitable for realistic Best for line drawings


Picture Quality and wireframe images.
images and filled areas.
Memory Requires large memory Requires less memory.
Requirement (frame buffer).
Refresh Refreshes whole screen Refreshes only drawn
Process continuously. components.

More complex control


Complexity Simpler hardware design. system.

Cost Less expensive. More expensive.

CAD systems, flight


Television, modern simulators, early
Applications
monitors, smartphones. graphics systems.

Example Vector display monitors


CRT TV, LCD monitors
Devices
9. Explain frame buffer and pixel resolution.
1. Frame Buffer

A frame buffer is a dedicated memory area used in computer graphics to store the
visual information of an image before it is displayed on the screen.

Explanation:
 The screen is divided into many small picture elements called pixels.
 Each pixel’s color or intensity value is stored in memory.
 This memory storing pixel data is called the frame buffer (also known as refresh
buffer).
 During display refresh, the video controller reads data from the frame buffer and
shows it on the monitor.

Key Points
 Stores color/intensity information of every pixel.
 Size of frame buffer depends on screen resolution and color depth.
 Higher resolution → larger frame buffer required.
 Used mainly in raster scan systems.
Example
If resolution = 1024 × 768

1024 × 768 = 786,432 pixels


Total pixels stored:

Each pixel value is saved inside the frame buffer memory.

2. Pixel resolution refers to the number of pixels displayed on a screen in horizontal


and vertical directions.
Explanation
Resolution determines image clarity and detail.

Horizontal Pixels × Vertical Pixels


It is expressed as:

Examples
 640 × 480
 1024 × 768
 1920 × 1080 (Full HD)
Higher resolution means:
 More pixels
 Sharper images
 Better display quality
LAB SHEET – 1
Experiment Aim:
To implement efficient algorithms for drawing circles and ellipses.

1. Midpoint Circle Algorithm.


Output:
2. Bresenham’s Circle Algorithm.
Output:
3. Draw concentric circles.
Output:
4. Draw filled circle.
Output:
5. Draw semi-circle.
Output:
6. Draw quadrant circle.
Output:
7. Compare circle and ellipse algorithms.
Circle Drawing Ellipse Drawing
Feature Algorithm
Algorithm

Shape Drawn Circle Ellipse

Radii Single radius r Two radii rx and ry

( x^2 + y^2 = r^2 ( \frac{x^2}{rx^2} +


Equation Used \frac{y^2}{ry^2} = 1 )
)
Bresenham / Midpoint Ellipse
Algorithm
Midpoint Circle Algorithm
Used
Algorithm
Symmetry 8-way symmetry 4-way symmetry

Number of Two regions


Single region
Regions
Decision One decision Two decision
Parameter parameter parameters (d1, d2)

Complexity Simple More complex

Slope change not Divided based on


Slope
considered slope change
Handling
separately
Computation Faster Slightly slower

Region-1: x
Increment x increases, y increasesRegion-2: y
Direction decreases decreases

Wheels, coins, Planet orbits, lenses,


Applications tracks
circular objects
8. Decision parameter explanation.

A decision parameter is a variable used in computer graphics algorithms to


determine which pixel should be selected next while drawing a curve such as a
circle or an ellipse. It helps in choosing the pixel that lies closest to the actual
mathematical curve.

Instead of calculating exact points using complex mathematical operations like


square roots or floating-point calculations, the algorithm evaluates a decision
parameter and selects the most appropriate pixel using simple arithmetic
operations.

Purpose of Decision Parameter


The main purposes of using a decision parameter are:

 To select the nearest pixel to the required curve.


 To avoid complex calculations.
 To increase drawing speed.
 To use only addition and subtraction operations for efficient raster display.

You might also like