Graphics Mid-Term Notes (Complete)
Graphics Mid-Term Notes (Complete)
Graphics Images
1. Raster Image
2. Vector Image
Vector Image
Common models: RGB (Red, Green, Blue) & CMYK (Cyan, Magenta, Yellow, Black).
Colors are represented through color space, defining the range of possible colors.
Fig-3 (a): RGB Color Space Fig-3 (b): CMY Color Space
Definition:
The RGB color model is an additive color model where colors are created by mixing three
primary colors—Red (R), Green (G), and Blue (B)—at varying intensity levels from 0 (lowest)
to 1 (highest).
Key Points:
The RGB model is based on an addi ve process, star ng with black and adding light.
Different intensity combina ons of R, G, and B produce various colors.
The RGB color space forms a cube, where each color is represented by coordinates (r, g, b).
Example color coordinates:
o Black → (0,0,0)
o White → (1,1,1)
o Yellow → (1,1,0)
o Gray (midway) → (0.7,0.7,0.7)
Definition:
The CMY color model is a subtractive color model that defines colors using three primary
colors—Cyan (C), Magenta (M), and Yellow (Y). It is complementary to the RGB model.
Key Points:
The CMY model uses a subtrac ve process, star ng with white and removing colors.
Removing red leaves cyan, removing green leaves magenta, and removing blue leaves yellow.
The CMY color space is represented using (C, M, Y) coordinates.
Example: Subtrac ng red from white results in cyan (combina on of green and blue).
Conversion Formula between the two-color models
𝑪𝒐𝒍𝒐𝒓. 𝑹
𝑪=𝟏−
𝟐𝟓𝟓. 𝟎
𝑪𝒐𝒍𝒐𝒓. 𝑮
𝑴=𝟏−
𝟐𝟓𝟓. 𝟎
𝑪𝒐𝒍𝒐𝒓. 𝑩
𝒀=𝟏−
𝟐𝟓𝟓. 𝟎
𝑹 = (𝟏 − 𝑪) ∗ 𝟐𝟓𝟓. 𝟎
𝑮 = (𝟏 − 𝑴) ∗ 𝟐𝟓𝟓. 𝟎
𝑩 = (𝟏 − 𝒀) ∗ 𝟐𝟓𝟓. 𝟎
Color Representation Techniques
Definition:
In digital image processing, different methods are used to store and access pixel color
information. Two common methods are Direct Coding and Lookup Tables (LUTs).
Direct Coding:
Each pixel is allocated a fixed amount of storage space for its color.
Example: 3-bit representa on (1 bit per primary color: R, G, B).
Each primary can be 0 (off) or 1 (on), allowing 8 possible colors (corners of the RGB
color cube).
3-bit RGB:
o Uses 1 bit per primary color (R, G, B).
o Each component is either on (1) or off (0).
o Results in 8 colors: (2 ) = 8
6-bit RGB:
o Uses 2 bits per primary color.
o Each component has 4 intensity levels (22= 4).
o Results in 64 colors: (2 ) = 64
General Formula:
A Lookup Table (LUT) is an indirect method of storing color information where pixel
values do not directly encode colors but act as indices pointing to a predefined table of colors.
1. Each pixel stores an index value instead of actual color informa on.
2. The index references a color entry in the lookup table.
3. The lookup table contains predefined color values, usually in RGB format.
4. When displaying the image, the system maps the pixel indices to the actual color values
stored in the table.
Advantages of LUT:
Efficient memory usage: Instead of storing full RGB values for every pixel, LUTs allow
storing only index values, reducing storage requirements.
Flexible color mapping: Easily modify colors by upda ng the table without changing the
pixel data.
Useful for limited color displays: Common in systems with 8-bit color depth, where 256
colors are stored in a LUT.
Halftone Technique
Halftone is the technique that simulates continuous tone imagery using dots.
Dots can be varied either
o in size
o in shape or
o in spacing
Halftone generates a gradient like effect.
Halftone Image
Halftone image consists of discrete dots, not continuous tones.
Dots blur together from a distance, creating an illusion of continuous shapes.
Dots are arranged at a 45° screen angle to the horizon.
Dot size is inversely proportional to the intensity level.
Practice Questions
The equation 𝑦 = 𝑥 + 3 represents a straight line. To create a vector image, plot the line on
a coordinate plane, and each point on the line corresponds to a 𝑣𝑒𝑐𝑡𝑜𝑟 𝑣 = ⟨𝑥, 𝑥 + 3⟩,
representing the position on the line.
Or, the equation 𝑦 = 𝑥 + 3 represents a straight line with a slope of 1 and a y-intercept of 3. To
create a vector image:
1. Graphical Representation: Plot the equation on a coordinate plane, where the x-axis
and y-axis represent the horizontal and vertical components, respectively. Each point on
the line corresponds to a vector from the origin (0, 0) to the point (x, y), forming a vector
field along the line.
2. Vector Equation: A vector image can be created by treating the points on the line as
vectors. For any point (x, y), the vector can be represented as 𝑣 = ⟨𝑥, 𝑥 + 3⟩, which is
Problem2: Show mathematically how you can create a different color Palettes
Function/Parameter Purpose
glutDisplayFunc(display);
Registers the display function as the display callback, which is
called whenever the window needs to be redrawn.
scene in (a);
Represents the scene or graphical content that is being rendered in
part (a) of the program.
gluOrtho2D(l, r, b, t);
Defines a 2D orthographic projection with left (l), right (r), bottom
(b), and top (t) clipping boundaries.
GL_LINE
Used in OpenGL to specify that a shape should be drawn as a line or a
series of connected line segments.
Parameters defining the left (l) and bottom (b) boundaries of the
l and b in (c)
viewport or coordinate system in part (c) of the program.
OR
Function/Parameter Purpose
glutDisplayFunc(display); Sets the display callback function.
scene in (a); likely refers to rendering objects.
gluOrtho2D(l, r, b, t); Sets a 2D orthographic projec on.
GL_LINE Used to draw lines in OpenGL.
l and b in (c) l (le ) and b (bo om) set the viewport limits.
Problem4: Suppose you need to design the given image using glut. Write the
code to represent the image only showing the vertex plotting part using the
given sample. You must show all the elements given in the samples.
Sample:
glBegin(PRIMITIVE);
glVertex2f(x1, y1);
glVertex2f(x2, y2);
glVertex2f(x3, y3);
...
...
glEnd();
Ans:
// Draw the square using GL_QUADS
glColor3f(0.5f, 0.5f, 0.5f); // Gray color
glBegin(GL_QUADS); // PRIMITIVE is GL_QUADS
glVertex2f(-0.5f, -0.5f);
glVertex2f(0.5f, -0.5f);
glVertex2f(0.5f, 0.5f);
glVertex2f(-0.5f, 0.5f);
glEnd();
Sample:
glBegin(PRIMITIVE);
glVertex2f(x1, y1);
glVertex2f(x2, y2);
glVertex2f(x3, y3);
...
...
glEnd();
Ans:
// Draw the square using GL_QUADS
glColor3f(0.5f, 0.5f, 0.5f); // Gray color
glBegin(GL_QUADS); // PRIMITIVE is GL_QUADS
glVertex2f(-0.5f, -0.5f);
glVertex2f(0.5f, -0.5f);
glVertex2f(0.5f, 0.5f);
glVertex2f(-0.5f, 0.5f);
glEnd();
Primitive Description
GL_POINTS Draws individual points
GL_LINES Draws separate line segments (every two vertices form a line)
GL_LINE_STRIP Draws a connected sequence of lines
GL_LINE_LOOP Same as GL_LINE_STRIP but connects the last vertex to the first
GL_TRIANGLES Draws separate triangles (every three vertices form a triangle)
GL_TRIANGLE_STRIP Connected triangles that share vertices
GL_TRIANGLE_FAN Like GL_TRIANGLE_STRIP, but with a shared center vertex
GL_QUADS Draws separate quadrilaterals (four vertices per quad)
GL_QUAD_STRIP A connected strip of quadrilaterals
GL_POLYGON Draws a filled convex polygon
Scan Conversation
Scan Conversion is the process of converting geometric shapes (such as lines, triangles, and
polygons) into a set of pixels that can be displayed on a screen. It is a key step in rasterization,
ensuring that vector-based graphics are properly mapped to a raster display.
Rasterization
Rasterization is the process of converting vector graphics (shapes) into a raster image
(pixels) for display, printing, or storage.
Incremental Algorithm
Incremental Algorithm is a line drawing method that starts from the initial pixel and
progresses step by step to the final pixel.
Formula
if M< 1 if M >1
𝟏
𝒙𝒏𝒆𝒘 = 𝒙𝒐𝒍𝒅 + 𝟏 𝒙𝒏𝒆𝒘 = 𝒓𝒐𝒖𝒏𝒅(𝒙𝒐𝒍𝒅 + )
𝒎
if M=1
𝒙𝒏𝒆𝒘 = 𝒙𝒐𝒍𝒅 + 𝟏
𝒚𝒏𝒆𝒘 = 𝒚𝒐𝒍𝒅 + 𝟏
Practice Problem
Problem1: Use the DDA algorithm to determine the pixel positions for the
given line segment from (x₁, y₁) to (x₂, y₂) as shown in the graph.
Is given,
X1= 2 Y1= 3
X2 = 6 Y2 = 8
We Know,
𝑚= = = 1.25 > 1
if 𝒎 > 𝟏 𝒕𝒉𝒆𝒏,
𝟏
𝒙𝒏𝒆𝒘 = 𝒓𝒐𝒖𝒏𝒅(𝒙𝒐𝒍𝒅 + )
𝒎
𝒚𝒏𝒆𝒘 = 𝒚𝒐𝒍𝒅 + 𝟏
𝒙𝒐𝒍𝒅 𝒚𝒐𝒍𝒅 𝒙𝒏𝒆𝒘 𝒚𝒏𝒆𝒘 𝒙𝒑𝒍𝒐𝒕 𝒚𝒑𝒍𝒐𝒕
2 3 (𝑥 + ) = (2+
.
) = 2.8 𝑦 +1=3+1=4 𝑟𝑜𝑢𝑛𝑑(2.8) = 3 4
2.8 4 (𝑥 + ) = (2.8+
.
) = 3.6 𝑦 +1=4+1=5 𝑟𝑜𝑢𝑛𝑑(3.6) = 4 5
3.6 5 4.4 6 4 6
4.4 6 5.2 7 5 7
5.2 7 6 8 6 8
Problem2: Use the Digital Differential Analyzer (DDA) algorithm to find
and plot the intermediate points for the line segment between (2,3) & (8,6).
Is given,
X1= 2 Y1= 3
X2 = 8 Y2 = 6
We Know,
𝑚= = = 0.5 < 1
if 𝒎 < 𝟏 𝒕𝒉𝒆𝒏,
𝒙𝒏𝒆𝒘 = 𝒙𝒐𝒍𝒅 + 𝟏
𝒚𝒏𝒆𝒘 = 𝒓𝒐𝒖𝒏𝒅(𝒚𝒐𝒍𝒅 + 𝒎)
𝒙𝒐𝒍𝒅 𝒚𝒐𝒍𝒅 𝒙𝒏𝒆𝒘 𝒚𝒏𝒆𝒘 𝒙𝒑𝒍𝒐𝒕 𝒚𝒑𝒍𝒐𝒕
4 4 5 4.5 5 5
5 4.5 6 5 6 5
6 5 7 5.5 7 6
7 5.5 8 6 8 6
We See the Staircase (Jagged) Effect The actual straight line is smooth, but due to pixel
approxima on, it appears jagged on a digital display
Problem3: Use the Digital Differential Analyzer (DDA) algorithm to find and
plot the intermediate points for the line segment between A= (2,2) & B= (2,7).
Is given,
X1= 2 Y1= 2
X2 = 2 Y2 = 7
We Know,
𝑚= = = = 𝒖𝒏𝒅𝒆𝒇𝒊𝒏𝒆𝒅
So Theoretically,
DDA does not allow vertical lines.
it works with special adjustments to handle them.
Special Adjustments,
A= (2,2), B= (2,7)
≫ ∆𝒙 = 𝒙𝟐 − 𝒙𝟏 = 𝟐 − 𝟐 = 𝟎
≫ ∆𝒚 = 𝒚𝟐 − 𝒚𝟏 = 𝟕 − 𝟐 = 𝟓
≫ 𝑵𝒐. 𝒐𝒇 𝒔𝒕𝒆𝒑 = 𝟓 [largest value between ∆x & ∆y]
∆𝒙 𝟎
≫ 𝑺𝒕𝒆𝒑 𝒔𝒊𝒛𝒆 𝒇𝒐𝒓 x = = =𝟎
𝑵𝒐. 𝒐𝒇 𝒔𝒕𝒆𝒑 𝟓
∆𝒚 𝟓
≫ 𝑺𝒕𝒆𝒑 𝒔𝒊𝒛𝒆 𝒇𝒐𝒓 y = = =𝟏
𝑵𝒐. 𝒐𝒇 𝒔𝒕𝒆𝒑 𝟓
2 2 2+0 = 2 2+1 = 3 2 3
2 3 2+0 = 2 3+1 = 4 2 4
2 4 2 5 2 5
2 5 2 6 2 6
2 6 2 7 2 7
Table: Intermediate Points Calculated Using DDA Fig: DDA Line Plot for A (2,2) to B (2,7)
Bresenham's Mid-Point Line Algorithm
Type: Incremental line drawing algorithm.
Purpose: Approximates a straight line between two points.
Approach: Uses decision parameter to choose the next pixel.
Efficiency: Avoids floating-point calculations.
Initial Decision Parameter: Based on midpoint between two candidate pixels.
Update: Decision parameter updated incrementally.
Best For: Lines with gentle slope (0 ≤ m ≤ 1); can be adapted for other slopes.
𝐝𝐲
≫𝐲= 𝒙+𝐜
𝒅𝒙
≫ 𝐝𝐲. 𝐱 − 𝐝𝐱. 𝐲 + 𝐝𝐱. 𝐜 = 𝟎
Where:
𝐚 = 𝐝𝐲;
𝐛 = −𝐝𝐱;
𝐂 = 𝐝𝐱. 𝐜;
𝐄 (𝐄𝐚𝐬𝐭): (𝒙𝒑 + 𝟏, 𝒚𝒑 )
𝐍𝐄 (𝐍𝐨𝐫𝐭𝐡_𝐄𝐚𝐬𝐭): (𝒙𝒑 + 𝟏, 𝒚𝒑 + 1)
1
𝑚𝑖𝑑 = 𝒙𝒑 + 𝟏, 𝒚𝒑 +
2
𝒘𝒆 𝒌𝒏𝒐𝒘,
𝒘𝒆 𝒌𝒏𝒐𝒘, 1
1 𝑚𝑖𝑑 = 𝒙𝒑 + 𝟏, 𝒚𝒑 +
2
𝑚𝑖𝑑 = 𝒙𝒑 + 𝟏, 𝒚𝒑 + 1
2
1 ≫ 𝑚𝑖𝑑 = 𝒙𝒑 + 𝟏 + 𝟏, 𝒚𝒑 + + 𝟏
2
≫ 𝑚𝑖𝑑 = 𝒙𝒑 + 𝟏 + 𝟏, 𝒚𝒑 + 3 1
2 ≫ ∆𝑑 = 𝑓 𝒙𝒑 + 2, 𝒚𝒑 + − 𝒇 𝒙𝒑 + 1, 𝒚𝒑 +
1 1 2 2
≫ ∆𝑑 = 𝑓 𝒙𝒑 + 2, 𝒚𝒑 + − 𝒇 𝒙𝒑 + 1, 𝒚𝒑 +
=a+b
2 2
=a = 𝒅𝒚 − 𝒅𝒙
= 𝒅𝒚 ≫ 2 × ∆𝑑 = 2(𝑑𝑦 − 𝑑𝑥)
≫ 2 × ∆𝑑 = 2𝑑𝑦 𝑑𝑁𝐸 = 2(𝑑𝑦 − 𝑑𝑥)
𝑑𝐸 = 2𝑑𝑦
𝒊𝒇,
1
𝑚𝑖𝑑 = 𝒙𝟎 + 𝟏, 𝒚𝟎 +
2
≫ 𝑑 = 𝑓(𝑚𝑖𝑑 )
1
≫ 𝑑 = 𝑓 𝒙𝟎 + 1, 𝒚𝟎 +
2
𝟏
= 𝑎(𝒙𝟎 + 𝟏) + 𝒃 𝒚𝟎 + +𝒄
𝟐
𝒃
= 𝑎 𝒙𝟎 + 𝒃 𝒚 𝟎 + 𝒄 + 𝒂 + ∵ 𝑎 𝒙𝟎 + 𝒃 𝒚 𝟎 + 𝒄 = 𝟎
𝟐
𝒃
=𝟎+𝒂+
𝟐
𝒃
≫ 2 × 𝑑 = 2(𝒂 + )
𝟐
𝑑 = 2𝑎 + 𝑏
𝒅𝒔𝒕𝒂𝒓𝒕 = 𝟐. 𝒅𝒚 − 𝒅𝒙
Problem1: Using Bresenham’s Midpoint Line Algorithm, draw a line from point
(2, 3) to point (10, 6). Show all steps including the initial decision parameter and
how it is updated at each step. Plot the pixels selected by the algorithm.
Is given,
X0 = 02 Y0 = 3
X1 = 10 Y1 = 6
= −2 ≤ 0 → (3,3)
Step 3: Find the Next Pixel Values
𝒅𝒏𝒆𝒘 = 𝒅𝒐𝒍𝒅 + 𝒅𝑬 𝒅𝒏𝒆𝒘 = 𝒅𝒐𝒍𝒅 + 𝒅𝑵𝑬
3.1 3.2
𝒅𝒏𝒆𝒘 = −𝟐 + 𝟐𝒅𝒚 𝒅𝒏𝒆𝒘 = 𝟒 + 𝟐(𝒅𝒚 − 𝒅𝒙)
= −𝟐 + 𝟐 × 𝟑 = 𝟒 + 𝟐(𝟑 − 𝟖)
𝑁𝐸 𝐸
=𝟒>0 (4,4) = −𝟔 ≤ 0 → (5,4)
3.3 𝒅𝒏𝒆𝒘 = 𝒅𝒐𝒍𝒅 + 𝒅𝑬 3.4 𝒅𝒏𝒆𝒘 = 𝒅𝒐𝒍𝒅 + 𝒅𝑬
𝒅𝒏𝒆𝒘 = −𝟔 + 𝟐𝒅𝒚 𝒅𝒏𝒆𝒘 = 𝟎 + 𝟐𝒅𝒚
= −𝟔 + 𝟐 × 𝟑 =𝟎+𝟐×𝟑
𝐸 𝑁𝐸
= 𝟎 ≤ 0 → (6,4) =𝟔>0 (7,5)
Problem2: Using Bresenham’s Midpoint Line Algorithm, draw a line from point
(1, 1) to point (7, 6). Show all steps including the initial decision parameter and how
it is updated at each step. Plot the pixels selected by the algorithm.
Is given,
X0 = 1 Y0 = 1
X1 = 7 Y1 = 6
≫ dx = x1 − x0 = 7 − 1 = 6 𝒘𝒆 𝒌𝒏𝒐𝒘,
≫ dy = y1 − y0 = 6 − 1 = 5 𝒅𝒔𝒕𝒂𝒓𝒕 = 𝟐. 𝒅𝒚 − 𝒅𝒙
≫ dy − dx = 5 − 6 = −1 = 2×5−6
≫ 2(dy − dx) = 2(−1) = −2 =4>0 (2,2)
Step 3: Find the Next Pixel Values
𝒅𝒏𝒆𝒘 = 𝒅𝒐𝒍𝒅 + 𝒅𝑵𝑬 𝒅𝒏𝒆𝒘 = 𝒅𝒐𝒍𝒅 + 𝒅𝑵𝑬
3.1 3.2
𝒅𝒏𝒆𝒘 = 𝟒 + 𝟐(𝒅𝒚 − 𝒅𝒙) 𝒅𝒏𝒆𝒘 = 𝟐 + 𝟐(𝒅𝒚 − 𝒅𝒙)
=𝟒−𝟐 =𝟐−𝟐
𝑁𝐸 𝐸
=𝟐>0 (3,3) = 𝟎 ≤ 0 → (4,3)
3.3 𝒅𝒏𝒆𝒘 = 𝒅𝒐𝒍𝒅 + 𝒅𝑬 3.4 𝒅𝒏𝒆𝒘 = 𝒅𝒐𝒍𝒅 + 𝒅𝑵𝑬
𝒅𝒏𝒆𝒘 = 𝟎 + 𝟐𝒅𝒚 𝒅𝒏𝒆𝒘 = 𝟏𝟎 + 𝟐(𝒅𝒚 − 𝒅𝒙)
=𝟎+𝟐×𝟓 = 𝟏𝟎 − 𝟐
𝑁𝐸 𝑁𝐸
= 𝟏𝟎 > 0 (5,4) =𝟖>0 (6,5)
Problem3: Using Bresenham’s Midpoint Line Algorithm, draw a line from point
(2, 1) to point (2, 7). Show all steps including the initial decision parameter and how
it is updated at each step. Plot the pixels selected by the algorithm.
Is given,
X0 = 2 Y0 = 1
X1 = 2 Y1 = 7
≫ dx = x1 − x0 = 2 − 2 = 0
≫ dy = y1 − y0 = 7 − 1 = 6
So, Vertical lines aren't handled normally in Bresenham’s algorithm because dx = 0, so x doesn't
change. The algorithm relies on x-increment to update the decision parameter, which doesn't
work for vertical lines. Special handling is required.
Problem4: Using Bresenham’s Midpoint Line Algorithm, draw a line from point
(9, 5) to point (15, 13). Show all steps including the initial decision parameter and
how it is updated at each step. Plot the pixels selected by the algorithm.
Is given,
X0 = 09 Y0 = 05
X1 = 15 Y1 = 13
≫ dx = x1 − x0 = 15 − 9 = 6 𝒘𝒆 𝒌𝒏𝒐𝒘,
≫ dy = y1 − y0 = 13 − 5 = 8 𝒅𝒔𝒕𝒂𝒓𝒕 = 𝟐. 𝒅𝒚 − 𝒅𝒙
≫ dy − dx = 8 − 6 = 2 = 2×8−6
≫ 2(dy − dx) = 2(2) = 4 = 10 > 0 (10,6)
Step 3: Find the Next Pixel Values
𝒅𝒏𝒆𝒘 = 𝒅𝒐𝒍𝒅 + 𝒅𝑵𝑬 𝒅𝒏𝒆𝒘 = 𝒅𝒐𝒍𝒅 + 𝒅𝑵𝑬
3.1 3.2
𝒅𝒏𝒆𝒘 = 𝟏𝟎 + 𝟐(𝒅𝒚 − 𝒅𝒙) 𝒅𝒏𝒆𝒘 = 𝟏𝟒 + 𝟐(𝒅𝒚 − 𝒅𝒙)
= 𝟏𝟎 + 𝟒 = 𝟏𝟒 + 𝟒
𝑁𝐸 𝑁𝐸
= 𝟏𝟒 > 0 (11,7) = 𝟏𝟖 > 0 (12,8)
This is the output of Bresenham’s algorithm for this line. The algorithm ensures that the line is as close as
possible to the true line while using only integer arithmetic.
Derivation of Bresenham's Midpoint Circle Drawing Algorithm
We Know,
Circle Equation:
The general Circle equa on:
≫ 𝒙𝟐 + 𝒚𝟐 = 𝑹𝟐
𝐟(𝐱, 𝐲) = 𝒙𝟐 + 𝒚𝟐 − 𝑹𝟐
8-fold Symmetry
𝐄 (𝐄𝐚𝐬𝐭): (𝒙𝒑 + 𝟏, 𝐲𝒑 )
S𝐄 (South_𝐄𝐚𝐬𝐭): (𝒙𝒑 + 𝟏, 𝒚𝒑 − 1)
1
𝑚𝑖𝑑 = 𝒙𝒑 + 1, 𝒚𝒑 −
2
𝒘𝒆 𝒌𝒏𝒐𝒘,
1 𝒘𝒆 𝒌𝒏𝒐𝒘,
𝑚𝑖𝑑 = 𝒙𝒑 + 𝟏, 𝒚𝒑 − 1
2 𝑚𝑖𝑑 = 𝒙𝒑 + 𝟏, 𝒚𝒑 −
1 2
≫ 𝑚𝑖𝑑 = 𝒙𝒑 + 𝟏 + 𝟏, 𝒚𝒑 − 1
2 ≫ 𝑚𝑖𝑑 = 𝒙𝒑 + 𝟏 + 𝟏, 𝒚𝒑 − − 𝟏
1 𝟐 2
= 𝒙𝒑 + 2 + ( 𝒚𝒑 − ) − 𝑹𝟐
2 𝟐
3
)
≫ ∆𝑑 = 𝑓(𝒎𝒊𝒅𝑬 − 𝒇(𝑚) = 𝒙𝒑 + 2 + ( 𝒚 𝒑 − ) − 𝑹𝟐
2
= 𝟐𝒙𝒑 + 𝟑
≫ ∆𝑑 = 𝑓(𝒎𝒊𝒅𝑺𝑬 ) − 𝒇(𝒎 )
≫ ℎ + ∆𝑑 = 2𝑥 + 3 + ℎ = 𝟐(𝒙𝒑 − 𝒚𝒑 ) + 𝟓
ℎ = 2𝑥 + 3 + ℎ
≫ ℎ + ∆𝑑 = 2(𝑥 − 𝑦 ) + 5 + ℎ
ℎ = 2(𝑥 − 𝑦 ) + 5 + ℎ
𝒉𝒏𝒆𝒘 = 𝒉𝒐𝒍𝒅 + 𝟐𝒙𝒑 + 𝟑
𝒊𝒇,
1
𝑚𝑖𝑑 = 𝒙𝟎 + 𝟏, 𝒚𝟎 −
2
≫ 𝑑 = 𝑓(𝑚𝑖𝑑 )
1
≫ 𝑑 = 𝑓 𝒙𝟎 + 1, 𝒚𝟎 −
2
1
= 𝑓 (0 + 1), (𝐑 − )
2
1 𝟓
= 1 + (𝑅 − ) − 𝑅 = − 𝑹
2 𝟒
1 5 1
≫ 𝑑 − = −𝑅−
4 4 4
ℎ =1−𝑅
𝒉𝒔𝒕𝒂𝒓𝒕 = 𝟏 − 𝑹
≫SO, 8-fold Symmetry are:
(c)
≫is given,
≫ (𝑥) +(𝑦) = 49
≫ (𝑥) +(𝑦) = 7
= −6 < 0 → (1,7)
(e)
Octant 2 Octant 6 Octant 1 Octant 5 Octant 3 Octant 7 Octant 4 Octant 8
(0,7) (-0,-7) (7,0) (-7,-0) (-0,7) (0,-7) (-7,0) (7,-0)
(1,7) (-1,-7) (7,1) (-7,-1) (-1,7) (1,-7) (-7,1) (7,-1)
(2,7) (-2,-7) (7,2) (-7,-2) (-2,7) (2,-7) (-7,2) (7,-2)
(3,6) (-3,-6) (6,3) (-6,-3) (-3,6) (3,-6) (-6,3) (6,-3)
(4,6) (-4,-6) (6,4) (-6,-4) (-4,6) (4,-6) (-6,4) (6,-4)
(5,5) (-5,-5) (5,5) (-5,-5) (-5,5) (5,-5) (-5,5) (5,-5)
Problem2: Using Bresenham’s Midpoint Circle Algorithm, For the given
equations of circle (𝑥 + 2) +(𝑦 − 3) = 49
a. Find the center of the circle
b. Find the radius of the circle
c. Initial coordinate
d. Coordinate for Octant 2
e. Find the coordinates for the other 7 octants.
(a) (b)
≫is given, ≫is given,
≫ (𝑥 + 2) +(𝑦 − 3) = 49 ≫ (𝑥 + 2) +(𝑦 − 3) = 49
≫ (𝑥 + 2) +(𝑦 − 3) = 7 ≫ (𝑥 + 2) +(𝑦 − 3) = 7
(c)
≫is given,
≫ (𝑥 + 2) +(𝑦 − 3) = 49
≫ (𝑥 + 2) +(𝑦 − 3) = 7
𝑆𝑜, 𝑖𝑛𝑖𝑡𝑖𝑎𝑙 𝑐𝑜𝑜𝑟𝑑𝑖𝑛𝑎𝑡𝑒 = (0, 𝑟 ) = (0,7)
(d)
Step 1: Ini al Decision Parameter
= −6 < 0 → (1,7)
Step 2: Find the Next Pixel Values
(e)
Octant 2 Octant 6 Octant 1 Octant 5 Octant 3 Octant 7 Octant 4 Octant 8
(0,7) (-0,-7) (7,0) (-7,-0) (-0,7) (0,-7) (-7,0) (7,-0)
(1,7) (-1,-7) (7,1) (-7,-1) (-1,7) (1,-7) (-7,1) (7,-1)
(2,7) (-2,-7) (7,2) (-7,-2) (-2,7) (2,-7) (-7,2) (7,-2)
(3,6) (-3,-6) (6,3) (-6,-3) (-3,6) (3,-6) (-6,3) (6,-3)
(4,6) (-4,-6) (6,4) (-6,-4) (-4,6) (4,-6) (-6,4) (6,-4)
(5,5) (-5,-5) (5,5) (-5,-5) (-5,5) (5,-5) (-5,5) (5,-5)
2. In coloring, the technique that uses a storage approach to iden fy the color codes is known as:
A. Direct Coding
B. Lookup Table
C. Rasterization
D. Halftone
A. Overlapping pixels
B. Floating point pixel grid
C. Slope
D. Disjoint colors in pixels
4. What’s the formula for the decision parameter in East for Bresenham’s midpoint circle
algorithm:
A. d0 + 2x + 3
B. d0 + 2(x – y) + 5
C. x2 + y2 – R2
D. 1 - R
A. glColor3ub()
B. glEnd()
C. glutDisplayFunc()
D. gluFlush()
6. For the equa on (x+5)2+ (y-7)2 = 16 The ini al Y co-ordinate for Bresenham’s midpoint line
algorithm is generally considered:
A. 16
B. 4
C. 5
D. 7
7. The property of Hal oning is:
A. Cyan
B. Black
C. Magenta
D. Yellow
9. When we require more default colors for a system which of the following need not to be
applied:
10. The default value of Le in the co-ordinate system in OpenGL with respect to GluOrtho2D() is:
A. 0
B. -1
C. 1
D. None of the above
11. The number of pixels stored in the frame buffer of a graphics system is known as
A. Depth
B. Resolution
C. Image
D. Pixel
A. Y = G + R
B. C = R + G
C. Y = W – G
D. M = R + G
A. TIFF
B. PCX
C. GIF
D. PICT
A. Scan Conversation
B. Rasterization
C. Halftoning
D. Dithering
16. To use Polygon primi ve, the least number of points needed?
A. 3
B. 1
C. 2
D. None of the above
A. Primitives
B. Bitmaps
C. Texture
D. All of the above
18. For a par cular situa on you are using the formula x=x+1 and y=round(y+m) for DDA. What
could be the situa on?
A. m>1
B. m=1
C. m=0
D. m<1
19. The binary for color intensity values (136, 85, 212) is:
20. (x-3)2 + (y-5)2 = 49, considering the equa on, which one of the following would be the ini al
Y coordinate according to Bresenham’s midpoint circle algorithm?
A. 1
B. 3
C. 7
D. 8
A. Magenta
B. Cyan
C. Black
D. Yellow
A. 8
B. 256
C. 100
D. 200
A. AI
B. PCX
C. CGM
D. PICT
A. Resolution
B. Orientation
C. Projection
D. Transformation
25. Scan conversion takes place a er
A. Rendering
B. Mapping
C. Mapping Shading
D. Clipping
A. Position of a pixel
B. Background Color
C. Window Position
D. Window Title
28. Which func on is meant for looping con nuously through glut events?
A. glutDisplayFunc()
B. glutInit(&argc, argv)
C. glutMainLoop()
D. display()
A. Opacity
B. Intensity colors
C. Vertex value
D. GL Primitive type
31. How many ver ces are required to create a four-sided box with lines in OpenGL?
A. 4
B. 2
C. 8
D. Not possible
A. Polygon
B. Points
C. Lines
D. All of the above
A. GIF
B. PICT
C. TIFF
D. GIF
A. 4 way
B. 6 way
C. 8 way
D. 10 way
35. Which of the following is one of the steps for the midpoint circle algorithm?
A. d = 3 − 2r
B. d = 1 − R
C. m = dy/dx
D. ax + by + c = 0
A. x = round(x + m)
B. y = y + 2
C. 2dy
D. ax + by + c = 0
37. For genera ng a line, which features do we need to consider?
A. End point
B. Floating point arithmetic
C. Avoiding floating point arithmetic
D. All of the above
A. Number of pixels
B. Colors assigned to each pixel
C. Display device quality
D. All of the above
A. Scan code
B. Shade
C. Shape
D. None
A. TIFF
B. PCX
C. PICT
D. GIF
42. In coloring, the technique that uses a storage approach to iden fy the color codes is:
A. Direct Coding
B. Lookup Table
C. Rasterization
D. Halftone
43. What is the formula for the decision parameter in East for Bresenham’s midpoint circle
algorithm?
A. d0 + 2x + 3
B. d0 + 2(x - y) + 5
C. 1 - R
D. None
44. If point A (2, 3) belongs to a line having m = 2.5, what will be the next point if DDA is
applied?
A. B(3, 3)
B. B(2, 4)
C. B(3, 4)
D. B(4, 4)
45. If d >= 0, then next which point is selected according to midpoint circle algorithm?
A. East
B. North-East
C. South-East
D. Both A & B
A. glColor3ub()
B. glEnd()
C. glutDisplayFunc()
D. glFlush()
47. For the equa on (x+5)² + (y–7)² = 16 the ini al Y-coordinate for Bresenham’s midpoint line
algorithm is generally considered:
A. 16
B. 4
C. -5
D. 7
A. Line
B. Quad
C. Polygon
D. None
49. An image composed of individual pixels arranged in a grid is referred to as:
A. Vector graphic
B. Raster image
C. Polygon mesh
D. Bezier curve
A. ID Grid
B. 2D Vector
C. Bitmap
D. Coordinates
52. (x-1)2+(y-1)2 = 25, considering the equation, which one of the following would be the initial
point according to Bresenham’s midpoint circle algorithm?
A. (0, 25)
B. (0, 5)
C. (1, 1)
D. (-1, -1)
53. If d > 0, then which one is true for midpoint line algorithm?
A. tan = 2dy - dx
B. East point is selected if d > 0
C. (Δd)E = 2dy
D. (Δd)NE = 2(dy - dx)
10. In midpoint line algorithm, incremental calcula ons are made based on preceding step to
find next y value, in order to form an exact approxima on to a straight line between two points.
12. Resolu on in raster graphics is measured in dpi, or dots per inch. The lower the dpi, the
be er the resolu on.
15. CMYK stores color values for cyan, magenta, yellow, black.
21. Lookup table uses a table like structure to find color codes
28. Subtrac ve color model u lizes transmi ed light for showing an object
29. The number of dots per inch of ink on a printed page determines the resolu on of the
printer
30. Lookup table looks into a table like structure to find the color codes