0% found this document useful (0 votes)
11 views5 pages

Scan converting a straight line

The document discusses various algorithms for scan converting straight lines in computer graphics, including the Digital Differential Analyzer (DDA) and Bresenham's Line Algorithm, highlighting their advantages and disadvantages. It also covers different display technologies, such as random scan and raster scan displays, and introduces key concepts in interactive computer graphics, including frame buffers and display controllers. Additionally, it outlines techniques for user interaction in graphical interfaces, such as dragging, scaling, and gesture input.

Uploaded by

Ravi dahiya
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)
11 views5 pages

Scan converting a straight line

The document discusses various algorithms for scan converting straight lines in computer graphics, including the Digital Differential Analyzer (DDA) and Bresenham's Line Algorithm, highlighting their advantages and disadvantages. It also covers different display technologies, such as random scan and raster scan displays, and introduces key concepts in interactive computer graphics, including frame buffers and display controllers. Additionally, it outlines techniques for user interaction in graphical interfaces, such as dragging, scaling, and gesture input.

Uploaded by

Ravi dahiya
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/ 5

Scan converting a straight line :- A straight line The Simple DDA:- DDA stand for ‘Digital

may be defined by two endpoints and an Differential Analyzer’ also known as


equation the two endpoints are described by incremental method of scan conversion ,
(x1,y1) and (x2,y2). The equation of the line is In this algorithm we can perform the
used to describe the x,y coordinates of all points calculation in a step by step manner. We
that lie between these two endpoints. use the previous step result in next step.
Using the equation of a straight line, y=mx+b General equation of line y=mx+b here m is
where m=dy/dx and b= the y interrupt, we can slope y2-y1/ x2-x1 now we find the slope
find values of by x++ from x=x1, to x=x2. By scan b/w starting point and ending point.
converting these calculated x, y values, we Algorithm :-
represent a line as a sequence of pixels. (i)Compute length = abs(x2-x1)
Algorithm :- (i)Compute dx=x2-x1 (ii) If abs(y2-y1)> length then length=
dy=y2-y1 abs(y2-y1)
m=dy/dx (iii) xinc=( x2-x1)/length
b=y1-mx1 yinc=( y2-y1)/length
(ii) If dx<0 then x=x2 , y=y2 and xend=x1 (iv) x=x1 +0.5
If dx>0 then x=x1 , y=y1 and xend=x2 y=y1 +0.5
(iii) Test to determine whether the entire line (v) i=1
has been drawn. If x>xend then stop. (vi) Plot (trunc (x), trunc (y));
(iv) Plot(x, y) (vii) x=x+ xinc
(v) increment x=x+1 Y=y+ yinc
(vi) Compute the next valued of y from the (viii) i=i+1
equation y=mx+b (ix) If i<=length then go to step(vi)
(vii) Go to step (iii) (x) stop
Advantages : Advantages :- Simplicity: Easy to
1. Efficiency: Fast and computationally implement and understand.
simple, especially for raster displays. Efficient for Low Slopes: Works well for
2. Simplicity: Easy to implement and lines with shallow slopes.
understand. Straightforward Calculation: Uses simple
3. Speed: Suitable for real-time rendering floating-point arithmetic to increment x
with low resource consumption. and y coordinates.
4. Hardware-friendly: Optimized for use in Disadvantages :
hardware like GPUs. Floating-Point Operations: Requires
Disadvantages: floating-point calculations, which are
1. Aliasing: Produces jagged, stair-stepped slower than integer operations.
lines (aliasing) on low-resolution screens. Less Efficient for Steep Slopes:
2. Approximation: The line is an Performance decreases for lines with
approximation, not a perfect continuous steep slopes (close to vertical).
one. Aliasing: Like other basic algorithms, it
3. Limited to raster: Not suitable for non- can produce jagged lines due to pixel
raster (vector) displays. rounding, especially at lower resolutions.
Bresenham’s Line Algorithm :- It is 45 to 90 degree :-
efficient method because it involves only (i)Compute dx= y2-y1
integer addition, subtraction and dy= x2-x1
multiplication operations. These inc1=2dy
Operations can be performed very rapidly inc2=2(dy-dx)
so lines can generated quickly. In this d= inc1-dx
method, next pixel selected in order to (ii) If dx<0, then then y=x2 , x=y2 and xend=y1
form a close approximation to a straight If dx>0 then y=x1 , x=y1 and xend=y2
line between two points. (iii) Plot (x, y)
Algorithm :- 0 to 45 degree (iv) Test to determine whether the entire line
(i)Compute dx=x2-x1 dy=y2-y1 has been drawn. If x>xend then stop.
inc1=2dy inc2=2(dy-dx) d= inc1-dx (v) Compute the location of the next pixel.
(ii) If dx<0, then then x=x2 , y=y2 and xend=x1 If d<0 then d=d+ inc1 else d=d+ inc2 and y=y+1
If dx>0 then x=x1 , y=y1 and xend=x2 (vi) Increment x=x+1
(iii) Plot (x, y) (vii) Plot (y, x).
(iv) Test to see whether the entire line has (viii) Go to step (iv)
been drawn. If x>xend then stop.
(v) Compute the location of the next pixel.
If d<0 then d=d+ inc1 else d=d+ inc2 and
y=y+1
(vi) Increment x=x+1
(vii) Plot (x, y).
(viii) Go to step (iv)
Advantages of Bresenham's Algorithm:
1. Efficient: Uses only integer math,
making it fast.
2. No Floating-Point Operations:
Works well on hardware with limited
floating-point support.
3. Accurate: Produces a good
approximation of a straight line.
Disadvantages:
1. Complex for Steep Slopes: Handling
steep lines can be tricky.
2. Jagged Edges: Can produce aliasing
(jagged lines) on low-res displays.
3. More Complex to Implement:
Harder to code compared to simpler
methods like DDA.
Random Scan Display (Vector Display): Raster Scan Display (Bitmap Display):
• Description: In a random scan • Description: A raster scan display uses a
display, the electron beam is grid of pixels arranged in rows and
directed to any location on the columns. The electron beam scans each
screen based on the vector data (x, y row sequentially from top to bottom,
coordinates), drawing lines directly illuminating the corresponding pixels. It is
from point to point. It is often used widely used in modern computer screens
for vector graphics. and TVs.
• Advantages: • Advantages:
o High-quality and precise lines. o Ideal for displaying complex images,
o Suitable for drawing lines and text, and color graphics.
shapes (e.g., CAD systems, o Suitable for most modern graphics
oscilloscopes). applications (video games, digital
o No pixelation; smooth curves media).
and lines. o Easier to implement and cheaper
• Disadvantages: hardware compared to random
o Cannot efficiently display scan displays.
complex images or large areas • Disadvantages:
(only draws lines). o Lower quality for certain graphics
o More expensive hardware (can appear pixelated or jagged).
(requires high-speed electron o Requires more memory to store
beam control). pixel data.
o Limited to specific types of o The resolution is limited by the
graphics, not ideal for bitmap number of pixels.
images or text.

