Example #1
0
        private void Image_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            var centerpoint = new CoordinateHandler(Image.ActualWidth / 2, Image.ActualHeight / 2);

            System.Windows.Point position = e.GetPosition(Image);
            RectCreator.AddPoint(new SigamDetec.Point(position.X, position.Y));
            if (RectCreator.ListOfPoints.Count == 2)
            {
                var createdRect = RectCreator.CreateRectangle();
                RectCreator.ListOfPoints.Clear();
            }
        }
Example #2
0
        private void Image_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            var centerpoint = new CoordinateHandler(Image.ActualWidth / 2, Image.ActualHeight / 2);

            System.Windows.Point position = e.GetPosition(Image);
            var coordhandler = new CoordinateHandler(position.X, position.Y);

            var widthtransformed  = (position.X - centerpoint.Width) / centerpoint.Width;
            var heighttransformed = (position.Y - centerpoint.Height) / centerpoint.Height;

            var convertedcoords = new CoordinateHandler(CoordsConverter.ToInverseCoords(widthtransformed), CoordsConverter.ToInverseCoords(heighttransformed));

            Console.WriteLine($"x:{convertedcoords.Width} y:{convertedcoords.Height}");
            USB.Communicator.WriteLine(USB.MovementEncoder.EncodeArmMovement((float)convertedcoords.Width, (float)convertedcoords.Height, 300));
        }