Re: Distance point <=> straight line in space



On Jul 31, 1:43 am, Daniel Kraft <d...@xxxxxxxx> wrote:
... I need to calculate ... distance[s] ...
... unfortunatelly, my program spents
a large amount of time (~ 95% of total runtime)
in this routine ...

I believe *many* applications for distance
can be rewritten to use distance-squared
(i.e., don't take square roots); for example
if (distance(me, pizzashop) < TWO_MILES)
order(pizzashop, Hold_anchovies);
becomes
if (sqdist(me, pizzashop) < FOUR_SQ_MILES)
order(pizzashop, Hold_anchovies);

Can your application be so rewritten?

James
.



Relevant Pages

  • Re: Distance point <=> straight line in space
    ... in this routine ... ... don't take square roots); ... if (sqdist(me, pizzashop) < FOUR_SQ_MILES) ... square root per iteration in my algorithm; but I thought it would be clearer to state the problem in terms of distance not distance squared:) ...
    (comp.programming)
  • Re: Color conversion
    ... > I test the distance between two colors aand b ... {This routine returns the distance divided by 256} ...
    (borland.public.delphi.language.basm)
  • Re: metric or measure?
    ... the distance between a and b has to be no greater than the ... In many real-world applications, there ... that are zero distance apart by the metric. ... consider also cosine similarity with colinear tuples.) ...
    (alt.usage.english)
  • Re: 4 hundred quadrillonth?
    ... blood cell compared to the distance between Earth and the sun. ... are very few applications that need more accuracy than that. ...
    (comp.lang.python)
  • Re: distance approximation in 3D
    ... I need this for the pathfinder and the standard math forumla is way to expensive to compute.. ... applications where you're just comparing the relative values of distances. ... Sometimes, one does not need the accuracy anyway, and should just use MAX or SUM to find the distance. ...
    (rec.games.roguelike.development)