예제 #1
0
        private static double GetLeftRightThrusterMagnitude(MyMatrix3 inertialTensor)
        {
            // Create a standard sized solid ball, and use that as my baseline
            SolidBall standBall = new SolidBall(new MyVector(), new DoubleVector(1, 0, 0, 0, 1, 0), STANDARDRADIUS, UtilityCore.GetMassForRadius(STANDARDRADIUS, 1d));

            double averageStand = GetLeftRightThrusterMagnitudeSprtGetAvg(standBall.InertialTensorBody);
            double averageShip  = GetLeftRightThrusterMagnitudeSprtGetAvg(inertialTensor);

            return(THRUSTER_FORCE * (Math.Sqrt(averageShip) / Math.Sqrt(averageStand)));     // I need sqrt, because the tensor's don't grow linearly
        }
예제 #2
0
        private static double GetLeftRightThrusterMagnitudeSprtGetAvg(MyMatrix3 inertialTensor)
        {
            double retVal = 0;

            // I don't include 2-2, because it represents the center, and doesn't really have an effect on spin?
            retVal += inertialTensor.M11;
            //retVal += inertialTensor.M12;
            //retVal += inertialTensor.M13;
            //retVal += inertialTensor.M21;
            //retVal += inertialTensor.M22;
            //retVal += inertialTensor.M23;
            //retVal += inertialTensor.M31;
            //retVal += inertialTensor.M32;
            retVal += inertialTensor.M33;

            return(retVal / 2d);
        }
예제 #3
0
        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);
        }