Example #1
0
 /**
  *
  */
 internal static IList <IPointIdFloat> RegionQuery(IList <IPointIdFloat> points, IPointIdFloat p, float epsilon)
 {
     return(points.Where(x => p.DistanceTo(x) <= epsilon).ToList());
 }
Example #2
0
        public float Score(IPointIdFloat p, float epsilon, Dictionary <long, int> mapClusters)
        {
            var res = RegionQuery(kdt, p, epsilon);

            if (res.Count() <= 1)
            {
                return(1f);
            }
            else
            {
                var sorted = res.Select(pe => new Tuple <float, int>((float)(1 / (epsilon + p.DistanceTo(pe))), mapClusters[pe.id]))
                             .OrderBy(c => c);
                float score = 0f;
                int   last  = mapClusters[p.id];
                float lastd = 0f;
                foreach (var el in sorted)
                {
                    if (el.Item2 != last)
                    {
                        score += el.Item1 - lastd;
                        lastd  = el.Item1;
                    }
                }
                return(score);
            }
        }