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; }
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); }
static void Main(string[] args) { Console.WriteLine(new Position(2, 4) + new Position(1, 2) + "\n"); Console.WriteLine(new Position(2, 4) - new Position(1, 2) + "\n"); Console.WriteLine(new Position(1, 2) - new Position(3, 6) + "\n"); Console.WriteLine(new Position(3, 5) % new Position(1, 3) + "\n"); SortedPosList list1 = new SortedPosList(); SortedPosList list2 = new SortedPosList(); list1.Add(new Position(3, 7)); list1.Add(new Position(1, 4)); list1.Add(new Position(2, 6)); list1.Add(new Position(2, 3)); Console.WriteLine(list1 + "\n"); list1.Remove(new Position(2, 6)); Console.WriteLine(list1 + "\n"); list2.Add(new Position(3, 7)); list2.Add(new Position(1, 2)); list2.Add(new Position(3, 6)); list2.Add(new Position(2, 3)); Console.WriteLine((list2 + list1) + "\n"); SortedPosList circleList = new SortedPosList(); circleList.Add(new Position(1, 1)); circleList.Add(new Position(2, 2)); circleList.Add(new Position(3, 3)); Console.WriteLine(circleList.CircleContent(new Position(5, 5), 4) + "\n"); /*VG uppgift test * Console.WriteLine((list2 - list1) + "\n"); * Console.WriteLine((list1 - list2) + "\n"); */ Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine(new Position(2, 4) + new Position(1, 2) + "\n"); Console.WriteLine(new Position(2, 4) - new Position(1, 2) + "\n"); Console.WriteLine(new Position(1, 2) - new Position(3, 6) + "\n"); Console.WriteLine(new Position(3, 5) % new Position(1, 3) + "\n"); SortedPosList list1 = new SortedPosList(); SortedPosList list2 = new SortedPosList(); list1.Add(new Position(3, 7)); list1.Add(new Position(1, 4)); list1.Add(new Position(2, 6)); list1.Add(new Position(2, 3)); Console.WriteLine(list1 + "\n"); list1.Remove(new Position(2, 6)); Console.WriteLine(list1 + "\n"); list2.Add(new Position(3, 7)); list2.Add(new Position(1, 2)); list2.Add(new Position(3, 6)); list2.Add(new Position(2, 3)); Console.WriteLine((list2 + list1) + "\n"); SortedPosList circleList = new SortedPosList(); circleList.Add(new Position(1, 1)); circleList.Add(new Position(2, 2)); circleList.Add(new Position(3, 3)); Console.WriteLine(circleList.CircleContent(new Position(5, 5), 4) + "\n"); /*VG uppgift test Console.WriteLine((list2 - list1) + "\n"); Console.WriteLine((list1 - list2) + "\n"); */ Console.ReadLine(); }