ruby-eigen 0.0.9 → 0.0.10.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +22 -0
- data/README.md +21 -0
- data/ext/eigen/eigen3/COPYING.BSD +26 -0
- data/ext/eigen/eigen3/COPYING.MPL2 +373 -0
- data/ext/eigen/eigen3/COPYING.README +18 -0
- data/ext/eigen/eigen3/Eigen/Array +11 -0
- data/ext/eigen/eigen3/Eigen/Cholesky +32 -0
- data/ext/eigen/eigen3/Eigen/CholmodSupport +45 -0
- data/ext/eigen/eigen3/Eigen/Core +376 -0
- data/ext/eigen/eigen3/Eigen/Dense +7 -0
- data/ext/eigen/eigen3/Eigen/Eigen +2 -0
- data/ext/eigen/eigen3/Eigen/Eigen2Support +95 -0
- data/ext/eigen/eigen3/Eigen/Eigenvalues +48 -0
- data/ext/eigen/eigen3/Eigen/Geometry +63 -0
- data/ext/eigen/eigen3/Eigen/Householder +23 -0
- data/ext/eigen/eigen3/Eigen/IterativeLinearSolvers +40 -0
- data/ext/eigen/eigen3/Eigen/Jacobi +26 -0
- data/ext/eigen/eigen3/Eigen/LU +41 -0
- data/ext/eigen/eigen3/Eigen/LeastSquares +32 -0
- data/ext/eigen/eigen3/Eigen/MetisSupport +28 -0
- data/ext/eigen/eigen3/Eigen/PaStiXSupport +46 -0
- data/ext/eigen/eigen3/Eigen/PardisoSupport +30 -0
- data/ext/eigen/eigen3/Eigen/QR +45 -0
- data/ext/eigen/eigen3/Eigen/QtAlignedMalloc +34 -0
- data/ext/eigen/eigen3/Eigen/SPQRSupport +29 -0
- data/ext/eigen/eigen3/Eigen/SVD +37 -0
- data/ext/eigen/eigen3/Eigen/Sparse +27 -0
- data/ext/eigen/eigen3/Eigen/SparseCore +64 -0
- data/ext/eigen/eigen3/Eigen/SparseLU +49 -0
- data/ext/eigen/eigen3/Eigen/SparseQR +33 -0
- data/ext/eigen/eigen3/Eigen/StdDeque +27 -0
- data/ext/eigen/eigen3/Eigen/StdList +26 -0
- data/ext/eigen/eigen3/Eigen/StdVector +27 -0
- data/ext/eigen/eigen3/Eigen/SuperLUSupport +59 -0
- data/ext/eigen/eigen3/Eigen/UmfPackSupport +36 -0
- data/ext/eigen/eigen3/Eigen/src/Cholesky/LDLT.h +611 -0
- data/ext/eigen/eigen3/Eigen/src/Cholesky/LLT.h +498 -0
- data/ext/eigen/eigen3/Eigen/src/Cholesky/LLT_MKL.h +102 -0
- data/ext/eigen/eigen3/Eigen/src/CholmodSupport/CholmodSupport.h +607 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Array.h +323 -0
- data/ext/eigen/eigen3/Eigen/src/Core/ArrayBase.h +226 -0
- data/ext/eigen/eigen3/Eigen/src/Core/ArrayWrapper.h +264 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Assign.h +590 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Assign_MKL.h +224 -0
- data/ext/eigen/eigen3/Eigen/src/Core/BandMatrix.h +334 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Block.h +406 -0
- data/ext/eigen/eigen3/Eigen/src/Core/BooleanRedux.h +154 -0
- data/ext/eigen/eigen3/Eigen/src/Core/CommaInitializer.h +154 -0
- data/ext/eigen/eigen3/Eigen/src/Core/CoreIterators.h +61 -0
- data/ext/eigen/eigen3/Eigen/src/Core/CwiseBinaryOp.h +230 -0
- data/ext/eigen/eigen3/Eigen/src/Core/CwiseNullaryOp.h +864 -0
- data/ext/eigen/eigen3/Eigen/src/Core/CwiseUnaryOp.h +126 -0
- data/ext/eigen/eigen3/Eigen/src/Core/CwiseUnaryView.h +139 -0
- data/ext/eigen/eigen3/Eigen/src/Core/DenseBase.h +521 -0
- data/ext/eigen/eigen3/Eigen/src/Core/DenseCoeffsBase.h +754 -0
- data/ext/eigen/eigen3/Eigen/src/Core/DenseStorage.h +434 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Diagonal.h +237 -0
- data/ext/eigen/eigen3/Eigen/src/Core/DiagonalMatrix.h +313 -0
- data/ext/eigen/eigen3/Eigen/src/Core/DiagonalProduct.h +131 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Dot.h +263 -0
- data/ext/eigen/eigen3/Eigen/src/Core/EigenBase.h +131 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Flagged.h +140 -0
- data/ext/eigen/eigen3/Eigen/src/Core/ForceAlignedAccess.h +146 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Functors.h +1026 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Fuzzy.h +150 -0
- data/ext/eigen/eigen3/Eigen/src/Core/GeneralProduct.h +635 -0
- data/ext/eigen/eigen3/Eigen/src/Core/GenericPacketMath.h +350 -0
- data/ext/eigen/eigen3/Eigen/src/Core/GlobalFunctions.h +92 -0
- data/ext/eigen/eigen3/Eigen/src/Core/IO.h +250 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Map.h +192 -0
- data/ext/eigen/eigen3/Eigen/src/Core/MapBase.h +247 -0
- data/ext/eigen/eigen3/Eigen/src/Core/MathFunctions.h +768 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Matrix.h +420 -0
- data/ext/eigen/eigen3/Eigen/src/Core/MatrixBase.h +563 -0
- data/ext/eigen/eigen3/Eigen/src/Core/NestByValue.h +111 -0
- data/ext/eigen/eigen3/Eigen/src/Core/NoAlias.h +134 -0
- data/ext/eigen/eigen3/Eigen/src/Core/NumTraits.h +150 -0
- data/ext/eigen/eigen3/Eigen/src/Core/PermutationMatrix.h +721 -0
- data/ext/eigen/eigen3/Eigen/src/Core/PlainObjectBase.h +822 -0
- data/ext/eigen/eigen3/Eigen/src/Core/ProductBase.h +290 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Random.h +152 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Redux.h +409 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Ref.h +278 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Replicate.h +177 -0
- data/ext/eigen/eigen3/Eigen/src/Core/ReturnByValue.h +99 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Reverse.h +224 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Select.h +162 -0
- data/ext/eigen/eigen3/Eigen/src/Core/SelfAdjointView.h +314 -0
- data/ext/eigen/eigen3/Eigen/src/Core/SelfCwiseBinaryOp.h +191 -0
- data/ext/eigen/eigen3/Eigen/src/Core/SolveTriangular.h +260 -0
- data/ext/eigen/eigen3/Eigen/src/Core/StableNorm.h +203 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Stride.h +108 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Swap.h +126 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Transpose.h +419 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Transpositions.h +436 -0
- data/ext/eigen/eigen3/Eigen/src/Core/TriangularMatrix.h +839 -0
- data/ext/eigen/eigen3/Eigen/src/Core/VectorBlock.h +95 -0
- data/ext/eigen/eigen3/Eigen/src/Core/VectorwiseOp.h +642 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Visitor.h +237 -0
- data/ext/eigen/eigen3/Eigen/src/Core/arch/AltiVec/Complex.h +217 -0
- data/ext/eigen/eigen3/Eigen/src/Core/arch/AltiVec/PacketMath.h +501 -0
- data/ext/eigen/eigen3/Eigen/src/Core/arch/Default/Settings.h +49 -0
- data/ext/eigen/eigen3/Eigen/src/Core/arch/NEON/Complex.h +253 -0
- data/ext/eigen/eigen3/Eigen/src/Core/arch/NEON/PacketMath.h +420 -0
- data/ext/eigen/eigen3/Eigen/src/Core/arch/SSE/Complex.h +442 -0
- data/ext/eigen/eigen3/Eigen/src/Core/arch/SSE/MathFunctions.h +475 -0
- data/ext/eigen/eigen3/Eigen/src/Core/arch/SSE/PacketMath.h +649 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/CoeffBasedProduct.h +476 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h +1341 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h +427 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +278 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_MKL.h +146 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixMatrix_MKL.h +118 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixVector.h +566 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixVector_MKL.h +131 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/Parallelizer.h +162 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +436 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointMatrixMatrix_MKL.h +295 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointMatrixVector.h +281 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointMatrixVector_MKL.h +114 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointProduct.h +123 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointRank2Update.h +93 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularMatrixMatrix.h +427 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularMatrixMatrix_MKL.h +309 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularMatrixVector.h +348 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularMatrixVector_MKL.h +247 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularSolverMatrix.h +332 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularSolverMatrix_MKL.h +155 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularSolverVector.h +139 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/BlasUtil.h +264 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/Constants.h +451 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/DisableStupidWarnings.h +40 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/ForwardDeclarations.h +302 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/MKL_support.h +158 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/Macros.h +451 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/Memory.h +977 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/Meta.h +243 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/NonMPL2.h +3 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/ReenableStupidWarnings.h +14 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/StaticAssert.h +208 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/XprHelper.h +469 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Block.h +126 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Cwise.h +192 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/CwiseOperators.h +298 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/AlignedBox.h +159 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/All.h +115 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/AngleAxis.h +214 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Hyperplane.h +254 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/ParametrizedLine.h +141 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Quaternion.h +495 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Rotation2D.h +145 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/RotationBase.h +123 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Scaling.h +167 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Transform.h +786 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Translation.h +184 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/LU.h +120 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Lazy.h +71 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/LeastSquares.h +169 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Macros.h +20 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/MathFunctions.h +57 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Memory.h +45 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Meta.h +75 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Minor.h +117 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/QR.h +67 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/SVD.h +637 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/TriangularSolver.h +42 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/VectorBlock.h +94 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/ComplexEigenSolver.h +341 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/ComplexSchur.h +456 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/ComplexSchur_MKL.h +94 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/EigenSolver.h +607 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +350 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +227 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/HessenbergDecomposition.h +373 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +160 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/RealQZ.h +624 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/RealSchur.h +525 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/RealSchur_MKL.h +83 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +801 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_MKL.h +92 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/Tridiagonalization.h +557 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/AlignedBox.h +392 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/AngleAxis.h +233 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/EulerAngles.h +104 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/Homogeneous.h +307 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/Hyperplane.h +280 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/OrthoMethods.h +218 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/ParametrizedLine.h +195 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/Quaternion.h +776 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/Rotation2D.h +160 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/RotationBase.h +206 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/Scaling.h +166 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/Transform.h +1455 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/Translation.h +206 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/Umeyama.h +177 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/arch/Geometry_SSE.h +115 -0
- data/ext/eigen/eigen3/Eigen/src/Householder/BlockHouseholder.h +68 -0
- data/ext/eigen/eigen3/Eigen/src/Householder/Householder.h +171 -0
- data/ext/eigen/eigen3/Eigen/src/Householder/HouseholderSequence.h +441 -0
- data/ext/eigen/eigen3/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +149 -0
- data/ext/eigen/eigen3/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +263 -0
- data/ext/eigen/eigen3/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +256 -0
- data/ext/eigen/eigen3/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +282 -0
- data/ext/eigen/eigen3/Eigen/src/Jacobi/Jacobi.h +433 -0
- data/ext/eigen/eigen3/Eigen/src/LU/Determinant.h +101 -0
- data/ext/eigen/eigen3/Eigen/src/LU/FullPivLU.h +751 -0
- data/ext/eigen/eigen3/Eigen/src/LU/Inverse.h +400 -0
- data/ext/eigen/eigen3/Eigen/src/LU/PartialPivLU.h +509 -0
- data/ext/eigen/eigen3/Eigen/src/LU/PartialPivLU_MKL.h +85 -0
- data/ext/eigen/eigen3/Eigen/src/LU/arch/Inverse_SSE.h +329 -0
- data/ext/eigen/eigen3/Eigen/src/MetisSupport/MetisSupport.h +137 -0
- data/ext/eigen/eigen3/Eigen/src/OrderingMethods/Amd.h +444 -0
- data/ext/eigen/eigen3/Eigen/src/OrderingMethods/Eigen_Colamd.h +1850 -0
- data/ext/eigen/eigen3/Eigen/src/PaStiXSupport/PaStiXSupport.h +721 -0
- data/ext/eigen/eigen3/Eigen/src/PardisoSupport/PardisoSupport.h +592 -0
- data/ext/eigen/eigen3/Eigen/src/QR/ColPivHouseholderQR.h +580 -0
- data/ext/eigen/eigen3/Eigen/src/QR/ColPivHouseholderQR_MKL.h +99 -0
- data/ext/eigen/eigen3/Eigen/src/QR/FullPivHouseholderQR.h +622 -0
- data/ext/eigen/eigen3/Eigen/src/QR/HouseholderQR.h +388 -0
- data/ext/eigen/eigen3/Eigen/src/QR/HouseholderQR_MKL.h +71 -0
- data/ext/eigen/eigen3/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +338 -0
- data/ext/eigen/eigen3/Eigen/src/SVD/JacobiSVD.h +976 -0
- data/ext/eigen/eigen3/Eigen/src/SVD/JacobiSVD_MKL.h +92 -0
- data/ext/eigen/eigen3/Eigen/src/SVD/UpperBidiagonalization.h +148 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCholesky/SimplicialCholesky.h +671 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +199 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/AmbiVector.h +373 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/CompressedStorage.h +233 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +245 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/MappedSparseMatrix.h +181 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseBlock.h +537 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseColEtree.h +206 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +325 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +163 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseDenseProduct.h +311 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseDiagonalProduct.h +196 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseDot.h +101 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseFuzzy.h +26 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseMatrix.h +1262 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseMatrixBase.h +461 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparsePermutation.h +148 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseProduct.h +188 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseRedux.h +45 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseSelfAdjointView.h +507 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +150 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseTranspose.h +63 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseTriangularView.h +179 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseUtil.h +172 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseVector.h +448 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseView.h +99 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/TriangularSolver.h +334 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU.h +806 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLUImpl.h +66 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_Memory.h +227 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_Structs.h +111 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +298 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_Utils.h +80 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_column_bmod.h +180 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_column_dfs.h +177 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +106 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +279 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +127 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +130 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_panel_bmod.h +223 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_panel_dfs.h +258 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_pivotL.h +137 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_pruneL.h +135 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_relax_snode.h +83 -0
- data/ext/eigen/eigen3/Eigen/src/SparseQR/SparseQR.h +714 -0
- data/ext/eigen/eigen3/Eigen/src/StlSupport/StdDeque.h +134 -0
- data/ext/eigen/eigen3/Eigen/src/StlSupport/StdList.h +114 -0
- data/ext/eigen/eigen3/Eigen/src/StlSupport/StdVector.h +126 -0
- data/ext/eigen/eigen3/Eigen/src/StlSupport/details.h +84 -0
- data/ext/eigen/eigen3/Eigen/src/SuperLUSupport/SuperLUSupport.h +1026 -0
- data/ext/eigen/eigen3/Eigen/src/UmfPackSupport/UmfPackSupport.h +474 -0
- data/ext/eigen/eigen3/Eigen/src/misc/Image.h +84 -0
- data/ext/eigen/eigen3/Eigen/src/misc/Kernel.h +81 -0
- data/ext/eigen/eigen3/Eigen/src/misc/Solve.h +76 -0
- data/ext/eigen/eigen3/Eigen/src/misc/SparseSolve.h +128 -0
- data/ext/eigen/eigen3/Eigen/src/misc/blas.h +658 -0
- data/ext/eigen/eigen3/Eigen/src/plugins/ArrayCwiseBinaryOps.h +253 -0
- data/ext/eigen/eigen3/Eigen/src/plugins/ArrayCwiseUnaryOps.h +187 -0
- data/ext/eigen/eigen3/Eigen/src/plugins/BlockMethods.h +935 -0
- data/ext/eigen/eigen3/Eigen/src/plugins/CommonCwiseBinaryOps.h +46 -0
- data/ext/eigen/eigen3/Eigen/src/plugins/CommonCwiseUnaryOps.h +172 -0
- data/ext/eigen/eigen3/Eigen/src/plugins/MatrixCwiseBinaryOps.h +143 -0
- data/ext/eigen/eigen3/Eigen/src/plugins/MatrixCwiseUnaryOps.h +52 -0
- data/ext/eigen/eigen3/signature_of_eigen3_matrix_library +1 -0
- data/ext/eigen/eigen_wrap.cxx +19420 -10396
- data/ext/eigen/extconf.rb +37 -2
- data/lib/eigen.rb +146 -3
- metadata +294 -7
@@ -0,0 +1,145 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
|
5
|
+
//
|
6
|
+
// This Source Code Form is subject to the terms of the Mozilla
|
7
|
+
// Public License v. 2.0. If a copy of the MPL was not distributed
|
8
|
+
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
9
|
+
|
10
|
+
// no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway
|
11
|
+
|
12
|
+
namespace Eigen {
|
13
|
+
|
14
|
+
/** \geometry_module \ingroup Geometry_Module
|
15
|
+
*
|
16
|
+
* \class Rotation2D
|
17
|
+
*
|
18
|
+
* \brief Represents a rotation/orientation in a 2 dimensional space.
|
19
|
+
*
|
20
|
+
* \param _Scalar the scalar type, i.e., the type of the coefficients
|
21
|
+
*
|
22
|
+
* This class is equivalent to a single scalar representing a counter clock wise rotation
|
23
|
+
* as a single angle in radian. It provides some additional features such as the automatic
|
24
|
+
* conversion from/to a 2x2 rotation matrix. Moreover this class aims to provide a similar
|
25
|
+
* interface to Quaternion in order to facilitate the writing of generic algorithms
|
26
|
+
* dealing with rotations.
|
27
|
+
*
|
28
|
+
* \sa class Quaternion, class Transform
|
29
|
+
*/
|
30
|
+
template<typename _Scalar> struct ei_traits<Rotation2D<_Scalar> >
|
31
|
+
{
|
32
|
+
typedef _Scalar Scalar;
|
33
|
+
};
|
34
|
+
|
35
|
+
template<typename _Scalar>
|
36
|
+
class Rotation2D : public RotationBase<Rotation2D<_Scalar>,2>
|
37
|
+
{
|
38
|
+
typedef RotationBase<Rotation2D<_Scalar>,2> Base;
|
39
|
+
|
40
|
+
public:
|
41
|
+
|
42
|
+
using Base::operator*;
|
43
|
+
|
44
|
+
enum { Dim = 2 };
|
45
|
+
/** the scalar type of the coefficients */
|
46
|
+
typedef _Scalar Scalar;
|
47
|
+
typedef Matrix<Scalar,2,1> Vector2;
|
48
|
+
typedef Matrix<Scalar,2,2> Matrix2;
|
49
|
+
|
50
|
+
protected:
|
51
|
+
|
52
|
+
Scalar m_angle;
|
53
|
+
|
54
|
+
public:
|
55
|
+
|
56
|
+
/** Construct a 2D counter clock wise rotation from the angle \a a in radian. */
|
57
|
+
inline Rotation2D(Scalar a) : m_angle(a) {}
|
58
|
+
|
59
|
+
/** \returns the rotation angle */
|
60
|
+
inline Scalar angle() const { return m_angle; }
|
61
|
+
|
62
|
+
/** \returns a read-write reference to the rotation angle */
|
63
|
+
inline Scalar& angle() { return m_angle; }
|
64
|
+
|
65
|
+
/** \returns the inverse rotation */
|
66
|
+
inline Rotation2D inverse() const { return -m_angle; }
|
67
|
+
|
68
|
+
/** Concatenates two rotations */
|
69
|
+
inline Rotation2D operator*(const Rotation2D& other) const
|
70
|
+
{ return m_angle + other.m_angle; }
|
71
|
+
|
72
|
+
/** Concatenates two rotations */
|
73
|
+
inline Rotation2D& operator*=(const Rotation2D& other)
|
74
|
+
{ return m_angle += other.m_angle; return *this; }
|
75
|
+
|
76
|
+
/** Applies the rotation to a 2D vector */
|
77
|
+
Vector2 operator* (const Vector2& vec) const
|
78
|
+
{ return toRotationMatrix() * vec; }
|
79
|
+
|
80
|
+
template<typename Derived>
|
81
|
+
Rotation2D& fromRotationMatrix(const MatrixBase<Derived>& m);
|
82
|
+
Matrix2 toRotationMatrix(void) const;
|
83
|
+
|
84
|
+
/** \returns the spherical interpolation between \c *this and \a other using
|
85
|
+
* parameter \a t. It is in fact equivalent to a linear interpolation.
|
86
|
+
*/
|
87
|
+
inline Rotation2D slerp(Scalar t, const Rotation2D& other) const
|
88
|
+
{ return m_angle * (1-t) + other.angle() * t; }
|
89
|
+
|
90
|
+
/** \returns \c *this with scalar type casted to \a NewScalarType
|
91
|
+
*
|
92
|
+
* Note that if \a NewScalarType is equal to the current scalar type of \c *this
|
93
|
+
* then this function smartly returns a const reference to \c *this.
|
94
|
+
*/
|
95
|
+
template<typename NewScalarType>
|
96
|
+
inline typename internal::cast_return_type<Rotation2D,Rotation2D<NewScalarType> >::type cast() const
|
97
|
+
{ return typename internal::cast_return_type<Rotation2D,Rotation2D<NewScalarType> >::type(*this); }
|
98
|
+
|
99
|
+
/** Copy constructor with scalar type conversion */
|
100
|
+
template<typename OtherScalarType>
|
101
|
+
inline explicit Rotation2D(const Rotation2D<OtherScalarType>& other)
|
102
|
+
{
|
103
|
+
m_angle = Scalar(other.angle());
|
104
|
+
}
|
105
|
+
|
106
|
+
/** \returns \c true if \c *this is approximately equal to \a other, within the precision
|
107
|
+
* determined by \a prec.
|
108
|
+
*
|
109
|
+
* \sa MatrixBase::isApprox() */
|
110
|
+
bool isApprox(const Rotation2D& other, typename NumTraits<Scalar>::Real prec = precision<Scalar>()) const
|
111
|
+
{ return ei_isApprox(m_angle,other.m_angle, prec); }
|
112
|
+
};
|
113
|
+
|
114
|
+
/** \ingroup Geometry_Module
|
115
|
+
* single precision 2D rotation type */
|
116
|
+
typedef Rotation2D<float> Rotation2Df;
|
117
|
+
/** \ingroup Geometry_Module
|
118
|
+
* double precision 2D rotation type */
|
119
|
+
typedef Rotation2D<double> Rotation2Dd;
|
120
|
+
|
121
|
+
/** Set \c *this from a 2x2 rotation matrix \a mat.
|
122
|
+
* In other words, this function extract the rotation angle
|
123
|
+
* from the rotation matrix.
|
124
|
+
*/
|
125
|
+
template<typename Scalar>
|
126
|
+
template<typename Derived>
|
127
|
+
Rotation2D<Scalar>& Rotation2D<Scalar>::fromRotationMatrix(const MatrixBase<Derived>& mat)
|
128
|
+
{
|
129
|
+
EIGEN_STATIC_ASSERT(Derived::RowsAtCompileTime==2 && Derived::ColsAtCompileTime==2,YOU_MADE_A_PROGRAMMING_MISTAKE)
|
130
|
+
m_angle = ei_atan2(mat.coeff(1,0), mat.coeff(0,0));
|
131
|
+
return *this;
|
132
|
+
}
|
133
|
+
|
134
|
+
/** Constructs and \returns an equivalent 2x2 rotation matrix.
|
135
|
+
*/
|
136
|
+
template<typename Scalar>
|
137
|
+
typename Rotation2D<Scalar>::Matrix2
|
138
|
+
Rotation2D<Scalar>::toRotationMatrix(void) const
|
139
|
+
{
|
140
|
+
Scalar sinA = ei_sin(m_angle);
|
141
|
+
Scalar cosA = ei_cos(m_angle);
|
142
|
+
return (Matrix2() << cosA, -sinA, sinA, cosA).finished();
|
143
|
+
}
|
144
|
+
|
145
|
+
} // end namespace Eigen
|
@@ -0,0 +1,123 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
|
5
|
+
//
|
6
|
+
// This Source Code Form is subject to the terms of the Mozilla
|
7
|
+
// Public License v. 2.0. If a copy of the MPL was not distributed
|
8
|
+
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
9
|
+
|
10
|
+
// no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway
|
11
|
+
|
12
|
+
namespace Eigen {
|
13
|
+
|
14
|
+
// this file aims to contains the various representations of rotation/orientation
|
15
|
+
// in 2D and 3D space excepted Matrix and Quaternion.
|
16
|
+
|
17
|
+
/** \class RotationBase
|
18
|
+
*
|
19
|
+
* \brief Common base class for compact rotation representations
|
20
|
+
*
|
21
|
+
* \param Derived is the derived type, i.e., a rotation type
|
22
|
+
* \param _Dim the dimension of the space
|
23
|
+
*/
|
24
|
+
template<typename Derived, int _Dim>
|
25
|
+
class RotationBase
|
26
|
+
{
|
27
|
+
public:
|
28
|
+
enum { Dim = _Dim };
|
29
|
+
/** the scalar type of the coefficients */
|
30
|
+
typedef typename ei_traits<Derived>::Scalar Scalar;
|
31
|
+
|
32
|
+
/** corresponding linear transformation matrix type */
|
33
|
+
typedef Matrix<Scalar,Dim,Dim> RotationMatrixType;
|
34
|
+
|
35
|
+
inline const Derived& derived() const { return *static_cast<const Derived*>(this); }
|
36
|
+
inline Derived& derived() { return *static_cast<Derived*>(this); }
|
37
|
+
|
38
|
+
/** \returns an equivalent rotation matrix */
|
39
|
+
inline RotationMatrixType toRotationMatrix() const { return derived().toRotationMatrix(); }
|
40
|
+
|
41
|
+
/** \returns the inverse rotation */
|
42
|
+
inline Derived inverse() const { return derived().inverse(); }
|
43
|
+
|
44
|
+
/** \returns the concatenation of the rotation \c *this with a translation \a t */
|
45
|
+
inline Transform<Scalar,Dim> operator*(const Translation<Scalar,Dim>& t) const
|
46
|
+
{ return toRotationMatrix() * t; }
|
47
|
+
|
48
|
+
/** \returns the concatenation of the rotation \c *this with a scaling \a s */
|
49
|
+
inline RotationMatrixType operator*(const Scaling<Scalar,Dim>& s) const
|
50
|
+
{ return toRotationMatrix() * s; }
|
51
|
+
|
52
|
+
/** \returns the concatenation of the rotation \c *this with an affine transformation \a t */
|
53
|
+
inline Transform<Scalar,Dim> operator*(const Transform<Scalar,Dim>& t) const
|
54
|
+
{ return toRotationMatrix() * t; }
|
55
|
+
};
|
56
|
+
|
57
|
+
/** \geometry_module
|
58
|
+
*
|
59
|
+
* Constructs a Dim x Dim rotation matrix from the rotation \a r
|
60
|
+
*/
|
61
|
+
template<typename _Scalar, int _Rows, int _Cols, int _Storage, int _MaxRows, int _MaxCols>
|
62
|
+
template<typename OtherDerived>
|
63
|
+
Matrix<_Scalar, _Rows, _Cols, _Storage, _MaxRows, _MaxCols>
|
64
|
+
::Matrix(const RotationBase<OtherDerived,ColsAtCompileTime>& r)
|
65
|
+
{
|
66
|
+
EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Matrix,int(OtherDerived::Dim),int(OtherDerived::Dim))
|
67
|
+
*this = r.toRotationMatrix();
|
68
|
+
}
|
69
|
+
|
70
|
+
/** \geometry_module
|
71
|
+
*
|
72
|
+
* Set a Dim x Dim rotation matrix from the rotation \a r
|
73
|
+
*/
|
74
|
+
template<typename _Scalar, int _Rows, int _Cols, int _Storage, int _MaxRows, int _MaxCols>
|
75
|
+
template<typename OtherDerived>
|
76
|
+
Matrix<_Scalar, _Rows, _Cols, _Storage, _MaxRows, _MaxCols>&
|
77
|
+
Matrix<_Scalar, _Rows, _Cols, _Storage, _MaxRows, _MaxCols>
|
78
|
+
::operator=(const RotationBase<OtherDerived,ColsAtCompileTime>& r)
|
79
|
+
{
|
80
|
+
EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Matrix,int(OtherDerived::Dim),int(OtherDerived::Dim))
|
81
|
+
return *this = r.toRotationMatrix();
|
82
|
+
}
|
83
|
+
|
84
|
+
/** \internal
|
85
|
+
*
|
86
|
+
* Helper function to return an arbitrary rotation object to a rotation matrix.
|
87
|
+
*
|
88
|
+
* \param Scalar the numeric type of the matrix coefficients
|
89
|
+
* \param Dim the dimension of the current space
|
90
|
+
*
|
91
|
+
* It returns a Dim x Dim fixed size matrix.
|
92
|
+
*
|
93
|
+
* Default specializations are provided for:
|
94
|
+
* - any scalar type (2D),
|
95
|
+
* - any matrix expression,
|
96
|
+
* - any type based on RotationBase (e.g., Quaternion, AngleAxis, Rotation2D)
|
97
|
+
*
|
98
|
+
* Currently ei_toRotationMatrix is only used by Transform.
|
99
|
+
*
|
100
|
+
* \sa class Transform, class Rotation2D, class Quaternion, class AngleAxis
|
101
|
+
*/
|
102
|
+
template<typename Scalar, int Dim>
|
103
|
+
static inline Matrix<Scalar,2,2> ei_toRotationMatrix(const Scalar& s)
|
104
|
+
{
|
105
|
+
EIGEN_STATIC_ASSERT(Dim==2,YOU_MADE_A_PROGRAMMING_MISTAKE)
|
106
|
+
return Rotation2D<Scalar>(s).toRotationMatrix();
|
107
|
+
}
|
108
|
+
|
109
|
+
template<typename Scalar, int Dim, typename OtherDerived>
|
110
|
+
static inline Matrix<Scalar,Dim,Dim> ei_toRotationMatrix(const RotationBase<OtherDerived,Dim>& r)
|
111
|
+
{
|
112
|
+
return r.toRotationMatrix();
|
113
|
+
}
|
114
|
+
|
115
|
+
template<typename Scalar, int Dim, typename OtherDerived>
|
116
|
+
static inline const MatrixBase<OtherDerived>& ei_toRotationMatrix(const MatrixBase<OtherDerived>& mat)
|
117
|
+
{
|
118
|
+
EIGEN_STATIC_ASSERT(OtherDerived::RowsAtCompileTime==Dim && OtherDerived::ColsAtCompileTime==Dim,
|
119
|
+
YOU_MADE_A_PROGRAMMING_MISTAKE)
|
120
|
+
return mat;
|
121
|
+
}
|
122
|
+
|
123
|
+
} // end namespace Eigen
|
@@ -0,0 +1,167 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
|
5
|
+
//
|
6
|
+
// This Source Code Form is subject to the terms of the Mozilla
|
7
|
+
// Public License v. 2.0. If a copy of the MPL was not distributed
|
8
|
+
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
9
|
+
|
10
|
+
// no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway
|
11
|
+
|
12
|
+
namespace Eigen {
|
13
|
+
|
14
|
+
/** \geometry_module \ingroup Geometry_Module
|
15
|
+
*
|
16
|
+
* \class Scaling
|
17
|
+
*
|
18
|
+
* \brief Represents a possibly non uniform scaling transformation
|
19
|
+
*
|
20
|
+
* \param _Scalar the scalar type, i.e., the type of the coefficients.
|
21
|
+
* \param _Dim the dimension of the space, can be a compile time value or Dynamic
|
22
|
+
*
|
23
|
+
* \note This class is not aimed to be used to store a scaling transformation,
|
24
|
+
* but rather to make easier the constructions and updates of Transform objects.
|
25
|
+
*
|
26
|
+
* \sa class Translation, class Transform
|
27
|
+
*/
|
28
|
+
template<typename _Scalar, int _Dim>
|
29
|
+
class Scaling
|
30
|
+
{
|
31
|
+
public:
|
32
|
+
EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_Dim)
|
33
|
+
/** dimension of the space */
|
34
|
+
enum { Dim = _Dim };
|
35
|
+
/** the scalar type of the coefficients */
|
36
|
+
typedef _Scalar Scalar;
|
37
|
+
/** corresponding vector type */
|
38
|
+
typedef Matrix<Scalar,Dim,1> VectorType;
|
39
|
+
/** corresponding linear transformation matrix type */
|
40
|
+
typedef Matrix<Scalar,Dim,Dim> LinearMatrixType;
|
41
|
+
/** corresponding translation type */
|
42
|
+
typedef Translation<Scalar,Dim> TranslationType;
|
43
|
+
/** corresponding affine transformation type */
|
44
|
+
typedef Transform<Scalar,Dim> TransformType;
|
45
|
+
|
46
|
+
protected:
|
47
|
+
|
48
|
+
VectorType m_coeffs;
|
49
|
+
|
50
|
+
public:
|
51
|
+
|
52
|
+
/** Default constructor without initialization. */
|
53
|
+
Scaling() {}
|
54
|
+
/** Constructs and initialize a uniform scaling transformation */
|
55
|
+
explicit inline Scaling(const Scalar& s) { m_coeffs.setConstant(s); }
|
56
|
+
/** 2D only */
|
57
|
+
inline Scaling(const Scalar& sx, const Scalar& sy)
|
58
|
+
{
|
59
|
+
ei_assert(Dim==2);
|
60
|
+
m_coeffs.x() = sx;
|
61
|
+
m_coeffs.y() = sy;
|
62
|
+
}
|
63
|
+
/** 3D only */
|
64
|
+
inline Scaling(const Scalar& sx, const Scalar& sy, const Scalar& sz)
|
65
|
+
{
|
66
|
+
ei_assert(Dim==3);
|
67
|
+
m_coeffs.x() = sx;
|
68
|
+
m_coeffs.y() = sy;
|
69
|
+
m_coeffs.z() = sz;
|
70
|
+
}
|
71
|
+
/** Constructs and initialize the scaling transformation from a vector of scaling coefficients */
|
72
|
+
explicit inline Scaling(const VectorType& coeffs) : m_coeffs(coeffs) {}
|
73
|
+
|
74
|
+
const VectorType& coeffs() const { return m_coeffs; }
|
75
|
+
VectorType& coeffs() { return m_coeffs; }
|
76
|
+
|
77
|
+
/** Concatenates two scaling */
|
78
|
+
inline Scaling operator* (const Scaling& other) const
|
79
|
+
{ return Scaling(coeffs().cwise() * other.coeffs()); }
|
80
|
+
|
81
|
+
/** Concatenates a scaling and a translation */
|
82
|
+
inline TransformType operator* (const TranslationType& t) const;
|
83
|
+
|
84
|
+
/** Concatenates a scaling and an affine transformation */
|
85
|
+
inline TransformType operator* (const TransformType& t) const;
|
86
|
+
|
87
|
+
/** Concatenates a scaling and a linear transformation matrix */
|
88
|
+
// TODO returns an expression
|
89
|
+
inline LinearMatrixType operator* (const LinearMatrixType& other) const
|
90
|
+
{ return coeffs().asDiagonal() * other; }
|
91
|
+
|
92
|
+
/** Concatenates a linear transformation matrix and a scaling */
|
93
|
+
// TODO returns an expression
|
94
|
+
friend inline LinearMatrixType operator* (const LinearMatrixType& other, const Scaling& s)
|
95
|
+
{ return other * s.coeffs().asDiagonal(); }
|
96
|
+
|
97
|
+
template<typename Derived>
|
98
|
+
inline LinearMatrixType operator*(const RotationBase<Derived,Dim>& r) const
|
99
|
+
{ return *this * r.toRotationMatrix(); }
|
100
|
+
|
101
|
+
/** Applies scaling to vector */
|
102
|
+
inline VectorType operator* (const VectorType& other) const
|
103
|
+
{ return coeffs().asDiagonal() * other; }
|
104
|
+
|
105
|
+
/** \returns the inverse scaling */
|
106
|
+
inline Scaling inverse() const
|
107
|
+
{ return Scaling(coeffs().cwise().inverse()); }
|
108
|
+
|
109
|
+
inline Scaling& operator=(const Scaling& other)
|
110
|
+
{
|
111
|
+
m_coeffs = other.m_coeffs;
|
112
|
+
return *this;
|
113
|
+
}
|
114
|
+
|
115
|
+
/** \returns \c *this with scalar type casted to \a NewScalarType
|
116
|
+
*
|
117
|
+
* Note that if \a NewScalarType is equal to the current scalar type of \c *this
|
118
|
+
* then this function smartly returns a const reference to \c *this.
|
119
|
+
*/
|
120
|
+
template<typename NewScalarType>
|
121
|
+
inline typename internal::cast_return_type<Scaling,Scaling<NewScalarType,Dim> >::type cast() const
|
122
|
+
{ return typename internal::cast_return_type<Scaling,Scaling<NewScalarType,Dim> >::type(*this); }
|
123
|
+
|
124
|
+
/** Copy constructor with scalar type conversion */
|
125
|
+
template<typename OtherScalarType>
|
126
|
+
inline explicit Scaling(const Scaling<OtherScalarType,Dim>& other)
|
127
|
+
{ m_coeffs = other.coeffs().template cast<Scalar>(); }
|
128
|
+
|
129
|
+
/** \returns \c true if \c *this is approximately equal to \a other, within the precision
|
130
|
+
* determined by \a prec.
|
131
|
+
*
|
132
|
+
* \sa MatrixBase::isApprox() */
|
133
|
+
bool isApprox(const Scaling& other, typename NumTraits<Scalar>::Real prec = precision<Scalar>()) const
|
134
|
+
{ return m_coeffs.isApprox(other.m_coeffs, prec); }
|
135
|
+
|
136
|
+
};
|
137
|
+
|
138
|
+
/** \addtogroup Geometry_Module */
|
139
|
+
//@{
|
140
|
+
typedef Scaling<float, 2> Scaling2f;
|
141
|
+
typedef Scaling<double,2> Scaling2d;
|
142
|
+
typedef Scaling<float, 3> Scaling3f;
|
143
|
+
typedef Scaling<double,3> Scaling3d;
|
144
|
+
//@}
|
145
|
+
|
146
|
+
template<typename Scalar, int Dim>
|
147
|
+
inline typename Scaling<Scalar,Dim>::TransformType
|
148
|
+
Scaling<Scalar,Dim>::operator* (const TranslationType& t) const
|
149
|
+
{
|
150
|
+
TransformType res;
|
151
|
+
res.matrix().setZero();
|
152
|
+
res.linear().diagonal() = coeffs();
|
153
|
+
res.translation() = m_coeffs.cwise() * t.vector();
|
154
|
+
res(Dim,Dim) = Scalar(1);
|
155
|
+
return res;
|
156
|
+
}
|
157
|
+
|
158
|
+
template<typename Scalar, int Dim>
|
159
|
+
inline typename Scaling<Scalar,Dim>::TransformType
|
160
|
+
Scaling<Scalar,Dim>::operator* (const TransformType& t) const
|
161
|
+
{
|
162
|
+
TransformType res = t;
|
163
|
+
res.prescale(m_coeffs);
|
164
|
+
return res;
|
165
|
+
}
|
166
|
+
|
167
|
+
} // end namespace Eigen
|
@@ -0,0 +1,786 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
|
5
|
+
// Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
|
6
|
+
//
|
7
|
+
// This Source Code Form is subject to the terms of the Mozilla
|
8
|
+
// Public License v. 2.0. If a copy of the MPL was not distributed
|
9
|
+
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
10
|
+
|
11
|
+
// no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway
|
12
|
+
|
13
|
+
namespace Eigen {
|
14
|
+
|
15
|
+
// Note that we have to pass Dim and HDim because it is not allowed to use a template
|
16
|
+
// parameter to define a template specialization. To be more precise, in the following
|
17
|
+
// specializations, it is not allowed to use Dim+1 instead of HDim.
|
18
|
+
template< typename Other,
|
19
|
+
int Dim,
|
20
|
+
int HDim,
|
21
|
+
int OtherRows=Other::RowsAtCompileTime,
|
22
|
+
int OtherCols=Other::ColsAtCompileTime>
|
23
|
+
struct ei_transform_product_impl;
|
24
|
+
|
25
|
+
/** \geometry_module \ingroup Geometry_Module
|
26
|
+
*
|
27
|
+
* \class Transform
|
28
|
+
*
|
29
|
+
* \brief Represents an homogeneous transformation in a N dimensional space
|
30
|
+
*
|
31
|
+
* \param _Scalar the scalar type, i.e., the type of the coefficients
|
32
|
+
* \param _Dim the dimension of the space
|
33
|
+
*
|
34
|
+
* The homography is internally represented and stored as a (Dim+1)^2 matrix which
|
35
|
+
* is available through the matrix() method.
|
36
|
+
*
|
37
|
+
* Conversion methods from/to Qt's QMatrix and QTransform are available if the
|
38
|
+
* preprocessor token EIGEN_QT_SUPPORT is defined.
|
39
|
+
*
|
40
|
+
* \sa class Matrix, class Quaternion
|
41
|
+
*/
|
42
|
+
template<typename _Scalar, int _Dim>
|
43
|
+
class Transform
|
44
|
+
{
|
45
|
+
public:
|
46
|
+
EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_Dim==Dynamic ? Dynamic : (_Dim+1)*(_Dim+1))
|
47
|
+
enum {
|
48
|
+
Dim = _Dim, ///< space dimension in which the transformation holds
|
49
|
+
HDim = _Dim+1 ///< size of a respective homogeneous vector
|
50
|
+
};
|
51
|
+
/** the scalar type of the coefficients */
|
52
|
+
typedef _Scalar Scalar;
|
53
|
+
/** type of the matrix used to represent the transformation */
|
54
|
+
typedef Matrix<Scalar,HDim,HDim> MatrixType;
|
55
|
+
/** type of the matrix used to represent the linear part of the transformation */
|
56
|
+
typedef Matrix<Scalar,Dim,Dim> LinearMatrixType;
|
57
|
+
/** type of read/write reference to the linear part of the transformation */
|
58
|
+
typedef Block<MatrixType,Dim,Dim> LinearPart;
|
59
|
+
/** type of read/write reference to the linear part of the transformation */
|
60
|
+
typedef const Block<const MatrixType,Dim,Dim> ConstLinearPart;
|
61
|
+
/** type of a vector */
|
62
|
+
typedef Matrix<Scalar,Dim,1> VectorType;
|
63
|
+
/** type of a read/write reference to the translation part of the rotation */
|
64
|
+
typedef Block<MatrixType,Dim,1> TranslationPart;
|
65
|
+
/** type of a read/write reference to the translation part of the rotation */
|
66
|
+
typedef const Block<const MatrixType,Dim,1> ConstTranslationPart;
|
67
|
+
/** corresponding translation type */
|
68
|
+
typedef Translation<Scalar,Dim> TranslationType;
|
69
|
+
/** corresponding scaling transformation type */
|
70
|
+
typedef Scaling<Scalar,Dim> ScalingType;
|
71
|
+
|
72
|
+
protected:
|
73
|
+
|
74
|
+
MatrixType m_matrix;
|
75
|
+
|
76
|
+
public:
|
77
|
+
|
78
|
+
/** Default constructor without initialization of the coefficients. */
|
79
|
+
inline Transform() { }
|
80
|
+
|
81
|
+
inline Transform(const Transform& other)
|
82
|
+
{
|
83
|
+
m_matrix = other.m_matrix;
|
84
|
+
}
|
85
|
+
|
86
|
+
inline explicit Transform(const TranslationType& t) { *this = t; }
|
87
|
+
inline explicit Transform(const ScalingType& s) { *this = s; }
|
88
|
+
template<typename Derived>
|
89
|
+
inline explicit Transform(const RotationBase<Derived, Dim>& r) { *this = r; }
|
90
|
+
|
91
|
+
inline Transform& operator=(const Transform& other)
|
92
|
+
{ m_matrix = other.m_matrix; return *this; }
|
93
|
+
|
94
|
+
template<typename OtherDerived, bool BigMatrix> // MSVC 2005 will commit suicide if BigMatrix has a default value
|
95
|
+
struct construct_from_matrix
|
96
|
+
{
|
97
|
+
static inline void run(Transform *transform, const MatrixBase<OtherDerived>& other)
|
98
|
+
{
|
99
|
+
transform->matrix() = other;
|
100
|
+
}
|
101
|
+
};
|
102
|
+
|
103
|
+
template<typename OtherDerived> struct construct_from_matrix<OtherDerived, true>
|
104
|
+
{
|
105
|
+
static inline void run(Transform *transform, const MatrixBase<OtherDerived>& other)
|
106
|
+
{
|
107
|
+
transform->linear() = other;
|
108
|
+
transform->translation().setZero();
|
109
|
+
transform->matrix()(Dim,Dim) = Scalar(1);
|
110
|
+
transform->matrix().template block<1,Dim>(Dim,0).setZero();
|
111
|
+
}
|
112
|
+
};
|
113
|
+
|
114
|
+
/** Constructs and initializes a transformation from a Dim^2 or a (Dim+1)^2 matrix. */
|
115
|
+
template<typename OtherDerived>
|
116
|
+
inline explicit Transform(const MatrixBase<OtherDerived>& other)
|
117
|
+
{
|
118
|
+
construct_from_matrix<OtherDerived, int(OtherDerived::RowsAtCompileTime) == Dim>::run(this, other);
|
119
|
+
}
|
120
|
+
|
121
|
+
/** Set \c *this from a (Dim+1)^2 matrix. */
|
122
|
+
template<typename OtherDerived>
|
123
|
+
inline Transform& operator=(const MatrixBase<OtherDerived>& other)
|
124
|
+
{ m_matrix = other; return *this; }
|
125
|
+
|
126
|
+
#ifdef EIGEN_QT_SUPPORT
|
127
|
+
inline Transform(const QMatrix& other);
|
128
|
+
inline Transform& operator=(const QMatrix& other);
|
129
|
+
inline QMatrix toQMatrix(void) const;
|
130
|
+
inline Transform(const QTransform& other);
|
131
|
+
inline Transform& operator=(const QTransform& other);
|
132
|
+
inline QTransform toQTransform(void) const;
|
133
|
+
#endif
|
134
|
+
|
135
|
+
/** shortcut for m_matrix(row,col);
|
136
|
+
* \sa MatrixBase::operaror(int,int) const */
|
137
|
+
inline Scalar operator() (int row, int col) const { return m_matrix(row,col); }
|
138
|
+
/** shortcut for m_matrix(row,col);
|
139
|
+
* \sa MatrixBase::operaror(int,int) */
|
140
|
+
inline Scalar& operator() (int row, int col) { return m_matrix(row,col); }
|
141
|
+
|
142
|
+
/** \returns a read-only expression of the transformation matrix */
|
143
|
+
inline const MatrixType& matrix() const { return m_matrix; }
|
144
|
+
/** \returns a writable expression of the transformation matrix */
|
145
|
+
inline MatrixType& matrix() { return m_matrix; }
|
146
|
+
|
147
|
+
/** \returns a read-only expression of the linear (linear) part of the transformation */
|
148
|
+
inline ConstLinearPart linear() const { return m_matrix.template block<Dim,Dim>(0,0); }
|
149
|
+
/** \returns a writable expression of the linear (linear) part of the transformation */
|
150
|
+
inline LinearPart linear() { return m_matrix.template block<Dim,Dim>(0,0); }
|
151
|
+
|
152
|
+
/** \returns a read-only expression of the translation vector of the transformation */
|
153
|
+
inline ConstTranslationPart translation() const { return m_matrix.template block<Dim,1>(0,Dim); }
|
154
|
+
/** \returns a writable expression of the translation vector of the transformation */
|
155
|
+
inline TranslationPart translation() { return m_matrix.template block<Dim,1>(0,Dim); }
|
156
|
+
|
157
|
+
/** \returns an expression of the product between the transform \c *this and a matrix expression \a other
|
158
|
+
*
|
159
|
+
* The right hand side \a other might be either:
|
160
|
+
* \li a vector of size Dim,
|
161
|
+
* \li an homogeneous vector of size Dim+1,
|
162
|
+
* \li a transformation matrix of size Dim+1 x Dim+1.
|
163
|
+
*/
|
164
|
+
// note: this function is defined here because some compilers cannot find the respective declaration
|
165
|
+
template<typename OtherDerived>
|
166
|
+
inline const typename ei_transform_product_impl<OtherDerived,_Dim,_Dim+1>::ResultType
|
167
|
+
operator * (const MatrixBase<OtherDerived> &other) const
|
168
|
+
{ return ei_transform_product_impl<OtherDerived,Dim,HDim>::run(*this,other.derived()); }
|
169
|
+
|
170
|
+
/** \returns the product expression of a transformation matrix \a a times a transform \a b
|
171
|
+
* The transformation matrix \a a must have a Dim+1 x Dim+1 sizes. */
|
172
|
+
template<typename OtherDerived>
|
173
|
+
friend inline const typename ProductReturnType<OtherDerived,MatrixType>::Type
|
174
|
+
operator * (const MatrixBase<OtherDerived> &a, const Transform &b)
|
175
|
+
{ return a.derived() * b.matrix(); }
|
176
|
+
|
177
|
+
/** Contatenates two transformations */
|
178
|
+
inline const Transform
|
179
|
+
operator * (const Transform& other) const
|
180
|
+
{ return Transform(m_matrix * other.matrix()); }
|
181
|
+
|
182
|
+
/** \sa MatrixBase::setIdentity() */
|
183
|
+
void setIdentity() { m_matrix.setIdentity(); }
|
184
|
+
static const typename MatrixType::IdentityReturnType Identity()
|
185
|
+
{
|
186
|
+
return MatrixType::Identity();
|
187
|
+
}
|
188
|
+
|
189
|
+
template<typename OtherDerived>
|
190
|
+
inline Transform& scale(const MatrixBase<OtherDerived> &other);
|
191
|
+
|
192
|
+
template<typename OtherDerived>
|
193
|
+
inline Transform& prescale(const MatrixBase<OtherDerived> &other);
|
194
|
+
|
195
|
+
inline Transform& scale(Scalar s);
|
196
|
+
inline Transform& prescale(Scalar s);
|
197
|
+
|
198
|
+
template<typename OtherDerived>
|
199
|
+
inline Transform& translate(const MatrixBase<OtherDerived> &other);
|
200
|
+
|
201
|
+
template<typename OtherDerived>
|
202
|
+
inline Transform& pretranslate(const MatrixBase<OtherDerived> &other);
|
203
|
+
|
204
|
+
template<typename RotationType>
|
205
|
+
inline Transform& rotate(const RotationType& rotation);
|
206
|
+
|
207
|
+
template<typename RotationType>
|
208
|
+
inline Transform& prerotate(const RotationType& rotation);
|
209
|
+
|
210
|
+
Transform& shear(Scalar sx, Scalar sy);
|
211
|
+
Transform& preshear(Scalar sx, Scalar sy);
|
212
|
+
|
213
|
+
inline Transform& operator=(const TranslationType& t);
|
214
|
+
inline Transform& operator*=(const TranslationType& t) { return translate(t.vector()); }
|
215
|
+
inline Transform operator*(const TranslationType& t) const;
|
216
|
+
|
217
|
+
inline Transform& operator=(const ScalingType& t);
|
218
|
+
inline Transform& operator*=(const ScalingType& s) { return scale(s.coeffs()); }
|
219
|
+
inline Transform operator*(const ScalingType& s) const;
|
220
|
+
friend inline Transform operator*(const LinearMatrixType& mat, const Transform& t)
|
221
|
+
{
|
222
|
+
Transform res = t;
|
223
|
+
res.matrix().row(Dim) = t.matrix().row(Dim);
|
224
|
+
res.matrix().template block<Dim,HDim>(0,0) = (mat * t.matrix().template block<Dim,HDim>(0,0)).lazy();
|
225
|
+
return res;
|
226
|
+
}
|
227
|
+
|
228
|
+
template<typename Derived>
|
229
|
+
inline Transform& operator=(const RotationBase<Derived,Dim>& r);
|
230
|
+
template<typename Derived>
|
231
|
+
inline Transform& operator*=(const RotationBase<Derived,Dim>& r) { return rotate(r.toRotationMatrix()); }
|
232
|
+
template<typename Derived>
|
233
|
+
inline Transform operator*(const RotationBase<Derived,Dim>& r) const;
|
234
|
+
|
235
|
+
LinearMatrixType rotation() const;
|
236
|
+
template<typename RotationMatrixType, typename ScalingMatrixType>
|
237
|
+
void computeRotationScaling(RotationMatrixType *rotation, ScalingMatrixType *scaling) const;
|
238
|
+
template<typename ScalingMatrixType, typename RotationMatrixType>
|
239
|
+
void computeScalingRotation(ScalingMatrixType *scaling, RotationMatrixType *rotation) const;
|
240
|
+
|
241
|
+
template<typename PositionDerived, typename OrientationType, typename ScaleDerived>
|
242
|
+
Transform& fromPositionOrientationScale(const MatrixBase<PositionDerived> &position,
|
243
|
+
const OrientationType& orientation, const MatrixBase<ScaleDerived> &scale);
|
244
|
+
|
245
|
+
inline const MatrixType inverse(TransformTraits traits = Affine) const;
|
246
|
+
|
247
|
+
/** \returns a const pointer to the column major internal matrix */
|
248
|
+
const Scalar* data() const { return m_matrix.data(); }
|
249
|
+
/** \returns a non-const pointer to the column major internal matrix */
|
250
|
+
Scalar* data() { return m_matrix.data(); }
|
251
|
+
|
252
|
+
/** \returns \c *this with scalar type casted to \a NewScalarType
|
253
|
+
*
|
254
|
+
* Note that if \a NewScalarType is equal to the current scalar type of \c *this
|
255
|
+
* then this function smartly returns a const reference to \c *this.
|
256
|
+
*/
|
257
|
+
template<typename NewScalarType>
|
258
|
+
inline typename internal::cast_return_type<Transform,Transform<NewScalarType,Dim> >::type cast() const
|
259
|
+
{ return typename internal::cast_return_type<Transform,Transform<NewScalarType,Dim> >::type(*this); }
|
260
|
+
|
261
|
+
/** Copy constructor with scalar type conversion */
|
262
|
+
template<typename OtherScalarType>
|
263
|
+
inline explicit Transform(const Transform<OtherScalarType,Dim>& other)
|
264
|
+
{ m_matrix = other.matrix().template cast<Scalar>(); }
|
265
|
+
|
266
|
+
/** \returns \c true if \c *this is approximately equal to \a other, within the precision
|
267
|
+
* determined by \a prec.
|
268
|
+
*
|
269
|
+
* \sa MatrixBase::isApprox() */
|
270
|
+
bool isApprox(const Transform& other, typename NumTraits<Scalar>::Real prec = precision<Scalar>()) const
|
271
|
+
{ return m_matrix.isApprox(other.m_matrix, prec); }
|
272
|
+
|
273
|
+
#ifdef EIGEN_TRANSFORM_PLUGIN
|
274
|
+
#include EIGEN_TRANSFORM_PLUGIN
|
275
|
+
#endif
|
276
|
+
|
277
|
+
protected:
|
278
|
+
|
279
|
+
};
|
280
|
+
|
281
|
+
/** \ingroup Geometry_Module */
|
282
|
+
typedef Transform<float,2> Transform2f;
|
283
|
+
/** \ingroup Geometry_Module */
|
284
|
+
typedef Transform<float,3> Transform3f;
|
285
|
+
/** \ingroup Geometry_Module */
|
286
|
+
typedef Transform<double,2> Transform2d;
|
287
|
+
/** \ingroup Geometry_Module */
|
288
|
+
typedef Transform<double,3> Transform3d;
|
289
|
+
|
290
|
+
/**************************
|
291
|
+
*** Optional QT support ***
|
292
|
+
**************************/
|
293
|
+
|
294
|
+
#ifdef EIGEN_QT_SUPPORT
|
295
|
+
/** Initialises \c *this from a QMatrix assuming the dimension is 2.
|
296
|
+
*
|
297
|
+
* This function is available only if the token EIGEN_QT_SUPPORT is defined.
|
298
|
+
*/
|
299
|
+
template<typename Scalar, int Dim>
|
300
|
+
Transform<Scalar,Dim>::Transform(const QMatrix& other)
|
301
|
+
{
|
302
|
+
*this = other;
|
303
|
+
}
|
304
|
+
|
305
|
+
/** Set \c *this from a QMatrix assuming the dimension is 2.
|
306
|
+
*
|
307
|
+
* This function is available only if the token EIGEN_QT_SUPPORT is defined.
|
308
|
+
*/
|
309
|
+
template<typename Scalar, int Dim>
|
310
|
+
Transform<Scalar,Dim>& Transform<Scalar,Dim>::operator=(const QMatrix& other)
|
311
|
+
{
|
312
|
+
EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
|
313
|
+
m_matrix << other.m11(), other.m21(), other.dx(),
|
314
|
+
other.m12(), other.m22(), other.dy(),
|
315
|
+
0, 0, 1;
|
316
|
+
return *this;
|
317
|
+
}
|
318
|
+
|
319
|
+
/** \returns a QMatrix from \c *this assuming the dimension is 2.
|
320
|
+
*
|
321
|
+
* \warning this convertion might loss data if \c *this is not affine
|
322
|
+
*
|
323
|
+
* This function is available only if the token EIGEN_QT_SUPPORT is defined.
|
324
|
+
*/
|
325
|
+
template<typename Scalar, int Dim>
|
326
|
+
QMatrix Transform<Scalar,Dim>::toQMatrix(void) const
|
327
|
+
{
|
328
|
+
EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
|
329
|
+
return QMatrix(m_matrix.coeff(0,0), m_matrix.coeff(1,0),
|
330
|
+
m_matrix.coeff(0,1), m_matrix.coeff(1,1),
|
331
|
+
m_matrix.coeff(0,2), m_matrix.coeff(1,2));
|
332
|
+
}
|
333
|
+
|
334
|
+
/** Initialises \c *this from a QTransform assuming the dimension is 2.
|
335
|
+
*
|
336
|
+
* This function is available only if the token EIGEN_QT_SUPPORT is defined.
|
337
|
+
*/
|
338
|
+
template<typename Scalar, int Dim>
|
339
|
+
Transform<Scalar,Dim>::Transform(const QTransform& other)
|
340
|
+
{
|
341
|
+
*this = other;
|
342
|
+
}
|
343
|
+
|
344
|
+
/** Set \c *this from a QTransform assuming the dimension is 2.
|
345
|
+
*
|
346
|
+
* This function is available only if the token EIGEN_QT_SUPPORT is defined.
|
347
|
+
*/
|
348
|
+
template<typename Scalar, int Dim>
|
349
|
+
Transform<Scalar,Dim>& Transform<Scalar,Dim>::operator=(const QTransform& other)
|
350
|
+
{
|
351
|
+
EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
|
352
|
+
m_matrix << other.m11(), other.m21(), other.dx(),
|
353
|
+
other.m12(), other.m22(), other.dy(),
|
354
|
+
other.m13(), other.m23(), other.m33();
|
355
|
+
return *this;
|
356
|
+
}
|
357
|
+
|
358
|
+
/** \returns a QTransform from \c *this assuming the dimension is 2.
|
359
|
+
*
|
360
|
+
* This function is available only if the token EIGEN_QT_SUPPORT is defined.
|
361
|
+
*/
|
362
|
+
template<typename Scalar, int Dim>
|
363
|
+
QTransform Transform<Scalar,Dim>::toQTransform(void) const
|
364
|
+
{
|
365
|
+
EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
|
366
|
+
return QTransform(m_matrix.coeff(0,0), m_matrix.coeff(1,0), m_matrix.coeff(2,0),
|
367
|
+
m_matrix.coeff(0,1), m_matrix.coeff(1,1), m_matrix.coeff(2,1),
|
368
|
+
m_matrix.coeff(0,2), m_matrix.coeff(1,2), m_matrix.coeff(2,2));
|
369
|
+
}
|
370
|
+
#endif
|
371
|
+
|
372
|
+
/*********************
|
373
|
+
*** Procedural API ***
|
374
|
+
*********************/
|
375
|
+
|
376
|
+
/** Applies on the right the non uniform scale transformation represented
|
377
|
+
* by the vector \a other to \c *this and returns a reference to \c *this.
|
378
|
+
* \sa prescale()
|
379
|
+
*/
|
380
|
+
template<typename Scalar, int Dim>
|
381
|
+
template<typename OtherDerived>
|
382
|
+
Transform<Scalar,Dim>&
|
383
|
+
Transform<Scalar,Dim>::scale(const MatrixBase<OtherDerived> &other)
|
384
|
+
{
|
385
|
+
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
|
386
|
+
linear() = (linear() * other.asDiagonal()).lazy();
|
387
|
+
return *this;
|
388
|
+
}
|
389
|
+
|
390
|
+
/** Applies on the right a uniform scale of a factor \a c to \c *this
|
391
|
+
* and returns a reference to \c *this.
|
392
|
+
* \sa prescale(Scalar)
|
393
|
+
*/
|
394
|
+
template<typename Scalar, int Dim>
|
395
|
+
inline Transform<Scalar,Dim>& Transform<Scalar,Dim>::scale(Scalar s)
|
396
|
+
{
|
397
|
+
linear() *= s;
|
398
|
+
return *this;
|
399
|
+
}
|
400
|
+
|
401
|
+
/** Applies on the left the non uniform scale transformation represented
|
402
|
+
* by the vector \a other to \c *this and returns a reference to \c *this.
|
403
|
+
* \sa scale()
|
404
|
+
*/
|
405
|
+
template<typename Scalar, int Dim>
|
406
|
+
template<typename OtherDerived>
|
407
|
+
Transform<Scalar,Dim>&
|
408
|
+
Transform<Scalar,Dim>::prescale(const MatrixBase<OtherDerived> &other)
|
409
|
+
{
|
410
|
+
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
|
411
|
+
m_matrix.template block<Dim,HDim>(0,0) = (other.asDiagonal() * m_matrix.template block<Dim,HDim>(0,0)).lazy();
|
412
|
+
return *this;
|
413
|
+
}
|
414
|
+
|
415
|
+
/** Applies on the left a uniform scale of a factor \a c to \c *this
|
416
|
+
* and returns a reference to \c *this.
|
417
|
+
* \sa scale(Scalar)
|
418
|
+
*/
|
419
|
+
template<typename Scalar, int Dim>
|
420
|
+
inline Transform<Scalar,Dim>& Transform<Scalar,Dim>::prescale(Scalar s)
|
421
|
+
{
|
422
|
+
m_matrix.template corner<Dim,HDim>(TopLeft) *= s;
|
423
|
+
return *this;
|
424
|
+
}
|
425
|
+
|
426
|
+
/** Applies on the right the translation matrix represented by the vector \a other
|
427
|
+
* to \c *this and returns a reference to \c *this.
|
428
|
+
* \sa pretranslate()
|
429
|
+
*/
|
430
|
+
template<typename Scalar, int Dim>
|
431
|
+
template<typename OtherDerived>
|
432
|
+
Transform<Scalar,Dim>&
|
433
|
+
Transform<Scalar,Dim>::translate(const MatrixBase<OtherDerived> &other)
|
434
|
+
{
|
435
|
+
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
|
436
|
+
translation() += linear() * other;
|
437
|
+
return *this;
|
438
|
+
}
|
439
|
+
|
440
|
+
/** Applies on the left the translation matrix represented by the vector \a other
|
441
|
+
* to \c *this and returns a reference to \c *this.
|
442
|
+
* \sa translate()
|
443
|
+
*/
|
444
|
+
template<typename Scalar, int Dim>
|
445
|
+
template<typename OtherDerived>
|
446
|
+
Transform<Scalar,Dim>&
|
447
|
+
Transform<Scalar,Dim>::pretranslate(const MatrixBase<OtherDerived> &other)
|
448
|
+
{
|
449
|
+
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
|
450
|
+
translation() += other;
|
451
|
+
return *this;
|
452
|
+
}
|
453
|
+
|
454
|
+
/** Applies on the right the rotation represented by the rotation \a rotation
|
455
|
+
* to \c *this and returns a reference to \c *this.
|
456
|
+
*
|
457
|
+
* The template parameter \a RotationType is the type of the rotation which
|
458
|
+
* must be known by ei_toRotationMatrix<>.
|
459
|
+
*
|
460
|
+
* Natively supported types includes:
|
461
|
+
* - any scalar (2D),
|
462
|
+
* - a Dim x Dim matrix expression,
|
463
|
+
* - a Quaternion (3D),
|
464
|
+
* - a AngleAxis (3D)
|
465
|
+
*
|
466
|
+
* This mechanism is easily extendable to support user types such as Euler angles,
|
467
|
+
* or a pair of Quaternion for 4D rotations.
|
468
|
+
*
|
469
|
+
* \sa rotate(Scalar), class Quaternion, class AngleAxis, prerotate(RotationType)
|
470
|
+
*/
|
471
|
+
template<typename Scalar, int Dim>
|
472
|
+
template<typename RotationType>
|
473
|
+
Transform<Scalar,Dim>&
|
474
|
+
Transform<Scalar,Dim>::rotate(const RotationType& rotation)
|
475
|
+
{
|
476
|
+
linear() *= ei_toRotationMatrix<Scalar,Dim>(rotation);
|
477
|
+
return *this;
|
478
|
+
}
|
479
|
+
|
480
|
+
/** Applies on the left the rotation represented by the rotation \a rotation
|
481
|
+
* to \c *this and returns a reference to \c *this.
|
482
|
+
*
|
483
|
+
* See rotate() for further details.
|
484
|
+
*
|
485
|
+
* \sa rotate()
|
486
|
+
*/
|
487
|
+
template<typename Scalar, int Dim>
|
488
|
+
template<typename RotationType>
|
489
|
+
Transform<Scalar,Dim>&
|
490
|
+
Transform<Scalar,Dim>::prerotate(const RotationType& rotation)
|
491
|
+
{
|
492
|
+
m_matrix.template block<Dim,HDim>(0,0) = ei_toRotationMatrix<Scalar,Dim>(rotation)
|
493
|
+
* m_matrix.template block<Dim,HDim>(0,0);
|
494
|
+
return *this;
|
495
|
+
}
|
496
|
+
|
497
|
+
/** Applies on the right the shear transformation represented
|
498
|
+
* by the vector \a other to \c *this and returns a reference to \c *this.
|
499
|
+
* \warning 2D only.
|
500
|
+
* \sa preshear()
|
501
|
+
*/
|
502
|
+
template<typename Scalar, int Dim>
|
503
|
+
Transform<Scalar,Dim>&
|
504
|
+
Transform<Scalar,Dim>::shear(Scalar sx, Scalar sy)
|
505
|
+
{
|
506
|
+
EIGEN_STATIC_ASSERT(int(Dim)==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
|
507
|
+
VectorType tmp = linear().col(0)*sy + linear().col(1);
|
508
|
+
linear() << linear().col(0) + linear().col(1)*sx, tmp;
|
509
|
+
return *this;
|
510
|
+
}
|
511
|
+
|
512
|
+
/** Applies on the left the shear transformation represented
|
513
|
+
* by the vector \a other to \c *this and returns a reference to \c *this.
|
514
|
+
* \warning 2D only.
|
515
|
+
* \sa shear()
|
516
|
+
*/
|
517
|
+
template<typename Scalar, int Dim>
|
518
|
+
Transform<Scalar,Dim>&
|
519
|
+
Transform<Scalar,Dim>::preshear(Scalar sx, Scalar sy)
|
520
|
+
{
|
521
|
+
EIGEN_STATIC_ASSERT(int(Dim)==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
|
522
|
+
m_matrix.template block<Dim,HDim>(0,0) = LinearMatrixType(1, sx, sy, 1) * m_matrix.template block<Dim,HDim>(0,0);
|
523
|
+
return *this;
|
524
|
+
}
|
525
|
+
|
526
|
+
/******************************************************
|
527
|
+
*** Scaling, Translation and Rotation compatibility ***
|
528
|
+
******************************************************/
|
529
|
+
|
530
|
+
template<typename Scalar, int Dim>
|
531
|
+
inline Transform<Scalar,Dim>& Transform<Scalar,Dim>::operator=(const TranslationType& t)
|
532
|
+
{
|
533
|
+
linear().setIdentity();
|
534
|
+
translation() = t.vector();
|
535
|
+
m_matrix.template block<1,Dim>(Dim,0).setZero();
|
536
|
+
m_matrix(Dim,Dim) = Scalar(1);
|
537
|
+
return *this;
|
538
|
+
}
|
539
|
+
|
540
|
+
template<typename Scalar, int Dim>
|
541
|
+
inline Transform<Scalar,Dim> Transform<Scalar,Dim>::operator*(const TranslationType& t) const
|
542
|
+
{
|
543
|
+
Transform res = *this;
|
544
|
+
res.translate(t.vector());
|
545
|
+
return res;
|
546
|
+
}
|
547
|
+
|
548
|
+
template<typename Scalar, int Dim>
|
549
|
+
inline Transform<Scalar,Dim>& Transform<Scalar,Dim>::operator=(const ScalingType& s)
|
550
|
+
{
|
551
|
+
m_matrix.setZero();
|
552
|
+
linear().diagonal() = s.coeffs();
|
553
|
+
m_matrix.coeffRef(Dim,Dim) = Scalar(1);
|
554
|
+
return *this;
|
555
|
+
}
|
556
|
+
|
557
|
+
template<typename Scalar, int Dim>
|
558
|
+
inline Transform<Scalar,Dim> Transform<Scalar,Dim>::operator*(const ScalingType& s) const
|
559
|
+
{
|
560
|
+
Transform res = *this;
|
561
|
+
res.scale(s.coeffs());
|
562
|
+
return res;
|
563
|
+
}
|
564
|
+
|
565
|
+
template<typename Scalar, int Dim>
|
566
|
+
template<typename Derived>
|
567
|
+
inline Transform<Scalar,Dim>& Transform<Scalar,Dim>::operator=(const RotationBase<Derived,Dim>& r)
|
568
|
+
{
|
569
|
+
linear() = ei_toRotationMatrix<Scalar,Dim>(r);
|
570
|
+
translation().setZero();
|
571
|
+
m_matrix.template block<1,Dim>(Dim,0).setZero();
|
572
|
+
m_matrix.coeffRef(Dim,Dim) = Scalar(1);
|
573
|
+
return *this;
|
574
|
+
}
|
575
|
+
|
576
|
+
template<typename Scalar, int Dim>
|
577
|
+
template<typename Derived>
|
578
|
+
inline Transform<Scalar,Dim> Transform<Scalar,Dim>::operator*(const RotationBase<Derived,Dim>& r) const
|
579
|
+
{
|
580
|
+
Transform res = *this;
|
581
|
+
res.rotate(r.derived());
|
582
|
+
return res;
|
583
|
+
}
|
584
|
+
|
585
|
+
/************************
|
586
|
+
*** Special functions ***
|
587
|
+
************************/
|
588
|
+
|
589
|
+
/** \returns the rotation part of the transformation
|
590
|
+
* \nonstableyet
|
591
|
+
*
|
592
|
+
* \svd_module
|
593
|
+
*
|
594
|
+
* \sa computeRotationScaling(), computeScalingRotation(), class SVD
|
595
|
+
*/
|
596
|
+
template<typename Scalar, int Dim>
|
597
|
+
typename Transform<Scalar,Dim>::LinearMatrixType
|
598
|
+
Transform<Scalar,Dim>::rotation() const
|
599
|
+
{
|
600
|
+
LinearMatrixType result;
|
601
|
+
computeRotationScaling(&result, (LinearMatrixType*)0);
|
602
|
+
return result;
|
603
|
+
}
|
604
|
+
|
605
|
+
|
606
|
+
/** decomposes the linear part of the transformation as a product rotation x scaling, the scaling being
|
607
|
+
* not necessarily positive.
|
608
|
+
*
|
609
|
+
* If either pointer is zero, the corresponding computation is skipped.
|
610
|
+
*
|
611
|
+
* \nonstableyet
|
612
|
+
*
|
613
|
+
* \svd_module
|
614
|
+
*
|
615
|
+
* \sa computeScalingRotation(), rotation(), class SVD
|
616
|
+
*/
|
617
|
+
template<typename Scalar, int Dim>
|
618
|
+
template<typename RotationMatrixType, typename ScalingMatrixType>
|
619
|
+
void Transform<Scalar,Dim>::computeRotationScaling(RotationMatrixType *rotation, ScalingMatrixType *scaling) const
|
620
|
+
{
|
621
|
+
JacobiSVD<LinearMatrixType> svd(linear(), ComputeFullU|ComputeFullV);
|
622
|
+
Scalar x = (svd.matrixU() * svd.matrixV().adjoint()).determinant(); // so x has absolute value 1
|
623
|
+
Matrix<Scalar, Dim, 1> sv(svd.singularValues());
|
624
|
+
sv.coeffRef(0) *= x;
|
625
|
+
if(scaling)
|
626
|
+
{
|
627
|
+
scaling->noalias() = svd.matrixV() * sv.asDiagonal() * svd.matrixV().adjoint();
|
628
|
+
}
|
629
|
+
if(rotation)
|
630
|
+
{
|
631
|
+
LinearMatrixType m(svd.matrixU());
|
632
|
+
m.col(0) /= x;
|
633
|
+
rotation->noalias() = m * svd.matrixV().adjoint();
|
634
|
+
}
|
635
|
+
}
|
636
|
+
|
637
|
+
/** decomposes the linear part of the transformation as a product rotation x scaling, the scaling being
|
638
|
+
* not necessarily positive.
|
639
|
+
*
|
640
|
+
* If either pointer is zero, the corresponding computation is skipped.
|
641
|
+
*
|
642
|
+
* \nonstableyet
|
643
|
+
*
|
644
|
+
* \svd_module
|
645
|
+
*
|
646
|
+
* \sa computeRotationScaling(), rotation(), class SVD
|
647
|
+
*/
|
648
|
+
template<typename Scalar, int Dim>
|
649
|
+
template<typename ScalingMatrixType, typename RotationMatrixType>
|
650
|
+
void Transform<Scalar,Dim>::computeScalingRotation(ScalingMatrixType *scaling, RotationMatrixType *rotation) const
|
651
|
+
{
|
652
|
+
JacobiSVD<LinearMatrixType> svd(linear(), ComputeFullU|ComputeFullV);
|
653
|
+
Scalar x = (svd.matrixU() * svd.matrixV().adjoint()).determinant(); // so x has absolute value 1
|
654
|
+
Matrix<Scalar, Dim, 1> sv(svd.singularValues());
|
655
|
+
sv.coeffRef(0) *= x;
|
656
|
+
if(scaling)
|
657
|
+
{
|
658
|
+
scaling->noalias() = svd.matrixU() * sv.asDiagonal() * svd.matrixU().adjoint();
|
659
|
+
}
|
660
|
+
if(rotation)
|
661
|
+
{
|
662
|
+
LinearMatrixType m(svd.matrixU());
|
663
|
+
m.col(0) /= x;
|
664
|
+
rotation->noalias() = m * svd.matrixV().adjoint();
|
665
|
+
}
|
666
|
+
}
|
667
|
+
|
668
|
+
/** Convenient method to set \c *this from a position, orientation and scale
|
669
|
+
* of a 3D object.
|
670
|
+
*/
|
671
|
+
template<typename Scalar, int Dim>
|
672
|
+
template<typename PositionDerived, typename OrientationType, typename ScaleDerived>
|
673
|
+
Transform<Scalar,Dim>&
|
674
|
+
Transform<Scalar,Dim>::fromPositionOrientationScale(const MatrixBase<PositionDerived> &position,
|
675
|
+
const OrientationType& orientation, const MatrixBase<ScaleDerived> &scale)
|
676
|
+
{
|
677
|
+
linear() = ei_toRotationMatrix<Scalar,Dim>(orientation);
|
678
|
+
linear() *= scale.asDiagonal();
|
679
|
+
translation() = position;
|
680
|
+
m_matrix.template block<1,Dim>(Dim,0).setZero();
|
681
|
+
m_matrix(Dim,Dim) = Scalar(1);
|
682
|
+
return *this;
|
683
|
+
}
|
684
|
+
|
685
|
+
/** \nonstableyet
|
686
|
+
*
|
687
|
+
* \returns the inverse transformation matrix according to some given knowledge
|
688
|
+
* on \c *this.
|
689
|
+
*
|
690
|
+
* \param traits allows to optimize the inversion process when the transformion
|
691
|
+
* is known to be not a general transformation. The possible values are:
|
692
|
+
* - Projective if the transformation is not necessarily affine, i.e., if the
|
693
|
+
* last row is not guaranteed to be [0 ... 0 1]
|
694
|
+
* - Affine is the default, the last row is assumed to be [0 ... 0 1]
|
695
|
+
* - Isometry if the transformation is only a concatenations of translations
|
696
|
+
* and rotations.
|
697
|
+
*
|
698
|
+
* \warning unless \a traits is always set to NoShear or NoScaling, this function
|
699
|
+
* requires the generic inverse method of MatrixBase defined in the LU module. If
|
700
|
+
* you forget to include this module, then you will get hard to debug linking errors.
|
701
|
+
*
|
702
|
+
* \sa MatrixBase::inverse()
|
703
|
+
*/
|
704
|
+
template<typename Scalar, int Dim>
|
705
|
+
inline const typename Transform<Scalar,Dim>::MatrixType
|
706
|
+
Transform<Scalar,Dim>::inverse(TransformTraits traits) const
|
707
|
+
{
|
708
|
+
if (traits == Projective)
|
709
|
+
{
|
710
|
+
return m_matrix.inverse();
|
711
|
+
}
|
712
|
+
else
|
713
|
+
{
|
714
|
+
MatrixType res;
|
715
|
+
if (traits == Affine)
|
716
|
+
{
|
717
|
+
res.template corner<Dim,Dim>(TopLeft) = linear().inverse();
|
718
|
+
}
|
719
|
+
else if (traits == Isometry)
|
720
|
+
{
|
721
|
+
res.template corner<Dim,Dim>(TopLeft) = linear().transpose();
|
722
|
+
}
|
723
|
+
else
|
724
|
+
{
|
725
|
+
ei_assert("invalid traits value in Transform::inverse()");
|
726
|
+
}
|
727
|
+
// translation and remaining parts
|
728
|
+
res.template corner<Dim,1>(TopRight) = - res.template corner<Dim,Dim>(TopLeft) * translation();
|
729
|
+
res.template corner<1,Dim>(BottomLeft).setZero();
|
730
|
+
res.coeffRef(Dim,Dim) = Scalar(1);
|
731
|
+
return res;
|
732
|
+
}
|
733
|
+
}
|
734
|
+
|
735
|
+
/*****************************************************
|
736
|
+
*** Specializations of operator* with a MatrixBase ***
|
737
|
+
*****************************************************/
|
738
|
+
|
739
|
+
template<typename Other, int Dim, int HDim>
|
740
|
+
struct ei_transform_product_impl<Other,Dim,HDim, HDim,HDim>
|
741
|
+
{
|
742
|
+
typedef Transform<typename Other::Scalar,Dim> TransformType;
|
743
|
+
typedef typename TransformType::MatrixType MatrixType;
|
744
|
+
typedef typename ProductReturnType<MatrixType,Other>::Type ResultType;
|
745
|
+
static ResultType run(const TransformType& tr, const Other& other)
|
746
|
+
{ return tr.matrix() * other; }
|
747
|
+
};
|
748
|
+
|
749
|
+
template<typename Other, int Dim, int HDim>
|
750
|
+
struct ei_transform_product_impl<Other,Dim,HDim, Dim,Dim>
|
751
|
+
{
|
752
|
+
typedef Transform<typename Other::Scalar,Dim> TransformType;
|
753
|
+
typedef typename TransformType::MatrixType MatrixType;
|
754
|
+
typedef TransformType ResultType;
|
755
|
+
static ResultType run(const TransformType& tr, const Other& other)
|
756
|
+
{
|
757
|
+
TransformType res;
|
758
|
+
res.translation() = tr.translation();
|
759
|
+
res.matrix().row(Dim) = tr.matrix().row(Dim);
|
760
|
+
res.linear() = (tr.linear() * other).lazy();
|
761
|
+
return res;
|
762
|
+
}
|
763
|
+
};
|
764
|
+
|
765
|
+
template<typename Other, int Dim, int HDim>
|
766
|
+
struct ei_transform_product_impl<Other,Dim,HDim, HDim,1>
|
767
|
+
{
|
768
|
+
typedef Transform<typename Other::Scalar,Dim> TransformType;
|
769
|
+
typedef typename TransformType::MatrixType MatrixType;
|
770
|
+
typedef typename ProductReturnType<MatrixType,Other>::Type ResultType;
|
771
|
+
static ResultType run(const TransformType& tr, const Other& other)
|
772
|
+
{ return tr.matrix() * other; }
|
773
|
+
};
|
774
|
+
|
775
|
+
template<typename Other, int Dim, int HDim>
|
776
|
+
struct ei_transform_product_impl<Other,Dim,HDim, Dim,1>
|
777
|
+
{
|
778
|
+
typedef typename Other::Scalar Scalar;
|
779
|
+
typedef Transform<Scalar,Dim> TransformType;
|
780
|
+
typedef Matrix<Scalar,Dim,1> ResultType;
|
781
|
+
static ResultType run(const TransformType& tr, const Other& other)
|
782
|
+
{ return ((tr.linear() * other) + tr.translation())
|
783
|
+
* (Scalar(1) / ( (tr.matrix().template block<1,Dim>(Dim,0) * other).coeff(0) + tr.matrix().coeff(Dim,Dim))); }
|
784
|
+
};
|
785
|
+
|
786
|
+
} // end namespace Eigen
|