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

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -