Trajectories.VesselAerodynamicModel.PackForces C# (CSharp) Method

PackForces() public method

Aerodynamic forces are roughly proportional to rho and squared air velocity, so we divide by these values to get something that can be linearly interpolated (the reverse operation is then applied after interpolation) This operation is optional but should slightly increase the cache accuracy
public PackForces ( UnityEngine.Vector3d forces, double altitudeAboveSea, double velocity ) : Vector2
forces UnityEngine.Vector3d
altitudeAboveSea double
velocity double
return Vector2
        public virtual Vector2 PackForces(Vector3d forces, double altitudeAboveSea, double velocity)
        {
            return new Vector2((float)forces.x, (float)forces.y);
        }

Usage Example

Ejemplo n.º 1
0
        private Vector2d ComputeCacheEntry(int v, int a, int m)
        {
            double   vel             = MaxVelocity * (double)v / (double)(InternalArray.GetLength(0) - 1);
            Vector3d velocity        = new Vector3d(vel, 0, 0);
            double   AoA             = MaxAoA * ((double)a / (double)(InternalArray.GetLength(1) - 1) * 2.0 - 1.0);
            double   currentAltitude = MaxAltitude * (double)m / (double)(InternalArray.GetLength(2) - 1);

            Vector2d packedForce = Model.PackForces(Model.ComputeForces(currentAltitude, velocity, new Vector3d(0, 1, 0), AoA), currentAltitude, vel);

            return(InternalArray[v, a, m] = packedForce);
        }