Esempio n. 1
0
        public List <int> findAllCloserThan(Candidate query, double dist)
        {
            List <int> result = new List <int>();

            root.findAllCloserThan(query, dist, result);
            return(result);
        }
Esempio n. 2
0
 internal void findAllCloserThan(Candidate query, double dist, List <int> result)
 {
     if (leaf)
     {
         foreach (int i in items)
         {
             double d = query.SqrtDistanceTo(cands[i]);
             if (d < dist)
             {
                 result.Add(i);
             }
         }
     }
     else
     {
         double d = query.SqrtDistanceTo(cands[node]);
         if (d < dist)
         {
             result.Add(node);
         }
         if (d <= (threshold + dist))
         {
             if (close != null)
             {
                 close.findAllCloserThan(query, dist, result);
             }
         }
         if (d >= (threshold - dist))
         {
             far.findAllCloserThan(query, dist, result);
         }
     }
 }