Magnum/EigenIntegration/Integration.h file

Conversion of Eigen array and matrix types.


Provides conversion for the following types:

Magnum vector typeEquivalent Eigen type
Math::BoolVector<size>Eigen::Array<bool, size, 1>
Math::Vector<size, T> and derived classesEigen::Array<T, size, 1>
Math::Vector<size, T> and derived classesEigen::Matrix<T, size, 1>
Magnum matrix typeEquivalent Eigen type
Math::RectangularMatrix<cols, rows, T> and derived classesEigen::Array<T, rows, cols>
Math::RectangularMatrix<cols, rows, T> and derived classesEigen::Matrix<T, rows, cols>

Eigen::Array and Eigen::Matrix classes provide a std::iostream operator<< overload, which means they're directly usable with Corrade::Utility::Debug if you include Corrade/Utility/DebugStl.h as well. Example usage:

Eigen::Vector3f a{1.0f, 2.0f, 3.0f};
Vector3 b(a);

auto c = Matrix3::rotation(35.0_degf);

// It's not possible to convert using Eigen::Matrix3f(c)
auto d = EigenIntegration::cast<Eigen::Matrix3f>(c);

Debug{} << Eigen::Array3i{1, 42, -3}; // prints   1
                                      //         42
                                      //         -3

See Magnum/EigenIntegration/GeometryIntegration.h for conversion of special geometry types.


namespace Magnum
Root namespace.
namespace Magnum::Math
Math library.
namespace Magnum::EigenIntegration
Integration with Eigen.


template<class To, std::size_t cols, std::size_t rows, class T>
auto cast(const Math::RectangularMatrix<cols, rows, T>& from) -> To
Convert a Magnum type to Eigen type.