private void button5_Click(object sender, EventArgs e) { // This button tests TorqueBall.OrthonormalizeOrientation ClearPictureBox(); // Setup Orig Vector MyVector origVector = new MyVector(9, 0, 0); DrawVector(origVector, Color.Silver); // Rotate around Z MyQuaternion rotationQuat = new MyQuaternion(new MyVector(0, 0, 1), Utility3D.GetDegreesToRadians(30)); MyVector rotated = rotationQuat.GetRotatedVector(origVector, true); DrawVector(rotated, Color.Black); MyMatrix3 rotationMatrix = rotationQuat.ToMatrix3FromUnitQuaternion(); // See if this affects the rotation matrix TorqueBall.OrthonormalizeOrientation(rotationMatrix); rotationQuat = null; rotationQuat = new MyQuaternion(); rotationQuat.FromRotationMatrix(rotationMatrix); rotationMatrix = null; // Draw the results rotated = rotationQuat.GetRotatedVector(origVector, true); DrawVector(rotated, Color.DodgerBlue); }
/// <summary> /// The only reason you would pass in your own guid is when loading a previously saved scene (the token /// works good for processing in ram, but when stuff needs to go to file, use the guid) /// </summary> public BallBlip(Ball ball, CollisionStyle collisionStyle, RadarBlipQual blipQual, long token, Guid objectID) : base(ball, collisionStyle, blipQual, token, objectID) { _ball = ball; _torqueBall = ball as TorqueBall; // if it's not, null will be stored }