Computer Graphics is the field of computer science that involves generating,


manipulating, and representing visual images and models with the help of
computers. Computer graphics are used to create visual content for a wide range
of applications, including entertainment, design, simulations, and scientific
visualization. Types :-
Non-interactive computer graphics are static or pre-rendered visual content that
doesn't require user input once displayed. Users only view the graphics but can't
alter or manipulate them.
Interactive computer graphics allow users to actively interact with the graphic
content in real-time. The system responds to user input (like mouse clicks,
keyboard inputs, or touch) and changes the graphical display accordingly.
Components of Interactive Computer Graphics:
Frame Buffer: A frame buffer is a portion of memory used to store pixel data that
is displayed on the screen. It holds the image data that represents the content to
be displayed, such as color values for each pixel. The frame buffer is the memory
area where the image is created or modified in real time based on user
interaction. Once the graphics are processed, they are stored in the frame buffer
before being sent to the display.
Display Controller: A display controller is the hardware responsible for
transferring the image data from the frame buffer to the display screen. It controls
the timing and sequence of displaying the image on the monitor. It manages how
the pixel data stored in the frame buffer is presented on the screen, handling tasks
such as refresh rates and synchronization.
Display (TV Monitor or Screen): A TV monitor or any type of display screen (such
as an LCD or LED monitor) is the physical device that shows the graphics stored in
the frame buffer. The contents of the frame buffer are sent to the display at a high
rate (typically 60 times per second or more) to create the illusion of continuous,
real-time graphics.
A pixel (short for picture element) is the smallest unit of a digital image or
display. It is a single point in a raster image or on a digital screen.

Resolution refers to the amount of detail an image holds, typically defined by the
number of pixels in the image or the display screen. Image Resolution: The
number of pixels in the horizontal and vertical dimensions of the image.

Aspect Ratio refers to the proportional relationship between the width and height
of an image, video, or screen. It’s often expressed as a ratio of width to height
(width:height).

Interlacing is a technique used in video display systems where each frame is


divided into two fields: one containing all the odd-numbered lines (field 1), and
the other containing all the even-numbered lines (field 2). These fields are
displayed alternately, rather than displaying the entire frame at once.

A Color CRT (Cathode Ray Tube) is a type of display technology used primarily in
older television sets and computer monitors. It is a technology that uses electron
beams to project light onto phosphorescent material on the screen to create
images. The CRT is an analog device that uses the principle of electron emission
and phosphor lighting to display images in color.
1. Rubber Band Technique:- The Rubber Band Technique is a common technique
in interactive computer graphics that allows users to visually manipulate graphical
elements (such as lines, shapes, or objects) by "stretching" or "pulling" them with
the mouse (or another pointing device). This is done in a way that resembles the
stretching of a rubber band.
Example: Drawing a rectangle in a graphics program: As you click and drag the
mouse, the corners of the rectangle stretch out (like a rubber band), and the
shape is finalized when you release the mouse button.
2. Pointing and Clicking:- Pointing and clicking is a simple but fundamental
technique in graphical user interfaces. Users move the mouse cursor to an object
on the screen and click (usually with the left mouse button) to select, activate, or
manipulate the object.
Example: Clicking on a button to activate a command, like selecting "Save" in a
word processor.
3. Dragging:- Dragging involves selecting an object or graphical element and
moving it around the screen by holding down the mouse button and dragging the
object to a new location.
Example: Dragging a window to a different location on the desktop.
4. Rotation:- Rotation refers to turning a graphical object around a fixed point,
usually the center of the object or a specific anchor point.
Example: Rotating a 3D model in Blender or adjusting an object in AutoCAD.
5. Scaling:- Scaling involves resizing an object, typically by stretching or shrinking
it.
Example: Resizing a photo or shape in Adobe Photoshop or Illustrator.
6. Drag-and-Drop:- This is a combination of the clicking and dragging techniques.
Users click on an object, drag it to a new location or area, and then "drop" it
there.
Example: Dragging a file from one folder to another in a file explorer or moving a
graphical element in a design program.
7. Selection/Highlighting:- Selection involves clicking on an object or area to make
it active or to manipulate it. Highlighting is often part of the selection process.
Example: Selecting multiple text blocks in a document for formatting or
highlighting an area of an image for cropping.
8. Gesture Input (Touch and Motion):- Gesture-based input uses touch or motion
sensors to recognize and interpret hand or body movements.
Example: Swiping across a smartphone screen to switch between apps or waving
a hand to control a VR interface.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy