00001 ////////////////////////////////////////////////////////////////////////////////////////////////// 00002 /*! \file PositionVelocity.h 00003 * \brief Implementation of the Position/Velocity Coordinate Type Class. 00004 * \author $Author: jayhawk_hokie $ 00005 * \version $Revision: 1.2 $ 00006 * \date $Date: 2005/06/10 12:53:28 $ 00007 *////////////////////////////////////////////////////////////////////////////////////////////////// 00008 /* \warning OrbitFrame conversions not included yet 00009 * \todo include conversion functions 00010 */ 00011 ////////////////////////////////////////////////////////////////////////////////////////////////// 00012 00013 #ifndef __SSF_POSITIONVELOCITY_H__ 00014 #define __SSF_POSITIONVELOCITY_H__ 00015 #include <matrix/Matrix.h> 00016 #include <orbit/orbitstaterep/OrbitStateRepresentation.h> 00017 00018 namespace O_SESSAME { 00019 /*! \ingroup OrbitStateRepresentation @{ */ 00020 #define NUM_POSVEL_ELEMENTS 6 /*!< Number of elements in the Position/Velocity elements vector */ 00021 /** @} */ 00022 00023 /*! \brief Position & Velocity representation of the orbital position. 00024 * \ingroup OrbitStateRepresentation 00025 * 00026 * \detail The PositionVelocity class stores the position and velocity components of an orbital position. 00027 * This should be used in an OrbitState object to also store the appropriate reference frame. 00028 * 00029 * \par Example: 00030 * 00031 */ 00032 class PositionVelocity : public OrbitStateRepresentation 00033 { 00034 public: 00035 /*! \brief Create an initially empty PositionVelocity orbit state representation. */ 00036 PositionVelocity(); 00037 /*! \brief Create a PositionVelocity orbit state representation from a vector of the position & velocity elements. 00038 * @param _State 6-element vector of the position and velocity components. (km, km/s) 00039 */ 00040 PositionVelocity(const Vector &_State); 00041 /*! \brief Create a PositionVelocity orbit state representation from the position & velocity vectors. 00042 * @param _Position 3-element vector of the position components. (km) 00043 * @param _Velocity 3-element vector of the velocity components. (km/s) 00044 */ 00045 PositionVelocity(const Vector &_Position, const Vector &_Velocity); 00046 00047 /*! \brief Default Deconstructor */ 00048 virtual ~PositionVelocity(); 00049 00050 /*! \brief Set the PositionVelocity representation directly from the position and velocity vectors. 00051 * @param _Position 3-element vector of position components. (km) 00052 * @param _Velocity 3-element vector of vector components. (km/s) 00053 * @param _TargetOrbFrame Reference frame that the vector components are in. 00054 */ 00055 void SetPositionVelocity(const Vector &_Position, const Vector &_Velocity); 00056 /*! \brief Set the PositionVelocity representation by converting the position and velocity vector. 00057 * @param _Position 6-element vector of position and velocity components. (km, km/s) 00058 * @param _TargetOrbFrame Reference frame that the vector components are in. 00059 */ 00060 void SetPositionVelocity(const Vector &_PositionVelocity) {SetState(_PositionVelocity);}; 00061 00062 /*! \brief Return the stored position and velocity vector. 00063 * @return 6-element vector of position and velocity vector components. [km, km, km, km/s, km/s, km/s]^T 00064 */ 00065 Vector GetPositionVelocity() const {return GetState();}; 00066 00067 /*! \brief Return the stored position and velocity vectors by reference. 00068 * @param _Position a Vector through which to return the 3-element position vector. (km) 00069 * @param _Velocity a Vector through which to return the 3-element velocity vector. (km/s) 00070 */ 00071 void GetPositionVelocity(Vector &_Position, Vector &_Velocity) const {GetState(_Position, _Velocity); return;}; 00072 00073 /*! \brief Return a pointer to a new instance of a PositionVelocity orbit state representation type. 00074 * 00075 * \detail This is used to request memory for a new instance of a PositionVelocity. It is necessary 00076 * when attempting to get a pointer from the abstract data type OrbitStateRepresentation 00077 * and the actual representation type isn't known. 00078 * @return a pointer to a new allocation of memory for the PositionVelocity object. 00079 */ 00080 virtual PositionVelocity* NewPointer(); 00081 /*! \brief Return a pointer to a copy of the PositionVelocity orbit state representation instance. 00082 * 00083 * \detail This is used to request memory for a copy of this instance of PositionVelocity. It is necessary 00084 * when attempting to get a pointer from the abstract data type OrbitStateRepresentation 00085 * and the actual representation type isn't known. 00086 * @return a pointer to a copy of the PositionVelocity object. 00087 */ 00088 virtual PositionVelocity* Clone(); 00089 00090 00091 virtual void SetState(const Vector &_State); 00092 virtual void SetState(const Vector &_Position, const Vector &_Velocity); 00093 virtual Vector GetState() const; 00094 virtual void GetState(Vector &_Position, Vector &_Velocity) const; 00095 00096 private: 00097 /*! 6x1 vector of position and velocity vector components (km, km/s) */ 00098 Vector m_Elements; 00099 }; 00100 } // close namespace O_SESSAME 00101 00102 #endif 00103 00104 // Do not change the comments below - they will be added automatically by CVS 00105 /***************************************************************************** 00106 * $Log: PositionVelocity.h,v $ 00107 * Revision 1.2 2005/06/10 12:53:28 jayhawk_hokie 00108 * Changed header file format to make it easier to link to the spacecraft code by only having to specify dsacss/dep/spacecraft/src (ex. "file.h" changed to <dir/file.h> where dir is a folder in src). 00109 * 00110 * Revision 1.1.1.1 2005/04/26 17:41:00 cakinli 00111 * Adding OpenSESSAME to DSACSS distrib to capture fixed version. 00112 * 00113 * Revision 1.7 2003/05/13 18:47:56 nilspace 00114 * Fixed comments for better formatting. 00115 * 00116 * Revision 1.6 2003/05/02 16:16:47 nilspace 00117 * Documented the API. 00118 * 00119 * Revision 1.5 2003/04/29 18:48:31 nilspace 00120 * Added NewPointer and Clone functions to help in getting the correct memory allocation. 00121 * 00122 * Revision 1.4 2003/04/24 20:19:31 nilspace 00123 * const'd all Get() functions. 00124 * 00125 * Revision 1.3 2003/04/23 18:52:29 nilspace 00126 * Updated to call correct OrbitFrame::GetRotation calls. 00127 * Added temporary PI and MU values. 00128 * Added K_Vector Values. 00129 * 00130 * Revision 1.2 2003/04/22 18:06:08 nilspace 00131 * Added math for Matthew Berry. 00132 * 00133 * Revision 1.1 2003/04/08 22:47:35 nilspace 00134 * Initial Submission. 00135 * 00136 * 00137 ******************************************************************************/