Blender  V2.93
matrix.cc
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2018 Blender Foundation.
17  * All rights reserved.
18  */
19 
20 #ifndef __EIGEN3_MATRIX_C_API_CC__
21 #define __EIGEN3_MATRIX_C_API_CC__
22 
23 /* Eigen gives annoying huge amount of warnings here, silence them! */
24 #if defined(__GNUC__) && !defined(__clang__)
25 # pragma GCC diagnostic ignored "-Wlogical-op"
26 #endif
27 
28 #ifdef __EIGEN3_MATRIX_C_API_CC__ /* quiet warning */
29 #endif
30 
31 #include <Eigen/Core>
32 #include <Eigen/Dense>
33 
34 #include "matrix.h"
35 
36 using Eigen::Map;
37 using Eigen::Matrix4f;
38 
39 bool EIG_invert_m4_m4(float inverse[4][4], const float matrix[4][4])
40 {
41  Map<Matrix4f> M = Map<Matrix4f>((float *)matrix);
42  Matrix4f R;
43  bool invertible = true;
44  M.computeInverseWithCheck(R, invertible, 0.0f);
45  if (!invertible) {
46  R = R.Zero();
47  }
48  memcpy(inverse, R.data(), sizeof(float) * 4 * 4);
49  return invertible;
50 }
51 
52 #endif /* __EIGEN3_MATRIX_C_API_CC__ */
btMatrix3x3 inverse() const
Return the inverse of the matrix.
Definition: btTransform.h:182
#define M
bool EIG_invert_m4_m4(float inverse[4][4], const float matrix[4][4])
Definition: matrix.cc:39
#define R