I'm lookin to start a new project, and this time around I want to avoid floats as much as possible. (Armor City is pretty float intensive because I didn't realize the GP2X didn't have an FPU untill I was fairly far along, serves me right for starting to code without reading the forums first). Anyway, one of the things I'm having trouble doing without floats is my vector intersection function.
If I have a line from (x1, y1) to (x2, y2), and a bounding box, how can I determine if the line intersects the box without floats. Previously I was calculating the slope of the line, and finding the point at which it crossed vertical and horizontal lines of the bounding box, but that wont work without float slopes. Fixed point math is an option, but I'm just wondering if there are any integer based algorithms for this that I'm not aware of.
If I have a line from (x1, y1) to (x2, y2), and a bounding box, how can I determine if the line intersects the box without floats. Previously I was calculating the slope of the line, and finding the point at which it crossed vertical and horizontal lines of the bounding box, but that wont work without float slopes. Fixed point math is an option, but I'm just wondering if there are any integer based algorithms for this that I'm not aware of.