public static InspectableVectorPoint Create <TPoint>(IVectorPoint <TPoint> point)
     where TPoint : IGridPoint <TPoint>, IVectorPoint <TPoint>
 {
     return(new InspectableVectorPoint
     {
         x = point.X,
         y = point.Y
     });
 }
Esempio n. 2
0
 public static double GetDistance(IVectorPoint a, IVectorPoint b, Distance.GetDistance measure = null)
 {
     if (a is DoubleVectorPoint && b is DoubleVectorPoint)
     {
         return(measure(((DoubleVectorPoint)a).Vector, ((DoubleVectorPoint)b).Vector));
     }
     else if (a is StringVectorPoint && b is StringVectorPoint)
     {
         return(Distance.Levenshtein(((StringVectorPoint)a).Vector, ((StringVectorPoint)b).Vector));
     }
     else
     {
         throw new ArrayTypeMismatchException(string.Format("Cannot calculate distance between type {0} and type {1}", a.GetType(), b.GetType()));
     }
 }
Esempio n. 3
0
 public static double DistanceFrom(this IVectorPoint a, IVectorPoint b, Distance.GetDistance measrue = null)
 {
     return(GetDistance(a, b, measrue));
 }