java - Faster math ops -
possible duplicate:
fast algorithm polar -> cartesian conversion
i running pathfinding code (which bit slow) through jvisualvm, found 80% time being spent in vector implementation more part convert cartesian polar,
r = math.sqrt((x * x) + (y * y)); t = math.atan2(y,x);
are there old school tricks me more performance?
in experience in path finding algorithms, problem not lines.
the main questions "how many times call these 2 lines?"
you should investigate path finding algorithm.
anyway, if want reduce delay of lines, possible make pre-calculated table sqrt
, atan2
each x
, y
. or table maps each (x, y) (r, t) directly.
Comments
Post a Comment