[A86] Re: line draw sub


[Prev][Next][Index][Thread]

[A86] Re: line draw sub




The basic algorithm is

x1 = xOff;
y1 = yOff
x2 = xOff + ( cos(angle) * line_length)
y2 = yOff + ( sin(angle) * line_length)

draw_line(x1,y1,x2,y2);

This assumes that cosine or sine may return a negative number dependending
on what quandrant your in. If your using lookup tables that only cover the
first 90 degrees., you need to encapsulate the call to cos or sin, check
what angle is used and negate the number if necessary. If your using OP
routines, then its handled for you. David's routine I believe uses the upper
8-bit portion exclusively for the sign of the number. Clever

Matt

> I need a quick way to draw lines at a angle from point to point, and I
cant
> quite figure out how to it.






References: