Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
0Activity
0 of .
Results for:
No results containing your search query
P. 1
Brese Nham algorithm

Brese Nham algorithm

Ratings: (0)|Views: 1 |Likes:
Published by Saran Jl
cad
cad

More info:

Categories:Types, Research
Published by: Saran Jl on May 10, 2013
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOCX, PDF, TXT or read online from Scribd
See more
See less

05/10/2013

pdf

text

original

 
Bresenham’s line algorithm
 
To draw a line with coordinates (0,0) and (5,3) ?
x , y ε
 
0 ,
0 m= Δy / Δx = 3
-0 / 5-0 = 3/5 = 0.6
ε = m
-1 = 0.6-1 = -0.4<01 , 0
ε =
-
0.4+ 0.6 = 0.2˃ 0
 
1 , 1 ε = 0.2 – 
1 = -0.8< 02 , 1
ε =
-0.8 + 0.6 = -0.2< 0
3 , 1 ε =
-
0.2 +0.6 = 0.4˃0
 3 , 2
ε = 0.4 – 
1 = -0.6<0
4 , 2 ε =
-0.6 + 0.6 = 0Consider a line with initial points (x1,y1) and terminal points (x2,y2) in
device space. If Δx = x2 – 
 
x1 and Δy = y2 – 
y1, we define the driving axis to be x axis if |
Δ
x |
≥ | Δy | and y axis if | Δy | ≥ | Δx |. Driving axis is used as the axis of control for the
algorithm. With in the main loop of the algorithm the coordinates corresponding to the drivingaxis is incremented by 1 unit. The coordinates corresponding to other axis is only incremented asneeded.Consider an example in which we have to draw a line from (0 , 0) to (5 , 3).
Bresenham’s algorithm begins with the point (0 , 0) since x is the driving axis. It then increments
x coordinate by 1 rather than keeping the track of y coordinates, the algorithm keeps an error 
 bounded “ε” at each stage, which represent
s negative of the distance from points where lineexists the pixel to the top edge of the pixel. This value is initially set to m
 – 
1, and is
incremented by each time the x coordinate is incremented by 1. If ε > 0, the line has moved up
 by 1 pixel and we must increment the y coordinate and re adjust the error to represent the
distance from the top of the new pixel which is done by subtracting 1 from ε
. The aboveillustration shows the complete operation of the algoriyhm.
Bresenham’s Circle Algorithm
 
Bresen
ham’s circle (Xc , Yc , R)
 Description: Xc and Yc denote x and y coordinates of center of circle and R is the radius.1)
 
Set X = 0 and Y = R 

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->