Listing the "Blender Foundation" as copyright holder implied the Blender Foundation holds copyright to files which may include work from many developers. While keeping copyright on headers makes sense for isolated libraries, Blender's own code may be refactored or moved between files in a way that makes the per file copyright holders less meaningful. Copyright references to the "Blender Foundation" have been replaced with "Blender Authors", with the exception of `./extern/` since these this contains libraries which are more isolated, any changed to license headers there can be handled on a case-by-case basis. Some directories in `./intern/` have also been excluded: - `./intern/cycles/` it's own `AUTHORS` file is planned. - `./intern/opensubdiv/`. An "AUTHORS" file has been added, using the chromium projects authors file as a template. Design task: #110784 Ref !110783.
42 lines
926 B
C++
42 lines
926 B
C++
/* SPDX-FileCopyrightText: 2018 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
/** \file
|
|
* \ingroup intern_eigen
|
|
*/
|
|
|
|
#ifndef __EIGEN3_MATRIX_C_API_CC__
|
|
#define __EIGEN3_MATRIX_C_API_CC__
|
|
|
|
/* Eigen gives annoying huge amount of warnings here, silence them! */
|
|
#if defined(__GNUC__) && !defined(__clang__)
|
|
# pragma GCC diagnostic ignored "-Wlogical-op"
|
|
#endif
|
|
|
|
#ifdef __EIGEN3_MATRIX_C_API_CC__ /* quiet warning */
|
|
#endif
|
|
|
|
#include <Eigen/Core>
|
|
#include <Eigen/Dense>
|
|
|
|
#include "matrix.h"
|
|
|
|
using Eigen::Map;
|
|
using Eigen::Matrix4f;
|
|
|
|
bool EIG_invert_m4_m4(float inverse[4][4], const float matrix[4][4])
|
|
{
|
|
Map<Matrix4f> M = Map<Matrix4f>((float *)matrix);
|
|
Matrix4f R;
|
|
bool invertible = true;
|
|
M.computeInverseWithCheck(R, invertible, 0.0f);
|
|
if (!invertible) {
|
|
R = R.Zero();
|
|
}
|
|
memcpy(inverse, R.data(), sizeof(float) * 4 * 4);
|
|
return invertible;
|
|
}
|
|
|
|
#endif /* __EIGEN3_MATRIX_C_API_CC__ */
|