release/4.3a0
John Lambert 2021-12-07 13:31:39 -07:00 committed by GitHub
parent 37af8cfbec
commit 68535708af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -131,9 +131,11 @@ Rot2 Rot2::relativeBearing(const Point2& d, OptionalJacobian<1, 2> H) {
/* ************************************************************************* */ /* ************************************************************************* */
static Rot2 ClosestTo(const Matrix2& M) { static Rot2 ClosestTo(const Matrix2& M) {
double theta_rad = atan2(M(0,0), M(1,0)); double c = M(0,0);
double c = cos(theta_rad); double s = M(1,0);
double s = sin(theta_rad); double theta_rad = atan2(s, c);
c = cos(theta_rad);
s = sin(theta_rad);
return Rot2::fromCosSin(c, s); return Rot2::fromCosSin(c, s);
} }