public IComparer <GeoName> Comparator(KDTree.Axis Axis) { switch (Axis) { case KDTree.Axis.X: return(new CompareX()); case KDTree.Axis.Y: return(new CompareY()); case KDTree.Axis.Z: return(new CompareZ()); } throw new ArgumentException("Invalid Axis"); }
public double AxisSquaredDistance(GeoName Location, KDTree.Axis Axis) { double Distance; if (Axis == KDTree.Axis.X) { Distance = GetX() - Location.GetX(); } else if (Axis == KDTree.Axis.Y) { Distance = GetY() - Location.GetY(); } else { Distance = GetZ() - Location.GetZ(); } return(Distance * Distance); }