Esempio n. 1
0
 public bool Remove(Position pos)
 {
     var element = positionList
         .FirstOrDefault(p => p.Equals(pos));
     if (element != null)
     {
         positionList.Remove(element);
         return true;
     }
     return false;
 }
Esempio n. 2
0
        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;
        }
Esempio n. 3
0
 public bool Equals(Position p)
 {
     return (X == p.X && Y == p.Y);
 }
Esempio n. 4
0
 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;
 }
Esempio n. 5
0
 public void Add(Position pos)
 {
     positionList.Add(pos);
     positionList = positionList
         .OrderBy(p => p.Lenght()).ToList();
 }