Bresenham algorithm

Line is a collection of dots arranged in such a way that has the base and tip. A point on the screen located at the position (x, y), to describe the plot of a pixel corresponds to the position.

Appearance of lines on a computer screen-resolution distinguished by nya.-state pixel resolution is contained in a particular area Example: 640x480 resolution, meaning the screen is 640 pixels kompuer the column and 480 pixels per baris.-resolution can also be divided into coarse, medium and fine. To show or describe lines on the screen takes at least 2 points (endpoint), the beginning and end points.
Free line (Simple Digital Differential Analyzer / DDA) line which runs between 2 points, P1 and P2, are always very yangbesarnya angle bervariasi.-angle formed to determine the slope of a line or called gradient / slop or m.Jika parameters denoted by point - BBK point line is: (x1, y1) and (x2, y2) ΔYY2-makaΔYm = Y1m = X2-X1P1 (x1, y1) P2 (x2, y2) ΔYΔX

Drawing LINE

Bresenham algorithm
Bresenhma algorithm chose the nearest point from the actual path diinkrement Each sampling will be 1 or 0 initial conditions: If m <> Bresenham perform increment and 1 for x 0 or 1 for y. Where will the next pixel in the plot, whether the (xk +1, yk +1) = (xk +1, yk), or (xk +1, yk +1)

Bresenham algorithm for | m | <> was 2Δy decision-p0 = Δx
At each xkdi line, starting from k = 0, test: if pk <1 = ""> pk + "> the plot (xk +1, yk +1) and pk +1 = pk + 2Δy-2Δx
Repeat step 4 Δx times

Comments

One response to “Bresenham algorithm”

Anonymous said...
February 23, 2010 at 3:47 AM

Thank for sharing...

I like it...

Post a Comment