Вы находитесь на странице: 1из 24

Computer Science III B.

Sc CS Sem : VI Year 2019 - 2020

Subject: Graphics and Multimedia

Google Classroom : oefqdki Subject code: 63A

Output Primitives
Unit: I Drawing Line, Circle and
Ellipse
Dr.M.Manimaran,
Associate Professor,
Department Computer Science, SKACAS
oefqdki - Graphics & Multimedia Unit I Output Primitives 1
Computer Science III B.Sc CS Sem : VI Year 2019 - 2020

Snap talk / Attendance

oefqdki - Graphics & Multimedia Unit I Output Primitives 2


Computer Science III B.Sc CS Sem : VI Year 2019 - 2020

Lecture Agenda
• Introduction to Primitives

• Points & Lines

• Line Drawing Algorithms

– Digital Differential Analyzer (DDA)

– Bresenham’s Algorithm

– Parallel Line Algorithm

oefqdki - Graphics & Multimedia Unit I Output Primitives 3


Computer Science III B.Sc CS Sem : VI Year 2019 - 2020

Expected outcome
After studying this class, you should be able to:

• To understand the concepts of Primitives

• To understand the concepts of Points & Lines

• To understand the concepts of Line Drawing Algorithms

• To understand the concepts of Digital Differential Analyzer (DDA)

• To understand the concepts of Bresenham’s Algorithm

• To understand the concepts of Parallel Line Algorithm

oefqdki - Graphics & Multimedia Unit I Output Primitives 4


Computer Science III B.Sc CS Sem : VI Year 2019 - 2020

Introduction
• For a raster display, a picture is completely specified
by:
• intensity and position of pixels, or/and
• set of complex objects

• Shapes and contours can either be stored in terms of


pixel patterns (bitmaps) or as a set of basic geometric
structures (for example, line segments).

oefqdki - Graphics & Multimedia Unit I Output Primitives 5


Computer Science III B.Sc CS Sem : VI Year 2019 - 2020

Introduction
• Output primitives are the basic geometric structures
which facilitate or describe a scene/picture. Example
of these include:

– points, lines, curves (circles, conics etc), surfaces,


fill colour, character string etc.

oefqdki - Graphics & Multimedia Unit I Output Primitives 6


Computer Science III B.Sc CS Sem : VI Year 2019 - 2020

Points
• A point is shown by
illuminating a pixel
on the screen

oefqdki - Graphics & Multimedia Unit I Output Primitives 7


Computer Science III B.Sc CS Sem : VI Year 2019 - 2020

Lines
• A line segment is completely defined in terms
of its two endpoints.
• A line segment is thus defined as:
Line_Seg = { (x1, y1), (x2, y2) }

oefqdki - Graphics & Multimedia Unit I Output Primitives 8


Computer Science III B.Sc CS Sem : VI Year 2019 - 2020

Lines
y
• A line is
produced by
means of
illuminating a
y2
set of
intermediary
pixels between y1

the two
endpoints.
x
x1 x2

oefqdki - Graphics & Multimedia Unit I Output Primitives 9


Computer Science III B.Sc CS Sem : VI Year 2019 - 2020

Lines
• Lines is digitized into a set of discrete integer
positions that approximate the actual line path.
• Example: A computed line position of (10.48, 20.51)
is converted to pixel position (10, 21).

oefqdki - Graphics & Multimedia Unit I Output Primitives 10


Computer Science III B.Sc CS Sem : VI Year 2019 - 2020

Line
• The rounding of coordinate values to integer causes
all but horizontal and vertical lines to be displayed
with a stair step appearance “the jaggies(informal
name for artifacts in raster images)”.

oefqdki - Graphics & Multimedia Unit I Output Primitives 11


Computer Science III B.Sc CS Sem : VI Year 2019 - 2020

Key Points
• Output Primitives
• Pixel
• Points
• Lines
• End points
• Curves

oefqdki - Graphics & Multimedia Unit I Output Primitives 12


Computer Science III B.Sc CS Sem : VI Year 2019 - 2020

MCQ
1. The basic attributes of a straight line segment
are
a) Type
b) Width
c) Color
d) All of these

oefqdki - Graphics & Multimedia Unit I Output Primitives 13


Computer Science III B.Sc CS Sem : VI Year 2019 - 2020

MCQ
2. A dashed line could be displayed by
generating_________.
a) Inter dash spacing
b) Very short dashes
c) Botha a and b
d) A or B

oefqdki - Graphics & Multimedia Unit I Output Primitives 14


Computer Science III B.Sc CS Sem : VI Year 2019 - 2020

MCQ
3. A dotted line can be displayed by generating
a) Very short dashes with spacing equal to and greater
than dash size
b) Very long dashes with spacing equal to or greater
than dash size
c) Very short dashes with spacing equal to and greater
than dash size
d) Dots

oefqdki - Graphics & Multimedia Unit I Output Primitives 15


Computer Science III B.Sc CS Sem : VI Year 2019 - 2020

MCQ
4. Which of the following is not a line-type?
a) Dashed line
b) Dark line
c) Dotted line
d) Only b

oefqdki - Graphics & Multimedia Unit I Output Primitives 16


Computer Science III B.Sc CS Sem : VI Year 2019 - 2020

MCQ
5). The algorithm which displays line-type attributes
by plotting pixel spans is
a) Raster line algorithm
b) Raster scan algorithm
c) Random line algorithm
d) Random scan algorithm

oefqdki - Graphics & Multimedia Unit I Output Primitives 17


Computer Science III B.Sc CS Sem : VI Year 2019 - 2020

MCQ ANSWERS
1) Answer: d
Explanation: Type, width and colors are the basic
attributes of line.
2) Answer: a
Explanation: The inter dash spacing that is equal to
the length of the solid sections displays dashed line.

oefqdki - Graphics & Multimedia Unit I Output Primitives 18


Computer Science III B.Sc CS Sem : VI Year 2019 - 2020

MCQ ANSWERS
3) Answer: c
Explanation: Very long dashes with spacing equal to or
greater than dash size can displays dotted line.
4) Answer: d
Explanation: Except dark line those are the types of the
line.
5) Answer: a
Explanation: Raster line algorithm displays line-
type attributes.

oefqdki - Graphics & Multimedia Unit I Output Primitives 19


Computer Science III B.Sc CS Sem : VI Year 2019 - 2020

Next Lecture
LINE DRAWING ALGORITHMS

oefqdki - Graphics & Multimedia Unit I Output Primitives 20


Computer Science III B.Sc CS Sem : VI Year 2019 - 2020

Video URL
https://www.youtube.com/watch?v=yZIyWA08s
J4

oefqdki - Graphics & Multimedia Unit I Output Primitives 21


Computer Science III B.Sc CS Sem : VI Year 2019 - 2020

Sanfoundry one mark URL


https://www.sanfoundry.com/computer-
graphics-mcqs-line-attributes/

oefqdki - Graphics & Multimedia Unit I Output Primitives 22


Computer Science III B.Sc CS Sem : VI Year 2019 - 2020

DISCUSSIONS

oefqdki - Graphics & Multimedia Unit I Output Primitives 23


Computer Science III B.Sc CS Sem : VI Year 2019 - 2020

oefqdki - Graphics & Multimedia Unit I Output Primitives 24