Last active
June 14, 2018 06:54
-
-
Save Unril/03fa353d0461ed6bd41d to your computer and use it in GitHub Desktop.
Revisions
-
Unril renamed this gist
Mar 4, 2016 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Unril created this gist
Mar 4, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ EIGEN_STRONG_INLINE Matrix &normalize() { *this /= norm(); return *this; } EIGEN_STRONG_INLINE Scalar length() const { return norm(); } EIGEN_STRONG_INLINE Matrix &vectorize(Scalar v) { fill(v); return *this; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,41 @@ #define EIGEN_MATRIX_PLUGIN "EigenOpenMeshPlugin.h" #include <Eigen/Core> #include <Eigen/Geometry> #include <OpenMesh/Core/Mesh/Traits.hh> #include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh> namespace OpenMesh { template <typename _Scalar, int _Rows, int _Cols, int _Options> struct vector_traits<Eigen::Matrix<_Scalar, _Rows, _Cols, _Options>> { static_assert(_Rows != Eigen::Dynamic && _Cols != Eigen::Dynamic, "Should not use dynamic vectors."); static_assert(_Rows == 1 || _Cols == 1, "Should not use matrices."); using vector_type = Eigen::Matrix<_Scalar, _Rows, _Cols, _Options>; using value_type = _Scalar; static const size_t size_ = _Rows * _Cols; static size_t size() { return size_; } }; template <typename _Scalar, int _Rows, int _Cols, int _Options> struct VectorDimensionsT<Eigen::Matrix<_Scalar, _Rows, _Cols, _Options>> { static_assert(_Rows != Eigen::Dynamic && _Cols != Eigen::Dynamic, "Should not use dynamic vectors."); static_assert(_Rows == 1 || _Cols == 1, "Should not use matrices."); enum { value = _Rows * _Cols }; }; template <typename Derived> typename Derived::Scalar dot(Eigen::MatrixBase<Derived> const &v1, Eigen::MatrixBase<Derived> const &v2) { return v1.dot(v2); } template <typename Derived> typename Derived::template cross_product_return_type<Derived>::type cross(Eigen::MatrixBase<Derived> const &v1, Eigen::MatrixBase<Derived> const &v2) { return v1.cross(v2); } }