#include "SateOrbit.h" //#define EIGEN_USE_MKL_ALL //#define EIGEN_VECTORIZE_SSE4_2 //#include #include #include #include #include //#include using namespace std; using namespace Eigen; OrbitPoly::OrbitPoly() { } OrbitPoly::OrbitPoly(int polynum, Eigen::MatrixX polySatellitePara, double SatelliteModelStartTime) { if (polySatellitePara.rows() != polynum||polySatellitePara.cols()!=6) { throw exception("?????????????????"); } this->polySatellitePara = polySatellitePara; this->SatelliteModelStartTime = SatelliteModelStartTime; this->polynum = polynum; } OrbitPoly::~OrbitPoly() { } Eigen::MatrixX OrbitPoly::SatelliteSpacePoint(Eigen::MatrixX satellitetime) { Eigen::MatrixX result= SatelliteSpacePoints(satellitetime, this->SatelliteModelStartTime, this->polySatellitePara, this->polynum); return result; } Eigen::MatrixX OrbitPoly::SatelliteSpacePoint(long double satellitetime) { if (this->polySatellitePara.rows() != polynum || this->polySatellitePara.cols() != 6) { throw exception("the size of satellitetime has error!! row: p1,p2,p3,p4 col: x,y,z,vx,vy,vz "); } // ????????? double satellitetime2 =double( satellitetime - this->SatelliteModelStartTime); Eigen::MatrixX satetime(1, polynum); for (int i = 0; i < polynum; i++) { satetime(0, i) = pow(satellitetime2, i); } // ???? Eigen::MatrixX satellitePoints(1, 6); satellitePoints = satetime * polySatellitePara; return satellitePoints; } /// /// ???????????????????? /// /// ??????? /// ?????????? /// ??????[x1,y1,z1,vx1,vy1,vz1; x2,y2,z2,vx2,vy2,vz2; ..... ] /// ?????????? /// ???????? Eigen::MatrixX SatelliteSpacePoints(Eigen::MatrixX& satellitetime, double SatelliteModelStartTime, Eigen::MatrixX& polySatellitePara, int polynum) { if (satellitetime.cols() != 1) { throw exception("the size of satellitetime has error!!"); } if (polySatellitePara.rows() != polynum || polySatellitePara.cols() != 6) { throw exception("the size of satellitetime has error!! row: p1,p2,p3,p4 col: x,y,z,vx,vy,vz "); } // ????????? int satellitetime_num = satellitetime.rows(); satellitetime = satellitetime.array() - SatelliteModelStartTime; Eigen::MatrixX satelliteTime(satellitetime_num, polynum); for (int i = 0; i < polynum; i++) { satelliteTime.col(i) = satellitetime.array().pow(i); } // ???? Eigen::MatrixX satellitePoints(satellitetime_num, 6); satellitePoints = satelliteTime * polySatellitePara; return satellitePoints; }