cdolphin

euclidzz

Mar 14th, 2012
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.70 KB | None | 0 0
  1.  
  2. // "space distance" is not a distance in physical space. It is a distance in 76D space.
  3.         //$q = 'select placename from point where true order by SQRT('; //Square root does not change ordering.
  4.         // $q = 'select placename, spacedistance as (';  from point where true order by spacedistance limit 10';
  5.         //$q = 'select distinct placename,mapx,mapy,mapw from point where true order by (';
  6.  
  7.         $q = 'SELECT placename, mapx, mapy, mapw, min(';
  8.  
  9.         for ($i=0; $i < $nTotalMacs; $i++)
  10.         {
  11.                 $q .= 'pow(coord'.($i+1).' - '. $vector[$i].',2)+';
  12.         }
  13.         $q .= ' 0) AS score FROM point '.$wherecondition.' GROUP BY placename ORDER BY score ASC LIMIT 10';
Advertisement
Add Comment
Please, Sign In to add comment