Example #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)));
        }
Example #2
0
 public static Vector3Fix16 Abs(Vector3Fix16 value) =>
 new Vector3Fix16(Fix16.Abs(value.X), Fix16.Abs(value.Y), Fix16.Abs(value.Z));
Example #3
0
 public bool Equals(Vector2Fix16 other, Fix16 delta) =>
 (delta != Fix16.Zero) ? (Fix16.Abs(X - other.X) < delta) && Fix16.Abs(Y - other.Y) < delta : this == other;