Skip to content

Commit

Permalink
add inclination cosine
Browse files Browse the repository at this point in the history
  • Loading branch information
A-Hayasaka committed Jun 1, 2024
1 parent 2817e97 commit fc7ebf4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/pybind_coordinate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ PYBIND11_MODULE(coordinate_c, m) {
m.def("angular_momentum_vec", &angular_momentum_vec, "angular momentum vector from ECI position and velocity");
m.def("angular_momentum", &angular_momentum, "angular momentum from ECI position and velocity");
m.def("inclination_rad", &inclination_rad, "inclination from ECI position and velocity");
m.def("inclination_cosine", &inclination_cosine, "inclination cosine from ECI position and velocity");
m.def("laplace_vector", &laplace_vector, "Laplace vector from ECI position and velocity");
m.def("orbit_energy", &orbit_energy, "orbital energy from ECI position and velocity");
m.def("angular_momentum_from_altitude", &angular_momentum_from_altitude, "angular momentum from altitude");
Expand Down
8 changes: 5 additions & 3 deletions src/wrapper_coordinate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,13 @@ vec3d angular_momentum_vec(vec3d pos_eci, vec3d vel_eci) {
double angular_momentum(vec3d pos_eci, vec3d vel_eci) {
return angular_momentum_vec(pos_eci, vel_eci).norm();
}
double inclination_cosine(vec3d pos_eci, vec3d vel_eci) {
return angular_momentum_vec(pos_eci, vel_eci)[2] /
angular_momentum(pos_eci, vel_eci);
}

double inclination_rad(vec3d pos_eci, vec3d vel_eci) {
double ci = angular_momentum_vec(pos_eci, vel_eci)[2] /
angular_momentum(pos_eci, vel_eci);
return acos(ci);
return acos(inclination_cosine(pos_eci, vel_eci));
}

vec3d laplace_vector(vec3d pos_eci, vec3d vel_eci) {
Expand Down

0 comments on commit fc7ebf4

Please sign in to comment.