===============================================================================
Date: 08-01-95 Time: 11:24p Number: 155
From: Jan_Reidar Jørgensen Refer: 154
To: Bjørn Stærk Board ID: ROLVSOY Reply: 06-29-95
Subject: Linjer 34: TEAM/Program Status: Public
-------------------------------------------------------------------------------
BS│ Er det noen som kan skaffe meg en rask linjerutine, helst i
BS│ ASM eller C++?
Denne skal visst være en Bresenham algoritme for linje:
Forklaring:
CUR_X : Initial x-axis coordinate
CUR_Y : ........y................
MAJ_AXIS_PCNT : Length of line projected onto major axis (dmajor)
DESTX_DIASTP : 2*dminor-2*dmajor
DESTY_AXSTP : 2*dminor
ERROR_TERM : 2*dminor-dmajor
Programrutine:
draw_line()
{
int xstep,ystep,i;
if (INC_Y) ystep = 1; else ystep = -1;
if (INC_X) ystep = 1; else ystep = -1; ---> xstep???
for (i=0; i0) {
CUR_X += xstep
CUR_Y += ystep
ERROR_TERM += DESTX_DIASTP;
}
else {
// if YMAJAXIS==1 then y axis is the major axis
if(YMAJAXIS) CUR_Y += ystep; else CUR_X += xstep;
ERROR_TERM += DESTY_AXSTP;
}
}
}
HENTET FRA Programmer's Guide to the EGA, VGA and Super VGA Cards
av Richard F. Ferraro. ISBN 0-201-62490-7
╔═╗─╔═╗─╔═╗─╔═╗─> Jan Reidar Jørgensen - jare@rol.bbs.no
──║─╠═╣─╠╦╝─╠═──> SigOp på Rolvsøy BBS: Programmering og Hoved/Dataprat
╚═╝─╝─╚─╝╚╝─╚═╝─> Det er Kjell, det!
===============================================================================