v3d_mathutilities.h

来自「A version of a sparse bundle adjustment 」· C头文件 代码 · 共 60 行

H
60
字号
// -*- C++ -*-/*Copyright (c) 2008 University of North Carolina at Chapel HillThis file is part of SSBA (Simple Sparse Bundle Adjustment).SSBA is free software: you can redistribute it and/or modify it under theterms of the GNU Lesser General Public License as published by the FreeSoftware Foundation, either version 3 of the License, or (at your option) anylater version.SSBA is distributed in the hope that it will be useful, but WITHOUT ANYWARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FORA PARTICULAR PURPOSE.  See the GNU Lesser General Public License for moredetails.You should have received a copy of the GNU Lesser General Public License alongwith SSBA. If not, see <http://www.gnu.org/licenses/>.*/#ifndef V3D_MATH_UTILITIES_H#define V3D_MATH_UTILITIES_H#include "Math/v3d_linear.h"#include "Math/v3d_linear_utils.h"#include <vector>namespace V3D{   template <typename Vec, typename Mat>   inline void   createRotationMatrixRodriguez(Vec const& omega, Mat& R)   {      assert(omega.size() == 3);      assert(R.num_rows() == 3);      assert(R.num_cols() == 3);      double const theta = norm_L2(omega);      makeIdentityMatrix(R);      if (fabs(theta) > 1e-6)      {         Matrix3x3d J, J2;         makeCrossProductMatrix(omega, J);         multiply_A_B(J, J, J2);         double const c1 = sin(theta)/theta;         double const c2 = (1-cos(theta))/(theta*theta);         for (int i = 0; i < 3; ++i)            for (int j = 0; j < 3; ++j)               R[i][j] += c1*J[i][j] + c2*J2[i][j];      }   } // end createRotationMatrixRodriguez()   template <typename T> inline double sqr(T x) { return x*x; }} // namespace V3D#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?