/// <summary>
        /// Get distance.
        /// </summary>
        /// <param name="point"> point </param>
        /// <returns> Distance between 2 points </returns>
        public double GetDistance(PointS point)
        {
            double dx = X - point.X;
            double dy = Y - point.Y;

            return(Math.Sqrt(dx * dx + dy * dy));
        }
 // Constructor.
 public SetOfMassPoint(IEnumerable <MassPoint> collection, PointS point, double rad)
 {
     _set   = collection.Where(mp => mp.Center.GetDistance(point) <= rad).ToList();
     Radius = rad;
 }
Ejemplo n.º 3
0
 // Constructor.
 public SetOfMassPoints(List <MassPoint> massPoints, PointS point, double radius)
 {
     SpecialSetMassPoints = massPoints.FindAll(
         el => el.Coordinates.GetDistance(point) <= radius);
 }
        /// <summary>
        /// Implementation IComparable.
        /// </summary>
        /// <param name="otherPoint"> Other point </param>
        /// <returns> -1, 0, or 1</returns>
        public int CompareTo(object otherPoint)
        {
            var temp = new PointS(0, 0);

            return(((PointS)otherPoint).GetDistance(temp).CompareTo(GetDistance(temp)));
        }