private void cmdSetAxis2_Click(object sender, EventArgs e)
        {
            double _Axis2X = LeapX;
            double _Axis2Y = LeapY;
            double _Axis2Z = LeapZ;

            //double _Axis2X = 0;
            //double _Axis2Y = 0;
            //double _Axis2Z = 0.175;
            AxisY       = new VectorClass(_Axis2X - _OriginX, _Axis2Y - _OriginY, _Axis2Z - _OriginZ);
            UnitAxisY   = AxisY.Norm();
            QAxisX.Text = UnitAxisY.X.ToString();
            QAxisY.Text = UnitAxisY.Y.ToString();
            QAxisZ.Text = UnitAxisY.Z.ToString();
            UnitAxisZ   = new VectorClass(UnitAxisX.Y * UnitAxisY.Z - UnitAxisX.Z * UnitAxisY.Y,
                                          UnitAxisX.Z * UnitAxisY.X - UnitAxisX.X * UnitAxisY.Z,
                                          UnitAxisX.X * UnitAxisY.Y - UnitAxisX.Y * UnitAxisY.X);

            _orientationScreen[0, 0] = UnitAxisX.X;
            _orientationScreen[1, 0] = UnitAxisY.X;
            _orientationScreen[2, 0] = UnitAxisZ.X;

            _orientationScreen[0, 1] = UnitAxisX.Y;
            _orientationScreen[1, 1] = UnitAxisY.Y;
            _orientationScreen[2, 1] = UnitAxisZ.Y;

            _orientationScreen[0, 2] = UnitAxisX.Z;
            _orientationScreen[1, 2] = UnitAxisY.Z;
            _orientationScreen[2, 2] = UnitAxisZ.Z;
            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    _orientationScreenTransposed[i, j] = _orientationScreen[j, i];
                }
            }
            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    _transformationInverse[i, j] = _orientationScreenTransposed[i, j];
                }
            }
            _transformationInverse[3, 0] = -(_orientationScreenTransposed[0, 0] * _OriginX + _orientationScreenTransposed[1, 0] * _OriginY + _orientationScreenTransposed[2, 0] * _OriginZ);
            _transformationInverse[3, 1] = -(_orientationScreenTransposed[0, 1] * _OriginX + _orientationScreenTransposed[1, 1] * _OriginY + _orientationScreenTransposed[2, 1] * _OriginZ);
            _transformationInverse[3, 2] = -(_orientationScreenTransposed[0, 2] * _OriginX + _orientationScreenTransposed[1, 2] * _OriginY + _orientationScreenTransposed[2, 2] * _OriginZ);
            _transformationInverse[0, 3] = _transformationInverse[1, 3] = _transformationInverse[2, 3] = 0;
            _transformationInverse[3, 3] = 1;

            isTransformed = true;
        }
        private void cmdSetAxis1_Click(object sender, EventArgs e)
        {
            double _Axis1X = LeapX;
            double _Axis1Y = LeapY;
            double _Axis1Z = LeapZ;

            //testing
            //double _Axis1X = 0.2;
            //double _Axis1Y = 0;
            //double _Axis1Z = 0.275;
            AxisX       = new VectorClass(_Axis1X - _OriginX, _Axis1Y - _OriginY, _Axis1Z - _OriginZ);
            UnitAxisX   = AxisX.Norm();
            PAxisX.Text = UnitAxisX.X.ToString();
            PAxisY.Text = UnitAxisX.Y.ToString();
            PAxisZ.Text = UnitAxisX.Z.ToString();
        }