Trajectories.VesselAerodynamicModel.UnpackForces C# (CSharp) Method

UnpackForces() public method

See PackForces
public UnpackForces ( Vector2 packedForces, double altitudeAboveSea, double velocity ) : UnityEngine.Vector3d
packedForces Vector2
altitudeAboveSea double
velocity double
return UnityEngine.Vector3d
        public virtual Vector3d UnpackForces(Vector2 packedForces, double altitudeAboveSea, double velocity)
        {
            return new Vector3d((double)packedForces.x, (double)packedForces.y, 0.0);
        }
    }

Usage Example

Esempio n. 1
0
        public Vector3d GetForce(double velocity, double angleOfAttack, double altitude)
        {
            double vFrac  = (velocity / MaxVelocity * (double)(InternalArray.GetLength(0) - 1));
            int    vFloor = Math.Max(0, Math.Min(InternalArray.GetLength(0) - 2, (int)vFrac));

            vFrac = Math.Max(0.0f, Math.Min(1.0f, vFrac - (float)vFloor));

            double aFrac  = ((angleOfAttack / MaxAoA * 0.5 + 0.5) * (double)(InternalArray.GetLength(1) - 1));
            int    aFloor = Math.Max(0, Math.Min(InternalArray.GetLength(1) - 2, (int)aFrac));

            aFrac = Math.Max(0.0f, Math.Min(1.0f, aFrac - (float)aFloor));

            double mFrac  = (altitude / MaxAltitude * (double)(InternalArray.GetLength(2) - 1));
            int    mFloor = Math.Max(0, Math.Min(InternalArray.GetLength(2) - 2, (int)mFrac));

            mFrac = Math.Max(0.0f, Math.Min(1.0f, mFrac - (float)mFloor));

            //if (Verbose)
            //{
            //    Util.PostSingleScreenMessage("cache cell", "cache cell: [" + vFloor + ", " + aFloor + ", " + mFloor + "]");
            //    Util.PostSingleScreenMessage("altitude cell", "altitude cell: " + altitude + " / " + MaxAltitude + " * " + (double)(InternalArray.GetLength(2) - 1));
            //}

            Vector2d res = Sample3d(vFloor, vFrac, aFloor, aFrac, mFloor, mFrac);

            return(Model.UnpackForces(res, altitude, velocity));
        }