Tvmet2Eigen.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
3  * All rights reserved. This program is made available under the terms of the
4  * Eclipse Public License v1.0 which accompanies this distribution, and is
5  * available at http://www.eclipse.org/legal/epl-v10.html
6  * Contributors:
7  * National Institute of Advanced Industrial Science and Technology (AIST)
8  * General Robotix Inc.
9  */
10 
11 #ifndef HRPUTIL_TVMET2EIGEN_H_INCLUDED
12 #define HRPUTIL_TVMET2EIGEN_H_INCLUDED
13 
14 namespace hrp{
15  inline Vector3 cross(const Vector3& v1, const Vector3& v2){
16  return v1.cross(v2);
17  }
18  inline Matrix33 trans(const Matrix33& m) { return m.transpose(); }
19  inline double dot(const Vector3& v1, const Vector3& v2) {
20  return v1.dot(v2);
21  }
22  inline double norm2(const Vector3& v) { return v.norm(); }
23  inline Vector3 nomralize(const Vector3& v) { return v.normalized(); }
24  inline Matrix33 VVt_prod(const Vector3& a, const Vector3& b){
25  Matrix33 m;
26  m << a(0) * b(0), a(0) * b(1), a(0) * b(2),
27  a(1) * b(0), a(1) * b(1), a(1) * b(2),
28  a(2) * b(0), a(2) * b(1), a(2) * b(2);
29  return m;
30  }
31 
32  inline void calcInverse(Matrix33& inv, const Matrix33& m){
33  bool invertible;
34  m.computeInverseWithCheck(inv, invertible);
35  if(!invertible){
36  throw std::string("Inverse matrix cannot be calculated.");
37  }
38  }
39 
40  inline Matrix33 inverse(const Matrix33& m){
41  Matrix33 inv;
42  calcInverse(inv, m);
43  return inv;
44  }
45 
46  HRP_UTIL_EXPORT inline Matrix33 inverse33(const Matrix33& m) { return inverse(m); }
47 };
48 
49 #endif
Matrix33 trans(const Matrix33 &m)
Definition: Tvmet2Eigen.h:18
void calcInverse(Matrix33 &inv, const Matrix33 &m)
Definition: Tvmet2Eigen.h:32
dmatrix inverse(const dmatrix &M)
Definition: MatrixSolvers.h:37
long b
Definition: jpegint.h:371
Eigen::Vector3d Vector3
Definition: EigenTypes.h:11
Eigen::Matrix3d Matrix33
Definition: EigenTypes.h:12
Vector3 nomralize(const Vector3 &v)
Definition: Tvmet2Eigen.h:23
Matrix33 VVt_prod(const Vector3 &a, const Vector3 &b)
Definition: Tvmet2Eigen.h:24
#define HRP_UTIL_EXPORT
Vector3 cross(const Vector3 &v1, const Vector3 &v2)
Definition: Tvmet2Eigen.h:15
double dot(const Vector3 &v1, const Vector3 &v2)
Definition: Tvmet2Eigen.h:19
fMat inv(const fMat &mat)
Definition: fMatrix.cpp:176
double norm2(const Vector3 &v)
Definition: Tvmet2Eigen.h:22
HRP_UTIL_EXPORT Matrix33 inverse33(const Matrix33 &m)
Definition: Tvmet2Eigen.h:46


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat Apr 13 2019 02:14:25