Development > Coding

Trying to speed up code for Routing

<< < (2/2)

Sandro:
Somehow missed this topic earlier. :(

A quick answer:

1) Intent of this code is stated just a few lines above: "/* put the crosspoint DIST_EPSILON pixels on the near side */". The same comment is present in the original Quake2 source code, which also uses the same signs; in fact, UFO:AI code is 100% identical here.

2) First Quake uses a different approach, with a single fraction, like  Namerutan proposes. So calculating two fraction for the split is the intentional by the engeine developers.

3) Quake3 collision detection code is seriously refactored, but this calculation is identical to the Quake2 and the UFO:AI. So this math is likely to be intentional rather than bug.

4) CPU consumption by calculating fractions separately is marginal; main cost lies in the AABB vs arbitrary polytope collision detection.

So, unless someone sits with paper & pencil to redo the math, I'd recommend to keep it as it is.

PS: Routing code can (and, likely, should) be optimized, that is true. But not here.

Navigation

[0] Message Index

[*] Previous page

Go to full version