Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
Solved

Fastest Bresenham algorithm

Posted on 2002-03-13
Medium Priority
1,216 Views
Hi Experts,

I've read one in a book, there is the most fastest line algorithm founded by two university guys, I don't remember the name but their algorithm is based on improved Bresenham.

So please can someone create a line function which I can simply use based on that fastest improved Bresenham ?

for example a function like this :

function Line(x1, y1, x2, y2: integer)

So I can simply use that on my program thanks alot experts... you are all always great on helping student like me :)
0
Question by:comicboy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 2

LVL 11

Expert Comment

ID: 6860615
I searched on Google with "improved Bresenham2 and found this http://www.cs.unc.edu/~davemc/Class/136/Lecture9/Lines.html
The source is in C, but conversion should be easy.
0

Accepted Solution

Rabster earned 200 total points
ID: 6860994
A guy called G. Hoffman has adapted a routine from C based on an algorithm from a Kenny Hoff. This is an improved version of Bresenham's algorithm:

Procedure MakeBLine(p0,q0,p1,q1, pal,col : Byte);
var
x,y,dx,dy,
ix,iy,du,
dr,pp,cp,
i : Integer;
Begin
dx := p1-p0;
dy := q1-q0;
x := p0;
y := q0;
cp := 0;
If dx > 0 then
ix:= 1
else
begin
ix := -1;
cp := -1;
end;
if dy > 0 then
iy := 1
else
iy := -1;
begin
For i := 0 to adx do
begin
{SpcSixel(x,y,pal,col);  }
x:= x + ix;
If pp > cp then
begin
y := y + iy;
pp := pp + du;
end
else
pp := pp + dr;
end;
end
else
begin
For i := 0 to ady do
begin
{SpcSixel(x,y,pal,col); }
y := y + iy;
If pp > cp then
begin
x := x + ix;
pp := pp + du;
end
else
pp := pp + dr;
end;
end;
end;
0

Author Comment

ID: 6864104
Well thanks, Robert and Rabster, now my turn to try your code...
0

Author Comment

ID: 6920718
Sorry for long delay, my Delphi disc broken but now it's up again, I've tried your code...

Excellent!!! it's working as best and as fast as I need

Thanks :)
0

Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month9 days, 12 hours left to enroll