protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (!m_LeftButtonDown) { return; } int MotionX = e.Location.X - m_ButtonDownPosition.X; int MotionY = e.Location.Y - m_ButtonDownPosition.Y; float AngleX = 1.5f * (float)Math.PI * MotionX / Width; float AngleY = -1.2f * (float)Math.PI * MotionY / Height; WMath.Matrix3x3 RotX = new WMath.Matrix3x3(WMath.Matrix3x3.INIT_TYPES.ROT_Y, AngleX); WMath.Matrix3x3 RotY = new WMath.Matrix3x3(WMath.Matrix3x3.INIT_TYPES.ROT_X, AngleY); WMath.Matrix3x3 Rot = RotY * RotX; float3 NewAt = m_ButtonDownAt * Rot; this.At = NewAt; // Force refresh for faster update... Refresh(); }
void TestEigenVectors() { // WMath.Vector Axis = new WMath.Vector( 1, 1, 1 ); WMath.Vector Axis = new WMath.Vector(1, 0, 0); Axis.Normalize(); WMath.Matrix3x3 Rot = (WMath.Matrix3x3) new WMath.Quat(new WMath.AngleAxis(0.5f * (float)Math.PI, Axis)); Rot.Transpose(); WMath.Vector Eigen = Rot.EigenValues(); WMath.Matrix3x3 M0 = Rot - Eigen.x * WMath.Matrix3x3.IDENTITY; WMath.Matrix3x3 M1 = Rot - Eigen.y * WMath.Matrix3x3.IDENTITY; WMath.Matrix3x3 M2 = Rot - Eigen.z * WMath.Matrix3x3.IDENTITY; WMath.Vector X = M0.GetRow0(); WMath.Vector Y = M0.GetRow1(); WMath.Vector Z = M0.GetRow2(); }
protected override void OnMouseMove( MouseEventArgs e ) { base.OnMouseMove( e ); if ( !m_LeftButtonDown ) return; int MotionX = e.Location.X - m_ButtonDownPosition.X; int MotionY = e.Location.Y - m_ButtonDownPosition.Y; float AngleX = 1.5f * (float) Math.PI * MotionX / Width; float AngleY = -1.2f * (float) Math.PI * MotionY / Height; WMath.Matrix3x3 RotX = new WMath.Matrix3x3( WMath.Matrix3x3.INIT_TYPES.ROT_Y, AngleX ); WMath.Matrix3x3 RotY = new WMath.Matrix3x3( WMath.Matrix3x3.INIT_TYPES.ROT_X, AngleY ); WMath.Matrix3x3 Rot = RotY * RotX; WMath.Vector NewAt = m_ButtonDownAt * Rot; this.At = NewAt; // Force refresh for faster update... Refresh(); }