public bool Remove(Position pos)
 {
     var element = positionList
         .FirstOrDefault(p => p.Equals(pos));
     if (element != null)
     {
         positionList.Remove(element);
         return true;
     }
     return false;
 }
        public SortedPosList CircleContent(Position centerPos, double radius)
        {
            var temp = new SortedPosList();

            foreach (var item in positionList)
            {
                if (IsInside(item, centerPos, radius))
                {
                    temp.Add(item);
                }
            }
            return temp;
        }
Exemple #3
0
 public bool Equals(Position p)
 {
     return (X == p.X && Y == p.Y);
 }
 private bool IsInside(Position pos, Position centerPos, double radius)
 {
     if (Math.Pow((pos.X - centerPos.X), 2) + Math.Pow((pos.Y- centerPos.Y), 2) < Math.Pow(radius, 2))
     {
         return true;
     }
     return false;
 }
 public void Add(Position pos)
 {
     positionList.Add(pos);
     positionList = positionList
         .OrderBy(p => p.Lenght()).ToList();
 }