Re: A83: Calculating Distances Fast - any suggestions ?
[Prev][Next][Index][Thread]
Re: A83: Calculating Distances Fast - any suggestions ?
> Since I really dont think there is a very good approximation
> algorithm for distance (without tons of iterations), perhaps you can
> attack the problem in a different manner. For instance, I doubt when
> drawing the lines for the vector based system you really need to know the
> length of a straight line between the two points.
Distance isn't used when drawing unfilled polygons, anyway. But it has
many, many other uses in a vector engine, such as collision detection.
> I would suggest in your "drawing loop" you increment parallel counters for
> X and Y using the slope of the line which could be easily calculated
> beforehand. ie. X would increment by one, whereas Y would increment by
> abs((y1-y0)/(x1-x0))
In other words, use Bresenham's line algorithm? :)
_____________________________________________
NetZero - Defenders of the Free World
Click here for FREE Internet Access and Email
http://www.netzero.net/download/index.html
Follow-Ups:
References: