@smake/eigen 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/eigen/Eigen/AccelerateSupport +52 -0
- package/eigen/Eigen/Cholesky +18 -20
- package/eigen/Eigen/CholmodSupport +28 -28
- package/eigen/Eigen/Core +187 -120
- package/eigen/Eigen/Eigenvalues +16 -13
- package/eigen/Eigen/Geometry +18 -18
- package/eigen/Eigen/Householder +9 -7
- package/eigen/Eigen/IterativeLinearSolvers +8 -4
- package/eigen/Eigen/Jacobi +14 -13
- package/eigen/Eigen/KLUSupport +23 -21
- package/eigen/Eigen/LU +15 -16
- package/eigen/Eigen/MetisSupport +12 -12
- package/eigen/Eigen/OrderingMethods +54 -51
- package/eigen/Eigen/PaStiXSupport +23 -21
- package/eigen/Eigen/PardisoSupport +17 -14
- package/eigen/Eigen/QR +18 -20
- package/eigen/Eigen/QtAlignedMalloc +5 -12
- package/eigen/Eigen/SPQRSupport +21 -14
- package/eigen/Eigen/SVD +23 -17
- package/eigen/Eigen/Sparse +1 -2
- package/eigen/Eigen/SparseCholesky +18 -15
- package/eigen/Eigen/SparseCore +18 -17
- package/eigen/Eigen/SparseLU +9 -9
- package/eigen/Eigen/SparseQR +16 -14
- package/eigen/Eigen/StdDeque +5 -2
- package/eigen/Eigen/StdList +5 -2
- package/eigen/Eigen/StdVector +5 -2
- package/eigen/Eigen/SuperLUSupport +30 -24
- package/eigen/Eigen/ThreadPool +80 -0
- package/eigen/Eigen/UmfPackSupport +19 -17
- package/eigen/Eigen/Version +14 -0
- package/eigen/Eigen/src/AccelerateSupport/AccelerateSupport.h +423 -0
- package/eigen/Eigen/src/AccelerateSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Cholesky/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Cholesky/LDLT.h +366 -405
- package/eigen/Eigen/src/Cholesky/LLT.h +323 -367
- package/eigen/Eigen/src/Cholesky/LLT_LAPACKE.h +81 -56
- package/eigen/Eigen/src/CholmodSupport/CholmodSupport.h +585 -529
- package/eigen/Eigen/src/CholmodSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Core/ArithmeticSequence.h +143 -317
- package/eigen/Eigen/src/Core/Array.h +329 -370
- package/eigen/Eigen/src/Core/ArrayBase.h +190 -203
- package/eigen/Eigen/src/Core/ArrayWrapper.h +126 -170
- package/eigen/Eigen/src/Core/Assign.h +30 -40
- package/eigen/Eigen/src/Core/AssignEvaluator.h +651 -604
- package/eigen/Eigen/src/Core/Assign_MKL.h +125 -120
- package/eigen/Eigen/src/Core/BandMatrix.h +267 -282
- package/eigen/Eigen/src/Core/Block.h +371 -390
- package/eigen/Eigen/src/Core/CommaInitializer.h +85 -100
- package/eigen/Eigen/src/Core/ConditionEstimator.h +51 -53
- package/eigen/Eigen/src/Core/CoreEvaluators.h +1214 -937
- package/eigen/Eigen/src/Core/CoreIterators.h +72 -63
- package/eigen/Eigen/src/Core/CwiseBinaryOp.h +112 -129
- package/eigen/Eigen/src/Core/CwiseNullaryOp.h +676 -702
- package/eigen/Eigen/src/Core/CwiseTernaryOp.h +77 -103
- package/eigen/Eigen/src/Core/CwiseUnaryOp.h +55 -67
- package/eigen/Eigen/src/Core/CwiseUnaryView.h +127 -92
- package/eigen/Eigen/src/Core/DenseBase.h +630 -658
- package/eigen/Eigen/src/Core/DenseCoeffsBase.h +511 -628
- package/eigen/Eigen/src/Core/DenseStorage.h +511 -590
- package/eigen/Eigen/src/Core/DeviceWrapper.h +153 -0
- package/eigen/Eigen/src/Core/Diagonal.h +168 -207
- package/eigen/Eigen/src/Core/DiagonalMatrix.h +346 -317
- package/eigen/Eigen/src/Core/DiagonalProduct.h +12 -10
- package/eigen/Eigen/src/Core/Dot.h +167 -217
- package/eigen/Eigen/src/Core/EigenBase.h +74 -85
- package/eigen/Eigen/src/Core/Fill.h +138 -0
- package/eigen/Eigen/src/Core/FindCoeff.h +464 -0
- package/eigen/Eigen/src/Core/ForceAlignedAccess.h +90 -113
- package/eigen/Eigen/src/Core/Fuzzy.h +82 -105
- package/eigen/Eigen/src/Core/GeneralProduct.h +315 -261
- package/eigen/Eigen/src/Core/GenericPacketMath.h +1182 -520
- package/eigen/Eigen/src/Core/GlobalFunctions.h +193 -157
- package/eigen/Eigen/src/Core/IO.h +131 -156
- package/eigen/Eigen/src/Core/IndexedView.h +209 -125
- package/eigen/Eigen/src/Core/InnerProduct.h +260 -0
- package/eigen/Eigen/src/Core/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Core/Inverse.h +50 -59
- package/eigen/Eigen/src/Core/Map.h +123 -141
- package/eigen/Eigen/src/Core/MapBase.h +255 -282
- package/eigen/Eigen/src/Core/MathFunctions.h +1247 -1201
- package/eigen/Eigen/src/Core/MathFunctionsImpl.h +162 -99
- package/eigen/Eigen/src/Core/Matrix.h +463 -494
- package/eigen/Eigen/src/Core/MatrixBase.h +468 -470
- package/eigen/Eigen/src/Core/NestByValue.h +58 -52
- package/eigen/Eigen/src/Core/NoAlias.h +79 -86
- package/eigen/Eigen/src/Core/NumTraits.h +206 -206
- package/eigen/Eigen/src/Core/PartialReduxEvaluator.h +163 -142
- package/eigen/Eigen/src/Core/PermutationMatrix.h +461 -511
- package/eigen/Eigen/src/Core/PlainObjectBase.h +858 -972
- package/eigen/Eigen/src/Core/Product.h +246 -130
- package/eigen/Eigen/src/Core/ProductEvaluators.h +779 -671
- package/eigen/Eigen/src/Core/Random.h +153 -164
- package/eigen/Eigen/src/Core/RandomImpl.h +262 -0
- package/eigen/Eigen/src/Core/RealView.h +250 -0
- package/eigen/Eigen/src/Core/Redux.h +334 -314
- package/eigen/Eigen/src/Core/Ref.h +259 -257
- package/eigen/Eigen/src/Core/Replicate.h +92 -104
- package/eigen/Eigen/src/Core/Reshaped.h +215 -271
- package/eigen/Eigen/src/Core/ReturnByValue.h +47 -55
- package/eigen/Eigen/src/Core/Reverse.h +133 -148
- package/eigen/Eigen/src/Core/Select.h +68 -140
- package/eigen/Eigen/src/Core/SelfAdjointView.h +254 -290
- package/eigen/Eigen/src/Core/SelfCwiseBinaryOp.h +23 -20
- package/eigen/Eigen/src/Core/SkewSymmetricMatrix3.h +382 -0
- package/eigen/Eigen/src/Core/Solve.h +88 -102
- package/eigen/Eigen/src/Core/SolveTriangular.h +126 -124
- package/eigen/Eigen/src/Core/SolverBase.h +132 -133
- package/eigen/Eigen/src/Core/StableNorm.h +113 -147
- package/eigen/Eigen/src/Core/StlIterators.h +404 -248
- package/eigen/Eigen/src/Core/Stride.h +90 -92
- package/eigen/Eigen/src/Core/Swap.h +70 -39
- package/eigen/Eigen/src/Core/Transpose.h +258 -295
- package/eigen/Eigen/src/Core/Transpositions.h +270 -333
- package/eigen/Eigen/src/Core/TriangularMatrix.h +642 -743
- package/eigen/Eigen/src/Core/VectorBlock.h +59 -72
- package/eigen/Eigen/src/Core/VectorwiseOp.h +653 -704
- package/eigen/Eigen/src/Core/Visitor.h +464 -308
- package/eigen/Eigen/src/Core/arch/AVX/Complex.h +380 -187
- package/eigen/Eigen/src/Core/arch/AVX/MathFunctions.h +65 -163
- package/eigen/Eigen/src/Core/arch/AVX/PacketMath.h +2145 -638
- package/eigen/Eigen/src/Core/arch/AVX/Reductions.h +353 -0
- package/eigen/Eigen/src/Core/arch/AVX/TypeCasting.h +253 -60
- package/eigen/Eigen/src/Core/arch/AVX512/Complex.h +278 -228
- package/eigen/Eigen/src/Core/arch/AVX512/GemmKernel.h +1245 -0
- package/eigen/Eigen/src/Core/arch/AVX512/MathFunctions.h +48 -269
- package/eigen/Eigen/src/Core/arch/AVX512/MathFunctionsFP16.h +75 -0
- package/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h +1597 -754
- package/eigen/Eigen/src/Core/arch/AVX512/PacketMathFP16.h +1413 -0
- package/eigen/Eigen/src/Core/arch/AVX512/Reductions.h +297 -0
- package/eigen/Eigen/src/Core/arch/AVX512/TrsmKernel.h +1167 -0
- package/eigen/Eigen/src/Core/arch/AVX512/TrsmUnrolls.inc +1219 -0
- package/eigen/Eigen/src/Core/arch/AVX512/TypeCasting.h +229 -41
- package/eigen/Eigen/src/Core/arch/AVX512/TypeCastingFP16.h +130 -0
- package/eigen/Eigen/src/Core/arch/AltiVec/Complex.h +420 -184
- package/eigen/Eigen/src/Core/arch/AltiVec/MathFunctions.h +40 -49
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProduct.h +2962 -2213
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h +196 -212
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h +713 -441
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductMMAbfloat16.h +742 -0
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixVectorProduct.inc +2818 -0
- package/eigen/Eigen/src/Core/arch/AltiVec/PacketMath.h +2380 -1362
- package/eigen/Eigen/src/Core/arch/AltiVec/TypeCasting.h +153 -0
- package/eigen/Eigen/src/Core/arch/Default/BFloat16.h +390 -224
- package/eigen/Eigen/src/Core/arch/Default/ConjHelper.h +78 -67
- package/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +1784 -799
- package/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +167 -50
- package/eigen/Eigen/src/Core/arch/Default/Half.h +528 -379
- package/eigen/Eigen/src/Core/arch/Default/Settings.h +10 -12
- package/eigen/Eigen/src/Core/arch/GPU/Complex.h +244 -0
- package/eigen/Eigen/src/Core/arch/GPU/MathFunctions.h +41 -40
- package/eigen/Eigen/src/Core/arch/GPU/PacketMath.h +550 -523
- package/eigen/Eigen/src/Core/arch/GPU/Tuple.h +268 -0
- package/eigen/Eigen/src/Core/arch/GPU/TypeCasting.h +27 -30
- package/eigen/Eigen/src/Core/arch/HIP/hcc/math_constants.h +8 -8
- package/eigen/Eigen/src/Core/arch/HVX/PacketMath.h +1088 -0
- package/eigen/Eigen/src/Core/arch/LSX/Complex.h +520 -0
- package/eigen/Eigen/src/Core/arch/LSX/GeneralBlockPanelKernel.h +23 -0
- package/eigen/Eigen/src/Core/arch/LSX/MathFunctions.h +43 -0
- package/eigen/Eigen/src/Core/arch/LSX/PacketMath.h +2866 -0
- package/eigen/Eigen/src/Core/arch/LSX/TypeCasting.h +526 -0
- package/eigen/Eigen/src/Core/arch/MSA/Complex.h +54 -82
- package/eigen/Eigen/src/Core/arch/MSA/MathFunctions.h +84 -92
- package/eigen/Eigen/src/Core/arch/MSA/PacketMath.h +51 -47
- package/eigen/Eigen/src/Core/arch/NEON/Complex.h +454 -306
- package/eigen/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h +175 -115
- package/eigen/Eigen/src/Core/arch/NEON/MathFunctions.h +23 -30
- package/eigen/Eigen/src/Core/arch/NEON/PacketMath.h +4366 -2857
- package/eigen/Eigen/src/Core/arch/NEON/TypeCasting.h +616 -393
- package/eigen/Eigen/src/Core/arch/NEON/UnaryFunctors.h +57 -0
- package/eigen/Eigen/src/Core/arch/SSE/Complex.h +350 -198
- package/eigen/Eigen/src/Core/arch/SSE/MathFunctions.h +38 -149
- package/eigen/Eigen/src/Core/arch/SSE/PacketMath.h +1791 -912
- package/eigen/Eigen/src/Core/arch/SSE/Reductions.h +324 -0
- package/eigen/Eigen/src/Core/arch/SSE/TypeCasting.h +128 -40
- package/eigen/Eigen/src/Core/arch/SVE/MathFunctions.h +10 -6
- package/eigen/Eigen/src/Core/arch/SVE/PacketMath.h +156 -234
- package/eigen/Eigen/src/Core/arch/SVE/TypeCasting.h +6 -3
- package/eigen/Eigen/src/Core/arch/SYCL/InteropHeaders.h +27 -32
- package/eigen/Eigen/src/Core/arch/SYCL/MathFunctions.h +119 -117
- package/eigen/Eigen/src/Core/arch/SYCL/PacketMath.h +325 -419
- package/eigen/Eigen/src/Core/arch/SYCL/TypeCasting.h +15 -17
- package/eigen/Eigen/src/Core/arch/ZVector/Complex.h +325 -181
- package/eigen/Eigen/src/Core/arch/ZVector/MathFunctions.h +94 -83
- package/eigen/Eigen/src/Core/arch/ZVector/PacketMath.h +811 -458
- package/eigen/Eigen/src/Core/functors/AssignmentFunctors.h +121 -124
- package/eigen/Eigen/src/Core/functors/BinaryFunctors.h +576 -370
- package/eigen/Eigen/src/Core/functors/NullaryFunctors.h +194 -109
- package/eigen/Eigen/src/Core/functors/StlFunctors.h +95 -112
- package/eigen/Eigen/src/Core/functors/TernaryFunctors.h +34 -7
- package/eigen/Eigen/src/Core/functors/UnaryFunctors.h +1038 -749
- package/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h +1883 -1375
- package/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h +312 -370
- package/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +189 -176
- package/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +84 -81
- package/eigen/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +154 -73
- package/eigen/Eigen/src/Core/products/GeneralMatrixVector.h +292 -337
- package/eigen/Eigen/src/Core/products/GeneralMatrixVector_BLAS.h +80 -77
- package/eigen/Eigen/src/Core/products/Parallelizer.h +207 -105
- package/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +327 -388
- package/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +206 -224
- package/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h +138 -147
- package/eigen/Eigen/src/Core/products/SelfadjointMatrixVector_BLAS.h +58 -61
- package/eigen/Eigen/src/Core/products/SelfadjointProduct.h +71 -71
- package/eigen/Eigen/src/Core/products/SelfadjointRank2Update.h +48 -47
- package/eigen/Eigen/src/Core/products/TriangularMatrixMatrix.h +294 -369
- package/eigen/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h +246 -238
- package/eigen/Eigen/src/Core/products/TriangularMatrixVector.h +244 -247
- package/eigen/Eigen/src/Core/products/TriangularMatrixVector_BLAS.h +212 -192
- package/eigen/Eigen/src/Core/products/TriangularSolverMatrix.h +328 -277
- package/eigen/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +108 -109
- package/eigen/Eigen/src/Core/products/TriangularSolverVector.h +68 -94
- package/eigen/Eigen/src/Core/util/Assert.h +158 -0
- package/eigen/Eigen/src/Core/util/BlasUtil.h +342 -303
- package/eigen/Eigen/src/Core/util/ConfigureVectorization.h +348 -317
- package/eigen/Eigen/src/Core/util/Constants.h +297 -262
- package/eigen/Eigen/src/Core/util/DisableStupidWarnings.h +130 -90
- package/eigen/Eigen/src/Core/util/EmulateArray.h +270 -0
- package/eigen/Eigen/src/Core/util/ForwardDeclarations.h +449 -247
- package/eigen/Eigen/src/Core/util/GpuHipCudaDefines.inc +101 -0
- package/eigen/Eigen/src/Core/util/GpuHipCudaUndefines.inc +45 -0
- package/eigen/Eigen/src/Core/util/IndexedViewHelper.h +417 -116
- package/eigen/Eigen/src/Core/util/IntegralConstant.h +211 -204
- package/eigen/Eigen/src/Core/util/MKL_support.h +39 -37
- package/eigen/Eigen/src/Core/util/Macros.h +655 -773
- package/eigen/Eigen/src/Core/util/MaxSizeVector.h +139 -0
- package/eigen/Eigen/src/Core/util/Memory.h +970 -748
- package/eigen/Eigen/src/Core/util/Meta.h +581 -633
- package/eigen/Eigen/src/Core/util/MoreMeta.h +638 -0
- package/eigen/Eigen/src/Core/util/ReenableStupidWarnings.h +32 -19
- package/eigen/Eigen/src/Core/util/ReshapedHelper.h +17 -17
- package/eigen/Eigen/src/Core/util/Serializer.h +209 -0
- package/eigen/Eigen/src/Core/util/StaticAssert.h +50 -166
- package/eigen/Eigen/src/Core/util/SymbolicIndex.h +377 -225
- package/eigen/Eigen/src/Core/util/XprHelper.h +784 -547
- package/eigen/Eigen/src/Eigenvalues/ComplexEigenSolver.h +246 -277
- package/eigen/Eigen/src/Eigenvalues/ComplexSchur.h +299 -319
- package/eigen/Eigen/src/Eigenvalues/ComplexSchur_LAPACKE.h +52 -48
- package/eigen/Eigen/src/Eigenvalues/EigenSolver.h +413 -456
- package/eigen/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +309 -325
- package/eigen/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +157 -171
- package/eigen/Eigen/src/Eigenvalues/HessenbergDecomposition.h +292 -310
- package/eigen/Eigen/src/Eigenvalues/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +89 -105
- package/eigen/Eigen/src/Eigenvalues/RealQZ.h +537 -607
- package/eigen/Eigen/src/Eigenvalues/RealSchur.h +342 -381
- package/eigen/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h +41 -35
- package/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +541 -595
- package/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h +47 -44
- package/eigen/Eigen/src/Eigenvalues/Tridiagonalization.h +430 -462
- package/eigen/Eigen/src/Geometry/AlignedBox.h +226 -227
- package/eigen/Eigen/src/Geometry/AngleAxis.h +131 -133
- package/eigen/Eigen/src/Geometry/EulerAngles.h +163 -74
- package/eigen/Eigen/src/Geometry/Homogeneous.h +285 -333
- package/eigen/Eigen/src/Geometry/Hyperplane.h +151 -160
- package/eigen/Eigen/src/Geometry/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Geometry/OrthoMethods.h +168 -146
- package/eigen/Eigen/src/Geometry/ParametrizedLine.h +127 -127
- package/eigen/Eigen/src/Geometry/Quaternion.h +566 -506
- package/eigen/Eigen/src/Geometry/Rotation2D.h +107 -105
- package/eigen/Eigen/src/Geometry/RotationBase.h +148 -145
- package/eigen/Eigen/src/Geometry/Scaling.h +113 -106
- package/eigen/Eigen/src/Geometry/Transform.h +858 -936
- package/eigen/Eigen/src/Geometry/Translation.h +94 -92
- package/eigen/Eigen/src/Geometry/Umeyama.h +79 -84
- package/eigen/Eigen/src/Geometry/arch/Geometry_SIMD.h +90 -104
- package/eigen/Eigen/src/Householder/BlockHouseholder.h +51 -46
- package/eigen/Eigen/src/Householder/Householder.h +102 -124
- package/eigen/Eigen/src/Householder/HouseholderSequence.h +412 -453
- package/eigen/Eigen/src/Householder/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +149 -162
- package/eigen/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +124 -119
- package/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +92 -104
- package/eigen/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +251 -243
- package/eigen/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +224 -228
- package/eigen/Eigen/src/IterativeLinearSolvers/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +178 -227
- package/eigen/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +79 -84
- package/eigen/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +54 -60
- package/eigen/Eigen/src/Jacobi/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Jacobi/Jacobi.h +252 -308
- package/eigen/Eigen/src/KLUSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/KLUSupport/KLUSupport.h +208 -227
- package/eigen/Eigen/src/LU/Determinant.h +50 -69
- package/eigen/Eigen/src/LU/FullPivLU.h +545 -596
- package/eigen/Eigen/src/LU/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/LU/InverseImpl.h +206 -285
- package/eigen/Eigen/src/LU/PartialPivLU.h +390 -428
- package/eigen/Eigen/src/LU/PartialPivLU_LAPACKE.h +54 -40
- package/eigen/Eigen/src/LU/arch/InverseSize4.h +72 -70
- package/eigen/Eigen/src/MetisSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/MetisSupport/MetisSupport.h +81 -93
- package/eigen/Eigen/src/OrderingMethods/Amd.h +243 -265
- package/eigen/Eigen/src/OrderingMethods/Eigen_Colamd.h +831 -1004
- package/eigen/Eigen/src/OrderingMethods/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/OrderingMethods/Ordering.h +112 -119
- package/eigen/Eigen/src/PaStiXSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/PaStiXSupport/PaStiXSupport.h +524 -570
- package/eigen/Eigen/src/PardisoSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/PardisoSupport/PardisoSupport.h +385 -430
- package/eigen/Eigen/src/QR/ColPivHouseholderQR.h +479 -479
- package/eigen/Eigen/src/QR/ColPivHouseholderQR_LAPACKE.h +120 -56
- package/eigen/Eigen/src/QR/CompleteOrthogonalDecomposition.h +166 -153
- package/eigen/Eigen/src/QR/FullPivHouseholderQR.h +495 -475
- package/eigen/Eigen/src/QR/HouseholderQR.h +394 -285
- package/eigen/Eigen/src/QR/HouseholderQR_LAPACKE.h +32 -23
- package/eigen/Eigen/src/QR/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SPQRSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +244 -264
- package/eigen/Eigen/src/SVD/BDCSVD.h +817 -713
- package/eigen/Eigen/src/SVD/BDCSVD_LAPACKE.h +174 -0
- package/eigen/Eigen/src/SVD/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SVD/JacobiSVD.h +577 -543
- package/eigen/Eigen/src/SVD/JacobiSVD_LAPACKE.h +85 -49
- package/eigen/Eigen/src/SVD/SVDBase.h +242 -182
- package/eigen/Eigen/src/SVD/UpperBidiagonalization.h +200 -235
- package/eigen/Eigen/src/SparseCholesky/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SparseCholesky/SimplicialCholesky.h +765 -594
- package/eigen/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +308 -94
- package/eigen/Eigen/src/SparseCore/AmbiVector.h +202 -251
- package/eigen/Eigen/src/SparseCore/CompressedStorage.h +184 -252
- package/eigen/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +134 -178
- package/eigen/Eigen/src/SparseCore/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SparseCore/SparseAssign.h +149 -140
- package/eigen/Eigen/src/SparseCore/SparseBlock.h +403 -440
- package/eigen/Eigen/src/SparseCore/SparseColEtree.h +100 -112
- package/eigen/Eigen/src/SparseCore/SparseCompressedBase.h +525 -303
- package/eigen/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +555 -339
- package/eigen/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +100 -108
- package/eigen/Eigen/src/SparseCore/SparseDenseProduct.h +169 -197
- package/eigen/Eigen/src/SparseCore/SparseDiagonalProduct.h +71 -71
- package/eigen/Eigen/src/SparseCore/SparseDot.h +49 -47
- package/eigen/Eigen/src/SparseCore/SparseFuzzy.h +13 -11
- package/eigen/Eigen/src/SparseCore/SparseMap.h +243 -253
- package/eigen/Eigen/src/SparseCore/SparseMatrix.h +1603 -1245
- package/eigen/Eigen/src/SparseCore/SparseMatrixBase.h +403 -350
- package/eigen/Eigen/src/SparseCore/SparsePermutation.h +186 -115
- package/eigen/Eigen/src/SparseCore/SparseProduct.h +94 -97
- package/eigen/Eigen/src/SparseCore/SparseRedux.h +22 -24
- package/eigen/Eigen/src/SparseCore/SparseRef.h +268 -295
- package/eigen/Eigen/src/SparseCore/SparseSelfAdjointView.h +370 -416
- package/eigen/Eigen/src/SparseCore/SparseSolverBase.h +78 -87
- package/eigen/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +81 -95
- package/eigen/Eigen/src/SparseCore/SparseTranspose.h +62 -71
- package/eigen/Eigen/src/SparseCore/SparseTriangularView.h +132 -144
- package/eigen/Eigen/src/SparseCore/SparseUtil.h +138 -115
- package/eigen/Eigen/src/SparseCore/SparseVector.h +426 -372
- package/eigen/Eigen/src/SparseCore/SparseView.h +164 -193
- package/eigen/Eigen/src/SparseCore/TriangularSolver.h +129 -170
- package/eigen/Eigen/src/SparseLU/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SparseLU/SparseLU.h +756 -710
- package/eigen/Eigen/src/SparseLU/SparseLUImpl.h +61 -48
- package/eigen/Eigen/src/SparseLU/SparseLU_Memory.h +102 -118
- package/eigen/Eigen/src/SparseLU/SparseLU_Structs.h +38 -35
- package/eigen/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +245 -301
- package/eigen/Eigen/src/SparseLU/SparseLU_Utils.h +44 -49
- package/eigen/Eigen/src/SparseLU/SparseLU_column_bmod.h +104 -108
- package/eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h +89 -100
- package/eigen/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +57 -58
- package/eigen/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +43 -55
- package/eigen/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +74 -71
- package/eigen/Eigen/src/SparseLU/SparseLU_panel_bmod.h +124 -132
- package/eigen/Eigen/src/SparseLU/SparseLU_panel_dfs.h +136 -159
- package/eigen/Eigen/src/SparseLU/SparseLU_pivotL.h +51 -52
- package/eigen/Eigen/src/SparseLU/SparseLU_pruneL.h +67 -73
- package/eigen/Eigen/src/SparseLU/SparseLU_relax_snode.h +24 -26
- package/eigen/Eigen/src/SparseQR/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SparseQR/SparseQR.h +450 -502
- package/eigen/Eigen/src/StlSupport/StdDeque.h +28 -93
- package/eigen/Eigen/src/StlSupport/StdList.h +28 -84
- package/eigen/Eigen/src/StlSupport/StdVector.h +28 -108
- package/eigen/Eigen/src/StlSupport/details.h +48 -50
- package/eigen/Eigen/src/SuperLUSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h +634 -730
- package/eigen/Eigen/src/ThreadPool/Barrier.h +70 -0
- package/eigen/Eigen/src/ThreadPool/CoreThreadPoolDevice.h +336 -0
- package/eigen/Eigen/src/ThreadPool/EventCount.h +241 -0
- package/eigen/Eigen/src/ThreadPool/ForkJoin.h +140 -0
- package/eigen/Eigen/src/ThreadPool/InternalHeaderCheck.h +4 -0
- package/eigen/Eigen/src/ThreadPool/NonBlockingThreadPool.h +587 -0
- package/eigen/Eigen/src/ThreadPool/RunQueue.h +230 -0
- package/eigen/Eigen/src/ThreadPool/ThreadCancel.h +21 -0
- package/eigen/Eigen/src/ThreadPool/ThreadEnvironment.h +43 -0
- package/eigen/Eigen/src/ThreadPool/ThreadLocal.h +289 -0
- package/eigen/Eigen/src/ThreadPool/ThreadPoolInterface.h +50 -0
- package/eigen/Eigen/src/ThreadPool/ThreadYield.h +16 -0
- package/eigen/Eigen/src/UmfPackSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/UmfPackSupport/UmfPackSupport.h +428 -464
- package/eigen/Eigen/src/misc/Image.h +41 -43
- package/eigen/Eigen/src/misc/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/misc/Kernel.h +39 -41
- package/eigen/Eigen/src/misc/RealSvd2x2.h +19 -21
- package/eigen/Eigen/src/misc/blas.h +83 -426
- package/eigen/Eigen/src/misc/lapacke.h +9972 -16179
- package/eigen/Eigen/src/misc/lapacke_helpers.h +163 -0
- package/eigen/Eigen/src/misc/lapacke_mangling.h +4 -5
- package/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.inc +344 -0
- package/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.inc +544 -0
- package/eigen/Eigen/src/plugins/{BlockMethods.h → BlockMethods.inc} +434 -506
- package/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.inc +116 -0
- package/eigen/Eigen/src/plugins/{CommonCwiseUnaryOps.h → CommonCwiseUnaryOps.inc} +58 -68
- package/eigen/Eigen/src/plugins/IndexedViewMethods.inc +192 -0
- package/eigen/Eigen/src/plugins/InternalHeaderCheck.inc +3 -0
- package/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.inc +331 -0
- package/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.inc +118 -0
- package/eigen/Eigen/src/plugins/ReshapedMethods.inc +133 -0
- package/package.json +1 -1
- package/eigen/COPYING.APACHE +0 -203
- package/eigen/COPYING.BSD +0 -26
- package/eigen/COPYING.GPL +0 -674
- package/eigen/COPYING.LGPL +0 -502
- package/eigen/COPYING.MINPACK +0 -51
- package/eigen/COPYING.MPL2 +0 -373
- package/eigen/COPYING.README +0 -18
- package/eigen/Eigen/src/Core/BooleanRedux.h +0 -162
- package/eigen/Eigen/src/Core/arch/CUDA/Complex.h +0 -258
- package/eigen/Eigen/src/Core/arch/Default/TypeCasting.h +0 -120
- package/eigen/Eigen/src/Core/arch/SYCL/SyclMemoryModel.h +0 -694
- package/eigen/Eigen/src/Core/util/NonMPL2.h +0 -3
- package/eigen/Eigen/src/SparseCore/MappedSparseMatrix.h +0 -67
- package/eigen/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +0 -280
- package/eigen/Eigen/src/misc/lapack.h +0 -152
- package/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.h +0 -358
- package/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.h +0 -696
- package/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.h +0 -115
- package/eigen/Eigen/src/plugins/IndexedViewMethods.h +0 -262
- package/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.h +0 -152
- package/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.h +0 -95
- package/eigen/Eigen/src/plugins/ReshapedMethods.h +0 -149
- package/eigen/README.md +0 -5
|
@@ -10,30 +10,29 @@
|
|
|
10
10
|
|
|
11
11
|
#ifndef EIGEN_QUATERNION_H
|
|
12
12
|
#define EIGEN_QUATERNION_H
|
|
13
|
-
|
|
13
|
+
// IWYU pragma: private
|
|
14
|
+
#include "./InternalHeaderCheck.h"
|
|
14
15
|
|
|
16
|
+
namespace Eigen {
|
|
15
17
|
|
|
16
18
|
/***************************************************************************
|
|
17
|
-
* Definition of QuaternionBase<Derived>
|
|
18
|
-
* The implementation is at the end of the file
|
|
19
|
-
***************************************************************************/
|
|
19
|
+
* Definition of QuaternionBase<Derived>
|
|
20
|
+
* The implementation is at the end of the file
|
|
21
|
+
***************************************************************************/
|
|
20
22
|
|
|
21
23
|
namespace internal {
|
|
22
|
-
template<typename Other,
|
|
23
|
-
int OtherRows=Other::RowsAtCompileTime,
|
|
24
|
-
int OtherCols=Other::ColsAtCompileTime>
|
|
24
|
+
template <typename Other, int OtherRows = Other::RowsAtCompileTime, int OtherCols = Other::ColsAtCompileTime>
|
|
25
25
|
struct quaternionbase_assign_impl;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/** \geometry_module \ingroup Geometry_Module
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
template<class Derived>
|
|
35
|
-
class QuaternionBase : public RotationBase<Derived, 3>
|
|
36
|
-
{
|
|
29
|
+
* \class QuaternionBase
|
|
30
|
+
* \brief Base class for quaternion expressions
|
|
31
|
+
* \tparam Derived derived type (CRTP)
|
|
32
|
+
* \sa class Quaternion
|
|
33
|
+
*/
|
|
34
|
+
template <class Derived>
|
|
35
|
+
class QuaternionBase : public RotationBase<Derived, 3> {
|
|
37
36
|
public:
|
|
38
37
|
typedef RotationBase<Derived, 3> Base;
|
|
39
38
|
|
|
@@ -44,111 +43,144 @@ class QuaternionBase : public RotationBase<Derived, 3>
|
|
|
44
43
|
typedef typename NumTraits<Scalar>::Real RealScalar;
|
|
45
44
|
typedef typename internal::traits<Derived>::Coefficients Coefficients;
|
|
46
45
|
typedef typename Coefficients::CoeffReturnType CoeffReturnType;
|
|
47
|
-
typedef
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
typedef std::conditional_t<bool(internal::traits<Derived>::Flags& LvalueBit), Scalar&, CoeffReturnType>
|
|
47
|
+
NonConstCoeffReturnType;
|
|
50
48
|
|
|
51
|
-
enum {
|
|
52
|
-
Flags = Eigen::internal::traits<Derived>::Flags
|
|
53
|
-
};
|
|
49
|
+
enum { Flags = Eigen::internal::traits<Derived>::Flags };
|
|
54
50
|
|
|
55
|
-
|
|
51
|
+
// typedef typename Matrix<Scalar,4,1> Coefficients;
|
|
56
52
|
/** the type of a 3D vector */
|
|
57
|
-
typedef Matrix<Scalar,3,1> Vector3;
|
|
53
|
+
typedef Matrix<Scalar, 3, 1> Vector3;
|
|
58
54
|
/** the equivalent rotation matrix type */
|
|
59
|
-
typedef Matrix<Scalar,3,3> Matrix3;
|
|
55
|
+
typedef Matrix<Scalar, 3, 3> Matrix3;
|
|
60
56
|
/** the equivalent angle-axis type */
|
|
61
57
|
typedef AngleAxis<Scalar> AngleAxisType;
|
|
62
58
|
|
|
63
|
-
|
|
64
|
-
|
|
65
59
|
/** \returns the \c x coefficient */
|
|
66
|
-
EIGEN_DEVICE_FUNC
|
|
60
|
+
EIGEN_DEVICE_FUNC constexpr CoeffReturnType x() const { return this->derived().coeffs().coeff(0); }
|
|
67
61
|
/** \returns the \c y coefficient */
|
|
68
|
-
EIGEN_DEVICE_FUNC
|
|
62
|
+
EIGEN_DEVICE_FUNC constexpr CoeffReturnType y() const { return this->derived().coeffs().coeff(1); }
|
|
69
63
|
/** \returns the \c z coefficient */
|
|
70
|
-
EIGEN_DEVICE_FUNC
|
|
64
|
+
EIGEN_DEVICE_FUNC constexpr CoeffReturnType z() const { return this->derived().coeffs().coeff(2); }
|
|
71
65
|
/** \returns the \c w coefficient */
|
|
72
|
-
EIGEN_DEVICE_FUNC
|
|
66
|
+
EIGEN_DEVICE_FUNC constexpr CoeffReturnType w() const { return this->derived().coeffs().coeff(3); }
|
|
73
67
|
|
|
74
68
|
/** \returns a reference to the \c x coefficient (if Derived is a non-const lvalue) */
|
|
75
|
-
EIGEN_DEVICE_FUNC
|
|
69
|
+
EIGEN_DEVICE_FUNC constexpr NonConstCoeffReturnType x() { return this->derived().coeffs().x(); }
|
|
76
70
|
/** \returns a reference to the \c y coefficient (if Derived is a non-const lvalue) */
|
|
77
|
-
EIGEN_DEVICE_FUNC
|
|
71
|
+
EIGEN_DEVICE_FUNC constexpr NonConstCoeffReturnType y() { return this->derived().coeffs().y(); }
|
|
78
72
|
/** \returns a reference to the \c z coefficient (if Derived is a non-const lvalue) */
|
|
79
|
-
EIGEN_DEVICE_FUNC
|
|
73
|
+
EIGEN_DEVICE_FUNC constexpr NonConstCoeffReturnType z() { return this->derived().coeffs().z(); }
|
|
80
74
|
/** \returns a reference to the \c w coefficient (if Derived is a non-const lvalue) */
|
|
81
|
-
EIGEN_DEVICE_FUNC
|
|
75
|
+
EIGEN_DEVICE_FUNC constexpr NonConstCoeffReturnType w() { return this->derived().coeffs().w(); }
|
|
82
76
|
|
|
83
77
|
/** \returns a read-only vector expression of the imaginary part (x,y,z) */
|
|
84
|
-
EIGEN_DEVICE_FUNC inline const VectorBlock<const Coefficients,3> vec() const { return coeffs().template head<3>(); }
|
|
78
|
+
EIGEN_DEVICE_FUNC inline const VectorBlock<const Coefficients, 3> vec() const { return coeffs().template head<3>(); }
|
|
85
79
|
|
|
86
80
|
/** \returns a vector expression of the imaginary part (x,y,z) */
|
|
87
|
-
EIGEN_DEVICE_FUNC inline VectorBlock<Coefficients,3> vec() { return coeffs().template head<3>(); }
|
|
81
|
+
EIGEN_DEVICE_FUNC inline VectorBlock<Coefficients, 3> vec() { return coeffs().template head<3>(); }
|
|
88
82
|
|
|
89
83
|
/** \returns a read-only vector expression of the coefficients (x,y,z,w) */
|
|
90
|
-
EIGEN_DEVICE_FUNC inline const typename internal::traits<Derived>::Coefficients& coeffs() const {
|
|
84
|
+
EIGEN_DEVICE_FUNC inline const typename internal::traits<Derived>::Coefficients& coeffs() const {
|
|
85
|
+
return derived().coeffs();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** \returns a vector containing the coefficients, rearranged into the order [\c w, \c x, \c y, \c z].
|
|
89
|
+
*
|
|
90
|
+
* This is the order expected by the \code Quaternion(const Scalar& w, const Scalar& x, const Scalar& y, const Scalar&
|
|
91
|
+
* z) \endcode constructor, but not the order of the internal vector representation. Therefore, it returns a newly
|
|
92
|
+
* constructed vector.
|
|
93
|
+
*
|
|
94
|
+
* \sa QuaternionBase::coeffsScalarLast()
|
|
95
|
+
* */
|
|
96
|
+
EIGEN_DEVICE_FUNC inline typename internal::traits<Derived>::Coefficients coeffsScalarFirst() const {
|
|
97
|
+
return derived().coeffsScalarFirst();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** \returns a vector containing the coefficients in their original order [\c x, \c y, \c z, \c w].
|
|
101
|
+
*
|
|
102
|
+
* This is equivalent to \code coeffs() \endcode, but returns a newly constructed vector for uniformity with \code
|
|
103
|
+
* coeffsScalarFirst() \endcode.
|
|
104
|
+
*
|
|
105
|
+
* \sa QuaternionBase::coeffsScalarFirst()
|
|
106
|
+
* */
|
|
107
|
+
EIGEN_DEVICE_FUNC inline typename internal::traits<Derived>::Coefficients coeffsScalarLast() const {
|
|
108
|
+
return derived().coeffsScalarLast();
|
|
109
|
+
}
|
|
91
110
|
|
|
92
111
|
/** \returns a vector expression of the coefficients (x,y,z,w) */
|
|
93
112
|
EIGEN_DEVICE_FUNC inline typename internal::traits<Derived>::Coefficients& coeffs() { return derived().coeffs(); }
|
|
94
113
|
|
|
95
114
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE QuaternionBase<Derived>& operator=(const QuaternionBase<Derived>& other);
|
|
96
|
-
template<class OtherDerived>
|
|
115
|
+
template <class OtherDerived>
|
|
116
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const QuaternionBase<OtherDerived>& other);
|
|
97
117
|
|
|
98
|
-
// disabled this copy operator as it is giving very strange compilation errors when compiling
|
|
99
|
-
// test_stdvector with GCC 4.4.2. This looks like a GCC bug though, so feel free to re-enable it if it's
|
|
100
|
-
// useful; however notice that we already have the templated operator= above and e.g. in MatrixBase
|
|
101
|
-
// we didn't have to add, in addition to templated operator=, such a non-templated copy operator.
|
|
102
|
-
// Derived& operator=(const QuaternionBase& other)
|
|
103
|
-
// { return operator=<Derived>(other); }
|
|
118
|
+
// disabled this copy operator as it is giving very strange compilation errors when compiling
|
|
119
|
+
// test_stdvector with GCC 4.4.2. This looks like a GCC bug though, so feel free to re-enable it if it's
|
|
120
|
+
// useful; however notice that we already have the templated operator= above and e.g. in MatrixBase
|
|
121
|
+
// we didn't have to add, in addition to templated operator=, such a non-templated copy operator.
|
|
122
|
+
// Derived& operator=(const QuaternionBase& other)
|
|
123
|
+
// { return operator=<Derived>(other); }
|
|
104
124
|
|
|
105
125
|
EIGEN_DEVICE_FUNC Derived& operator=(const AngleAxisType& aa);
|
|
106
|
-
template<class OtherDerived>
|
|
126
|
+
template <class OtherDerived>
|
|
127
|
+
EIGEN_DEVICE_FUNC Derived& operator=(const MatrixBase<OtherDerived>& m);
|
|
107
128
|
|
|
108
129
|
/** \returns a quaternion representing an identity rotation
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
EIGEN_DEVICE_FUNC static inline Quaternion<Scalar> Identity() {
|
|
130
|
+
* \sa MatrixBase::Identity()
|
|
131
|
+
*/
|
|
132
|
+
EIGEN_DEVICE_FUNC static inline Quaternion<Scalar> Identity() {
|
|
133
|
+
return Quaternion<Scalar>(Scalar(1), Scalar(0), Scalar(0), Scalar(0));
|
|
134
|
+
}
|
|
112
135
|
|
|
113
136
|
/** \sa QuaternionBase::Identity(), MatrixBase::setIdentity()
|
|
114
|
-
|
|
115
|
-
EIGEN_DEVICE_FUNC inline QuaternionBase& setIdentity() {
|
|
137
|
+
*/
|
|
138
|
+
EIGEN_DEVICE_FUNC inline QuaternionBase& setIdentity() {
|
|
139
|
+
coeffs() << Scalar(0), Scalar(0), Scalar(0), Scalar(1);
|
|
140
|
+
return *this;
|
|
141
|
+
}
|
|
116
142
|
|
|
117
143
|
/** \returns the squared norm of the quaternion's coefficients
|
|
118
|
-
|
|
119
|
-
|
|
144
|
+
* \sa QuaternionBase::norm(), MatrixBase::squaredNorm()
|
|
145
|
+
*/
|
|
120
146
|
EIGEN_DEVICE_FUNC inline Scalar squaredNorm() const { return coeffs().squaredNorm(); }
|
|
121
147
|
|
|
122
148
|
/** \returns the norm of the quaternion's coefficients
|
|
123
|
-
|
|
124
|
-
|
|
149
|
+
* \sa QuaternionBase::squaredNorm(), MatrixBase::norm()
|
|
150
|
+
*/
|
|
125
151
|
EIGEN_DEVICE_FUNC inline Scalar norm() const { return coeffs().norm(); }
|
|
126
152
|
|
|
127
153
|
/** Normalizes the quaternion \c *this
|
|
128
|
-
|
|
154
|
+
* \sa normalized(), MatrixBase::normalize() */
|
|
129
155
|
EIGEN_DEVICE_FUNC inline void normalize() { coeffs().normalize(); }
|
|
130
156
|
/** \returns a normalized copy of \c *this
|
|
131
|
-
|
|
157
|
+
* \sa normalize(), MatrixBase::normalized() */
|
|
132
158
|
EIGEN_DEVICE_FUNC inline Quaternion<Scalar> normalized() const { return Quaternion<Scalar>(coeffs().normalized()); }
|
|
133
159
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
template<class OtherDerived>
|
|
160
|
+
/** \returns the dot product of \c *this and \a other
|
|
161
|
+
* Geometrically speaking, the dot product of two unit quaternions
|
|
162
|
+
* corresponds to the cosine of half the angle between the two rotations.
|
|
163
|
+
* \sa angularDistance()
|
|
164
|
+
*/
|
|
165
|
+
template <class OtherDerived>
|
|
166
|
+
EIGEN_DEVICE_FUNC inline Scalar dot(const QuaternionBase<OtherDerived>& other) const {
|
|
167
|
+
return coeffs().dot(other.coeffs());
|
|
168
|
+
}
|
|
140
169
|
|
|
141
|
-
template<class OtherDerived>
|
|
170
|
+
template <class OtherDerived>
|
|
171
|
+
EIGEN_DEVICE_FUNC Scalar angularDistance(const QuaternionBase<OtherDerived>& other) const;
|
|
142
172
|
|
|
143
173
|
/** \returns an equivalent 3x3 rotation matrix */
|
|
144
174
|
EIGEN_DEVICE_FUNC inline Matrix3 toRotationMatrix() const;
|
|
145
175
|
|
|
146
176
|
/** \returns the quaternion which transform \a a into \a b through a rotation */
|
|
147
|
-
template<typename Derived1, typename Derived2>
|
|
177
|
+
template <typename Derived1, typename Derived2>
|
|
148
178
|
EIGEN_DEVICE_FUNC Derived& setFromTwoVectors(const MatrixBase<Derived1>& a, const MatrixBase<Derived2>& b);
|
|
149
179
|
|
|
150
|
-
template<class OtherDerived>
|
|
151
|
-
|
|
180
|
+
template <class OtherDerived>
|
|
181
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Quaternion<Scalar> operator*(const QuaternionBase<OtherDerived>& q) const;
|
|
182
|
+
template <class OtherDerived>
|
|
183
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator*=(const QuaternionBase<OtherDerived>& q);
|
|
152
184
|
|
|
153
185
|
/** \returns the quaternion describing the inverse rotation */
|
|
154
186
|
EIGEN_DEVICE_FUNC Quaternion<Scalar> inverse() const;
|
|
@@ -156,127 +188,129 @@ class QuaternionBase : public RotationBase<Derived, 3>
|
|
|
156
188
|
/** \returns the conjugated quaternion */
|
|
157
189
|
EIGEN_DEVICE_FUNC Quaternion<Scalar> conjugate() const;
|
|
158
190
|
|
|
159
|
-
template<class OtherDerived>
|
|
191
|
+
template <class OtherDerived>
|
|
192
|
+
EIGEN_DEVICE_FUNC Quaternion<Scalar> slerp(const Scalar& t, const QuaternionBase<OtherDerived>& other) const;
|
|
160
193
|
|
|
161
194
|
/** \returns true if each coefficients of \c *this and \a other are all exactly equal.
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
template<class OtherDerived>
|
|
166
|
-
EIGEN_DEVICE_FUNC inline bool operator==(const QuaternionBase<OtherDerived>& other) const
|
|
167
|
-
|
|
195
|
+
* \warning When using floating point scalar values you probably should rather use a
|
|
196
|
+
* fuzzy comparison such as isApprox()
|
|
197
|
+
* \sa isApprox(), operator!= */
|
|
198
|
+
template <class OtherDerived>
|
|
199
|
+
EIGEN_DEVICE_FUNC inline bool operator==(const QuaternionBase<OtherDerived>& other) const {
|
|
200
|
+
return coeffs() == other.coeffs();
|
|
201
|
+
}
|
|
168
202
|
|
|
169
203
|
/** \returns true if at least one pair of coefficients of \c *this and \a other are not exactly equal to each other.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
template<class OtherDerived>
|
|
174
|
-
EIGEN_DEVICE_FUNC inline bool operator!=(const QuaternionBase<OtherDerived>& other) const
|
|
175
|
-
|
|
204
|
+
* \warning When using floating point scalar values you probably should rather use a
|
|
205
|
+
* fuzzy comparison such as isApprox()
|
|
206
|
+
* \sa isApprox(), operator== */
|
|
207
|
+
template <class OtherDerived>
|
|
208
|
+
EIGEN_DEVICE_FUNC inline bool operator!=(const QuaternionBase<OtherDerived>& other) const {
|
|
209
|
+
return coeffs() != other.coeffs();
|
|
210
|
+
}
|
|
176
211
|
|
|
177
212
|
/** \returns \c true if \c *this is approximately equal to \a other, within the precision
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
template<class OtherDerived>
|
|
182
|
-
EIGEN_DEVICE_FUNC bool isApprox(const QuaternionBase<OtherDerived>& other,
|
|
183
|
-
|
|
213
|
+
* determined by \a prec.
|
|
214
|
+
*
|
|
215
|
+
* \sa MatrixBase::isApprox() */
|
|
216
|
+
template <class OtherDerived>
|
|
217
|
+
EIGEN_DEVICE_FUNC bool isApprox(const QuaternionBase<OtherDerived>& other,
|
|
218
|
+
const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const {
|
|
219
|
+
return coeffs().isApprox(other.coeffs(), prec);
|
|
220
|
+
}
|
|
184
221
|
|
|
185
222
|
/** return the result vector of \a v through the rotation*/
|
|
186
223
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Vector3 _transformVector(const Vector3& v) const;
|
|
187
224
|
|
|
188
|
-
|
|
225
|
+
#ifdef EIGEN_PARSED_BY_DOXYGEN
|
|
189
226
|
/** \returns \c *this with scalar type casted to \a NewScalarType
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
template<typename NewScalarType>
|
|
195
|
-
EIGEN_DEVICE_FUNC inline typename internal::cast_return_type<Derived,Quaternion<NewScalarType> >::type cast() const;
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
template<typename NewScalarType>
|
|
200
|
-
EIGEN_DEVICE_FUNC inline
|
|
201
|
-
|
|
202
|
-
{
|
|
227
|
+
*
|
|
228
|
+
* Note that if \a NewScalarType is equal to the current scalar type of \c *this
|
|
229
|
+
* then this function smartly returns a const reference to \c *this.
|
|
230
|
+
*/
|
|
231
|
+
template <typename NewScalarType>
|
|
232
|
+
EIGEN_DEVICE_FUNC inline typename internal::cast_return_type<Derived, Quaternion<NewScalarType> >::type cast() const;
|
|
233
|
+
|
|
234
|
+
#else
|
|
235
|
+
|
|
236
|
+
template <typename NewScalarType>
|
|
237
|
+
EIGEN_DEVICE_FUNC inline std::enable_if_t<internal::is_same<Scalar, NewScalarType>::value, const Derived&> cast()
|
|
238
|
+
const {
|
|
203
239
|
return derived();
|
|
204
240
|
}
|
|
205
241
|
|
|
206
|
-
template<typename NewScalarType>
|
|
207
|
-
EIGEN_DEVICE_FUNC inline
|
|
208
|
-
|
|
209
|
-
{
|
|
242
|
+
template <typename NewScalarType>
|
|
243
|
+
EIGEN_DEVICE_FUNC inline std::enable_if_t<!internal::is_same<Scalar, NewScalarType>::value,
|
|
244
|
+
Quaternion<NewScalarType> >
|
|
245
|
+
cast() const {
|
|
210
246
|
return Quaternion<NewScalarType>(coeffs().template cast<NewScalarType>());
|
|
211
247
|
}
|
|
212
|
-
|
|
248
|
+
#endif
|
|
213
249
|
|
|
214
250
|
#ifndef EIGEN_NO_IO
|
|
215
251
|
friend std::ostream& operator<<(std::ostream& s, const QuaternionBase<Derived>& q) {
|
|
216
|
-
s << q.x() << "i + " << q.y() << "j + " << q.z() << "k"
|
|
252
|
+
s << q.x() << "i + " << q.y() << "j + " << q.z() << "k"
|
|
253
|
+
<< " + " << q.w();
|
|
217
254
|
return s;
|
|
218
255
|
}
|
|
219
256
|
#endif
|
|
220
257
|
|
|
221
258
|
#ifdef EIGEN_QUATERNIONBASE_PLUGIN
|
|
222
|
-
#
|
|
259
|
+
#include EIGEN_QUATERNIONBASE_PLUGIN
|
|
223
260
|
#endif
|
|
224
|
-
protected:
|
|
261
|
+
protected:
|
|
225
262
|
EIGEN_DEFAULT_COPY_CONSTRUCTOR(QuaternionBase)
|
|
226
263
|
EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(QuaternionBase)
|
|
227
264
|
};
|
|
228
265
|
|
|
229
266
|
/***************************************************************************
|
|
230
|
-
* Definition/implementation of Quaternion<Scalar>
|
|
231
|
-
***************************************************************************/
|
|
267
|
+
* Definition/implementation of Quaternion<Scalar>
|
|
268
|
+
***************************************************************************/
|
|
232
269
|
|
|
233
270
|
/** \geometry_module \ingroup Geometry_Module
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
271
|
+
*
|
|
272
|
+
* \class Quaternion
|
|
273
|
+
*
|
|
274
|
+
* \brief The quaternion class used to represent 3D orientations and rotations
|
|
275
|
+
*
|
|
276
|
+
* \tparam Scalar_ the scalar type, i.e., the type of the coefficients
|
|
277
|
+
* \tparam Options_ controls the memory alignment of the coefficients. Can be \# AutoAlign or \# DontAlign. Default is
|
|
278
|
+
* AutoAlign.
|
|
279
|
+
*
|
|
280
|
+
* This class represents a quaternion \f$ w+xi+yj+zk \f$ that is a convenient representation of
|
|
281
|
+
* orientations and rotations of objects in three dimensions. Compared to other representations
|
|
282
|
+
* like Euler angles or 3x3 matrices, quaternions offer the following advantages:
|
|
283
|
+
* \li \b compact storage (4 scalars)
|
|
284
|
+
* \li \b efficient to compose (28 flops),
|
|
285
|
+
* \li \b stable spherical interpolation
|
|
286
|
+
*
|
|
287
|
+
* The following two typedefs are provided for convenience:
|
|
288
|
+
* \li \c Quaternionf for \c float
|
|
289
|
+
* \li \c Quaterniond for \c double
|
|
290
|
+
*
|
|
291
|
+
* \warning Operations interpreting the quaternion as rotation have undefined behavior if the quaternion is not
|
|
292
|
+
* normalized.
|
|
293
|
+
*
|
|
294
|
+
* \sa class AngleAxis, class Transform
|
|
295
|
+
*/
|
|
257
296
|
|
|
258
297
|
namespace internal {
|
|
259
|
-
template<typename
|
|
260
|
-
struct traits<Quaternion<
|
|
261
|
-
|
|
262
|
-
typedef
|
|
263
|
-
typedef
|
|
264
|
-
|
|
265
|
-
enum{
|
|
266
|
-
Alignment = internal::traits<Coefficients>::Alignment,
|
|
267
|
-
Flags = LvalueBit
|
|
268
|
-
};
|
|
298
|
+
template <typename Scalar_, int Options_>
|
|
299
|
+
struct traits<Quaternion<Scalar_, Options_> > {
|
|
300
|
+
typedef Quaternion<Scalar_, Options_> PlainObject;
|
|
301
|
+
typedef Scalar_ Scalar;
|
|
302
|
+
typedef Matrix<Scalar_, 4, 1, Options_> Coefficients;
|
|
303
|
+
enum { Alignment = internal::traits<Coefficients>::Alignment, Flags = LvalueBit };
|
|
269
304
|
};
|
|
270
|
-
}
|
|
305
|
+
} // namespace internal
|
|
271
306
|
|
|
272
|
-
template<typename
|
|
273
|
-
class Quaternion : public QuaternionBase<Quaternion<
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
enum { NeedsAlignment = internal::traits<Quaternion>::Alignment>0 };
|
|
307
|
+
template <typename Scalar_, int Options_>
|
|
308
|
+
class Quaternion : public QuaternionBase<Quaternion<Scalar_, Options_> > {
|
|
309
|
+
public:
|
|
310
|
+
typedef QuaternionBase<Quaternion<Scalar_, Options_> > Base;
|
|
311
|
+
enum { NeedsAlignment = internal::traits<Quaternion>::Alignment > 0 };
|
|
278
312
|
|
|
279
|
-
typedef
|
|
313
|
+
typedef Scalar_ Scalar;
|
|
280
314
|
|
|
281
315
|
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Quaternion)
|
|
282
316
|
using Base::operator*=;
|
|
@@ -288,355 +322,375 @@ public:
|
|
|
288
322
|
EIGEN_DEVICE_FUNC inline Quaternion() {}
|
|
289
323
|
|
|
290
324
|
/** Constructs and initializes the quaternion \f$ w+xi+yj+zk \f$ from
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
EIGEN_DEVICE_FUNC inline Quaternion(const Scalar& w, const Scalar& x, const Scalar& y, const Scalar& z)
|
|
325
|
+
* its four coefficients \a w, \a x, \a y and \a z.
|
|
326
|
+
*
|
|
327
|
+
* \warning Note the order of the arguments: the real \a w coefficient first,
|
|
328
|
+
* while internally the coefficients are stored in the following order:
|
|
329
|
+
* [\c x, \c y, \c z, \c w]
|
|
330
|
+
*/
|
|
331
|
+
EIGEN_DEVICE_FUNC inline Quaternion(const Scalar& w, const Scalar& x, const Scalar& y, const Scalar& z)
|
|
332
|
+
: m_coeffs(x, y, z, w) {}
|
|
333
|
+
|
|
334
|
+
/** Constructs and initializes a quaternion from its real part as a scalar,
|
|
335
|
+
* and its imaginary part as a 3-vector [\c x, \c y, \c z]
|
|
336
|
+
*/
|
|
337
|
+
template <typename Derived>
|
|
338
|
+
EIGEN_DEVICE_FUNC inline Quaternion(const Scalar& w, const Eigen::MatrixBase<Derived>& vec)
|
|
339
|
+
: m_coeffs(vec.x(), vec.y(), vec.z(), w) {
|
|
340
|
+
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Derived, 3);
|
|
341
|
+
}
|
|
298
342
|
|
|
299
343
|
/** Constructs and initialize a quaternion from the array data */
|
|
300
344
|
EIGEN_DEVICE_FUNC explicit inline Quaternion(const Scalar* data) : m_coeffs(data) {}
|
|
301
345
|
|
|
302
346
|
/** Copy constructor */
|
|
303
|
-
template<class Derived>
|
|
347
|
+
template <class Derived>
|
|
348
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Quaternion(const QuaternionBase<Derived>& other) {
|
|
349
|
+
this->Base::operator=(other);
|
|
350
|
+
}
|
|
304
351
|
|
|
305
352
|
/** Constructs and initializes a quaternion from the angle-axis \a aa */
|
|
306
353
|
EIGEN_DEVICE_FUNC explicit inline Quaternion(const AngleAxisType& aa) { *this = aa; }
|
|
307
354
|
|
|
308
355
|
/** Constructs and initializes a quaternion from either:
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
template<typename Derived>
|
|
313
|
-
EIGEN_DEVICE_FUNC explicit inline Quaternion(const MatrixBase<Derived>& other) {
|
|
356
|
+
* - a rotation matrix expression,
|
|
357
|
+
* - a 4D vector expression representing quaternion coefficients in the order [\c x, \c y, \c z, \c w].
|
|
358
|
+
*/
|
|
359
|
+
template <typename Derived>
|
|
360
|
+
EIGEN_DEVICE_FUNC explicit inline Quaternion(const MatrixBase<Derived>& other) {
|
|
361
|
+
*this = other;
|
|
362
|
+
}
|
|
314
363
|
|
|
315
364
|
/** Explicit copy constructor with scalar conversion */
|
|
316
|
-
template<typename OtherScalar, int OtherOptions>
|
|
317
|
-
EIGEN_DEVICE_FUNC explicit inline Quaternion(const Quaternion<OtherScalar, OtherOptions>& other)
|
|
318
|
-
|
|
365
|
+
template <typename OtherScalar, int OtherOptions>
|
|
366
|
+
EIGEN_DEVICE_FUNC explicit inline Quaternion(const Quaternion<OtherScalar, OtherOptions>& other) {
|
|
367
|
+
m_coeffs = other.coeffs().template cast<Scalar>();
|
|
368
|
+
}
|
|
319
369
|
|
|
320
|
-
#if EIGEN_HAS_RVALUE_REFERENCES
|
|
321
370
|
// We define a copy constructor, which means we don't get an implicit move constructor or assignment operator.
|
|
322
371
|
/** Default move constructor */
|
|
323
|
-
EIGEN_DEVICE_FUNC inline Quaternion(Quaternion&& other)
|
|
324
|
-
|
|
325
|
-
{}
|
|
372
|
+
EIGEN_DEVICE_FUNC inline Quaternion(Quaternion&& other) noexcept(std::is_nothrow_move_constructible<Scalar>::value)
|
|
373
|
+
: m_coeffs(std::move(other.coeffs())) {}
|
|
326
374
|
|
|
327
375
|
/** Default move assignment operator */
|
|
328
|
-
EIGEN_DEVICE_FUNC Quaternion& operator=(Quaternion&& other)
|
|
329
|
-
{
|
|
376
|
+
EIGEN_DEVICE_FUNC Quaternion& operator=(Quaternion&& other) noexcept(std::is_nothrow_move_assignable<Scalar>::value) {
|
|
330
377
|
m_coeffs = std::move(other.coeffs());
|
|
331
378
|
return *this;
|
|
332
379
|
}
|
|
333
|
-
#endif
|
|
334
380
|
|
|
335
381
|
EIGEN_DEVICE_FUNC static Quaternion UnitRandom();
|
|
336
382
|
|
|
337
|
-
|
|
383
|
+
EIGEN_DEVICE_FUNC static Quaternion FromCoeffsScalarLast(const Scalar& x, const Scalar& y, const Scalar& z,
|
|
384
|
+
const Scalar& w);
|
|
385
|
+
|
|
386
|
+
EIGEN_DEVICE_FUNC static Quaternion FromCoeffsScalarFirst(const Scalar& w, const Scalar& x, const Scalar& y,
|
|
387
|
+
const Scalar& z);
|
|
388
|
+
|
|
389
|
+
template <typename Derived1, typename Derived2>
|
|
338
390
|
EIGEN_DEVICE_FUNC static Quaternion FromTwoVectors(const MatrixBase<Derived1>& a, const MatrixBase<Derived2>& b);
|
|
339
391
|
|
|
340
|
-
EIGEN_DEVICE_FUNC inline Coefficients& coeffs() { return m_coeffs;}
|
|
341
|
-
EIGEN_DEVICE_FUNC inline const Coefficients& coeffs() const { return m_coeffs;}
|
|
392
|
+
EIGEN_DEVICE_FUNC inline Coefficients& coeffs() { return m_coeffs; }
|
|
393
|
+
EIGEN_DEVICE_FUNC inline const Coefficients& coeffs() const { return m_coeffs; }
|
|
394
|
+
|
|
395
|
+
EIGEN_DEVICE_FUNC inline Coefficients coeffsScalarLast() const { return m_coeffs; }
|
|
342
396
|
|
|
397
|
+
EIGEN_DEVICE_FUNC inline Coefficients coeffsScalarFirst() const {
|
|
398
|
+
return {m_coeffs.w(), m_coeffs.x(), m_coeffs.y(), m_coeffs.z()};
|
|
399
|
+
}
|
|
343
400
|
EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(bool(NeedsAlignment))
|
|
344
|
-
|
|
401
|
+
|
|
345
402
|
#ifdef EIGEN_QUATERNION_PLUGIN
|
|
346
|
-
#
|
|
403
|
+
#include EIGEN_QUATERNION_PLUGIN
|
|
347
404
|
#endif
|
|
348
405
|
|
|
349
|
-
protected:
|
|
406
|
+
protected:
|
|
350
407
|
Coefficients m_coeffs;
|
|
351
|
-
|
|
408
|
+
|
|
352
409
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
|
353
|
-
|
|
354
|
-
{
|
|
355
|
-
EIGEN_STATIC_ASSERT( (_Options & DontAlign) == _Options,
|
|
356
|
-
INVALID_MATRIX_TEMPLATE_PARAMETERS)
|
|
357
|
-
}
|
|
410
|
+
EIGEN_STATIC_ASSERT((Options_ & DontAlign) == Options_, INVALID_MATRIX_TEMPLATE_PARAMETERS)
|
|
358
411
|
#endif
|
|
359
412
|
};
|
|
360
413
|
|
|
361
414
|
/** \ingroup Geometry_Module
|
|
362
|
-
|
|
415
|
+
* single precision quaternion type */
|
|
363
416
|
typedef Quaternion<float> Quaternionf;
|
|
364
417
|
/** \ingroup Geometry_Module
|
|
365
|
-
|
|
418
|
+
* double precision quaternion type */
|
|
366
419
|
typedef Quaternion<double> Quaterniond;
|
|
367
420
|
|
|
368
421
|
/***************************************************************************
|
|
369
|
-
* Specialization of Map<Quaternion<Scalar>>
|
|
370
|
-
***************************************************************************/
|
|
422
|
+
* Specialization of Map<Quaternion<Scalar>>
|
|
423
|
+
***************************************************************************/
|
|
371
424
|
|
|
372
425
|
namespace internal {
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
}
|
|
426
|
+
template <typename Scalar_, int Options_>
|
|
427
|
+
struct traits<Map<Quaternion<Scalar_>, Options_> >
|
|
428
|
+
: traits<Quaternion<Scalar_, (int(Options_) & Aligned) == Aligned ? AutoAlign : DontAlign> > {
|
|
429
|
+
typedef Map<Matrix<Scalar_, 4, 1>, Options_> Coefficients;
|
|
430
|
+
};
|
|
431
|
+
} // namespace internal
|
|
379
432
|
|
|
380
433
|
namespace internal {
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
};
|
|
390
|
-
}
|
|
434
|
+
template <typename Scalar_, int Options_>
|
|
435
|
+
struct traits<Map<const Quaternion<Scalar_>, Options_> >
|
|
436
|
+
: traits<Quaternion<Scalar_, (int(Options_) & Aligned) == Aligned ? AutoAlign : DontAlign> > {
|
|
437
|
+
typedef Map<const Matrix<Scalar_, 4, 1>, Options_> Coefficients;
|
|
438
|
+
typedef traits<Quaternion<Scalar_, (int(Options_) & Aligned) == Aligned ? AutoAlign : DontAlign> > TraitsBase;
|
|
439
|
+
enum { Flags = TraitsBase::Flags & ~LvalueBit };
|
|
440
|
+
};
|
|
441
|
+
} // namespace internal
|
|
391
442
|
|
|
392
443
|
/** \ingroup Geometry_Module
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
template<typename
|
|
404
|
-
class Map<const Quaternion<
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
444
|
+
* \brief Quaternion expression mapping a constant memory buffer
|
|
445
|
+
*
|
|
446
|
+
* \tparam Scalar_ the type of the Quaternion coefficients
|
|
447
|
+
* \tparam Options_ see class Map
|
|
448
|
+
*
|
|
449
|
+
* This is a specialization of class Map for Quaternion. This class allows to view
|
|
450
|
+
* a 4 scalar memory buffer as an Eigen's Quaternion object.
|
|
451
|
+
*
|
|
452
|
+
* \sa class Map, class Quaternion, class QuaternionBase
|
|
453
|
+
*/
|
|
454
|
+
template <typename Scalar_, int Options_>
|
|
455
|
+
class Map<const Quaternion<Scalar_>, Options_> : public QuaternionBase<Map<const Quaternion<Scalar_>, Options_> > {
|
|
456
|
+
public:
|
|
457
|
+
typedef QuaternionBase<Map<const Quaternion<Scalar_>, Options_> > Base;
|
|
458
|
+
|
|
459
|
+
typedef Scalar_ Scalar;
|
|
460
|
+
typedef typename internal::traits<Map>::Coefficients Coefficients;
|
|
461
|
+
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Map)
|
|
462
|
+
using Base::operator*=;
|
|
463
|
+
|
|
464
|
+
/** Constructs a Mapped Quaternion object from the pointer \a coeffs
|
|
465
|
+
*
|
|
466
|
+
* The pointer \a coeffs must reference the four coefficients of Quaternion in the following order:
|
|
467
|
+
* \code *coeffs == {x, y, z, w} \endcode
|
|
468
|
+
*
|
|
469
|
+
* If the template parameter Options_ is set to #Aligned, then the pointer coeffs must be aligned. */
|
|
470
|
+
EIGEN_DEVICE_FUNC explicit EIGEN_STRONG_INLINE Map(const Scalar* coeffs) : m_coeffs(coeffs) {}
|
|
471
|
+
|
|
472
|
+
EIGEN_DEVICE_FUNC inline const Coefficients& coeffs() const { return m_coeffs; }
|
|
473
|
+
|
|
474
|
+
EIGEN_DEVICE_FUNC inline Coefficients coeffsScalarLast() const { return m_coeffs; }
|
|
475
|
+
|
|
476
|
+
EIGEN_DEVICE_FUNC inline Coefficients coeffsScalarFirst() const {
|
|
477
|
+
return {m_coeffs.w(), m_coeffs.x(), m_coeffs.y(), m_coeffs.z()};
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
protected:
|
|
481
|
+
const Coefficients m_coeffs;
|
|
427
482
|
};
|
|
428
483
|
|
|
429
484
|
/** \ingroup Geometry_Module
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
template<typename
|
|
441
|
-
class Map<Quaternion<
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
485
|
+
* \brief Expression of a quaternion from a memory buffer
|
|
486
|
+
*
|
|
487
|
+
* \tparam Scalar_ the type of the Quaternion coefficients
|
|
488
|
+
* \tparam Options_ see class Map
|
|
489
|
+
*
|
|
490
|
+
* This is a specialization of class Map for Quaternion. This class allows to view
|
|
491
|
+
* a 4 scalar memory buffer as an Eigen's Quaternion object.
|
|
492
|
+
*
|
|
493
|
+
* \sa class Map, class Quaternion, class QuaternionBase
|
|
494
|
+
*/
|
|
495
|
+
template <typename Scalar_, int Options_>
|
|
496
|
+
class Map<Quaternion<Scalar_>, Options_> : public QuaternionBase<Map<Quaternion<Scalar_>, Options_> > {
|
|
497
|
+
public:
|
|
498
|
+
typedef QuaternionBase<Map<Quaternion<Scalar_>, Options_> > Base;
|
|
499
|
+
|
|
500
|
+
typedef Scalar_ Scalar;
|
|
501
|
+
typedef typename internal::traits<Map>::Coefficients Coefficients;
|
|
502
|
+
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Map)
|
|
503
|
+
using Base::operator*=;
|
|
504
|
+
|
|
505
|
+
/** Constructs a Mapped Quaternion object from the pointer \a coeffs
|
|
506
|
+
*
|
|
507
|
+
* The pointer \a coeffs must reference the four coefficients of Quaternion in the following order:
|
|
508
|
+
* \code *coeffs == {x, y, z, w} \endcode
|
|
509
|
+
*
|
|
510
|
+
* If the template parameter Options_ is set to #Aligned, then the pointer coeffs must be aligned. */
|
|
511
|
+
EIGEN_DEVICE_FUNC explicit EIGEN_STRONG_INLINE Map(Scalar* coeffs) : m_coeffs(coeffs) {}
|
|
512
|
+
|
|
513
|
+
EIGEN_DEVICE_FUNC inline Coefficients& coeffs() { return m_coeffs; }
|
|
514
|
+
EIGEN_DEVICE_FUNC inline const Coefficients& coeffs() const { return m_coeffs; }
|
|
515
|
+
|
|
516
|
+
EIGEN_DEVICE_FUNC inline Coefficients coeffsScalarLast() const { return m_coeffs; }
|
|
517
|
+
|
|
518
|
+
EIGEN_DEVICE_FUNC inline Coefficients coeffsScalarFirst() const {
|
|
519
|
+
return {m_coeffs.w(), m_coeffs.x(), m_coeffs.y(), m_coeffs.z()};
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
protected:
|
|
523
|
+
Coefficients m_coeffs;
|
|
465
524
|
};
|
|
466
525
|
|
|
467
526
|
/** \ingroup Geometry_Module
|
|
468
|
-
|
|
469
|
-
typedef Map<Quaternion<float>, 0>
|
|
527
|
+
* Map an unaligned array of single precision scalars as a quaternion */
|
|
528
|
+
typedef Map<Quaternion<float>, 0> QuaternionMapf;
|
|
470
529
|
/** \ingroup Geometry_Module
|
|
471
|
-
|
|
472
|
-
typedef Map<Quaternion<double>, 0>
|
|
530
|
+
* Map an unaligned array of double precision scalars as a quaternion */
|
|
531
|
+
typedef Map<Quaternion<double>, 0> QuaternionMapd;
|
|
473
532
|
/** \ingroup Geometry_Module
|
|
474
|
-
|
|
475
|
-
typedef Map<Quaternion<float>, Aligned>
|
|
533
|
+
* Map a 16-byte aligned array of single precision scalars as a quaternion */
|
|
534
|
+
typedef Map<Quaternion<float>, Aligned> QuaternionMapAlignedf;
|
|
476
535
|
/** \ingroup Geometry_Module
|
|
477
|
-
|
|
478
|
-
typedef Map<Quaternion<double>, Aligned>
|
|
536
|
+
* Map a 16-byte aligned array of double precision scalars as a quaternion */
|
|
537
|
+
typedef Map<Quaternion<double>, Aligned> QuaternionMapAlignedd;
|
|
479
538
|
|
|
480
539
|
/***************************************************************************
|
|
481
|
-
* Implementation of QuaternionBase methods
|
|
482
|
-
***************************************************************************/
|
|
540
|
+
* Implementation of QuaternionBase methods
|
|
541
|
+
***************************************************************************/
|
|
483
542
|
|
|
484
543
|
// Generic Quaternion * Quaternion product
|
|
485
544
|
// This product can be specialized for a given architecture via the Arch template argument.
|
|
486
545
|
namespace internal {
|
|
487
|
-
template<int Arch, class Derived1, class Derived2, typename Scalar>
|
|
488
|
-
{
|
|
489
|
-
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Quaternion<Scalar> run(const QuaternionBase<Derived1>& a,
|
|
490
|
-
|
|
491
|
-
(
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
a.w() * b.z() + a.z() * b.w() + a.x() * b.y() - a.y() * b.x()
|
|
496
|
-
);
|
|
546
|
+
template <int Arch, class Derived1, class Derived2, typename Scalar>
|
|
547
|
+
struct quat_product {
|
|
548
|
+
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Quaternion<Scalar> run(const QuaternionBase<Derived1>& a,
|
|
549
|
+
const QuaternionBase<Derived2>& b) {
|
|
550
|
+
return Quaternion<Scalar>(a.w() * b.w() - a.x() * b.x() - a.y() * b.y() - a.z() * b.z(),
|
|
551
|
+
a.w() * b.x() + a.x() * b.w() + a.y() * b.z() - a.z() * b.y(),
|
|
552
|
+
a.w() * b.y() + a.y() * b.w() + a.z() * b.x() - a.x() * b.z(),
|
|
553
|
+
a.w() * b.z() + a.z() * b.w() + a.x() * b.y() - a.y() * b.x());
|
|
497
554
|
}
|
|
498
555
|
};
|
|
499
|
-
}
|
|
556
|
+
} // namespace internal
|
|
500
557
|
|
|
501
558
|
/** \returns the concatenation of two rotations as a quaternion-quaternion product */
|
|
502
559
|
template <class Derived>
|
|
503
560
|
template <class OtherDerived>
|
|
504
561
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Quaternion<typename internal::traits<Derived>::Scalar>
|
|
505
|
-
QuaternionBase<Derived>::operator*
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
562
|
+
QuaternionBase<Derived>::operator*(const QuaternionBase<OtherDerived>& other) const {
|
|
563
|
+
EIGEN_STATIC_ASSERT(
|
|
564
|
+
(internal::is_same<typename Derived::Scalar, typename OtherDerived::Scalar>::value),
|
|
565
|
+
YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
|
|
509
566
|
return internal::quat_product<Architecture::Target, Derived, OtherDerived,
|
|
510
|
-
|
|
567
|
+
typename internal::traits<Derived>::Scalar>::run(*this, other);
|
|
511
568
|
}
|
|
512
569
|
|
|
513
570
|
/** \sa operator*(Quaternion) */
|
|
514
571
|
template <class Derived>
|
|
515
572
|
template <class OtherDerived>
|
|
516
|
-
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& QuaternionBase<Derived>::operator*=
|
|
517
|
-
{
|
|
573
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& QuaternionBase<Derived>::operator*=(
|
|
574
|
+
const QuaternionBase<OtherDerived>& other) {
|
|
518
575
|
derived() = derived() * other.derived();
|
|
519
576
|
return derived();
|
|
520
577
|
}
|
|
521
578
|
|
|
522
579
|
/** Rotation of a vector by a quaternion.
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
580
|
+
* \remarks If the quaternion is used to rotate several points (>1)
|
|
581
|
+
* then it is much more efficient to first convert it to a 3x3 Matrix.
|
|
582
|
+
* Comparison of the operation cost for n transformations:
|
|
583
|
+
* - Quaternion2: 30n
|
|
584
|
+
* - Via a Matrix3: 24 + 15n
|
|
585
|
+
*/
|
|
529
586
|
template <class Derived>
|
|
530
587
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename QuaternionBase<Derived>::Vector3
|
|
531
|
-
QuaternionBase<Derived>::_transformVector(const Vector3& v) const
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
return v + this->w() * uv + this->vec().cross(uv);
|
|
588
|
+
QuaternionBase<Derived>::_transformVector(const Vector3& v) const {
|
|
589
|
+
// Note that this algorithm comes from the optimization by hand
|
|
590
|
+
// of the conversion to a Matrix followed by a Matrix/Vector product.
|
|
591
|
+
// It appears to be much faster than the common algorithm found
|
|
592
|
+
// in the literature (30 versus 39 flops). It also requires two
|
|
593
|
+
// Vector3 as temporaries.
|
|
594
|
+
Vector3 uv = this->vec().cross(v);
|
|
595
|
+
uv += uv;
|
|
596
|
+
return v + this->w() * uv + this->vec().cross(uv);
|
|
541
597
|
}
|
|
542
598
|
|
|
543
|
-
template<class Derived>
|
|
544
|
-
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE QuaternionBase<Derived>& QuaternionBase<Derived>::operator=(
|
|
545
|
-
{
|
|
599
|
+
template <class Derived>
|
|
600
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE QuaternionBase<Derived>& QuaternionBase<Derived>::operator=(
|
|
601
|
+
const QuaternionBase<Derived>& other) {
|
|
546
602
|
coeffs() = other.coeffs();
|
|
547
603
|
return derived();
|
|
548
604
|
}
|
|
549
605
|
|
|
550
|
-
template<class Derived>
|
|
551
|
-
template<class OtherDerived>
|
|
552
|
-
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& QuaternionBase<Derived>::operator=(
|
|
553
|
-
{
|
|
606
|
+
template <class Derived>
|
|
607
|
+
template <class OtherDerived>
|
|
608
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& QuaternionBase<Derived>::operator=(
|
|
609
|
+
const QuaternionBase<OtherDerived>& other) {
|
|
554
610
|
coeffs() = other.coeffs();
|
|
555
611
|
return derived();
|
|
556
612
|
}
|
|
557
613
|
|
|
558
614
|
/** Set \c *this from an angle-axis \a aa and returns a reference to \c *this
|
|
559
|
-
|
|
560
|
-
template<class Derived>
|
|
561
|
-
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& QuaternionBase<Derived>::operator=(const AngleAxisType& aa)
|
|
562
|
-
{
|
|
615
|
+
*/
|
|
616
|
+
template <class Derived>
|
|
617
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& QuaternionBase<Derived>::operator=(const AngleAxisType& aa) {
|
|
563
618
|
EIGEN_USING_STD(cos)
|
|
564
619
|
EIGEN_USING_STD(sin)
|
|
565
|
-
Scalar ha = Scalar(0.5)*aa.angle();
|
|
620
|
+
Scalar ha = Scalar(0.5) * aa.angle(); // Scalar(0.5) to suppress precision loss warnings
|
|
566
621
|
this->w() = cos(ha);
|
|
567
622
|
this->vec() = sin(ha) * aa.axis();
|
|
568
623
|
return derived();
|
|
569
624
|
}
|
|
570
625
|
|
|
571
626
|
/** Set \c *this from the expression \a xpr:
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
template<class Derived>
|
|
578
|
-
template<class MatrixDerived>
|
|
579
|
-
EIGEN_DEVICE_FUNC inline Derived& QuaternionBase<Derived>::operator=(const MatrixBase<MatrixDerived>& xpr)
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
627
|
+
* - if \a xpr is a 4x1 vector, then \a xpr is assumed to be a quaternion
|
|
628
|
+
* - if \a xpr is a 3x3 matrix, then \a xpr is assumed to be rotation matrix
|
|
629
|
+
* and \a xpr is converted to a quaternion
|
|
630
|
+
*/
|
|
631
|
+
|
|
632
|
+
template <class Derived>
|
|
633
|
+
template <class MatrixDerived>
|
|
634
|
+
EIGEN_DEVICE_FUNC inline Derived& QuaternionBase<Derived>::operator=(const MatrixBase<MatrixDerived>& xpr) {
|
|
635
|
+
EIGEN_STATIC_ASSERT(
|
|
636
|
+
(internal::is_same<typename Derived::Scalar, typename MatrixDerived::Scalar>::value),
|
|
637
|
+
YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
|
|
583
638
|
internal::quaternionbase_assign_impl<MatrixDerived>::run(*this, xpr.derived());
|
|
584
639
|
return derived();
|
|
585
640
|
}
|
|
586
641
|
|
|
587
642
|
/** Convert the quaternion to a 3x3 rotation matrix. The quaternion is required to
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
template<class Derived>
|
|
591
|
-
EIGEN_DEVICE_FUNC inline typename QuaternionBase<Derived>::Matrix3
|
|
592
|
-
|
|
593
|
-
{
|
|
643
|
+
* be normalized, otherwise the result is undefined.
|
|
644
|
+
*/
|
|
645
|
+
template <class Derived>
|
|
646
|
+
EIGEN_DEVICE_FUNC inline typename QuaternionBase<Derived>::Matrix3 QuaternionBase<Derived>::toRotationMatrix(
|
|
647
|
+
void) const {
|
|
594
648
|
// NOTE if inlined, then gcc 4.2 and 4.4 get rid of the temporary (not gcc 4.3 !!)
|
|
595
649
|
// if not inlined then the cost of the return by value is huge ~ +35%,
|
|
596
650
|
// however, not inlining this function is an order of magnitude slower, so
|
|
597
651
|
// it has to be inlined, and so the return by value is not an issue
|
|
598
652
|
Matrix3 res;
|
|
599
653
|
|
|
600
|
-
const Scalar tx
|
|
601
|
-
const Scalar ty
|
|
602
|
-
const Scalar tz
|
|
603
|
-
const Scalar twx = tx*this->w();
|
|
604
|
-
const Scalar twy = ty*this->w();
|
|
605
|
-
const Scalar twz = tz*this->w();
|
|
606
|
-
const Scalar txx = tx*this->x();
|
|
607
|
-
const Scalar txy = ty*this->x();
|
|
608
|
-
const Scalar txz = tz*this->x();
|
|
609
|
-
const Scalar tyy = ty*this->y();
|
|
610
|
-
const Scalar tyz = tz*this->y();
|
|
611
|
-
const Scalar tzz = tz*this->z();
|
|
612
|
-
|
|
613
|
-
res.coeffRef(0,0) = Scalar(1)-(tyy+tzz);
|
|
614
|
-
res.coeffRef(0,1) = txy-twz;
|
|
615
|
-
res.coeffRef(0,2) = txz+twy;
|
|
616
|
-
res.coeffRef(1,0) = txy+twz;
|
|
617
|
-
res.coeffRef(1,1) = Scalar(1)-(txx+tzz);
|
|
618
|
-
res.coeffRef(1,2) = tyz-twx;
|
|
619
|
-
res.coeffRef(2,0) = txz-twy;
|
|
620
|
-
res.coeffRef(2,1) = tyz+twx;
|
|
621
|
-
res.coeffRef(2,2) = Scalar(1)-(txx+tyy);
|
|
654
|
+
const Scalar tx = Scalar(2) * this->x();
|
|
655
|
+
const Scalar ty = Scalar(2) * this->y();
|
|
656
|
+
const Scalar tz = Scalar(2) * this->z();
|
|
657
|
+
const Scalar twx = tx * this->w();
|
|
658
|
+
const Scalar twy = ty * this->w();
|
|
659
|
+
const Scalar twz = tz * this->w();
|
|
660
|
+
const Scalar txx = tx * this->x();
|
|
661
|
+
const Scalar txy = ty * this->x();
|
|
662
|
+
const Scalar txz = tz * this->x();
|
|
663
|
+
const Scalar tyy = ty * this->y();
|
|
664
|
+
const Scalar tyz = tz * this->y();
|
|
665
|
+
const Scalar tzz = tz * this->z();
|
|
666
|
+
|
|
667
|
+
res.coeffRef(0, 0) = Scalar(1) - (tyy + tzz);
|
|
668
|
+
res.coeffRef(0, 1) = txy - twz;
|
|
669
|
+
res.coeffRef(0, 2) = txz + twy;
|
|
670
|
+
res.coeffRef(1, 0) = txy + twz;
|
|
671
|
+
res.coeffRef(1, 1) = Scalar(1) - (txx + tzz);
|
|
672
|
+
res.coeffRef(1, 2) = tyz - twx;
|
|
673
|
+
res.coeffRef(2, 0) = txz - twy;
|
|
674
|
+
res.coeffRef(2, 1) = tyz + twx;
|
|
675
|
+
res.coeffRef(2, 2) = Scalar(1) - (txx + tyy);
|
|
622
676
|
|
|
623
677
|
return res;
|
|
624
678
|
}
|
|
625
679
|
|
|
626
680
|
/** Sets \c *this to be a quaternion representing a rotation between
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
template<class Derived>
|
|
637
|
-
template<typename Derived1, typename Derived2>
|
|
638
|
-
EIGEN_DEVICE_FUNC inline Derived& QuaternionBase<Derived>::setFromTwoVectors(const MatrixBase<Derived1>& a,
|
|
639
|
-
{
|
|
681
|
+
* the two arbitrary vectors \a a and \a b. In other words, the built
|
|
682
|
+
* rotation represent a rotation sending the line of direction \a a
|
|
683
|
+
* to the line of direction \a b, both lines passing through the origin.
|
|
684
|
+
*
|
|
685
|
+
* \returns a reference to \c *this.
|
|
686
|
+
*
|
|
687
|
+
* Note that the two input vectors do \b not have to be normalized, and
|
|
688
|
+
* do not need to have the same norm.
|
|
689
|
+
*/
|
|
690
|
+
template <class Derived>
|
|
691
|
+
template <typename Derived1, typename Derived2>
|
|
692
|
+
EIGEN_DEVICE_FUNC inline Derived& QuaternionBase<Derived>::setFromTwoVectors(const MatrixBase<Derived1>& a,
|
|
693
|
+
const MatrixBase<Derived2>& b) {
|
|
640
694
|
EIGEN_USING_STD(sqrt)
|
|
641
695
|
Vector3 v0 = a.normalized();
|
|
642
696
|
Vector3 v1 = b.normalized();
|
|
@@ -650,21 +704,21 @@ EIGEN_DEVICE_FUNC inline Derived& QuaternionBase<Derived>::setFromTwoVectors(con
|
|
|
650
704
|
// under the constraint:
|
|
651
705
|
// ||x|| = 1
|
|
652
706
|
// which yields a singular value problem
|
|
653
|
-
if (c < Scalar(-1)+NumTraits<Scalar>::dummy_precision())
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
JacobiSVD<Matrix<Scalar,2,3
|
|
707
|
+
if (c < Scalar(-1) + NumTraits<Scalar>::dummy_precision()) {
|
|
708
|
+
c = numext::maxi(c, Scalar(-1));
|
|
709
|
+
Matrix<Scalar, 2, 3> m;
|
|
710
|
+
m << v0.transpose(), v1.transpose();
|
|
711
|
+
JacobiSVD<Matrix<Scalar, 2, 3>, ComputeFullV> svd(m);
|
|
658
712
|
Vector3 axis = svd.matrixV().col(2);
|
|
659
713
|
|
|
660
|
-
Scalar w2 = (Scalar(1)+c)*Scalar(0.5);
|
|
714
|
+
Scalar w2 = (Scalar(1) + c) * Scalar(0.5);
|
|
661
715
|
this->w() = sqrt(w2);
|
|
662
716
|
this->vec() = axis * sqrt(Scalar(1) - w2);
|
|
663
717
|
return derived();
|
|
664
718
|
}
|
|
665
719
|
Vector3 axis = v0.cross(v1);
|
|
666
|
-
Scalar s = sqrt((Scalar(1)+c)*Scalar(2));
|
|
667
|
-
Scalar invs = Scalar(1)/s;
|
|
720
|
+
Scalar s = sqrt((Scalar(1) + c) * Scalar(2));
|
|
721
|
+
Scalar invs = Scalar(1) / s;
|
|
668
722
|
this->vec() = axis * invs;
|
|
669
723
|
this->w() = s * Scalar(0.5);
|
|
670
724
|
|
|
@@ -672,59 +726,82 @@ EIGEN_DEVICE_FUNC inline Derived& QuaternionBase<Derived>::setFromTwoVectors(con
|
|
|
672
726
|
}
|
|
673
727
|
|
|
674
728
|
/** \returns a random unit quaternion following a uniform distribution law on SO(3)
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
template<typename Scalar, int Options>
|
|
679
|
-
EIGEN_DEVICE_FUNC Quaternion<Scalar,Options> Quaternion<Scalar,Options>::UnitRandom()
|
|
680
|
-
{
|
|
729
|
+
*
|
|
730
|
+
* \note The implementation is based on http://planning.cs.uiuc.edu/node198.html
|
|
731
|
+
*/
|
|
732
|
+
template <typename Scalar, int Options>
|
|
733
|
+
EIGEN_DEVICE_FUNC Quaternion<Scalar, Options> Quaternion<Scalar, Options>::UnitRandom() {
|
|
681
734
|
EIGEN_USING_STD(sqrt)
|
|
682
735
|
EIGEN_USING_STD(sin)
|
|
683
736
|
EIGEN_USING_STD(cos)
|
|
684
|
-
const Scalar u1 = internal::random<Scalar>(0, 1),
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
b = sqrt(u1);
|
|
689
|
-
return Quaternion (a * sin(u2), a * cos(u2), b * sin(u3), b * cos(u3));
|
|
737
|
+
const Scalar u1 = internal::random<Scalar>(0, 1), u2 = internal::random<Scalar>(0, 2 * EIGEN_PI),
|
|
738
|
+
u3 = internal::random<Scalar>(0, 2 * EIGEN_PI);
|
|
739
|
+
const Scalar a = sqrt(Scalar(1) - u1), b = sqrt(u1);
|
|
740
|
+
return Quaternion(a * sin(u2), a * cos(u2), b * sin(u3), b * cos(u3));
|
|
690
741
|
}
|
|
691
742
|
|
|
743
|
+
/** Constructs a quaternion from its coefficients in the order [\c x, \c y, \c z, \c w], i.e. vector part [\c x, \c y,
|
|
744
|
+
* \c z] first, scalar part \a w LAST.
|
|
745
|
+
*
|
|
746
|
+
* This factory accepts the parameters in the same order as the underlying coefficient vector. Consider using this
|
|
747
|
+
* factory function to make the parameter ordering explicit.
|
|
748
|
+
*/
|
|
749
|
+
template <typename Scalar, int Options>
|
|
750
|
+
EIGEN_DEVICE_FUNC Quaternion<Scalar, Options> Quaternion<Scalar, Options>::FromCoeffsScalarLast(const Scalar& x,
|
|
751
|
+
const Scalar& y,
|
|
752
|
+
const Scalar& z,
|
|
753
|
+
const Scalar& w) {
|
|
754
|
+
return Quaternion(w, x, y, z);
|
|
755
|
+
}
|
|
692
756
|
|
|
693
|
-
/**
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
{
|
|
707
|
-
Quaternion quat;
|
|
708
|
-
quat.setFromTwoVectors(a, b);
|
|
709
|
-
return quat;
|
|
757
|
+
/** Constructs a quaternion from its coefficients in the order [\c w, \c x, \c y, \c z], i.e. scalar part \a w FIRST,
|
|
758
|
+
* vector part [\c x, \c y, \c z] last.
|
|
759
|
+
*
|
|
760
|
+
* This factory accepts the parameters in the same order as the constructor \code Quaternion(const Scalar& w, const
|
|
761
|
+
* Scalar& x, const Scalar& y, const Scalar& z) \endcode. Consider using this factory function to make the parameter
|
|
762
|
+
* ordering explicit.
|
|
763
|
+
*/
|
|
764
|
+
template <typename Scalar, int Options>
|
|
765
|
+
EIGEN_DEVICE_FUNC Quaternion<Scalar, Options> Quaternion<Scalar, Options>::FromCoeffsScalarFirst(const Scalar& w,
|
|
766
|
+
const Scalar& x,
|
|
767
|
+
const Scalar& y,
|
|
768
|
+
const Scalar& z) {
|
|
769
|
+
return Quaternion(w, x, y, z);
|
|
710
770
|
}
|
|
711
771
|
|
|
772
|
+
/** Returns a quaternion representing a rotation between
|
|
773
|
+
* the two arbitrary vectors \a a and \a b. In other words, the built
|
|
774
|
+
* rotation represent a rotation sending the line of direction \a a
|
|
775
|
+
* to the line of direction \a b, both lines passing through the origin.
|
|
776
|
+
*
|
|
777
|
+
* \returns resulting quaternion
|
|
778
|
+
*
|
|
779
|
+
* Note that the two input vectors do \b not have to be normalized, and
|
|
780
|
+
* do not need to have the same norm.
|
|
781
|
+
*/
|
|
782
|
+
template <typename Scalar, int Options>
|
|
783
|
+
template <typename Derived1, typename Derived2>
|
|
784
|
+
EIGEN_DEVICE_FUNC Quaternion<Scalar, Options> Quaternion<Scalar, Options>::FromTwoVectors(
|
|
785
|
+
const MatrixBase<Derived1>& a, const MatrixBase<Derived2>& b) {
|
|
786
|
+
Quaternion quat;
|
|
787
|
+
quat.setFromTwoVectors(a, b);
|
|
788
|
+
return quat;
|
|
789
|
+
}
|
|
712
790
|
|
|
713
791
|
/** \returns the multiplicative inverse of \c *this
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
792
|
+
* Note that in most cases, i.e., if you simply want the opposite rotation,
|
|
793
|
+
* and/or the quaternion is normalized, then it is enough to use the conjugate.
|
|
794
|
+
*
|
|
795
|
+
* \sa QuaternionBase::conjugate()
|
|
796
|
+
*/
|
|
719
797
|
template <class Derived>
|
|
720
|
-
EIGEN_DEVICE_FUNC inline Quaternion<typename internal::traits<Derived>::Scalar> QuaternionBase<Derived>::inverse()
|
|
721
|
-
{
|
|
798
|
+
EIGEN_DEVICE_FUNC inline Quaternion<typename internal::traits<Derived>::Scalar> QuaternionBase<Derived>::inverse()
|
|
799
|
+
const {
|
|
722
800
|
// FIXME should this function be called multiplicativeInverse and conjugate() be called inverse() or opposite() ??
|
|
723
801
|
Scalar n2 = this->squaredNorm();
|
|
724
802
|
if (n2 > Scalar(0))
|
|
725
803
|
return Quaternion<Scalar>(conjugate().coeffs() / n2);
|
|
726
|
-
else
|
|
727
|
-
{
|
|
804
|
+
else {
|
|
728
805
|
// return an invalid result to flag the error
|
|
729
806
|
return Quaternion<Scalar>(Coefficients::Zero());
|
|
730
807
|
}
|
|
@@ -732,55 +809,48 @@ EIGEN_DEVICE_FUNC inline Quaternion<typename internal::traits<Derived>::Scalar>
|
|
|
732
809
|
|
|
733
810
|
// Generic conjugate of a Quaternion
|
|
734
811
|
namespace internal {
|
|
735
|
-
template<int Arch, class Derived, typename Scalar>
|
|
736
|
-
{
|
|
737
|
-
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Quaternion<Scalar> run(const QuaternionBase<Derived>& q){
|
|
738
|
-
return Quaternion<Scalar>(q.w()
|
|
812
|
+
template <int Arch, class Derived, typename Scalar>
|
|
813
|
+
struct quat_conj {
|
|
814
|
+
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Quaternion<Scalar> run(const QuaternionBase<Derived>& q) {
|
|
815
|
+
return Quaternion<Scalar>(q.w(), -q.x(), -q.y(), -q.z());
|
|
739
816
|
}
|
|
740
817
|
};
|
|
741
|
-
}
|
|
742
|
-
|
|
818
|
+
} // namespace internal
|
|
819
|
+
|
|
743
820
|
/** \returns the conjugate of the \c *this which is equal to the multiplicative inverse
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
821
|
+
* if the quaternion is normalized.
|
|
822
|
+
* The conjugate of a quaternion represents the opposite rotation.
|
|
823
|
+
*
|
|
824
|
+
* \sa Quaternion2::inverse()
|
|
825
|
+
*/
|
|
749
826
|
template <class Derived>
|
|
750
|
-
EIGEN_DEVICE_FUNC inline Quaternion<typename internal::traits<Derived>::Scalar>
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
return internal::quat_conj<Architecture::Target, Derived,
|
|
754
|
-
typename internal::traits<Derived>::Scalar>::run(*this);
|
|
755
|
-
|
|
827
|
+
EIGEN_DEVICE_FUNC inline Quaternion<typename internal::traits<Derived>::Scalar> QuaternionBase<Derived>::conjugate()
|
|
828
|
+
const {
|
|
829
|
+
return internal::quat_conj<Architecture::Target, Derived, typename internal::traits<Derived>::Scalar>::run(*this);
|
|
756
830
|
}
|
|
757
831
|
|
|
758
832
|
/** \returns the angle (in radian) between two rotations
|
|
759
|
-
|
|
760
|
-
|
|
833
|
+
* \sa dot()
|
|
834
|
+
*/
|
|
761
835
|
template <class Derived>
|
|
762
836
|
template <class OtherDerived>
|
|
763
|
-
EIGEN_DEVICE_FUNC inline typename internal::traits<Derived>::Scalar
|
|
764
|
-
|
|
765
|
-
{
|
|
837
|
+
EIGEN_DEVICE_FUNC inline typename internal::traits<Derived>::Scalar QuaternionBase<Derived>::angularDistance(
|
|
838
|
+
const QuaternionBase<OtherDerived>& other) const {
|
|
766
839
|
EIGEN_USING_STD(atan2)
|
|
767
840
|
Quaternion<Scalar> d = (*this) * other.conjugate();
|
|
768
|
-
return Scalar(2) * atan2(
|
|
841
|
+
return Scalar(2) * atan2(d.vec().norm(), numext::abs(d.w()));
|
|
769
842
|
}
|
|
770
843
|
|
|
771
|
-
|
|
772
|
-
|
|
773
844
|
/** \returns the spherical linear interpolation between the two quaternions
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
845
|
+
* \c *this and \a other at the parameter \a t in [0;1].
|
|
846
|
+
*
|
|
847
|
+
* This represents an interpolation for a constant motion between \c *this and \a other,
|
|
848
|
+
* see also http://en.wikipedia.org/wiki/Slerp.
|
|
849
|
+
*/
|
|
779
850
|
template <class Derived>
|
|
780
851
|
template <class OtherDerived>
|
|
781
|
-
EIGEN_DEVICE_FUNC Quaternion<typename internal::traits<Derived>::Scalar>
|
|
782
|
-
|
|
783
|
-
{
|
|
852
|
+
EIGEN_DEVICE_FUNC Quaternion<typename internal::traits<Derived>::Scalar> QuaternionBase<Derived>::slerp(
|
|
853
|
+
const Scalar& t, const QuaternionBase<OtherDerived>& other) const {
|
|
784
854
|
EIGEN_USING_STD(acos)
|
|
785
855
|
EIGEN_USING_STD(sin)
|
|
786
856
|
const Scalar one = Scalar(1) - NumTraits<Scalar>::epsilon();
|
|
@@ -790,21 +860,18 @@ QuaternionBase<Derived>::slerp(const Scalar& t, const QuaternionBase<OtherDerive
|
|
|
790
860
|
Scalar scale0;
|
|
791
861
|
Scalar scale1;
|
|
792
862
|
|
|
793
|
-
if(absD>=one)
|
|
794
|
-
{
|
|
863
|
+
if (absD >= one) {
|
|
795
864
|
scale0 = Scalar(1) - t;
|
|
796
865
|
scale1 = t;
|
|
797
|
-
}
|
|
798
|
-
else
|
|
799
|
-
{
|
|
866
|
+
} else {
|
|
800
867
|
// theta is the angle between the 2 quaternions
|
|
801
868
|
Scalar theta = acos(absD);
|
|
802
|
-
Scalar sinTheta =
|
|
869
|
+
Scalar sinTheta = numext::sqrt(Scalar(1) - absD * absD);
|
|
803
870
|
|
|
804
|
-
scale0 = sin(
|
|
805
|
-
scale1 = sin(
|
|
871
|
+
scale0 = sin((Scalar(1) - t) * theta) / sinTheta;
|
|
872
|
+
scale1 = sin((t * theta)) / sinTheta;
|
|
806
873
|
}
|
|
807
|
-
if(d<Scalar(0)) scale1 = -scale1;
|
|
874
|
+
if (d < Scalar(0)) scale1 = -scale1;
|
|
808
875
|
|
|
809
876
|
return Quaternion<Scalar>(scale0 * coeffs() + scale1 * other.coeffs());
|
|
810
877
|
}
|
|
@@ -812,59 +879,52 @@ QuaternionBase<Derived>::slerp(const Scalar& t, const QuaternionBase<OtherDerive
|
|
|
812
879
|
namespace internal {
|
|
813
880
|
|
|
814
881
|
// set from a rotation matrix
|
|
815
|
-
template<typename Other>
|
|
816
|
-
struct quaternionbase_assign_impl<Other,3,3>
|
|
817
|
-
{
|
|
882
|
+
template <typename Other>
|
|
883
|
+
struct quaternionbase_assign_impl<Other, 3, 3> {
|
|
818
884
|
typedef typename Other::Scalar Scalar;
|
|
819
|
-
template<class Derived>
|
|
820
|
-
{
|
|
821
|
-
const typename internal::nested_eval<Other,2>::type mat(a_mat);
|
|
885
|
+
template <class Derived>
|
|
886
|
+
EIGEN_DEVICE_FUNC static inline void run(QuaternionBase<Derived>& q, const Other& a_mat) {
|
|
887
|
+
const typename internal::nested_eval<Other, 2>::type mat(a_mat);
|
|
822
888
|
EIGEN_USING_STD(sqrt)
|
|
823
889
|
// This algorithm comes from "Quaternion Calculus and Fast Animation",
|
|
824
890
|
// Ken Shoemake, 1987 SIGGRAPH course notes
|
|
825
891
|
Scalar t = mat.trace();
|
|
826
|
-
if (t > Scalar(0))
|
|
827
|
-
{
|
|
892
|
+
if (t > Scalar(0)) {
|
|
828
893
|
t = sqrt(t + Scalar(1.0));
|
|
829
|
-
q.w() = Scalar(0.5)*t;
|
|
830
|
-
t = Scalar(0.5)/t;
|
|
831
|
-
q.x() = (mat.coeff(2,1) - mat.coeff(1,2)) * t;
|
|
832
|
-
q.y() = (mat.coeff(0,2) - mat.coeff(2,0)) * t;
|
|
833
|
-
q.z() = (mat.coeff(1,0) - mat.coeff(0,1)) * t;
|
|
834
|
-
}
|
|
835
|
-
else
|
|
836
|
-
{
|
|
894
|
+
q.w() = Scalar(0.5) * t;
|
|
895
|
+
t = Scalar(0.5) / t;
|
|
896
|
+
q.x() = (mat.coeff(2, 1) - mat.coeff(1, 2)) * t;
|
|
897
|
+
q.y() = (mat.coeff(0, 2) - mat.coeff(2, 0)) * t;
|
|
898
|
+
q.z() = (mat.coeff(1, 0) - mat.coeff(0, 1)) * t;
|
|
899
|
+
} else {
|
|
837
900
|
Index i = 0;
|
|
838
|
-
if (mat.coeff(1,1) > mat.coeff(0,0))
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
t = sqrt(mat.coeff(i,i)-mat.coeff(j,j)-mat.coeff(k,k) + Scalar(1.0));
|
|
901
|
+
if (mat.coeff(1, 1) > mat.coeff(0, 0)) i = 1;
|
|
902
|
+
if (mat.coeff(2, 2) > mat.coeff(i, i)) i = 2;
|
|
903
|
+
Index j = (i + 1) % 3;
|
|
904
|
+
Index k = (j + 1) % 3;
|
|
905
|
+
|
|
906
|
+
t = sqrt(mat.coeff(i, i) - mat.coeff(j, j) - mat.coeff(k, k) + Scalar(1.0));
|
|
846
907
|
q.coeffs().coeffRef(i) = Scalar(0.5) * t;
|
|
847
|
-
t = Scalar(0.5)/t;
|
|
848
|
-
q.w() = (mat.coeff(k,j)-mat.coeff(j,k))*t;
|
|
849
|
-
q.coeffs().coeffRef(j) = (mat.coeff(j,i)+mat.coeff(i,j))*t;
|
|
850
|
-
q.coeffs().coeffRef(k) = (mat.coeff(k,i)+mat.coeff(i,k))*t;
|
|
908
|
+
t = Scalar(0.5) / t;
|
|
909
|
+
q.w() = (mat.coeff(k, j) - mat.coeff(j, k)) * t;
|
|
910
|
+
q.coeffs().coeffRef(j) = (mat.coeff(j, i) + mat.coeff(i, j)) * t;
|
|
911
|
+
q.coeffs().coeffRef(k) = (mat.coeff(k, i) + mat.coeff(i, k)) * t;
|
|
851
912
|
}
|
|
852
913
|
}
|
|
853
914
|
};
|
|
854
915
|
|
|
855
916
|
// set from a vector of coefficients assumed to be a quaternion
|
|
856
|
-
template<typename Other>
|
|
857
|
-
struct quaternionbase_assign_impl<Other,4,1>
|
|
858
|
-
{
|
|
917
|
+
template <typename Other>
|
|
918
|
+
struct quaternionbase_assign_impl<Other, 4, 1> {
|
|
859
919
|
typedef typename Other::Scalar Scalar;
|
|
860
|
-
template<class Derived>
|
|
861
|
-
{
|
|
920
|
+
template <class Derived>
|
|
921
|
+
EIGEN_DEVICE_FUNC static inline void run(QuaternionBase<Derived>& q, const Other& vec) {
|
|
862
922
|
q.coeffs() = vec;
|
|
863
923
|
}
|
|
864
924
|
};
|
|
865
925
|
|
|
866
|
-
}
|
|
926
|
+
} // end namespace internal
|
|
867
927
|
|
|
868
|
-
}
|
|
928
|
+
} // end namespace Eigen
|
|
869
929
|
|
|
870
|
-
#endif
|
|
930
|
+
#endif // EIGEN_QUATERNION_H
|