⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fglocation.h

📁 6 DOF Missle Simulation
💻 H
📖 第 1 页 / 共 2 页
字号:
      class instance. The returned values are in the range between      -pi/2 <= lon <= pi/2. Latitude is positive north and negative south. */  double GetGeodLatitudeRad(void) const { ComputeDerived(); return mGeodLat; }  /** Get the latitude.      @return the latitude in deg of the location represented with this      class instance. The returned value is in the range between      -90 <= lon <= 90. Latitude is positive north and negative south. */  double GetLatitudeDeg() const { ComputeDerived(); return radtodeg*mLat; }  /** Get the geodetic latitude in degrees.      @return the geodetic latitude in degrees of the location represented by      this class instance. The returned value is in the range between      -90 <= lon <= 90. Latitude is positive north and negative south. */  double GetGeodLatitudeDeg(void) const { ComputeDerived(); return radtodeg*mGeodLat; }  /** Gets the geodetic altitude in feet. */  double GetGeodAltitude(void) const { return GeodeticAltitude;}  /** Get the sine of Latitude. */  double GetSinLatitude() const { ComputeDerived(); return -mTec2l(3,3); }  /** Get the cosine of Latitude. */  double GetCosLatitude() const { ComputeDerived(); return mTec2l(1,3); }  /** Get the cosine of Latitude. */  double GetTanLatitude() const {    ComputeDerived();    double cLat = mTec2l(1,3);    if (cLat == 0.0)      return 0.0;    else      return -mTec2l(3,3)/cLat;  }  /** Get the distance from the center of the earth.      @return the distance of the location represented with this class      instance to the center of the earth in ft. The radius value is      always positive. */  double GetRadius() const { ComputeDerived(); return mRadius; }  /** Transform matrix from local horizontal to earth centered frame.      Returns a const reference to the rotation matrix of the transform from      the local horizontal frame to the earth centered frame. */  const FGMatrix33& GetTl2ec(void) const { ComputeDerived(); return mTl2ec; }  /** Transform matrix from the earth centered to local horizontal frame.      Returns a const reference to the rotation matrix of the transform from      the earth centered frame to the local horizontal frame. */  const FGMatrix33& GetTec2l(void) const { ComputeDerived(); return mTec2l; }  /** Transform matrix from inertial to earth centered frame.      Returns a const reference to the rotation matrix of the transform from      the inertial frame to the earth centered frame (ECI to ECEF). */  const FGMatrix33& GetTi2ec(double epa);  /** Transform matrix from the earth centered to inertial frame.      Returns a const reference to the rotation matrix of the transform from      the earth centered frame to the inertial frame (ECEF to ECI). */  const FGMatrix33& GetTec2i(double epa);  /** Conversion from Local frame coordinates to a location in the      earth centered and fixed frame.      @param lvec Vector in the local horizontal coordinate frame      @return The location in the earth centered and fixed frame */  FGLocation LocalToLocation(const FGColumnVector3& lvec) const {    ComputeDerived(); return mTl2ec*lvec + mECLoc;  }  /** Conversion from a location in the earth centered and fixed frame      to local horizontal frame coordinates.      @param ecvec Vector in the earth centered and fixed frame      @return The vector in the local horizontal coordinate frame */  FGColumnVector3 LocationToLocal(const FGColumnVector3& ecvec) const {    ComputeDerived(); return mTec2l*(ecvec - mECLoc);  }  // For time-stepping, locations have vector properties...  /** Read access the entries of the vector.      @param idx the component index.      Return the value of the matrix entry at the given index.      Indices are counted starting with 1.      Note that the index given in the argument is unchecked. */  double operator()(unsigned int idx) const { return Entry(idx); }  /** Write access the entries of the vector.      @param idx the component index.      @return a reference to the vector entry at the given index.      Indices are counted starting with 1.      Note that the index given in the argument is unchecked. */  double& operator()(unsigned int idx) { return Entry(idx); }  /** Read access the entries of the vector.      @param idx the component index.      @return the value of the matrix entry at the given index.      Indices are counted starting with 1.      This function is just a shortcut for the <tt>double      operator()(unsigned int idx) const</tt> function. It is      used internally to access the elements in a more convenient way.      Note that the index given in the argument is unchecked. */  double Entry(unsigned int idx) const { return mECLoc.Entry(idx); }  /** Write access the entries of the vector.      @param idx the component index.      @return a reference to the vector entry at the given index.      Indices are counted starting with 1.      This function is just a shortcut for the double&      operator()(unsigned int idx) function. It is      used internally to access the elements in a more convenient way.      Note that the index given in the argument is unchecked. */  double& Entry(unsigned int idx) {    mCacheValid = false; return mECLoc.Entry(idx);  }  const FGLocation& operator=(const FGColumnVector3& v)  {    mECLoc(eX) = v(eX);    mECLoc(eY) = v(eY);    mECLoc(eZ) = v(eZ);    mCacheValid = false;    ComputeDerived();    return *this;  }  const FGLocation& operator=(const FGLocation& l)  {    mECLoc = l.mECLoc;    mCacheValid = l.mCacheValid;//    if (!mCacheValid) return *this; // Why is this here for an assignment operator?    mLon = l.mLon;    mLat = l.mLat;    mRadius = l.mRadius;    mTl2ec = l.mTl2ec;    mTec2l = l.mTec2l;    a = l.a;    b = l.b;    a2 = l.a2;    b2 = l.b2;    e2 = l.e2;    e = l.e;    eps2 = l.eps2;    f = l.f;    initial_longitude = l.initial_longitude;    return *this;  }  bool operator==(const FGLocation& l) const {    return mECLoc == l.mECLoc;  }  bool operator!=(const FGLocation& l) const { return ! operator==(l); }  const FGLocation& operator+=(const FGLocation &l) {    mCacheValid = false;    mECLoc += l.mECLoc;    return *this;  }  const FGLocation& operator-=(const FGLocation &l) {    mCacheValid = false;    mECLoc -= l.mECLoc;    return *this;  }  const FGLocation& operator*=(double scalar) {    mCacheValid = false;    mECLoc *= scalar;    return *this;  }  const FGLocation& operator/=(double scalar) {    return operator*=(1.0/scalar);  }  FGLocation operator+(const FGLocation& l) const {    return FGLocation(mECLoc + l.mECLoc);  }  FGLocation operator-(const FGLocation& l) const {    return FGLocation(mECLoc - l.mECLoc);  }  FGLocation operator*(double scalar) const {    return FGLocation(scalar*mECLoc);  }  /** Cast to a simple 3d vector */  operator const FGColumnVector3&() const {    return mECLoc;  }private:  /** Computation of derived values.      This function re-computes the derived values like lat/lon and      transformation matrices. It does this unconditionally. */  void ComputeDerivedUnconditional(void) const;  /** Computation of derived values.      This function checks if the derived values like lat/lon and      transformation matrices are already computed. If so, it      returns. If they need to be computed this is done here. */  void ComputeDerived(void) const {    if (!mCacheValid)      ComputeDerivedUnconditional();  }  /** The coordinates in the earth centered frame. This is the master copy.      The coordinate frame has its center in the middle of the earth.      Its x-axis points from the center of the earth towards a      location with zero latitude and longitude on the earths      surface. The y-axis points from the center of the earth towards a      location with zero latitude and 90deg longitude on the earths      surface. The z-axis points from the earths center to the      geographic north pole.      @see W. C. Durham "Aircraft Dynamics & Control", section 2.2 */  FGColumnVector3 mECLoc;  /** The cached lon/lat/radius values. */  mutable double mLon;  mutable double mLat;  mutable double mRadius;  mutable double mGeodLat;  mutable double GeodeticAltitude;    double initial_longitude;  /** The cached rotation matrices from and to the associated frames. */  mutable FGMatrix33 mTl2ec;  mutable FGMatrix33 mTec2l;  mutable FGMatrix33 mTi2ec;  mutable FGMatrix33 mTec2i;    /* Terms for geodetic latitude calculation. Values are from WGS84 model */  double a;    // Earth semimajor axis in feet (6,378,137.0 meters)  double b;    // Earth semiminor axis in feet (6,356,752.3142 meters)  double a2;  double b2;  double e;    // Earth eccentricity  double e2;   // Earth eccentricity squared  double eps2; //  double f;    // Flattening  /** A data validity flag.      This class implements caching of the derived values like the      orthogonal rotation matrices or the lon/lat/radius values. For caching we      carry a flag which signals if the values are valid or not.      The C++ keyword "mutable" tells the compiler that the data member is      allowed to change during a const member function. */  mutable bool mCacheValid;};/** Scalar multiplication.    @param scalar scalar value to multiply with.    @param l Vector to multiply.    Multiply the Vector with a scalar value. */inline FGLocation operator*(double scalar, const FGLocation& l){  return l.operator*(scalar);}} // namespace JSBSim//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -