Exemplo n.º 1
0
        /// <summary>
        /// Computes the efficiency of a thruster thrusting in a direction.
        /// </summary>
        /// <param name="angleOffCenter"></param>
        /// <returns></returns>
        private Fix16 GetThrustEfficiency(Compass angleOffCenter)
        {
            Fix16 OAC = Fix16.Abs(angleOffCenter.Degrees);            //Compass OAC = new Compass(Math.Abs(angleOffCenter.Radians));

            // normalize to range of -180 to +180
            OAC = Compass.NormalizeDegrees(OAC);
            if (OAC > 180)
            {
                OAC -= 360;
            }

            if (Math.Abs(OAC) >= 90)
            {
                return(Fix16.Zero);                // can't thrust sideways or backwards!
            }
            return(Fix16.Cos(OAC * (Fix16.Pi / (Fix16)180)));
        }