Re: A86: Vector


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

Re: A86: Vector




At 10:59 PM 6/2/98 EDT, you wrote:
>
>How do I 'cast' out a line from [X,Y] at a given angle, and trace it as it
>goes out, until it intersects a line on a 16x8 grid.  Then recording the
[X,Y]
>coordinates of that intersection?
>
>I'm thinking I'm gonna have to make a table of tangent values from 0 to
>359...ugh.
>
Unfortunately that's probably about the best way to do it in asm. If you
need speed, that is. If you don't, you can just do what Dave Phillips said,
just use the math routines and do everything in floating point. But if it
has to be fast, you should do a table of trig values and use Bresenham's
line algorithm. I wouldn't do a table of tangent values, though. I would do
sine values 0-90. You can get all sin and cos values from this, since
they're symmetrical. I could write the code for you, if you want. I've done
it in 80x86 asm, and it would be pretty simple to translate over to Z80 asm.

--Joshua


References: