Output Primitives PDF

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

Lecture Notes

Topic: Output Primitives: Point and Lines

Dr. Anand Kumar Pandey


Associate Professor CSA
Outlines
• Prerequisite of topic
• Objective
• Introduction
• Points
• Lines
• Attributes of output primitives
• Exercises
• Learning Outcomes
• References
Prerequisite of topic

Before start this topic student should have knowledge about Over view
of mathematical tools.

▪ The student must have science background.


▪ The student should have basic knowledge about architecture of
system.
▪ Having worked on a computer would be an added advantage in
completing the tutorial.
Objective

Two fundamental objects in geometry are points and lines. What are they
and what are its attributes?
Introduction
• The Primitives are the simple geometric functions that are used to
generate various Computer Graphics required by the User. Some most
basic Output primitives are point-position(pixel), and a straight line.

• In graphics, primitives are basic elements, such as lines, curves, and


polygons, which you can combine to create more complex graphical
images. In programming, primitives are the basic operations
supported by the programming language.

SELO: 1,8,9 Reference No.: R1, R2, R3


BCA-303
Introduction
• Those functions in a graphics package that we use to describe the
various picture components are called the graphics output primitives,
or simply primitives.

• The output primitives describing the geometry of objects are typically


referred to as geometric primitives.

SELO: 1,8,9 Reference No.: R1, R2, R3


BCA-303
Points

Q. What is a point?

Ans. A point is a location in space.

SELO: 1,8,9 Reference No.: R1, R2, R3


Points

A geometrical point is a location in space. It has no other characteristics.


It has no length, width, or thickness. It is pure location.

Point plotting is done by converting a single coordinate position


furnished by an application program into appropriate operations for the
output device in use.

SELO: 1,8,9 Reference No.: R1, R2, R3


Points

SELO: 1,8,9 Reference No.: R1, R2, R3


Lines

A line connects two points. It is a basic element in graphics. To draw a line,


you need two points between which you can draw a line. In the following
three algorithms, we refer the one point of line as X0,Y0 and the second
point of line as X1,Y1.

•Line drawing is done by calculating intermediate positions along the line


path between two specified endpoint positions.
•The output device is then directed to fill in those positions between the end
points with some color.
•For some device such as a pen plotter or random scan display, a straight
line can be drawn smoothly from one end point to other.

SELO: 1,8,9 Reference No.: R1, R2, R3


Lines

SELO: 1,8,9 Reference No.: R1, R2, R3


Lines
•Digital devices display a straight line segment by plotting discrete points
between the two endpoints.
•Discrete coordinate positions along the line path are calculated from the
equation of the line.
•For a raster video display, the line intensity is loaded in frame buffer at the
corresponding pixel positions.
•Reading from the frame buffer, the video controller then plots the screen
pixels.
•Screen locations are referenced with integer values, so plotted positions
may only approximate actual line positions between two specified
endpoints.
SELO: 1,8,9 Reference No.: R1, R2, R3
Lines
For example line position of (12.36, 23.87) would be converted to pixel
position (12, 24).

This rounding of coordinate values to integers causes lines to be displayed


with a stair step appearance (“the jaggies”), as represented in fig.

SELO: 1,8,9 Reference No.: R1, R2, R3


Attributes of Output Primitives

• Any parameter that affects the way a primitive is to be displayed is


referred to as an attribute parameter. Example attribute parameters
are color, size etc. A line drawing function for example could contain
parameter to set color, width and other properties.

• For Example: The Line Attributes are:-


- Line type
- Line Width
- Line Color
Exercises

Define points and Lines? What are the basic attributes of line?
References
1. David F. Rogers; Procedural Elements for Computer Graphics; Tata
McGraw-Hill.
2. Amrendra N. Sinha, Arun D. Udai; Computer Graphics; Tata
McGraw-Hill.
3. J. D. Folay, A. V. Dam, S. K. Feiner, J. F. Hughes; Computer
Graphics: Principle & Practice; Addison-Wesley.

You might also like