diff --git a/AstroLib/Src/AsCoordinate_2023.cpp b/AstroLib/Src/AsCoordinate_2023.cpp index 6baae6576facd262e488b4e2033fcd7746574b7e..0cc167d6d8a2063222fb8ca84ea1c41583a5749a 100644 --- a/AstroLib/Src/AsCoordinate_2023.cpp +++ b/AstroLib/Src/AsCoordinate_2023.cpp @@ -1,4 +1,4 @@ -//////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////// // // // Copyright (c) 2003-2006 // // Wang Hua // @@ -17,4 +17,23 @@ using namespace std; - +//******************************************************************** +///柱坐标系到直角坐标系的位置速度转换 +/// @Author jingheng +/// @Date 2025/2/27 +/// @Input : +/// @Param ppolar 柱坐标系航天器位置 +/// @Param vpolar 柱坐标系航天器速度 +/// @Output : +/// @Param pcart 直角坐标系航天器位置 +/// @Param vcart 直角坐标系航天器速度 +//******************************************************************** +void AsPolarToCart(const CPolar3 & ppolar, const CPolar3 & vpolar, CCoord& pcart, CCoord& vcart) +{ + pcart[0] = ppolar.m_Radius*cos(ppolar.m_Theta); + pcart[1] = ppolar.m_Radius*sin(ppolar.m_Theta); + pcart[2] = ppolar.m_Z; + vcart[0] = vpolar.m_Radius*cos(ppolar.m_Theta) - ppolar.m_Radius*vpolar.m_Theta*sin(ppolar.m_Theta); + vcart[1] = vpolar.m_Radius*sin(ppolar.m_Theta) + ppolar.m_Radius*vpolar.m_Theta*cos(ppolar.m_Theta); + vcart[2] = vpolar.m_Z; +}