public void CircleWithRangeIntersectTest()
        {
            RoomMap map = new RoomMap(100, 100);
            map.AddTracker("tracker1", new Point3D(5, 0, 5), 90);

            Assert.IsTrue(map.AddItem("mobile1", new Point3D(10, 0, 10), "tracker1"));
            map.ChangeAbsoluteOrientation("mobile1", 45);
            map.Items.ElementAt(0).Value.Shape = new Circle(2);
            map.Items.ElementAt(0).Value.SetLocation();

            Assert.IsTrue(map.AddItem("mobile2", new Point3D(11, 0, 11), "tracker1"));
            map.ChangeAbsoluteOrientation("mobile2", 45);
            map.Items.ElementAt(1).Value.Shape = new Circle(1);
            map.Items.ElementAt(1).Value.SetLocation();

            Assert.IsTrue(map.AddItem("mobile3", new Point3D(14, 0, 14), "tracker1"));
            map.ChangeAbsoluteOrientation("mobile3", 45);
            map.Items.ElementAt(2).Value.Shape = new Circle(1);
            map.Items.ElementAt(2).Value.SetLocation();

            List<KeyValuePair<string, PointOrient>> list = map.IntersectsWithRange("mobile1");
            Assert.AreEqual(1, list.Count);
            Assert.AreEqual("mobile2", list[0].Key);

            Assert.IsTrue(map.AddItem("mobile4", new Point3D(10.5, 0, 10.5), "tracker1"));
            map.ChangeAbsoluteOrientation("mobile4", 45);

            list = map.IntersectsWithRange("mobile1");
            Assert.AreEqual(2, list.Count);
            Assert.AreEqual("mobile2", list[0].Key);
            Assert.AreEqual("mobile4", list[1].Key);

            map.MoveItem("mobile4", new Point3D(13, 0, 13), "tracker1");
            list = map.IntersectsWithRange("mobile1");
            Assert.AreEqual(1, list.Count);
            Assert.AreEqual("mobile2", list[0].Key);

            Assert.IsTrue(map.AddItem("mobile5", new Point3D(10.5, 0, 10.5), "tracker1"));
            map.ChangeAbsoluteOrientation("mobile5", 45);
            map.Items.ElementAt(4).Value.Shape = new Circle(1);

            list = map.IntersectsWithRange("mobile1");
            Assert.AreEqual(2, list.Count);
            Assert.AreEqual("mobile2", list[0].Key);
            Assert.AreEqual("mobile5", list[1].Key);
        }
        public void ShapeMoveTest()
        {
            RoomMap map = new RoomMap(100, 100);
            map.AddTracker("tracker1", new Point3D(50, 0, 0), 1170);

            Assert.IsTrue(map.AddItem("mobile1", new Point3D(10, 0, 10), "tracker1"));
            map.ChangeAbsoluteOrientation("mobile1", 45);
            map.Items.ElementAt(0).Value.Shape = new Rectangle(1);
            map.Items.ElementAt(0).Value.SetLocation();
            Assert.AreEqual(Shape.Rectangle, map.Items.ElementAt(0).Value.Shape.Identity);
            Assert.AreEqual(new Point3D(60, 0, 10), map.Items.ElementAt(0).Value.coord);

            Point3D rfov = map.Items.ElementAt(0).Value.RightFOV;
            Point3D lfov = map.Items.ElementAt(0).Value.LeftFOV;

            Assert.IsTrue(map.MoveItem("mobile1", new Point3D(22, 0, 10), "tracker1"));
            Assert.AreEqual(new Point3D(72, 0, 10), map.Items.ElementAt(0).Value.coord);
            Assert.AreEqual(45, map.Items.ElementAt(0).Value.orientation);
            Assert.AreEqual(rfov, map.Items.ElementAt(0).Value.RightFOV);
            Assert.AreEqual(lfov, map.Items.ElementAt(0).Value.LeftFOV);
        }
        public void MoveItemTest()
        {
            RoomMap map = new RoomMap(100, 100);

            Assert.IsFalse(map.MoveItem("mobile1", new Point3D(10, 0, 10), "tracker1"));
            map.AddTracker("tracker1", new Point3D(50, 0, 0), 1170);
            Assert.IsFalse(map.MoveItem("mobile1", new Point3D(10, 0, 10), "tracker1"));

            Assert.IsTrue(map.AddItem("mobile1", new Point3D(0, 0, 5), "tracker1"));
            map.ChangeAbsoluteOrientation("mobile1", 90);
            Assert.AreEqual(new Point3D(50, 0, 5), map.Items.ElementAt(0).Value.coord);
            Assert.AreEqual(90, map.Items.ElementAt(0).Value.orientation);

            map.MoveItem("mobile1", new Point3D(0, 0, 5), "tracker1");
            Assert.AreEqual(new Point3D(50, 0, 5), map.Items.ElementAt(0).Value.coord);
            map.MoveItem("mobile1", new Point3D(20, 0, 10), "tracker1");
            Assert.AreEqual(new Point3D(70, 0, 10), map.Items.ElementAt(0).Value.coord);

            Assert.IsFalse(map.MoveItem("mobile1", new Point3D(-1, 0, 5), "tracker1"));
            Assert.IsFalse(map.MoveItem("mobile1", new Point3D(0, -1, 5), "tracker1"));
            Assert.IsFalse(map.MoveItem("mobile1", new Point3D(5, 0, -1), "tracker1"));
            Assert.IsFalse(map.MoveItem("mobile1", new Point3D(120, 0, 5), "tracker1"));
            Assert.IsFalse(map.MoveItem("mobile1", new Point3D(0, 10, 5), "tracker1"));
            Assert.IsFalse(map.MoveItem("mobile1", new Point3D(5, 0, 120), "tracker1"));
        }
        public void FindIntersectingItemsTest()
        {
            RoomMap map = new RoomMap(100, 100);
            Assert.AreEqual(100, map.Length);
            Assert.AreEqual(100, map.Width);

            map.AddTracker("tracker1", new Point3D(5, 0, 5), 1170);
            Assert.AreEqual(new Point3D(5, 0, 5), map.TrackerList.Values.ElementAt(0).TrackerPos);
            Assert.AreEqual(90, map.TrackerList.Values.ElementAt(0).AngleOffset);

            Assert.IsTrue(map.AddItem("mobile1", new Point3D(10, 0, 10), "tracker1"));
            map.ChangeAbsoluteOrientation("mobile1", 45);
            map.Items.ElementAt(0).Value.Shape = new Rectangle(2);
            map.Items.ElementAt(0).Value.SetLocation();
            Assert.AreEqual(Shape.Rectangle, map.Items.ElementAt(0).Value.Shape.Identity);

            Assert.IsTrue(map.AddItem("mobile2", new Point3D(17, 0, 17), "tracker1"));
            map.ChangeAbsoluteOrientation("mobile2", 45);
            map.Items.ElementAt(1).Value.Shape = new Rectangle(2);
            map.Items.ElementAt(1).Value.SetLocation();

            List<KeyValuePair<string, PointOrient>> list = map.Intersects("mobile1");
            Assert.AreEqual(1, list.Count);

            list = map.Intersects("mobile2");
            Assert.AreEqual(0, list.Count);

            map.MoveItem("mobile2", new Point3D(10.5, 0, 10.5), "tracker1");
            map.ChangeOrientation("mobile1", -45);
            list = map.Intersects("mobile2");
            Assert.AreEqual(1, list.Count);

            map.MoveItem("mobile2", new Point3D(9.5, 0, 9.5), "tracker1");
            list = map.Intersects("mobile2");
            Assert.AreEqual(1, list.Count);
        }
        public void MoreRectTest()
        {
            RoomMap map = new RoomMap(100, 100);
            map.AddTracker("tracker1", new Point3D(5, 0, 5), 90);

            Assert.IsTrue(map.AddItem("mobile1", new Point3D(10, 0, 10), "tracker1"));
            map.ChangeAbsoluteOrientation("mobile1", 45);
            map.Items.ElementAt(0).Value.Shape = new Rectangle(3);
            map.Items.ElementAt(0).Value.SetLocation();
            Assert.AreEqual(Shape.Rectangle, map.Items.ElementAt(0).Value.Shape.Identity);

            Assert.IsTrue(map.AddItem("mobile2", new Point3D(11.4, 0, 11.4), "tracker1"));
            map.ChangeAbsoluteOrientation("mobile2", 45);
            map.Items.ElementAt(1).Value.Shape = new Rectangle(3);
            map.Items.ElementAt(1).Value.SetLocation();

            List<KeyValuePair<string, PointOrient>> list = map.Intersects("mobile1");
            Assert.AreEqual(1, list.Count);
            map.Items.ElementAt(0).Value.RotateItem(-45);
            list = map.Intersects("mobile2");
            Assert.AreEqual(1, list.Count);

            map.MoveItem("mobile2", new Point3D(12, 0, 12), "tracker1");
            list = map.Intersects("mobile2");
            Assert.AreEqual(0, list.Count);
        }