performance - Standard Method of Simplifying Polynomial Formulas -
i trying reduce time takes (mostly) polynomial formula complete, non-recursive. there exist method in order reduce amount of processing required complete task?
for instance if run code:
if(distance > sqrt(dx*dx + dy*dy)) { dosomething(); }
this better implemented into:
if(distance*distance > dx*dx + dy*dy) { dosomething(); }
my question is, there standard way of knowing how simplify things this, kind of how if have formula, follow pemdas boiled down number. equation trying simplify this:
offset = |distance*(xobj-xcamera)-base*(base-depth)-distance*base| / hypot(distance, base); //variables are: distance, xobj, xcamera, base, depth;
i know couple of ways improve it, more i'd know if can solve methodically vs intuition.
Comments
Post a Comment