@smake/eigen 1.0.2 → 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.
Files changed (435) hide show
  1. package/README.md +1 -1
  2. package/eigen/Eigen/AccelerateSupport +52 -0
  3. package/eigen/Eigen/Cholesky +18 -21
  4. package/eigen/Eigen/CholmodSupport +28 -28
  5. package/eigen/Eigen/Core +235 -326
  6. package/eigen/Eigen/Eigenvalues +16 -14
  7. package/eigen/Eigen/Geometry +21 -24
  8. package/eigen/Eigen/Householder +9 -8
  9. package/eigen/Eigen/IterativeLinearSolvers +8 -4
  10. package/eigen/Eigen/Jacobi +14 -14
  11. package/eigen/Eigen/KLUSupport +43 -0
  12. package/eigen/Eigen/LU +16 -20
  13. package/eigen/Eigen/MetisSupport +12 -12
  14. package/eigen/Eigen/OrderingMethods +54 -54
  15. package/eigen/Eigen/PaStiXSupport +23 -20
  16. package/eigen/Eigen/PardisoSupport +17 -14
  17. package/eigen/Eigen/QR +18 -21
  18. package/eigen/Eigen/QtAlignedMalloc +5 -13
  19. package/eigen/Eigen/SPQRSupport +21 -14
  20. package/eigen/Eigen/SVD +23 -18
  21. package/eigen/Eigen/Sparse +1 -4
  22. package/eigen/Eigen/SparseCholesky +18 -23
  23. package/eigen/Eigen/SparseCore +18 -17
  24. package/eigen/Eigen/SparseLU +12 -8
  25. package/eigen/Eigen/SparseQR +16 -14
  26. package/eigen/Eigen/StdDeque +5 -2
  27. package/eigen/Eigen/StdList +5 -2
  28. package/eigen/Eigen/StdVector +5 -2
  29. package/eigen/Eigen/SuperLUSupport +30 -24
  30. package/eigen/Eigen/ThreadPool +80 -0
  31. package/eigen/Eigen/UmfPackSupport +19 -17
  32. package/eigen/Eigen/Version +14 -0
  33. package/eigen/Eigen/src/AccelerateSupport/AccelerateSupport.h +423 -0
  34. package/eigen/Eigen/src/AccelerateSupport/InternalHeaderCheck.h +3 -0
  35. package/eigen/Eigen/src/Cholesky/InternalHeaderCheck.h +3 -0
  36. package/eigen/Eigen/src/Cholesky/LDLT.h +377 -401
  37. package/eigen/Eigen/src/Cholesky/LLT.h +332 -360
  38. package/eigen/Eigen/src/Cholesky/LLT_LAPACKE.h +81 -56
  39. package/eigen/Eigen/src/CholmodSupport/CholmodSupport.h +620 -521
  40. package/eigen/Eigen/src/CholmodSupport/InternalHeaderCheck.h +3 -0
  41. package/eigen/Eigen/src/Core/ArithmeticSequence.h +239 -0
  42. package/eigen/Eigen/src/Core/Array.h +341 -294
  43. package/eigen/Eigen/src/Core/ArrayBase.h +190 -203
  44. package/eigen/Eigen/src/Core/ArrayWrapper.h +127 -171
  45. package/eigen/Eigen/src/Core/Assign.h +30 -40
  46. package/eigen/Eigen/src/Core/AssignEvaluator.h +711 -589
  47. package/eigen/Eigen/src/Core/Assign_MKL.h +130 -125
  48. package/eigen/Eigen/src/Core/BandMatrix.h +268 -283
  49. package/eigen/Eigen/src/Core/Block.h +375 -398
  50. package/eigen/Eigen/src/Core/CommaInitializer.h +86 -97
  51. package/eigen/Eigen/src/Core/ConditionEstimator.h +51 -53
  52. package/eigen/Eigen/src/Core/CoreEvaluators.h +1356 -1026
  53. package/eigen/Eigen/src/Core/CoreIterators.h +73 -59
  54. package/eigen/Eigen/src/Core/CwiseBinaryOp.h +114 -132
  55. package/eigen/Eigen/src/Core/CwiseNullaryOp.h +726 -617
  56. package/eigen/Eigen/src/Core/CwiseTernaryOp.h +77 -103
  57. package/eigen/Eigen/src/Core/CwiseUnaryOp.h +56 -68
  58. package/eigen/Eigen/src/Core/CwiseUnaryView.h +132 -95
  59. package/eigen/Eigen/src/Core/DenseBase.h +632 -571
  60. package/eigen/Eigen/src/Core/DenseCoeffsBase.h +511 -624
  61. package/eigen/Eigen/src/Core/DenseStorage.h +512 -509
  62. package/eigen/Eigen/src/Core/DeviceWrapper.h +153 -0
  63. package/eigen/Eigen/src/Core/Diagonal.h +169 -210
  64. package/eigen/Eigen/src/Core/DiagonalMatrix.h +351 -274
  65. package/eigen/Eigen/src/Core/DiagonalProduct.h +12 -10
  66. package/eigen/Eigen/src/Core/Dot.h +172 -222
  67. package/eigen/Eigen/src/Core/EigenBase.h +75 -85
  68. package/eigen/Eigen/src/Core/Fill.h +138 -0
  69. package/eigen/Eigen/src/Core/FindCoeff.h +464 -0
  70. package/eigen/Eigen/src/Core/ForceAlignedAccess.h +90 -109
  71. package/eigen/Eigen/src/Core/Fuzzy.h +82 -105
  72. package/eigen/Eigen/src/Core/GeneralProduct.h +327 -263
  73. package/eigen/Eigen/src/Core/GenericPacketMath.h +1472 -360
  74. package/eigen/Eigen/src/Core/GlobalFunctions.h +194 -151
  75. package/eigen/Eigen/src/Core/IO.h +147 -139
  76. package/eigen/Eigen/src/Core/IndexedView.h +321 -0
  77. package/eigen/Eigen/src/Core/InnerProduct.h +260 -0
  78. package/eigen/Eigen/src/Core/InternalHeaderCheck.h +3 -0
  79. package/eigen/Eigen/src/Core/Inverse.h +56 -66
  80. package/eigen/Eigen/src/Core/Map.h +124 -142
  81. package/eigen/Eigen/src/Core/MapBase.h +256 -281
  82. package/eigen/Eigen/src/Core/MathFunctions.h +1620 -938
  83. package/eigen/Eigen/src/Core/MathFunctionsImpl.h +233 -71
  84. package/eigen/Eigen/src/Core/Matrix.h +491 -416
  85. package/eigen/Eigen/src/Core/MatrixBase.h +468 -453
  86. package/eigen/Eigen/src/Core/NestByValue.h +66 -85
  87. package/eigen/Eigen/src/Core/NoAlias.h +79 -85
  88. package/eigen/Eigen/src/Core/NumTraits.h +235 -148
  89. package/eigen/Eigen/src/Core/PartialReduxEvaluator.h +253 -0
  90. package/eigen/Eigen/src/Core/PermutationMatrix.h +461 -511
  91. package/eigen/Eigen/src/Core/PlainObjectBase.h +871 -894
  92. package/eigen/Eigen/src/Core/Product.h +260 -139
  93. package/eigen/Eigen/src/Core/ProductEvaluators.h +863 -714
  94. package/eigen/Eigen/src/Core/Random.h +161 -136
  95. package/eigen/Eigen/src/Core/RandomImpl.h +262 -0
  96. package/eigen/Eigen/src/Core/RealView.h +250 -0
  97. package/eigen/Eigen/src/Core/Redux.h +366 -336
  98. package/eigen/Eigen/src/Core/Ref.h +308 -209
  99. package/eigen/Eigen/src/Core/Replicate.h +94 -106
  100. package/eigen/Eigen/src/Core/Reshaped.h +398 -0
  101. package/eigen/Eigen/src/Core/ReturnByValue.h +49 -55
  102. package/eigen/Eigen/src/Core/Reverse.h +136 -145
  103. package/eigen/Eigen/src/Core/Select.h +70 -140
  104. package/eigen/Eigen/src/Core/SelfAdjointView.h +262 -285
  105. package/eigen/Eigen/src/Core/SelfCwiseBinaryOp.h +23 -20
  106. package/eigen/Eigen/src/Core/SkewSymmetricMatrix3.h +382 -0
  107. package/eigen/Eigen/src/Core/Solve.h +97 -111
  108. package/eigen/Eigen/src/Core/SolveTriangular.h +131 -129
  109. package/eigen/Eigen/src/Core/SolverBase.h +138 -101
  110. package/eigen/Eigen/src/Core/StableNorm.h +156 -160
  111. package/eigen/Eigen/src/Core/StlIterators.h +619 -0
  112. package/eigen/Eigen/src/Core/Stride.h +91 -88
  113. package/eigen/Eigen/src/Core/Swap.h +70 -38
  114. package/eigen/Eigen/src/Core/Transpose.h +295 -273
  115. package/eigen/Eigen/src/Core/Transpositions.h +272 -317
  116. package/eigen/Eigen/src/Core/TriangularMatrix.h +670 -755
  117. package/eigen/Eigen/src/Core/VectorBlock.h +59 -72
  118. package/eigen/Eigen/src/Core/VectorwiseOp.h +668 -630
  119. package/eigen/Eigen/src/Core/Visitor.h +480 -216
  120. package/eigen/Eigen/src/Core/arch/AVX/Complex.h +407 -293
  121. package/eigen/Eigen/src/Core/arch/AVX/MathFunctions.h +79 -388
  122. package/eigen/Eigen/src/Core/arch/AVX/PacketMath.h +2935 -491
  123. package/eigen/Eigen/src/Core/arch/AVX/Reductions.h +353 -0
  124. package/eigen/Eigen/src/Core/arch/AVX/TypeCasting.h +279 -22
  125. package/eigen/Eigen/src/Core/arch/AVX512/Complex.h +472 -0
  126. package/eigen/Eigen/src/Core/arch/AVX512/GemmKernel.h +1245 -0
  127. package/eigen/Eigen/src/Core/arch/AVX512/MathFunctions.h +85 -333
  128. package/eigen/Eigen/src/Core/arch/AVX512/MathFunctionsFP16.h +75 -0
  129. package/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h +2490 -649
  130. package/eigen/Eigen/src/Core/arch/AVX512/PacketMathFP16.h +1413 -0
  131. package/eigen/Eigen/src/Core/arch/AVX512/Reductions.h +297 -0
  132. package/eigen/Eigen/src/Core/arch/AVX512/TrsmKernel.h +1167 -0
  133. package/eigen/Eigen/src/Core/arch/AVX512/TrsmUnrolls.inc +1219 -0
  134. package/eigen/Eigen/src/Core/arch/AVX512/TypeCasting.h +277 -0
  135. package/eigen/Eigen/src/Core/arch/AVX512/TypeCastingFP16.h +130 -0
  136. package/eigen/Eigen/src/Core/arch/AltiVec/Complex.h +521 -298
  137. package/eigen/Eigen/src/Core/arch/AltiVec/MathFunctions.h +39 -280
  138. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProduct.h +3686 -0
  139. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h +205 -0
  140. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h +901 -0
  141. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductMMAbfloat16.h +742 -0
  142. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixVectorProduct.inc +2818 -0
  143. package/eigen/Eigen/src/Core/arch/AltiVec/PacketMath.h +3391 -723
  144. package/eigen/Eigen/src/Core/arch/AltiVec/TypeCasting.h +153 -0
  145. package/eigen/Eigen/src/Core/arch/Default/BFloat16.h +866 -0
  146. package/eigen/Eigen/src/Core/arch/Default/ConjHelper.h +113 -14
  147. package/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +2634 -0
  148. package/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +227 -0
  149. package/eigen/Eigen/src/Core/arch/Default/Half.h +1091 -0
  150. package/eigen/Eigen/src/Core/arch/Default/Settings.h +11 -13
  151. package/eigen/Eigen/src/Core/arch/GPU/Complex.h +244 -0
  152. package/eigen/Eigen/src/Core/arch/GPU/MathFunctions.h +104 -0
  153. package/eigen/Eigen/src/Core/arch/GPU/PacketMath.h +1712 -0
  154. package/eigen/Eigen/src/Core/arch/GPU/Tuple.h +268 -0
  155. package/eigen/Eigen/src/Core/arch/GPU/TypeCasting.h +77 -0
  156. package/eigen/Eigen/src/Core/arch/HIP/hcc/math_constants.h +23 -0
  157. package/eigen/Eigen/src/Core/arch/HVX/PacketMath.h +1088 -0
  158. package/eigen/Eigen/src/Core/arch/LSX/Complex.h +520 -0
  159. package/eigen/Eigen/src/Core/arch/LSX/GeneralBlockPanelKernel.h +23 -0
  160. package/eigen/Eigen/src/Core/arch/LSX/MathFunctions.h +43 -0
  161. package/eigen/Eigen/src/Core/arch/LSX/PacketMath.h +2866 -0
  162. package/eigen/Eigen/src/Core/arch/LSX/TypeCasting.h +526 -0
  163. package/eigen/Eigen/src/Core/arch/MSA/Complex.h +620 -0
  164. package/eigen/Eigen/src/Core/arch/MSA/MathFunctions.h +379 -0
  165. package/eigen/Eigen/src/Core/arch/MSA/PacketMath.h +1237 -0
  166. package/eigen/Eigen/src/Core/arch/NEON/Complex.h +531 -289
  167. package/eigen/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h +243 -0
  168. package/eigen/Eigen/src/Core/arch/NEON/MathFunctions.h +50 -73
  169. package/eigen/Eigen/src/Core/arch/NEON/PacketMath.h +5915 -579
  170. package/eigen/Eigen/src/Core/arch/NEON/TypeCasting.h +1642 -0
  171. package/eigen/Eigen/src/Core/arch/NEON/UnaryFunctors.h +57 -0
  172. package/eigen/Eigen/src/Core/arch/SSE/Complex.h +366 -334
  173. package/eigen/Eigen/src/Core/arch/SSE/MathFunctions.h +40 -514
  174. package/eigen/Eigen/src/Core/arch/SSE/PacketMath.h +2164 -675
  175. package/eigen/Eigen/src/Core/arch/SSE/Reductions.h +324 -0
  176. package/eigen/Eigen/src/Core/arch/SSE/TypeCasting.h +188 -35
  177. package/eigen/Eigen/src/Core/arch/SVE/MathFunctions.h +48 -0
  178. package/eigen/Eigen/src/Core/arch/SVE/PacketMath.h +674 -0
  179. package/eigen/Eigen/src/Core/arch/SVE/TypeCasting.h +52 -0
  180. package/eigen/Eigen/src/Core/arch/SYCL/InteropHeaders.h +227 -0
  181. package/eigen/Eigen/src/Core/arch/SYCL/MathFunctions.h +303 -0
  182. package/eigen/Eigen/src/Core/arch/SYCL/PacketMath.h +576 -0
  183. package/eigen/Eigen/src/Core/arch/SYCL/TypeCasting.h +83 -0
  184. package/eigen/Eigen/src/Core/arch/ZVector/Complex.h +434 -261
  185. package/eigen/Eigen/src/Core/arch/ZVector/MathFunctions.h +160 -53
  186. package/eigen/Eigen/src/Core/arch/ZVector/PacketMath.h +1073 -605
  187. package/eigen/Eigen/src/Core/functors/AssignmentFunctors.h +123 -117
  188. package/eigen/Eigen/src/Core/functors/BinaryFunctors.h +594 -322
  189. package/eigen/Eigen/src/Core/functors/NullaryFunctors.h +204 -118
  190. package/eigen/Eigen/src/Core/functors/StlFunctors.h +110 -97
  191. package/eigen/Eigen/src/Core/functors/TernaryFunctors.h +34 -7
  192. package/eigen/Eigen/src/Core/functors/UnaryFunctors.h +1158 -530
  193. package/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h +2329 -1333
  194. package/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h +328 -364
  195. package/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +191 -178
  196. package/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +85 -82
  197. package/eigen/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +154 -73
  198. package/eigen/Eigen/src/Core/products/GeneralMatrixVector.h +396 -542
  199. package/eigen/Eigen/src/Core/products/GeneralMatrixVector_BLAS.h +80 -77
  200. package/eigen/Eigen/src/Core/products/Parallelizer.h +208 -92
  201. package/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +331 -375
  202. package/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +206 -224
  203. package/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h +139 -146
  204. package/eigen/Eigen/src/Core/products/SelfadjointMatrixVector_BLAS.h +58 -61
  205. package/eigen/Eigen/src/Core/products/SelfadjointProduct.h +71 -71
  206. package/eigen/Eigen/src/Core/products/SelfadjointRank2Update.h +48 -46
  207. package/eigen/Eigen/src/Core/products/TriangularMatrixMatrix.h +294 -369
  208. package/eigen/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h +246 -238
  209. package/eigen/Eigen/src/Core/products/TriangularMatrixVector.h +244 -247
  210. package/eigen/Eigen/src/Core/products/TriangularMatrixVector_BLAS.h +212 -192
  211. package/eigen/Eigen/src/Core/products/TriangularSolverMatrix.h +328 -275
  212. package/eigen/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +108 -109
  213. package/eigen/Eigen/src/Core/products/TriangularSolverVector.h +70 -93
  214. package/eigen/Eigen/src/Core/util/Assert.h +158 -0
  215. package/eigen/Eigen/src/Core/util/BlasUtil.h +413 -290
  216. package/eigen/Eigen/src/Core/util/ConfigureVectorization.h +543 -0
  217. package/eigen/Eigen/src/Core/util/Constants.h +314 -263
  218. package/eigen/Eigen/src/Core/util/DisableStupidWarnings.h +130 -78
  219. package/eigen/Eigen/src/Core/util/EmulateArray.h +270 -0
  220. package/eigen/Eigen/src/Core/util/ForwardDeclarations.h +450 -224
  221. package/eigen/Eigen/src/Core/util/GpuHipCudaDefines.inc +101 -0
  222. package/eigen/Eigen/src/Core/util/GpuHipCudaUndefines.inc +45 -0
  223. package/eigen/Eigen/src/Core/util/IndexedViewHelper.h +487 -0
  224. package/eigen/Eigen/src/Core/util/IntegralConstant.h +279 -0
  225. package/eigen/Eigen/src/Core/util/MKL_support.h +39 -30
  226. package/eigen/Eigen/src/Core/util/Macros.h +939 -646
  227. package/eigen/Eigen/src/Core/util/MaxSizeVector.h +139 -0
  228. package/eigen/Eigen/src/Core/util/Memory.h +1042 -650
  229. package/eigen/Eigen/src/Core/util/Meta.h +618 -426
  230. package/eigen/Eigen/src/Core/util/MoreMeta.h +638 -0
  231. package/eigen/Eigen/src/Core/util/ReenableStupidWarnings.h +32 -19
  232. package/eigen/Eigen/src/Core/util/ReshapedHelper.h +51 -0
  233. package/eigen/Eigen/src/Core/util/Serializer.h +209 -0
  234. package/eigen/Eigen/src/Core/util/StaticAssert.h +51 -164
  235. package/eigen/Eigen/src/Core/util/SymbolicIndex.h +445 -0
  236. package/eigen/Eigen/src/Core/util/XprHelper.h +793 -538
  237. package/eigen/Eigen/src/Eigenvalues/ComplexEigenSolver.h +246 -277
  238. package/eigen/Eigen/src/Eigenvalues/ComplexSchur.h +299 -319
  239. package/eigen/Eigen/src/Eigenvalues/ComplexSchur_LAPACKE.h +52 -48
  240. package/eigen/Eigen/src/Eigenvalues/EigenSolver.h +413 -456
  241. package/eigen/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +309 -325
  242. package/eigen/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +157 -171
  243. package/eigen/Eigen/src/Eigenvalues/HessenbergDecomposition.h +292 -310
  244. package/eigen/Eigen/src/Eigenvalues/InternalHeaderCheck.h +3 -0
  245. package/eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +91 -107
  246. package/eigen/Eigen/src/Eigenvalues/RealQZ.h +539 -606
  247. package/eigen/Eigen/src/Eigenvalues/RealSchur.h +348 -382
  248. package/eigen/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h +41 -35
  249. package/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +579 -600
  250. package/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h +47 -44
  251. package/eigen/Eigen/src/Eigenvalues/Tridiagonalization.h +434 -461
  252. package/eigen/Eigen/src/Geometry/AlignedBox.h +307 -214
  253. package/eigen/Eigen/src/Geometry/AngleAxis.h +135 -137
  254. package/eigen/Eigen/src/Geometry/EulerAngles.h +163 -74
  255. package/eigen/Eigen/src/Geometry/Homogeneous.h +289 -333
  256. package/eigen/Eigen/src/Geometry/Hyperplane.h +152 -161
  257. package/eigen/Eigen/src/Geometry/InternalHeaderCheck.h +3 -0
  258. package/eigen/Eigen/src/Geometry/OrthoMethods.h +168 -145
  259. package/eigen/Eigen/src/Geometry/ParametrizedLine.h +141 -104
  260. package/eigen/Eigen/src/Geometry/Quaternion.h +595 -497
  261. package/eigen/Eigen/src/Geometry/Rotation2D.h +110 -108
  262. package/eigen/Eigen/src/Geometry/RotationBase.h +148 -145
  263. package/eigen/Eigen/src/Geometry/Scaling.h +115 -90
  264. package/eigen/Eigen/src/Geometry/Transform.h +896 -953
  265. package/eigen/Eigen/src/Geometry/Translation.h +100 -98
  266. package/eigen/Eigen/src/Geometry/Umeyama.h +79 -84
  267. package/eigen/Eigen/src/Geometry/arch/Geometry_SIMD.h +154 -0
  268. package/eigen/Eigen/src/Householder/BlockHouseholder.h +54 -42
  269. package/eigen/Eigen/src/Householder/Householder.h +104 -122
  270. package/eigen/Eigen/src/Householder/HouseholderSequence.h +416 -382
  271. package/eigen/Eigen/src/Householder/InternalHeaderCheck.h +3 -0
  272. package/eigen/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +153 -166
  273. package/eigen/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +127 -138
  274. package/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +95 -124
  275. package/eigen/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +269 -267
  276. package/eigen/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +246 -259
  277. package/eigen/Eigen/src/IterativeLinearSolvers/InternalHeaderCheck.h +3 -0
  278. package/eigen/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +218 -217
  279. package/eigen/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +80 -103
  280. package/eigen/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +59 -63
  281. package/eigen/Eigen/src/Jacobi/InternalHeaderCheck.h +3 -0
  282. package/eigen/Eigen/src/Jacobi/Jacobi.h +256 -291
  283. package/eigen/Eigen/src/KLUSupport/InternalHeaderCheck.h +3 -0
  284. package/eigen/Eigen/src/KLUSupport/KLUSupport.h +339 -0
  285. package/eigen/Eigen/src/LU/Determinant.h +60 -63
  286. package/eigen/Eigen/src/LU/FullPivLU.h +561 -626
  287. package/eigen/Eigen/src/LU/InternalHeaderCheck.h +3 -0
  288. package/eigen/Eigen/src/LU/InverseImpl.h +213 -275
  289. package/eigen/Eigen/src/LU/PartialPivLU.h +407 -435
  290. package/eigen/Eigen/src/LU/PartialPivLU_LAPACKE.h +54 -40
  291. package/eigen/Eigen/src/LU/arch/InverseSize4.h +353 -0
  292. package/eigen/Eigen/src/MetisSupport/InternalHeaderCheck.h +3 -0
  293. package/eigen/Eigen/src/MetisSupport/MetisSupport.h +81 -93
  294. package/eigen/Eigen/src/OrderingMethods/Amd.h +250 -282
  295. package/eigen/Eigen/src/OrderingMethods/Eigen_Colamd.h +950 -1103
  296. package/eigen/Eigen/src/OrderingMethods/InternalHeaderCheck.h +3 -0
  297. package/eigen/Eigen/src/OrderingMethods/Ordering.h +111 -122
  298. package/eigen/Eigen/src/PaStiXSupport/InternalHeaderCheck.h +3 -0
  299. package/eigen/Eigen/src/PaStiXSupport/PaStiXSupport.h +524 -570
  300. package/eigen/Eigen/src/PardisoSupport/InternalHeaderCheck.h +3 -0
  301. package/eigen/Eigen/src/PardisoSupport/PardisoSupport.h +385 -429
  302. package/eigen/Eigen/src/QR/ColPivHouseholderQR.h +494 -473
  303. package/eigen/Eigen/src/QR/ColPivHouseholderQR_LAPACKE.h +120 -56
  304. package/eigen/Eigen/src/QR/CompleteOrthogonalDecomposition.h +223 -137
  305. package/eigen/Eigen/src/QR/FullPivHouseholderQR.h +517 -460
  306. package/eigen/Eigen/src/QR/HouseholderQR.h +412 -278
  307. package/eigen/Eigen/src/QR/HouseholderQR_LAPACKE.h +32 -23
  308. package/eigen/Eigen/src/QR/InternalHeaderCheck.h +3 -0
  309. package/eigen/Eigen/src/SPQRSupport/InternalHeaderCheck.h +3 -0
  310. package/eigen/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +263 -261
  311. package/eigen/Eigen/src/SVD/BDCSVD.h +872 -679
  312. package/eigen/Eigen/src/SVD/BDCSVD_LAPACKE.h +174 -0
  313. package/eigen/Eigen/src/SVD/InternalHeaderCheck.h +3 -0
  314. package/eigen/Eigen/src/SVD/JacobiSVD.h +585 -543
  315. package/eigen/Eigen/src/SVD/JacobiSVD_LAPACKE.h +85 -49
  316. package/eigen/Eigen/src/SVD/SVDBase.h +281 -160
  317. package/eigen/Eigen/src/SVD/UpperBidiagonalization.h +202 -237
  318. package/eigen/Eigen/src/SparseCholesky/InternalHeaderCheck.h +3 -0
  319. package/eigen/Eigen/src/SparseCholesky/SimplicialCholesky.h +769 -590
  320. package/eigen/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +318 -129
  321. package/eigen/Eigen/src/SparseCore/AmbiVector.h +202 -251
  322. package/eigen/Eigen/src/SparseCore/CompressedStorage.h +184 -236
  323. package/eigen/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +140 -184
  324. package/eigen/Eigen/src/SparseCore/InternalHeaderCheck.h +3 -0
  325. package/eigen/Eigen/src/SparseCore/SparseAssign.h +174 -111
  326. package/eigen/Eigen/src/SparseCore/SparseBlock.h +408 -477
  327. package/eigen/Eigen/src/SparseCore/SparseColEtree.h +100 -112
  328. package/eigen/Eigen/src/SparseCore/SparseCompressedBase.h +531 -280
  329. package/eigen/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +559 -347
  330. package/eigen/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +100 -108
  331. package/eigen/Eigen/src/SparseCore/SparseDenseProduct.h +185 -191
  332. package/eigen/Eigen/src/SparseCore/SparseDiagonalProduct.h +71 -71
  333. package/eigen/Eigen/src/SparseCore/SparseDot.h +49 -47
  334. package/eigen/Eigen/src/SparseCore/SparseFuzzy.h +13 -11
  335. package/eigen/Eigen/src/SparseCore/SparseMap.h +243 -253
  336. package/eigen/Eigen/src/SparseCore/SparseMatrix.h +1614 -1142
  337. package/eigen/Eigen/src/SparseCore/SparseMatrixBase.h +403 -357
  338. package/eigen/Eigen/src/SparseCore/SparsePermutation.h +186 -115
  339. package/eigen/Eigen/src/SparseCore/SparseProduct.h +100 -91
  340. package/eigen/Eigen/src/SparseCore/SparseRedux.h +22 -24
  341. package/eigen/Eigen/src/SparseCore/SparseRef.h +268 -295
  342. package/eigen/Eigen/src/SparseCore/SparseSelfAdjointView.h +371 -414
  343. package/eigen/Eigen/src/SparseCore/SparseSolverBase.h +78 -87
  344. package/eigen/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +81 -95
  345. package/eigen/Eigen/src/SparseCore/SparseTranspose.h +62 -71
  346. package/eigen/Eigen/src/SparseCore/SparseTriangularView.h +132 -144
  347. package/eigen/Eigen/src/SparseCore/SparseUtil.h +146 -115
  348. package/eigen/Eigen/src/SparseCore/SparseVector.h +426 -372
  349. package/eigen/Eigen/src/SparseCore/SparseView.h +164 -193
  350. package/eigen/Eigen/src/SparseCore/TriangularSolver.h +129 -170
  351. package/eigen/Eigen/src/SparseLU/InternalHeaderCheck.h +3 -0
  352. package/eigen/Eigen/src/SparseLU/SparseLU.h +814 -618
  353. package/eigen/Eigen/src/SparseLU/SparseLUImpl.h +61 -48
  354. package/eigen/Eigen/src/SparseLU/SparseLU_Memory.h +102 -118
  355. package/eigen/Eigen/src/SparseLU/SparseLU_Structs.h +38 -35
  356. package/eigen/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +273 -255
  357. package/eigen/Eigen/src/SparseLU/SparseLU_Utils.h +44 -49
  358. package/eigen/Eigen/src/SparseLU/SparseLU_column_bmod.h +104 -108
  359. package/eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h +90 -101
  360. package/eigen/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +57 -58
  361. package/eigen/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +43 -55
  362. package/eigen/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +74 -71
  363. package/eigen/Eigen/src/SparseLU/SparseLU_panel_bmod.h +125 -133
  364. package/eigen/Eigen/src/SparseLU/SparseLU_panel_dfs.h +136 -159
  365. package/eigen/Eigen/src/SparseLU/SparseLU_pivotL.h +51 -52
  366. package/eigen/Eigen/src/SparseLU/SparseLU_pruneL.h +67 -73
  367. package/eigen/Eigen/src/SparseLU/SparseLU_relax_snode.h +24 -26
  368. package/eigen/Eigen/src/SparseQR/InternalHeaderCheck.h +3 -0
  369. package/eigen/Eigen/src/SparseQR/SparseQR.h +451 -490
  370. package/eigen/Eigen/src/StlSupport/StdDeque.h +28 -105
  371. package/eigen/Eigen/src/StlSupport/StdList.h +28 -84
  372. package/eigen/Eigen/src/StlSupport/StdVector.h +28 -108
  373. package/eigen/Eigen/src/StlSupport/details.h +48 -50
  374. package/eigen/Eigen/src/SuperLUSupport/InternalHeaderCheck.h +3 -0
  375. package/eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h +634 -732
  376. package/eigen/Eigen/src/ThreadPool/Barrier.h +70 -0
  377. package/eigen/Eigen/src/ThreadPool/CoreThreadPoolDevice.h +336 -0
  378. package/eigen/Eigen/src/ThreadPool/EventCount.h +241 -0
  379. package/eigen/Eigen/src/ThreadPool/ForkJoin.h +140 -0
  380. package/eigen/Eigen/src/ThreadPool/InternalHeaderCheck.h +4 -0
  381. package/eigen/Eigen/src/ThreadPool/NonBlockingThreadPool.h +587 -0
  382. package/eigen/Eigen/src/ThreadPool/RunQueue.h +230 -0
  383. package/eigen/Eigen/src/ThreadPool/ThreadCancel.h +21 -0
  384. package/eigen/Eigen/src/ThreadPool/ThreadEnvironment.h +43 -0
  385. package/eigen/Eigen/src/ThreadPool/ThreadLocal.h +289 -0
  386. package/eigen/Eigen/src/ThreadPool/ThreadPoolInterface.h +50 -0
  387. package/eigen/Eigen/src/ThreadPool/ThreadYield.h +16 -0
  388. package/eigen/Eigen/src/UmfPackSupport/InternalHeaderCheck.h +3 -0
  389. package/eigen/Eigen/src/UmfPackSupport/UmfPackSupport.h +480 -380
  390. package/eigen/Eigen/src/misc/Image.h +41 -43
  391. package/eigen/Eigen/src/misc/InternalHeaderCheck.h +3 -0
  392. package/eigen/Eigen/src/misc/Kernel.h +39 -41
  393. package/eigen/Eigen/src/misc/RealSvd2x2.h +19 -21
  394. package/eigen/Eigen/src/misc/blas.h +83 -426
  395. package/eigen/Eigen/src/misc/lapacke.h +9976 -16182
  396. package/eigen/Eigen/src/misc/lapacke_helpers.h +163 -0
  397. package/eigen/Eigen/src/misc/lapacke_mangling.h +4 -5
  398. package/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.inc +344 -0
  399. package/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.inc +544 -0
  400. package/eigen/Eigen/src/plugins/BlockMethods.inc +1370 -0
  401. package/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.inc +116 -0
  402. package/eigen/Eigen/src/plugins/CommonCwiseUnaryOps.inc +167 -0
  403. package/eigen/Eigen/src/plugins/IndexedViewMethods.inc +192 -0
  404. package/eigen/Eigen/src/plugins/InternalHeaderCheck.inc +3 -0
  405. package/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.inc +331 -0
  406. package/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.inc +118 -0
  407. package/eigen/Eigen/src/plugins/ReshapedMethods.inc +133 -0
  408. package/lib/LibEigen.d.ts +4 -0
  409. package/lib/LibEigen.js +14 -0
  410. package/lib/index.d.ts +1 -1
  411. package/lib/index.js +7 -3
  412. package/package.json +2 -10
  413. package/eigen/Eigen/CMakeLists.txt +0 -19
  414. package/eigen/Eigen/src/Core/BooleanRedux.h +0 -164
  415. package/eigen/Eigen/src/Core/arch/CUDA/Complex.h +0 -103
  416. package/eigen/Eigen/src/Core/arch/CUDA/Half.h +0 -675
  417. package/eigen/Eigen/src/Core/arch/CUDA/MathFunctions.h +0 -91
  418. package/eigen/Eigen/src/Core/arch/CUDA/PacketMath.h +0 -333
  419. package/eigen/Eigen/src/Core/arch/CUDA/PacketMathHalf.h +0 -1124
  420. package/eigen/Eigen/src/Core/arch/CUDA/TypeCasting.h +0 -212
  421. package/eigen/Eigen/src/Core/util/NonMPL2.h +0 -3
  422. package/eigen/Eigen/src/Geometry/arch/Geometry_SSE.h +0 -161
  423. package/eigen/Eigen/src/LU/arch/Inverse_SSE.h +0 -338
  424. package/eigen/Eigen/src/SparseCore/MappedSparseMatrix.h +0 -67
  425. package/eigen/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +0 -280
  426. package/eigen/Eigen/src/misc/lapack.h +0 -152
  427. package/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.h +0 -332
  428. package/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.h +0 -552
  429. package/eigen/Eigen/src/plugins/BlockMethods.h +0 -1058
  430. package/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.h +0 -115
  431. package/eigen/Eigen/src/plugins/CommonCwiseUnaryOps.h +0 -163
  432. package/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.h +0 -152
  433. package/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.h +0 -85
  434. package/lib/eigen.d.ts +0 -2
  435. package/lib/eigen.js +0 -15
@@ -12,66 +12,53 @@
12
12
  #ifndef EIGEN_TRANSFORM_H
13
13
  #define EIGEN_TRANSFORM_H
14
14
 
15
- namespace Eigen {
15
+ // IWYU pragma: private
16
+ #include "./InternalHeaderCheck.h"
17
+
18
+ namespace Eigen {
16
19
 
17
20
  namespace internal {
18
21
 
19
- template<typename Transform>
20
- struct transform_traits
21
- {
22
- enum
23
- {
22
+ template <typename Transform>
23
+ struct transform_traits {
24
+ enum {
24
25
  Dim = Transform::Dim,
25
26
  HDim = Transform::HDim,
26
27
  Mode = Transform::Mode,
27
- IsProjective = (int(Mode)==int(Projective))
28
+ IsProjective = (int(Mode) == int(Projective))
28
29
  };
29
30
  };
30
31
 
31
- template< typename TransformType,
32
- typename MatrixType,
33
- int Case = transform_traits<TransformType>::IsProjective ? 0
34
- : int(MatrixType::RowsAtCompileTime) == int(transform_traits<TransformType>::HDim) ? 1
35
- : 2,
32
+ template <typename TransformType, typename MatrixType,
33
+ int Case = transform_traits<TransformType>::IsProjective ? 0
34
+ : int(MatrixType::RowsAtCompileTime) == int(transform_traits<TransformType>::HDim) ? 1
35
+ : 2,
36
36
  int RhsCols = MatrixType::ColsAtCompileTime>
37
37
  struct transform_right_product_impl;
38
38
 
39
- template< typename Other,
40
- int Mode,
41
- int Options,
42
- int Dim,
43
- int HDim,
44
- int OtherRows=Other::RowsAtCompileTime,
45
- int OtherCols=Other::ColsAtCompileTime>
39
+ template <typename Other, int Mode, int Options, int Dim, int HDim, int OtherRows = Other::RowsAtCompileTime,
40
+ int OtherCols = Other::ColsAtCompileTime>
46
41
  struct transform_left_product_impl;
47
42
 
48
- template< typename Lhs,
49
- typename Rhs,
50
- bool AnyProjective =
51
- transform_traits<Lhs>::IsProjective ||
52
- transform_traits<Rhs>::IsProjective>
43
+ template <typename Lhs, typename Rhs,
44
+ bool AnyProjective = transform_traits<Lhs>::IsProjective || transform_traits<Rhs>::IsProjective>
53
45
  struct transform_transform_product_impl;
54
46
 
55
- template< typename Other,
56
- int Mode,
57
- int Options,
58
- int Dim,
59
- int HDim,
60
- int OtherRows=Other::RowsAtCompileTime,
61
- int OtherCols=Other::ColsAtCompileTime>
47
+ template <typename Other, int Mode, int Options, int Dim, int HDim, int OtherRows = Other::RowsAtCompileTime,
48
+ int OtherCols = Other::ColsAtCompileTime>
62
49
  struct transform_construct_from_matrix;
63
50
 
64
- template<typename TransformType> struct transform_take_affine_part;
51
+ template <typename TransformType>
52
+ struct transform_take_affine_part;
65
53
 
66
- template<typename _Scalar, int _Dim, int _Mode, int _Options>
67
- struct traits<Transform<_Scalar,_Dim,_Mode,_Options> >
68
- {
69
- typedef _Scalar Scalar;
54
+ template <typename Scalar_, int Dim_, int Mode_, int Options_>
55
+ struct traits<Transform<Scalar_, Dim_, Mode_, Options_> > {
56
+ typedef Scalar_ Scalar;
70
57
  typedef Eigen::Index StorageIndex;
71
58
  typedef Dense StorageKind;
72
59
  enum {
73
- Dim1 = _Dim==Dynamic ? _Dim : _Dim + 1,
74
- RowsAtCompileTime = _Mode==Projective ? Dim1 : _Dim,
60
+ Dim1 = Dim_ == Dynamic ? Dim_ : Dim_ + 1,
61
+ RowsAtCompileTime = Mode_ == Projective ? Dim1 : Dim_,
75
62
  ColsAtCompileTime = Dim1,
76
63
  MaxRowsAtCompileTime = RowsAtCompileTime,
77
64
  MaxColsAtCompileTime = ColsAtCompileTime,
@@ -79,277 +66,262 @@ struct traits<Transform<_Scalar,_Dim,_Mode,_Options> >
79
66
  };
80
67
  };
81
68
 
82
- template<int Mode> struct transform_make_affine;
69
+ template <int Mode>
70
+ struct transform_make_affine;
83
71
 
84
- } // end namespace internal
72
+ } // end namespace internal
85
73
 
86
74
  /** \geometry_module \ingroup Geometry_Module
87
- *
88
- * \class Transform
89
- *
90
- * \brief Represents an homogeneous transformation in a N dimensional space
91
- *
92
- * \tparam _Scalar the scalar type, i.e., the type of the coefficients
93
- * \tparam _Dim the dimension of the space
94
- * \tparam _Mode the type of the transformation. Can be:
95
- * - #Affine: the transformation is stored as a (Dim+1)^2 matrix,
96
- * where the last row is assumed to be [0 ... 0 1].
97
- * - #AffineCompact: the transformation is stored as a (Dim)x(Dim+1) matrix.
98
- * - #Projective: the transformation is stored as a (Dim+1)^2 matrix
99
- * without any assumption.
100
- * \tparam _Options has the same meaning as in class Matrix. It allows to specify DontAlign and/or RowMajor.
101
- * These Options are passed directly to the underlying matrix type.
102
- *
103
- * The homography is internally represented and stored by a matrix which
104
- * is available through the matrix() method. To understand the behavior of
105
- * this class you have to think a Transform object as its internal
106
- * matrix representation. The chosen convention is right multiply:
107
- *
108
- * \code v' = T * v \endcode
109
- *
110
- * Therefore, an affine transformation matrix M is shaped like this:
111
- *
112
- * \f$ \left( \begin{array}{cc}
113
- * linear & translation\\
114
- * 0 ... 0 & 1
115
- * \end{array} \right) \f$
116
- *
117
- * Note that for a projective transformation the last row can be anything,
118
- * and then the interpretation of different parts might be sightly different.
119
- *
120
- * However, unlike a plain matrix, the Transform class provides many features
121
- * simplifying both its assembly and usage. In particular, it can be composed
122
- * with any other transformations (Transform,Translation,RotationBase,DiagonalMatrix)
123
- * and can be directly used to transform implicit homogeneous vectors. All these
124
- * operations are handled via the operator*. For the composition of transformations,
125
- * its principle consists to first convert the right/left hand sides of the product
126
- * to a compatible (Dim+1)^2 matrix and then perform a pure matrix product.
127
- * Of course, internally, operator* tries to perform the minimal number of operations
128
- * according to the nature of each terms. Likewise, when applying the transform
129
- * to points, the latters are automatically promoted to homogeneous vectors
130
- * before doing the matrix product. The conventions to homogeneous representations
131
- * are performed as follow:
132
- *
133
- * \b Translation t (Dim)x(1):
134
- * \f$ \left( \begin{array}{cc}
135
- * I & t \\
136
- * 0\,...\,0 & 1
137
- * \end{array} \right) \f$
138
- *
139
- * \b Rotation R (Dim)x(Dim):
140
- * \f$ \left( \begin{array}{cc}
141
- * R & 0\\
142
- * 0\,...\,0 & 1
143
- * \end{array} \right) \f$
144
- *<!--
145
- * \b Linear \b Matrix L (Dim)x(Dim):
146
- * \f$ \left( \begin{array}{cc}
147
- * L & 0\\
148
- * 0\,...\,0 & 1
149
- * \end{array} \right) \f$
150
- *
151
- * \b Affine \b Matrix A (Dim)x(Dim+1):
152
- * \f$ \left( \begin{array}{c}
153
- * A\\
154
- * 0\,...\,0\,1
155
- * \end{array} \right) \f$
156
- *-->
157
- * \b Scaling \b DiagonalMatrix S (Dim)x(Dim):
158
- * \f$ \left( \begin{array}{cc}
159
- * S & 0\\
160
- * 0\,...\,0 & 1
161
- * \end{array} \right) \f$
162
- *
163
- * \b Column \b point v (Dim)x(1):
164
- * \f$ \left( \begin{array}{c}
165
- * v\\
166
- * 1
167
- * \end{array} \right) \f$
168
- *
169
- * \b Set \b of \b column \b points V1...Vn (Dim)x(n):
170
- * \f$ \left( \begin{array}{ccc}
171
- * v_1 & ... & v_n\\
172
- * 1 & ... & 1
173
- * \end{array} \right) \f$
174
- *
175
- * The concatenation of a Transform object with any kind of other transformation
176
- * always returns a Transform object.
177
- *
178
- * A little exception to the "as pure matrix product" rule is the case of the
179
- * transformation of non homogeneous vectors by an affine transformation. In
180
- * that case the last matrix row can be ignored, and the product returns non
181
- * homogeneous vectors.
182
- *
183
- * Since, for instance, a Dim x Dim matrix is interpreted as a linear transformation,
184
- * it is not possible to directly transform Dim vectors stored in a Dim x Dim matrix.
185
- * The solution is either to use a Dim x Dynamic matrix or explicitly request a
186
- * vector transformation by making the vector homogeneous:
187
- * \code
188
- * m' = T * m.colwise().homogeneous();
189
- * \endcode
190
- * Note that there is zero overhead.
191
- *
192
- * Conversion methods from/to Qt's QMatrix and QTransform are available if the
193
- * preprocessor token EIGEN_QT_SUPPORT is defined.
194
- *
195
- * This class can be extended with the help of the plugin mechanism described on the page
196
- * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_TRANSFORM_PLUGIN.
197
- *
198
- * \sa class Matrix, class Quaternion
199
- */
200
- template<typename _Scalar, int _Dim, int _Mode, int _Options>
201
- class Transform
202
- {
203
- public:
204
- EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_Dim==Dynamic ? Dynamic : (_Dim+1)*(_Dim+1))
75
+ *
76
+ * \class Transform
77
+ *
78
+ * \brief Represents an homogeneous transformation in a N dimensional space
79
+ *
80
+ * \tparam Scalar_ the scalar type, i.e., the type of the coefficients
81
+ * \tparam Dim_ the dimension of the space
82
+ * \tparam Mode_ the type of the transformation. Can be:
83
+ * - #Affine: the transformation is stored as a (Dim+1)^2 matrix,
84
+ * where the last row is assumed to be [0 ... 0 1].
85
+ * - #AffineCompact: the transformation is stored as a (Dim)x(Dim+1) matrix.
86
+ * - #Projective: the transformation is stored as a (Dim+1)^2 matrix
87
+ * without any assumption.
88
+ * - #Isometry: same as #Affine with the additional assumption that
89
+ * the linear part represents a rotation. This assumption is exploited
90
+ * to speed up some functions such as inverse() and rotation().
91
+ * \tparam Options_ has the same meaning as in class Matrix. It allows to specify DontAlign and/or RowMajor.
92
+ * These Options are passed directly to the underlying matrix type.
93
+ *
94
+ * The homography is internally represented and stored by a matrix which
95
+ * is available through the matrix() method. To understand the behavior of
96
+ * this class you have to think a Transform object as its internal
97
+ * matrix representation. The chosen convention is right multiply:
98
+ *
99
+ * \code v' = T * v \endcode
100
+ *
101
+ * Therefore, an affine transformation matrix M is shaped like this:
102
+ *
103
+ * \f$ \left( \begin{array}{cc}
104
+ * linear & translation\\
105
+ * 0 ... 0 & 1
106
+ * \end{array} \right) \f$
107
+ *
108
+ * Note that for a projective transformation the last row can be anything,
109
+ * and then the interpretation of different parts might be slightly different.
110
+ *
111
+ * However, unlike a plain matrix, the Transform class provides many features
112
+ * simplifying both its assembly and usage. In particular, it can be composed
113
+ * with any other transformations (Transform,Translation,RotationBase,DiagonalMatrix)
114
+ * and can be directly used to transform implicit homogeneous vectors. All these
115
+ * operations are handled via the operator*. For the composition of transformations,
116
+ * its principle consists to first convert the right/left hand sides of the product
117
+ * to a compatible (Dim+1)^2 matrix and then perform a pure matrix product.
118
+ * Of course, internally, operator* tries to perform the minimal number of operations
119
+ * according to the nature of each terms. Likewise, when applying the transform
120
+ * to points, the latters are automatically promoted to homogeneous vectors
121
+ * before doing the matrix product. The conventions to homogeneous representations
122
+ * are performed as follow:
123
+ *
124
+ * \b Translation t (Dim)x(1):
125
+ * \f$ \left( \begin{array}{cc}
126
+ * I & t \\
127
+ * 0\,...\,0 & 1
128
+ * \end{array} \right) \f$
129
+ *
130
+ * \b Rotation R (Dim)x(Dim):
131
+ * \f$ \left( \begin{array}{cc}
132
+ * R & 0\\
133
+ * 0\,...\,0 & 1
134
+ * \end{array} \right) \f$
135
+ *<!--
136
+ * \b Linear \b Matrix L (Dim)x(Dim):
137
+ * \f$ \left( \begin{array}{cc}
138
+ * L & 0\\
139
+ * 0\,...\,0 & 1
140
+ * \end{array} \right) \f$
141
+ *
142
+ * \b Affine \b Matrix A (Dim)x(Dim+1):
143
+ * \f$ \left( \begin{array}{c}
144
+ * A\\
145
+ * 0\,...\,0\,1
146
+ * \end{array} \right) \f$
147
+ *-->
148
+ * \b Scaling \b DiagonalMatrix S (Dim)x(Dim):
149
+ * \f$ \left( \begin{array}{cc}
150
+ * S & 0\\
151
+ * 0\,...\,0 & 1
152
+ * \end{array} \right) \f$
153
+ *
154
+ * \b Column \b point v (Dim)x(1):
155
+ * \f$ \left( \begin{array}{c}
156
+ * v\\
157
+ * 1
158
+ * \end{array} \right) \f$
159
+ *
160
+ * \b Set \b of \b column \b points V1...Vn (Dim)x(n):
161
+ * \f$ \left( \begin{array}{ccc}
162
+ * v_1 & ... & v_n\\
163
+ * 1 & ... & 1
164
+ * \end{array} \right) \f$
165
+ *
166
+ * The concatenation of a Transform object with any kind of other transformation
167
+ * always returns a Transform object.
168
+ *
169
+ * A little exception to the "as pure matrix product" rule is the case of the
170
+ * transformation of non homogeneous vectors by an affine transformation. In
171
+ * that case the last matrix row can be ignored, and the product returns non
172
+ * homogeneous vectors.
173
+ *
174
+ * Since, for instance, a Dim x Dim matrix is interpreted as a linear transformation,
175
+ * it is not possible to directly transform Dim vectors stored in a Dim x Dim matrix.
176
+ * The solution is either to use a Dim x Dynamic matrix or explicitly request a
177
+ * vector transformation by making the vector homogeneous:
178
+ * \code
179
+ * m' = T * m.colwise().homogeneous();
180
+ * \endcode
181
+ * Note that there is zero overhead.
182
+ *
183
+ * Conversion methods from/to Qt's QMatrix and QTransform are available if the
184
+ * preprocessor token EIGEN_QT_SUPPORT is defined.
185
+ *
186
+ * This class can be extended with the help of the plugin mechanism described on the page
187
+ * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_TRANSFORM_PLUGIN.
188
+ *
189
+ * \sa class Matrix, class Quaternion
190
+ */
191
+ template <typename Scalar_, int Dim_, int Mode_, int Options_>
192
+ class Transform {
193
+ public:
194
+ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(Scalar_,
195
+ Dim_ == Dynamic ? Dynamic : (Dim_ + 1) * (Dim_ + 1))
205
196
  enum {
206
- Mode = _Mode,
207
- Options = _Options,
208
- Dim = _Dim, ///< space dimension in which the transformation holds
209
- HDim = _Dim+1, ///< size of a respective homogeneous vector
210
- Rows = int(Mode)==(AffineCompact) ? Dim : HDim
197
+ Mode = Mode_,
198
+ Options = Options_,
199
+ Dim = Dim_, ///< space dimension in which the transformation holds
200
+ HDim = Dim_ + 1, ///< size of a respective homogeneous vector
201
+ Rows = int(Mode) == (AffineCompact) ? Dim : HDim
211
202
  };
212
203
  /** the scalar type of the coefficients */
213
- typedef _Scalar Scalar;
204
+ typedef Scalar_ Scalar;
214
205
  typedef Eigen::Index StorageIndex;
215
- typedef Eigen::Index Index; ///< \deprecated since Eigen 3.3
206
+ typedef Eigen::Index Index; ///< \deprecated since Eigen 3.3
216
207
  /** type of the matrix used to represent the transformation */
217
- typedef typename internal::make_proper_matrix_type<Scalar,Rows,HDim,Options>::type MatrixType;
208
+ typedef typename internal::make_proper_matrix_type<Scalar, Rows, HDim, Options>::type MatrixType;
218
209
  /** constified MatrixType */
219
210
  typedef const MatrixType ConstMatrixType;
220
211
  /** type of the matrix used to represent the linear part of the transformation */
221
- typedef Matrix<Scalar,Dim,Dim,Options> LinearMatrixType;
212
+ typedef Matrix<Scalar, Dim, Dim, Options> LinearMatrixType;
222
213
  /** type of read/write reference to the linear part of the transformation */
223
- typedef Block<MatrixType,Dim,Dim,int(Mode)==(AffineCompact) && (Options&RowMajor)==0> LinearPart;
214
+ typedef Block<MatrixType, Dim, Dim, int(Mode) == (AffineCompact) && (int(Options) & RowMajor) == 0> LinearPart;
224
215
  /** type of read reference to the linear part of the transformation */
225
- typedef const Block<ConstMatrixType,Dim,Dim,int(Mode)==(AffineCompact) && (Options&RowMajor)==0> ConstLinearPart;
216
+ typedef const Block<ConstMatrixType, Dim, Dim, int(Mode) == (AffineCompact) && (int(Options) & RowMajor) == 0>
217
+ ConstLinearPart;
226
218
  /** type of read/write reference to the affine part of the transformation */
227
- typedef typename internal::conditional<int(Mode)==int(AffineCompact),
228
- MatrixType&,
229
- Block<MatrixType,Dim,HDim> >::type AffinePart;
219
+ typedef std::conditional_t<int(Mode) == int(AffineCompact), MatrixType&, Block<MatrixType, Dim, HDim> > AffinePart;
230
220
  /** type of read reference to the affine part of the transformation */
231
- typedef typename internal::conditional<int(Mode)==int(AffineCompact),
232
- const MatrixType&,
233
- const Block<const MatrixType,Dim,HDim> >::type ConstAffinePart;
221
+ typedef std::conditional_t<int(Mode) == int(AffineCompact), const MatrixType&,
222
+ const Block<const MatrixType, Dim, HDim> >
223
+ ConstAffinePart;
234
224
  /** type of a vector */
235
- typedef Matrix<Scalar,Dim,1> VectorType;
225
+ typedef Matrix<Scalar, Dim, 1> VectorType;
236
226
  /** type of a read/write reference to the translation part of the rotation */
237
- typedef Block<MatrixType,Dim,1,!(internal::traits<MatrixType>::Flags & RowMajorBit)> TranslationPart;
227
+ typedef Block<MatrixType, Dim, 1, !(internal::traits<MatrixType>::Flags & RowMajorBit)> TranslationPart;
238
228
  /** type of a read reference to the translation part of the rotation */
239
- typedef const Block<ConstMatrixType,Dim,1,!(internal::traits<MatrixType>::Flags & RowMajorBit)> ConstTranslationPart;
229
+ typedef const Block<ConstMatrixType, Dim, 1, !(internal::traits<MatrixType>::Flags & RowMajorBit)>
230
+ ConstTranslationPart;
240
231
  /** corresponding translation type */
241
- typedef Translation<Scalar,Dim> TranslationType;
242
-
232
+ typedef Translation<Scalar, Dim> TranslationType;
233
+
243
234
  // this intermediate enum is needed to avoid an ICE with gcc 3.4 and 4.0
244
- enum { TransformTimeDiagonalMode = ((Mode==int(Isometry))?Affine:int(Mode)) };
235
+ enum { TransformTimeDiagonalMode = ((Mode == int(Isometry)) ? Affine : int(Mode)) };
245
236
  /** The return type of the product between a diagonal matrix and a transform */
246
- typedef Transform<Scalar,Dim,TransformTimeDiagonalMode> TransformTimeDiagonalReturnType;
247
-
248
- protected:
237
+ typedef Transform<Scalar, Dim, TransformTimeDiagonalMode> TransformTimeDiagonalReturnType;
249
238
 
239
+ protected:
250
240
  MatrixType m_matrix;
251
241
 
252
- public:
253
-
242
+ public:
254
243
  /** Default constructor without initialization of the meaningful coefficients.
255
- * If Mode==Affine or Mode==Isometry, then the last row is set to [0 ... 0 1] */
256
- EIGEN_DEVICE_FUNC inline Transform()
257
- {
244
+ * If Mode==Affine or Mode==Isometry, then the last row is set to [0 ... 0 1] */
245
+ EIGEN_DEVICE_FUNC inline Transform() {
258
246
  check_template_params();
259
- internal::transform_make_affine<(int(Mode)==Affine || int(Mode)==Isometry) ? Affine : AffineCompact>::run(m_matrix);
247
+ internal::transform_make_affine<(int(Mode) == Affine || int(Mode) == Isometry) ? Affine : AffineCompact>::run(
248
+ m_matrix);
260
249
  }
261
250
 
262
- EIGEN_DEVICE_FUNC inline Transform(const Transform& other)
263
- {
264
- check_template_params();
265
- m_matrix = other.m_matrix;
266
- }
267
-
268
- EIGEN_DEVICE_FUNC inline explicit Transform(const TranslationType& t)
269
- {
251
+ EIGEN_DEVICE_FUNC inline explicit Transform(const TranslationType& t) {
270
252
  check_template_params();
271
253
  *this = t;
272
254
  }
273
- EIGEN_DEVICE_FUNC inline explicit Transform(const UniformScaling<Scalar>& s)
274
- {
255
+ EIGEN_DEVICE_FUNC inline explicit Transform(const UniformScaling<Scalar>& s) {
275
256
  check_template_params();
276
257
  *this = s;
277
258
  }
278
- template<typename Derived>
279
- EIGEN_DEVICE_FUNC inline explicit Transform(const RotationBase<Derived, Dim>& r)
280
- {
259
+ template <typename Derived>
260
+ EIGEN_DEVICE_FUNC inline explicit Transform(const RotationBase<Derived, Dim>& r) {
281
261
  check_template_params();
282
262
  *this = r;
283
263
  }
284
264
 
285
- EIGEN_DEVICE_FUNC inline Transform& operator=(const Transform& other)
286
- { m_matrix = other.m_matrix; return *this; }
287
-
288
265
  typedef internal::transform_take_affine_part<Transform> take_affine_part;
289
266
 
290
267
  /** Constructs and initializes a transformation from a Dim^2 or a (Dim+1)^2 matrix. */
291
- template<typename OtherDerived>
292
- EIGEN_DEVICE_FUNC inline explicit Transform(const EigenBase<OtherDerived>& other)
293
- {
294
- EIGEN_STATIC_ASSERT((internal::is_same<Scalar,typename OtherDerived::Scalar>::value),
295
- YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY);
268
+ template <typename OtherDerived>
269
+ EIGEN_DEVICE_FUNC inline explicit Transform(const EigenBase<OtherDerived>& other) {
270
+ EIGEN_STATIC_ASSERT(
271
+ (internal::is_same<Scalar, typename OtherDerived::Scalar>::value),
272
+ YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY);
296
273
 
297
274
  check_template_params();
298
- internal::transform_construct_from_matrix<OtherDerived,Mode,Options,Dim,HDim>::run(this, other.derived());
275
+ internal::transform_construct_from_matrix<OtherDerived, Mode, Options, Dim, HDim>::run(this, other.derived());
299
276
  }
300
277
 
301
278
  /** Set \c *this from a Dim^2 or (Dim+1)^2 matrix. */
302
- template<typename OtherDerived>
303
- EIGEN_DEVICE_FUNC inline Transform& operator=(const EigenBase<OtherDerived>& other)
304
- {
305
- EIGEN_STATIC_ASSERT((internal::is_same<Scalar,typename OtherDerived::Scalar>::value),
306
- YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY);
279
+ template <typename OtherDerived>
280
+ EIGEN_DEVICE_FUNC inline Transform& operator=(const EigenBase<OtherDerived>& other) {
281
+ EIGEN_STATIC_ASSERT(
282
+ (internal::is_same<Scalar, typename OtherDerived::Scalar>::value),
283
+ YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY);
307
284
 
308
- internal::transform_construct_from_matrix<OtherDerived,Mode,Options,Dim,HDim>::run(this, other.derived());
285
+ internal::transform_construct_from_matrix<OtherDerived, Mode, Options, Dim, HDim>::run(this, other.derived());
309
286
  return *this;
310
287
  }
311
-
312
- template<int OtherOptions>
313
- EIGEN_DEVICE_FUNC inline Transform(const Transform<Scalar,Dim,Mode,OtherOptions>& other)
314
- {
288
+
289
+ template <int OtherOptions>
290
+ EIGEN_DEVICE_FUNC inline Transform(const Transform<Scalar, Dim, Mode, OtherOptions>& other) {
315
291
  check_template_params();
316
292
  // only the options change, we can directly copy the matrices
317
293
  m_matrix = other.matrix();
318
294
  }
319
295
 
320
- template<int OtherMode,int OtherOptions>
321
- EIGEN_DEVICE_FUNC inline Transform(const Transform<Scalar,Dim,OtherMode,OtherOptions>& other)
322
- {
296
+ template <int OtherMode, int OtherOptions>
297
+ EIGEN_DEVICE_FUNC inline Transform(const Transform<Scalar, Dim, OtherMode, OtherOptions>& other) {
323
298
  check_template_params();
324
299
  // prevent conversions as:
325
300
  // Affine | AffineCompact | Isometry = Projective
326
- EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(OtherMode==int(Projective), Mode==int(Projective)),
301
+ EIGEN_STATIC_ASSERT(internal::check_implication(OtherMode == int(Projective), Mode == int(Projective)),
327
302
  YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION)
328
303
 
329
304
  // prevent conversions as:
330
305
  // Isometry = Affine | AffineCompact
331
- EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(OtherMode==int(Affine)||OtherMode==int(AffineCompact), Mode!=int(Isometry)),
332
- YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION)
306
+ EIGEN_STATIC_ASSERT(
307
+ internal::check_implication(OtherMode == int(Affine) || OtherMode == int(AffineCompact), Mode != int(Isometry)),
308
+ YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION)
333
309
 
334
- enum { ModeIsAffineCompact = Mode == int(AffineCompact),
335
- OtherModeIsAffineCompact = OtherMode == int(AffineCompact)
310
+ enum {
311
+ ModeIsAffineCompact = Mode == int(AffineCompact),
312
+ OtherModeIsAffineCompact = OtherMode == int(AffineCompact)
336
313
  };
337
314
 
338
- if(ModeIsAffineCompact == OtherModeIsAffineCompact)
339
- {
315
+ if (EIGEN_CONST_CONDITIONAL(ModeIsAffineCompact == OtherModeIsAffineCompact)) {
340
316
  // We need the block expression because the code is compiled for all
341
317
  // combinations of transformations and will trigger a compile time error
342
318
  // if one tries to assign the matrices directly
343
- m_matrix.template block<Dim,Dim+1>(0,0) = other.matrix().template block<Dim,Dim+1>(0,0);
319
+ m_matrix.template block<Dim, Dim + 1>(0, 0) = other.matrix().template block<Dim, Dim + 1>(0, 0);
344
320
  makeAffine();
345
- }
346
- else if(OtherModeIsAffineCompact)
347
- {
348
- typedef typename Transform<Scalar,Dim,OtherMode,OtherOptions>::MatrixType OtherMatrixType;
349
- internal::transform_construct_from_matrix<OtherMatrixType,Mode,Options,Dim,HDim>::run(this, other.matrix());
350
- }
351
- else
352
- {
321
+ } else if (EIGEN_CONST_CONDITIONAL(OtherModeIsAffineCompact)) {
322
+ typedef typename Transform<Scalar, Dim, OtherMode, OtherOptions>::MatrixType OtherMatrixType;
323
+ internal::transform_construct_from_matrix<OtherMatrixType, Mode, Options, Dim, HDim>::run(this, other.matrix());
324
+ } else {
353
325
  // here we know that Mode == AffineCompact and OtherMode != AffineCompact.
354
326
  // if OtherMode were Projective, the static assert above would already have caught it.
355
327
  // So the only possibility is that OtherMode == Affine
@@ -358,38 +330,40 @@ public:
358
330
  }
359
331
  }
360
332
 
361
- template<typename OtherDerived>
362
- EIGEN_DEVICE_FUNC Transform(const ReturnByValue<OtherDerived>& other)
363
- {
333
+ template <typename OtherDerived>
334
+ EIGEN_DEVICE_FUNC Transform(const ReturnByValue<OtherDerived>& other) {
364
335
  check_template_params();
365
336
  other.evalTo(*this);
366
337
  }
367
338
 
368
- template<typename OtherDerived>
369
- EIGEN_DEVICE_FUNC Transform& operator=(const ReturnByValue<OtherDerived>& other)
370
- {
339
+ template <typename OtherDerived>
340
+ EIGEN_DEVICE_FUNC Transform& operator=(const ReturnByValue<OtherDerived>& other) {
371
341
  other.evalTo(*this);
372
342
  return *this;
373
343
  }
374
344
 
375
- #ifdef EIGEN_QT_SUPPORT
345
+ #ifdef EIGEN_QT_SUPPORT
346
+ #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
376
347
  inline Transform(const QMatrix& other);
377
348
  inline Transform& operator=(const QMatrix& other);
378
349
  inline QMatrix toQMatrix(void) const;
350
+ #endif
379
351
  inline Transform(const QTransform& other);
380
352
  inline Transform& operator=(const QTransform& other);
381
353
  inline QTransform toQTransform(void) const;
382
- #endif
383
-
384
- EIGEN_DEVICE_FUNC Index rows() const { return int(Mode)==int(Projective) ? m_matrix.cols() : (m_matrix.cols()-1); }
385
- EIGEN_DEVICE_FUNC Index cols() const { return m_matrix.cols(); }
354
+ #endif
355
+
356
+ EIGEN_DEVICE_FUNC constexpr Index rows() const noexcept {
357
+ return int(Mode) == int(Projective) ? m_matrix.cols() : (m_matrix.cols() - 1);
358
+ }
359
+ EIGEN_DEVICE_FUNC constexpr Index cols() const noexcept { return m_matrix.cols(); }
386
360
 
387
361
  /** shortcut for m_matrix(row,col);
388
- * \sa MatrixBase::operator(Index,Index) const */
389
- EIGEN_DEVICE_FUNC inline Scalar operator() (Index row, Index col) const { return m_matrix(row,col); }
362
+ * \sa MatrixBase::operator(Index,Index) const */
363
+ EIGEN_DEVICE_FUNC inline Scalar operator()(Index row, Index col) const { return m_matrix(row, col); }
390
364
  /** shortcut for m_matrix(row,col);
391
- * \sa MatrixBase::operator(Index,Index) */
392
- EIGEN_DEVICE_FUNC inline Scalar& operator() (Index row, Index col) { return m_matrix(row,col); }
365
+ * \sa MatrixBase::operator(Index,Index) */
366
+ EIGEN_DEVICE_FUNC inline Scalar& operator()(Index row, Index col) { return m_matrix(row, col); }
393
367
 
394
368
  /** \returns a read-only expression of the transformation matrix */
395
369
  EIGEN_DEVICE_FUNC inline const MatrixType& matrix() const { return m_matrix; }
@@ -397,9 +371,9 @@ public:
397
371
  EIGEN_DEVICE_FUNC inline MatrixType& matrix() { return m_matrix; }
398
372
 
399
373
  /** \returns a read-only expression of the linear part of the transformation */
400
- EIGEN_DEVICE_FUNC inline ConstLinearPart linear() const { return ConstLinearPart(m_matrix,0,0); }
374
+ EIGEN_DEVICE_FUNC inline ConstLinearPart linear() const { return ConstLinearPart(m_matrix, 0, 0); }
401
375
  /** \returns a writable expression of the linear part of the transformation */
402
- EIGEN_DEVICE_FUNC inline LinearPart linear() { return LinearPart(m_matrix,0,0); }
376
+ EIGEN_DEVICE_FUNC inline LinearPart linear() { return LinearPart(m_matrix, 0, 0); }
403
377
 
404
378
  /** \returns a read-only expression of the Dim x HDim affine part of the transformation */
405
379
  EIGEN_DEVICE_FUNC inline ConstAffinePart affine() const { return take_affine_part::run(m_matrix); }
@@ -407,127 +381,133 @@ public:
407
381
  EIGEN_DEVICE_FUNC inline AffinePart affine() { return take_affine_part::run(m_matrix); }
408
382
 
409
383
  /** \returns a read-only expression of the translation vector of the transformation */
410
- EIGEN_DEVICE_FUNC inline ConstTranslationPart translation() const { return ConstTranslationPart(m_matrix,0,Dim); }
384
+ EIGEN_DEVICE_FUNC inline ConstTranslationPart translation() const { return ConstTranslationPart(m_matrix, 0, Dim); }
411
385
  /** \returns a writable expression of the translation vector of the transformation */
412
- EIGEN_DEVICE_FUNC inline TranslationPart translation() { return TranslationPart(m_matrix,0,Dim); }
386
+ EIGEN_DEVICE_FUNC inline TranslationPart translation() { return TranslationPart(m_matrix, 0, Dim); }
413
387
 
414
388
  /** \returns an expression of the product between the transform \c *this and a matrix expression \a other.
415
- *
416
- * The right-hand-side \a other can be either:
417
- * \li an homogeneous vector of size Dim+1,
418
- * \li a set of homogeneous vectors of size Dim+1 x N,
419
- * \li a transformation matrix of size Dim+1 x Dim+1.
420
- *
421
- * Moreover, if \c *this represents an affine transformation (i.e., Mode!=Projective), then \a other can also be:
422
- * \li a point of size Dim (computes: \code this->linear() * other + this->translation()\endcode),
423
- * \li a set of N points as a Dim x N matrix (computes: \code (this->linear() * other).colwise() + this->translation()\endcode),
424
- *
425
- * In all cases, the return type is a matrix or vector of same sizes as the right-hand-side \a other.
426
- *
427
- * If you want to interpret \a other as a linear or affine transformation, then first convert it to a Transform<> type,
428
- * or do your own cooking.
429
- *
430
- * Finally, if you want to apply Affine transformations to vectors, then explicitly apply the linear part only:
431
- * \code
432
- * Affine3f A;
433
- * Vector3f v1, v2;
434
- * v2 = A.linear() * v1;
435
- * \endcode
436
- *
437
- */
389
+ *
390
+ * The right-hand-side \a other can be either:
391
+ * \li an homogeneous vector of size Dim+1,
392
+ * \li a set of homogeneous vectors of size Dim+1 x N,
393
+ * \li a transformation matrix of size Dim+1 x Dim+1.
394
+ *
395
+ * Moreover, if \c *this represents an affine transformation (i.e., Mode!=Projective), then \a other can also be:
396
+ * \li a point of size Dim (computes: \code this->linear() * other + this->translation()\endcode),
397
+ * \li a set of N points as a Dim x N matrix (computes: \code (this->linear() * other).colwise() +
398
+ * this->translation()\endcode),
399
+ *
400
+ * In all cases, the return type is a matrix or vector of same sizes as the right-hand-side \a other.
401
+ *
402
+ * If you want to interpret \a other as a linear or affine transformation, then first convert it to a Transform<>
403
+ * type, or do your own cooking.
404
+ *
405
+ * Finally, if you want to apply Affine transformations to vectors, then explicitly apply the linear part only:
406
+ * \code
407
+ * Affine3f A;
408
+ * Vector3f v1, v2;
409
+ * v2 = A.linear() * v1;
410
+ * \endcode
411
+ *
412
+ */
438
413
  // note: this function is defined here because some compilers cannot find the respective declaration
439
- template<typename OtherDerived>
440
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename internal::transform_right_product_impl<Transform, OtherDerived>::ResultType
441
- operator * (const EigenBase<OtherDerived> &other) const
442
- { return internal::transform_right_product_impl<Transform, OtherDerived>::run(*this,other.derived()); }
414
+ template <typename OtherDerived>
415
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename internal::transform_right_product_impl<Transform,
416
+ OtherDerived>::ResultType
417
+ operator*(const EigenBase<OtherDerived>& other) const {
418
+ return internal::transform_right_product_impl<Transform, OtherDerived>::run(*this, other.derived());
419
+ }
443
420
 
444
421
  /** \returns the product expression of a transformation matrix \a a times a transform \a b
445
- *
446
- * The left hand side \a other can be either:
447
- * \li a linear transformation matrix of size Dim x Dim,
448
- * \li an affine transformation matrix of size Dim x Dim+1,
449
- * \li a general transformation matrix of size Dim+1 x Dim+1.
450
- */
451
- template<typename OtherDerived> friend
452
- EIGEN_DEVICE_FUNC inline const typename internal::transform_left_product_impl<OtherDerived,Mode,Options,_Dim,_Dim+1>::ResultType
453
- operator * (const EigenBase<OtherDerived> &a, const Transform &b)
454
- { return internal::transform_left_product_impl<OtherDerived,Mode,Options,Dim,HDim>::run(a.derived(),b); }
422
+ *
423
+ * The left hand side \a other can be either:
424
+ * \li a linear transformation matrix of size Dim x Dim,
425
+ * \li an affine transformation matrix of size Dim x Dim+1,
426
+ * \li a general transformation matrix of size Dim+1 x Dim+1.
427
+ */
428
+ template <typename OtherDerived>
429
+ friend EIGEN_DEVICE_FUNC inline const typename internal::transform_left_product_impl<OtherDerived, Mode, Options,
430
+ Dim_, Dim_ + 1>::ResultType
431
+ operator*(const EigenBase<OtherDerived>& a, const Transform& b) {
432
+ return internal::transform_left_product_impl<OtherDerived, Mode, Options, Dim, HDim>::run(a.derived(), b);
433
+ }
455
434
 
456
435
  /** \returns The product expression of a transform \a a times a diagonal matrix \a b
457
- *
458
- * The rhs diagonal matrix is interpreted as an affine scaling transformation. The
459
- * product results in a Transform of the same type (mode) as the lhs only if the lhs
460
- * mode is no isometry. In that case, the returned transform is an affinity.
461
- */
462
- template<typename DiagonalDerived>
463
- EIGEN_DEVICE_FUNC inline const TransformTimeDiagonalReturnType
464
- operator * (const DiagonalBase<DiagonalDerived> &b) const
465
- {
436
+ *
437
+ * The rhs diagonal matrix is interpreted as an affine scaling transformation. The
438
+ * product results in a Transform of the same type (mode) as the lhs only if the lhs
439
+ * mode is no isometry. In that case, the returned transform is an affinity.
440
+ */
441
+ template <typename DiagonalDerived>
442
+ EIGEN_DEVICE_FUNC inline const TransformTimeDiagonalReturnType operator*(
443
+ const DiagonalBase<DiagonalDerived>& b) const {
466
444
  TransformTimeDiagonalReturnType res(*this);
467
445
  res.linearExt() *= b;
468
446
  return res;
469
447
  }
470
448
 
471
449
  /** \returns The product expression of a diagonal matrix \a a times a transform \a b
472
- *
473
- * The lhs diagonal matrix is interpreted as an affine scaling transformation. The
474
- * product results in a Transform of the same type (mode) as the lhs only if the lhs
475
- * mode is no isometry. In that case, the returned transform is an affinity.
476
- */
477
- template<typename DiagonalDerived>
478
- EIGEN_DEVICE_FUNC friend inline TransformTimeDiagonalReturnType
479
- operator * (const DiagonalBase<DiagonalDerived> &a, const Transform &b)
480
- {
450
+ *
451
+ * The lhs diagonal matrix is interpreted as an affine scaling transformation. The
452
+ * product results in a Transform of the same type (mode) as the lhs only if the lhs
453
+ * mode is no isometry. In that case, the returned transform is an affinity.
454
+ */
455
+ template <typename DiagonalDerived>
456
+ EIGEN_DEVICE_FUNC friend inline TransformTimeDiagonalReturnType operator*(const DiagonalBase<DiagonalDerived>& a,
457
+ const Transform& b) {
481
458
  TransformTimeDiagonalReturnType res;
482
- res.linear().noalias() = a*b.linear();
483
- res.translation().noalias() = a*b.translation();
484
- if (Mode!=int(AffineCompact))
485
- res.matrix().row(Dim) = b.matrix().row(Dim);
459
+ res.linear().noalias() = a * b.linear();
460
+ res.translation().noalias() = a * b.translation();
461
+ if (EIGEN_CONST_CONDITIONAL(Mode != int(AffineCompact))) res.matrix().row(Dim) = b.matrix().row(Dim);
486
462
  return res;
487
463
  }
488
464
 
489
- template<typename OtherDerived>
490
- EIGEN_DEVICE_FUNC inline Transform& operator*=(const EigenBase<OtherDerived>& other) { return *this = *this * other; }
465
+ template <typename OtherDerived>
466
+ EIGEN_DEVICE_FUNC inline Transform& operator*=(const EigenBase<OtherDerived>& other) {
467
+ return *this = *this * other;
468
+ }
491
469
 
492
470
  /** Concatenates two transformations */
493
- EIGEN_DEVICE_FUNC inline const Transform operator * (const Transform& other) const
494
- {
495
- return internal::transform_transform_product_impl<Transform,Transform>::run(*this,other);
471
+ EIGEN_DEVICE_FUNC inline const Transform operator*(const Transform& other) const {
472
+ return internal::transform_transform_product_impl<Transform, Transform>::run(*this, other);
496
473
  }
497
-
498
- #if EIGEN_COMP_ICC
499
- private:
474
+
475
+ #if EIGEN_COMP_ICC
476
+ private:
500
477
  // this intermediate structure permits to workaround a bug in ICC 11:
501
478
  // error: template instantiation resulted in unexpected function type of "Eigen::Transform<double, 3, 32, 0>
502
479
  // (const Eigen::Transform<double, 3, 2, 0> &) const"
503
480
  // (the meaning of a name may have changed since the template declaration -- the type of the template is:
504
481
  // "Eigen::internal::transform_transform_product_impl<Eigen::Transform<double, 3, 32, 0>,
505
- // Eigen::Transform<double, 3, Mode, Options>, <expression>>::ResultType (const Eigen::Transform<double, 3, Mode, Options> &) const")
506
- //
507
- template<int OtherMode,int OtherOptions> struct icc_11_workaround
508
- {
509
- typedef internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> > ProductType;
482
+ // Eigen::Transform<double, 3, Mode, Options>, <expression>>::ResultType (const Eigen::Transform<double, 3, Mode,
483
+ // Options> &) const")
484
+ //
485
+ template <int OtherMode, int OtherOptions>
486
+ struct icc_11_workaround {
487
+ typedef internal::transform_transform_product_impl<Transform, Transform<Scalar, Dim, OtherMode, OtherOptions> >
488
+ ProductType;
510
489
  typedef typename ProductType::ResultType ResultType;
511
490
  };
512
-
513
- public:
491
+
492
+ public:
514
493
  /** Concatenates two different transformations */
515
- template<int OtherMode,int OtherOptions>
516
- inline typename icc_11_workaround<OtherMode,OtherOptions>::ResultType
517
- operator * (const Transform<Scalar,Dim,OtherMode,OtherOptions>& other) const
518
- {
519
- typedef typename icc_11_workaround<OtherMode,OtherOptions>::ProductType ProductType;
520
- return ProductType::run(*this,other);
494
+ template <int OtherMode, int OtherOptions>
495
+ inline typename icc_11_workaround<OtherMode, OtherOptions>::ResultType operator*(
496
+ const Transform<Scalar, Dim, OtherMode, OtherOptions>& other) const {
497
+ typedef typename icc_11_workaround<OtherMode, OtherOptions>::ProductType ProductType;
498
+ return ProductType::run(*this, other);
521
499
  }
522
- #else
500
+ #else
523
501
  /** Concatenates two different transformations */
524
- template<int OtherMode,int OtherOptions>
525
- EIGEN_DEVICE_FUNC inline typename internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> >::ResultType
526
- operator * (const Transform<Scalar,Dim,OtherMode,OtherOptions>& other) const
527
- {
528
- return internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> >::run(*this,other);
502
+ template <int OtherMode, int OtherOptions>
503
+ EIGEN_DEVICE_FUNC inline
504
+ typename internal::transform_transform_product_impl<Transform,
505
+ Transform<Scalar, Dim, OtherMode, OtherOptions> >::ResultType
506
+ operator*(const Transform<Scalar, Dim, OtherMode, OtherOptions>& other) const {
507
+ return internal::transform_transform_product_impl<Transform, Transform<Scalar, Dim, OtherMode, OtherOptions> >::run(
508
+ *this, other);
529
509
  }
530
- #endif
510
+ #endif
531
511
 
532
512
  /** \sa MatrixBase::setIdentity() */
533
513
  EIGEN_DEVICE_FUNC void setIdentity() { m_matrix.setIdentity(); }
@@ -536,297 +516,279 @@ public:
536
516
  * \brief Returns an identity transformation.
537
517
  * \todo In the future this function should be returning a Transform expression.
538
518
  */
539
- EIGEN_DEVICE_FUNC static const Transform Identity()
540
- {
541
- return Transform(MatrixType::Identity());
542
- }
519
+ EIGEN_DEVICE_FUNC static const Transform Identity() { return Transform(MatrixType::Identity()); }
543
520
 
544
- template<typename OtherDerived>
545
- EIGEN_DEVICE_FUNC
546
- inline Transform& scale(const MatrixBase<OtherDerived> &other);
521
+ template <typename OtherDerived>
522
+ EIGEN_DEVICE_FUNC inline Transform& scale(const MatrixBase<OtherDerived>& other);
547
523
 
548
- template<typename OtherDerived>
549
- EIGEN_DEVICE_FUNC
550
- inline Transform& prescale(const MatrixBase<OtherDerived> &other);
524
+ template <typename OtherDerived>
525
+ EIGEN_DEVICE_FUNC inline Transform& prescale(const MatrixBase<OtherDerived>& other);
551
526
 
552
527
  EIGEN_DEVICE_FUNC inline Transform& scale(const Scalar& s);
553
528
  EIGEN_DEVICE_FUNC inline Transform& prescale(const Scalar& s);
554
529
 
555
- template<typename OtherDerived>
556
- EIGEN_DEVICE_FUNC
557
- inline Transform& translate(const MatrixBase<OtherDerived> &other);
530
+ template <typename OtherDerived>
531
+ EIGEN_DEVICE_FUNC inline Transform& translate(const MatrixBase<OtherDerived>& other);
558
532
 
559
- template<typename OtherDerived>
560
- EIGEN_DEVICE_FUNC
561
- inline Transform& pretranslate(const MatrixBase<OtherDerived> &other);
533
+ template <typename OtherDerived>
534
+ EIGEN_DEVICE_FUNC inline Transform& pretranslate(const MatrixBase<OtherDerived>& other);
562
535
 
563
- template<typename RotationType>
564
- EIGEN_DEVICE_FUNC
565
- inline Transform& rotate(const RotationType& rotation);
536
+ template <typename RotationType>
537
+ EIGEN_DEVICE_FUNC inline Transform& rotate(const RotationType& rotation);
566
538
 
567
- template<typename RotationType>
568
- EIGEN_DEVICE_FUNC
569
- inline Transform& prerotate(const RotationType& rotation);
539
+ template <typename RotationType>
540
+ EIGEN_DEVICE_FUNC inline Transform& prerotate(const RotationType& rotation);
570
541
 
571
542
  EIGEN_DEVICE_FUNC Transform& shear(const Scalar& sx, const Scalar& sy);
572
543
  EIGEN_DEVICE_FUNC Transform& preshear(const Scalar& sx, const Scalar& sy);
573
544
 
574
545
  EIGEN_DEVICE_FUNC inline Transform& operator=(const TranslationType& t);
575
-
576
- EIGEN_DEVICE_FUNC
577
- inline Transform& operator*=(const TranslationType& t) { return translate(t.vector()); }
578
-
546
+
547
+ EIGEN_DEVICE_FUNC inline Transform& operator*=(const TranslationType& t) { return translate(t.vector()); }
548
+
579
549
  EIGEN_DEVICE_FUNC inline Transform operator*(const TranslationType& t) const;
580
550
 
581
- EIGEN_DEVICE_FUNC
582
- inline Transform& operator=(const UniformScaling<Scalar>& t);
583
-
584
- EIGEN_DEVICE_FUNC
585
- inline Transform& operator*=(const UniformScaling<Scalar>& s) { return scale(s.factor()); }
586
-
587
- EIGEN_DEVICE_FUNC
588
- inline TransformTimeDiagonalReturnType operator*(const UniformScaling<Scalar>& s) const
589
- {
551
+ EIGEN_DEVICE_FUNC inline Transform& operator=(const UniformScaling<Scalar>& t);
552
+
553
+ EIGEN_DEVICE_FUNC inline Transform& operator*=(const UniformScaling<Scalar>& s) { return scale(s.factor()); }
554
+
555
+ EIGEN_DEVICE_FUNC inline TransformTimeDiagonalReturnType operator*(const UniformScaling<Scalar>& s) const {
590
556
  TransformTimeDiagonalReturnType res = *this;
591
557
  res.scale(s.factor());
592
558
  return res;
593
559
  }
594
560
 
595
- EIGEN_DEVICE_FUNC
596
- inline Transform& operator*=(const DiagonalMatrix<Scalar,Dim>& s) { linearExt() *= s; return *this; }
561
+ EIGEN_DEVICE_FUNC inline Transform& operator*=(const DiagonalMatrix<Scalar, Dim>& s) {
562
+ linearExt() *= s;
563
+ return *this;
564
+ }
597
565
 
598
- template<typename Derived>
599
- EIGEN_DEVICE_FUNC inline Transform& operator=(const RotationBase<Derived,Dim>& r);
600
- template<typename Derived>
601
- EIGEN_DEVICE_FUNC inline Transform& operator*=(const RotationBase<Derived,Dim>& r) { return rotate(r.toRotationMatrix()); }
602
- template<typename Derived>
603
- EIGEN_DEVICE_FUNC inline Transform operator*(const RotationBase<Derived,Dim>& r) const;
566
+ template <typename Derived>
567
+ EIGEN_DEVICE_FUNC inline Transform& operator=(const RotationBase<Derived, Dim>& r);
568
+ template <typename Derived>
569
+ EIGEN_DEVICE_FUNC inline Transform& operator*=(const RotationBase<Derived, Dim>& r) {
570
+ return rotate(r.toRotationMatrix());
571
+ }
572
+ template <typename Derived>
573
+ EIGEN_DEVICE_FUNC inline Transform operator*(const RotationBase<Derived, Dim>& r) const;
574
+
575
+ typedef std::conditional_t<int(Mode) == Isometry, ConstLinearPart, const LinearMatrixType> RotationReturnType;
576
+ EIGEN_DEVICE_FUNC RotationReturnType rotation() const;
604
577
 
605
- EIGEN_DEVICE_FUNC const LinearMatrixType rotation() const;
606
- template<typename RotationMatrixType, typename ScalingMatrixType>
607
- EIGEN_DEVICE_FUNC
608
- void computeRotationScaling(RotationMatrixType *rotation, ScalingMatrixType *scaling) const;
609
- template<typename ScalingMatrixType, typename RotationMatrixType>
610
- EIGEN_DEVICE_FUNC
611
- void computeScalingRotation(ScalingMatrixType *scaling, RotationMatrixType *rotation) const;
578
+ template <typename RotationMatrixType, typename ScalingMatrixType>
579
+ EIGEN_DEVICE_FUNC void computeRotationScaling(RotationMatrixType* rotation, ScalingMatrixType* scaling) const;
580
+ template <typename ScalingMatrixType, typename RotationMatrixType>
581
+ EIGEN_DEVICE_FUNC void computeScalingRotation(ScalingMatrixType* scaling, RotationMatrixType* rotation) const;
612
582
 
613
- template<typename PositionDerived, typename OrientationType, typename ScaleDerived>
614
- EIGEN_DEVICE_FUNC
615
- Transform& fromPositionOrientationScale(const MatrixBase<PositionDerived> &position,
616
- const OrientationType& orientation, const MatrixBase<ScaleDerived> &scale);
583
+ template <typename PositionDerived, typename OrientationType, typename ScaleDerived>
584
+ EIGEN_DEVICE_FUNC Transform& fromPositionOrientationScale(const MatrixBase<PositionDerived>& position,
585
+ const OrientationType& orientation,
586
+ const MatrixBase<ScaleDerived>& scale);
617
587
 
618
- EIGEN_DEVICE_FUNC
619
- inline Transform inverse(TransformTraits traits = (TransformTraits)Mode) const;
588
+ EIGEN_DEVICE_FUNC inline Transform inverse(TransformTraits traits = (TransformTraits)Mode) const;
620
589
 
621
590
  /** \returns a const pointer to the column major internal matrix */
622
- EIGEN_DEVICE_FUNC const Scalar* data() const { return m_matrix.data(); }
591
+ EIGEN_DEVICE_FUNC constexpr const Scalar* data() const { return m_matrix.data(); }
623
592
  /** \returns a non-const pointer to the column major internal matrix */
624
- EIGEN_DEVICE_FUNC Scalar* data() { return m_matrix.data(); }
593
+ EIGEN_DEVICE_FUNC constexpr Scalar* data() { return m_matrix.data(); }
625
594
 
626
595
  /** \returns \c *this with scalar type casted to \a NewScalarType
627
- *
628
- * Note that if \a NewScalarType is equal to the current scalar type of \c *this
629
- * then this function smartly returns a const reference to \c *this.
630
- */
631
- template<typename NewScalarType>
632
- EIGEN_DEVICE_FUNC inline typename internal::cast_return_type<Transform,Transform<NewScalarType,Dim,Mode,Options> >::type cast() const
633
- { return typename internal::cast_return_type<Transform,Transform<NewScalarType,Dim,Mode,Options> >::type(*this); }
596
+ *
597
+ * Note that if \a NewScalarType is equal to the current scalar type of \c *this
598
+ * then this function smartly returns a const reference to \c *this.
599
+ */
600
+ template <typename NewScalarType>
601
+ EIGEN_DEVICE_FUNC inline
602
+ typename internal::cast_return_type<Transform, Transform<NewScalarType, Dim, Mode, Options> >::type
603
+ cast() const {
604
+ return typename internal::cast_return_type<Transform, Transform<NewScalarType, Dim, Mode, Options> >::type(*this);
605
+ }
634
606
 
635
607
  /** Copy constructor with scalar type conversion */
636
- template<typename OtherScalarType>
637
- EIGEN_DEVICE_FUNC inline explicit Transform(const Transform<OtherScalarType,Dim,Mode,Options>& other)
638
- {
608
+ template <typename OtherScalarType>
609
+ EIGEN_DEVICE_FUNC inline explicit Transform(const Transform<OtherScalarType, Dim, Mode, Options>& other) {
639
610
  check_template_params();
640
611
  m_matrix = other.matrix().template cast<Scalar>();
641
612
  }
642
613
 
643
614
  /** \returns \c true if \c *this is approximately equal to \a other, within the precision
644
- * determined by \a prec.
645
- *
646
- * \sa MatrixBase::isApprox() */
647
- EIGEN_DEVICE_FUNC bool isApprox(const Transform& other, const typename NumTraits<Scalar>::Real& prec = NumTraits<Scalar>::dummy_precision()) const
648
- { return m_matrix.isApprox(other.m_matrix, prec); }
615
+ * determined by \a prec.
616
+ *
617
+ * \sa MatrixBase::isApprox() */
618
+ EIGEN_DEVICE_FUNC bool isApprox(const Transform& other, const typename NumTraits<Scalar>::Real& prec =
619
+ NumTraits<Scalar>::dummy_precision()) const {
620
+ return m_matrix.isApprox(other.m_matrix, prec);
621
+ }
649
622
 
650
623
  /** Sets the last row to [0 ... 0 1]
651
- */
652
- EIGEN_DEVICE_FUNC void makeAffine()
653
- {
654
- internal::transform_make_affine<int(Mode)>::run(m_matrix);
655
- }
624
+ */
625
+ EIGEN_DEVICE_FUNC void makeAffine() { internal::transform_make_affine<int(Mode)>::run(m_matrix); }
656
626
 
657
627
  /** \internal
658
- * \returns the Dim x Dim linear part if the transformation is affine,
659
- * and the HDim x Dim part for projective transformations.
660
- */
661
- EIGEN_DEVICE_FUNC inline Block<MatrixType,int(Mode)==int(Projective)?HDim:Dim,Dim> linearExt()
662
- { return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,Dim>(0,0); }
628
+ * \returns the Dim x Dim linear part if the transformation is affine,
629
+ * and the HDim x Dim part for projective transformations.
630
+ */
631
+ EIGEN_DEVICE_FUNC inline Block<MatrixType, int(Mode) == int(Projective) ? HDim : Dim, Dim> linearExt() {
632
+ return m_matrix.template block < int(Mode) == int(Projective) ? HDim : Dim, Dim > (0, 0);
633
+ }
663
634
  /** \internal
664
- * \returns the Dim x Dim linear part if the transformation is affine,
665
- * and the HDim x Dim part for projective transformations.
666
- */
667
- EIGEN_DEVICE_FUNC inline const Block<MatrixType,int(Mode)==int(Projective)?HDim:Dim,Dim> linearExt() const
668
- { return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,Dim>(0,0); }
635
+ * \returns the Dim x Dim linear part if the transformation is affine,
636
+ * and the HDim x Dim part for projective transformations.
637
+ */
638
+ EIGEN_DEVICE_FUNC inline const Block<MatrixType, int(Mode) == int(Projective) ? HDim : Dim, Dim> linearExt() const {
639
+ return m_matrix.template block < int(Mode) == int(Projective) ? HDim : Dim, Dim > (0, 0);
640
+ }
669
641
 
670
642
  /** \internal
671
- * \returns the translation part if the transformation is affine,
672
- * and the last column for projective transformations.
673
- */
674
- EIGEN_DEVICE_FUNC inline Block<MatrixType,int(Mode)==int(Projective)?HDim:Dim,1> translationExt()
675
- { return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,1>(0,Dim); }
643
+ * \returns the translation part if the transformation is affine,
644
+ * and the last column for projective transformations.
645
+ */
646
+ EIGEN_DEVICE_FUNC inline Block<MatrixType, int(Mode) == int(Projective) ? HDim : Dim, 1> translationExt() {
647
+ return m_matrix.template block < int(Mode) == int(Projective) ? HDim : Dim, 1 > (0, Dim);
648
+ }
676
649
  /** \internal
677
- * \returns the translation part if the transformation is affine,
678
- * and the last column for projective transformations.
679
- */
680
- EIGEN_DEVICE_FUNC inline const Block<MatrixType,int(Mode)==int(Projective)?HDim:Dim,1> translationExt() const
681
- { return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,1>(0,Dim); }
682
-
683
-
684
- #ifdef EIGEN_TRANSFORM_PLUGIN
685
- #include EIGEN_TRANSFORM_PLUGIN
686
- #endif
687
-
688
- protected:
689
- #ifndef EIGEN_PARSED_BY_DOXYGEN
690
- EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void check_template_params()
691
- {
692
- EIGEN_STATIC_ASSERT((Options & (DontAlign|RowMajor)) == Options, INVALID_MATRIX_TEMPLATE_PARAMETERS)
693
- }
694
- #endif
650
+ * \returns the translation part if the transformation is affine,
651
+ * and the last column for projective transformations.
652
+ */
653
+ EIGEN_DEVICE_FUNC inline const Block<MatrixType, int(Mode) == int(Projective) ? HDim : Dim, 1> translationExt()
654
+ const {
655
+ return m_matrix.template block < int(Mode) == int(Projective) ? HDim : Dim, 1 > (0, Dim);
656
+ }
695
657
 
658
+ #ifdef EIGEN_TRANSFORM_PLUGIN
659
+ #include EIGEN_TRANSFORM_PLUGIN
660
+ #endif
661
+
662
+ protected:
663
+ #ifndef EIGEN_PARSED_BY_DOXYGEN
664
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void check_template_params() {
665
+ EIGEN_STATIC_ASSERT((Options & (DontAlign | RowMajor)) == Options, INVALID_MATRIX_TEMPLATE_PARAMETERS)
666
+ }
667
+ #endif
696
668
  };
697
669
 
698
670
  /** \ingroup Geometry_Module */
699
- typedef Transform<float,2,Isometry> Isometry2f;
671
+ typedef Transform<float, 2, Isometry> Isometry2f;
700
672
  /** \ingroup Geometry_Module */
701
- typedef Transform<float,3,Isometry> Isometry3f;
673
+ typedef Transform<float, 3, Isometry> Isometry3f;
702
674
  /** \ingroup Geometry_Module */
703
- typedef Transform<double,2,Isometry> Isometry2d;
675
+ typedef Transform<double, 2, Isometry> Isometry2d;
704
676
  /** \ingroup Geometry_Module */
705
- typedef Transform<double,3,Isometry> Isometry3d;
677
+ typedef Transform<double, 3, Isometry> Isometry3d;
706
678
 
707
679
  /** \ingroup Geometry_Module */
708
- typedef Transform<float,2,Affine> Affine2f;
680
+ typedef Transform<float, 2, Affine> Affine2f;
709
681
  /** \ingroup Geometry_Module */
710
- typedef Transform<float,3,Affine> Affine3f;
682
+ typedef Transform<float, 3, Affine> Affine3f;
711
683
  /** \ingroup Geometry_Module */
712
- typedef Transform<double,2,Affine> Affine2d;
684
+ typedef Transform<double, 2, Affine> Affine2d;
713
685
  /** \ingroup Geometry_Module */
714
- typedef Transform<double,3,Affine> Affine3d;
686
+ typedef Transform<double, 3, Affine> Affine3d;
715
687
 
716
688
  /** \ingroup Geometry_Module */
717
- typedef Transform<float,2,AffineCompact> AffineCompact2f;
689
+ typedef Transform<float, 2, AffineCompact> AffineCompact2f;
718
690
  /** \ingroup Geometry_Module */
719
- typedef Transform<float,3,AffineCompact> AffineCompact3f;
691
+ typedef Transform<float, 3, AffineCompact> AffineCompact3f;
720
692
  /** \ingroup Geometry_Module */
721
- typedef Transform<double,2,AffineCompact> AffineCompact2d;
693
+ typedef Transform<double, 2, AffineCompact> AffineCompact2d;
722
694
  /** \ingroup Geometry_Module */
723
- typedef Transform<double,3,AffineCompact> AffineCompact3d;
695
+ typedef Transform<double, 3, AffineCompact> AffineCompact3d;
724
696
 
725
697
  /** \ingroup Geometry_Module */
726
- typedef Transform<float,2,Projective> Projective2f;
698
+ typedef Transform<float, 2, Projective> Projective2f;
727
699
  /** \ingroup Geometry_Module */
728
- typedef Transform<float,3,Projective> Projective3f;
700
+ typedef Transform<float, 3, Projective> Projective3f;
729
701
  /** \ingroup Geometry_Module */
730
- typedef Transform<double,2,Projective> Projective2d;
702
+ typedef Transform<double, 2, Projective> Projective2d;
731
703
  /** \ingroup Geometry_Module */
732
- typedef Transform<double,3,Projective> Projective3d;
704
+ typedef Transform<double, 3, Projective> Projective3d;
733
705
 
734
706
  /**************************
735
707
  *** Optional QT support ***
736
708
  **************************/
737
709
 
738
710
  #ifdef EIGEN_QT_SUPPORT
711
+
712
+ #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
739
713
  /** Initializes \c *this from a QMatrix assuming the dimension is 2.
740
- *
741
- * This function is available only if the token EIGEN_QT_SUPPORT is defined.
742
- */
743
- template<typename Scalar, int Dim, int Mode,int Options>
744
- Transform<Scalar,Dim,Mode,Options>::Transform(const QMatrix& other)
745
- {
714
+ *
715
+ * This function is available only if the token EIGEN_QT_SUPPORT is defined.
716
+ */
717
+ template <typename Scalar, int Dim, int Mode, int Options>
718
+ Transform<Scalar, Dim, Mode, Options>::Transform(const QMatrix& other) {
746
719
  check_template_params();
747
720
  *this = other;
748
721
  }
749
722
 
750
723
  /** Set \c *this from a QMatrix assuming the dimension is 2.
751
- *
752
- * This function is available only if the token EIGEN_QT_SUPPORT is defined.
753
- */
754
- template<typename Scalar, int Dim, int Mode,int Options>
755
- Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::operator=(const QMatrix& other)
756
- {
757
- EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
758
- if (Mode == int(AffineCompact))
759
- m_matrix << other.m11(), other.m21(), other.dx(),
760
- other.m12(), other.m22(), other.dy();
724
+ *
725
+ * This function is available only if the token EIGEN_QT_SUPPORT is defined.
726
+ */
727
+ template <typename Scalar, int Dim, int Mode, int Options>
728
+ Transform<Scalar, Dim, Mode, Options>& Transform<Scalar, Dim, Mode, Options>::operator=(const QMatrix& other) {
729
+ EIGEN_STATIC_ASSERT(Dim == 2, YOU_MADE_A_PROGRAMMING_MISTAKE)
730
+ if (EIGEN_CONST_CONDITIONAL(Mode == int(AffineCompact)))
731
+ m_matrix << other.m11(), other.m21(), other.dx(), other.m12(), other.m22(), other.dy();
761
732
  else
762
- m_matrix << other.m11(), other.m21(), other.dx(),
763
- other.m12(), other.m22(), other.dy(),
764
- 0, 0, 1;
733
+ m_matrix << other.m11(), other.m21(), other.dx(), other.m12(), other.m22(), other.dy(), 0, 0, 1;
765
734
  return *this;
766
735
  }
767
736
 
768
737
  /** \returns a QMatrix from \c *this assuming the dimension is 2.
769
- *
770
- * \warning this conversion might loss data if \c *this is not affine
771
- *
772
- * This function is available only if the token EIGEN_QT_SUPPORT is defined.
773
- */
774
- template<typename Scalar, int Dim, int Mode, int Options>
775
- QMatrix Transform<Scalar,Dim,Mode,Options>::toQMatrix(void) const
776
- {
738
+ *
739
+ * \warning this conversion might loss data if \c *this is not affine
740
+ *
741
+ * This function is available only if the token EIGEN_QT_SUPPORT is defined.
742
+ */
743
+ template <typename Scalar, int Dim, int Mode, int Options>
744
+ QMatrix Transform<Scalar, Dim, Mode, Options>::toQMatrix(void) const {
777
745
  check_template_params();
778
- EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
779
- return QMatrix(m_matrix.coeff(0,0), m_matrix.coeff(1,0),
780
- m_matrix.coeff(0,1), m_matrix.coeff(1,1),
781
- m_matrix.coeff(0,2), m_matrix.coeff(1,2));
746
+ EIGEN_STATIC_ASSERT(Dim == 2, YOU_MADE_A_PROGRAMMING_MISTAKE)
747
+ return QMatrix(m_matrix.coeff(0, 0), m_matrix.coeff(1, 0), m_matrix.coeff(0, 1), m_matrix.coeff(1, 1),
748
+ m_matrix.coeff(0, 2), m_matrix.coeff(1, 2));
782
749
  }
750
+ #endif
783
751
 
784
752
  /** Initializes \c *this from a QTransform assuming the dimension is 2.
785
- *
786
- * This function is available only if the token EIGEN_QT_SUPPORT is defined.
787
- */
788
- template<typename Scalar, int Dim, int Mode,int Options>
789
- Transform<Scalar,Dim,Mode,Options>::Transform(const QTransform& other)
790
- {
753
+ *
754
+ * This function is available only if the token EIGEN_QT_SUPPORT is defined.
755
+ */
756
+ template <typename Scalar, int Dim, int Mode, int Options>
757
+ Transform<Scalar, Dim, Mode, Options>::Transform(const QTransform& other) {
791
758
  check_template_params();
792
759
  *this = other;
793
760
  }
794
761
 
795
762
  /** Set \c *this from a QTransform assuming the dimension is 2.
796
- *
797
- * This function is available only if the token EIGEN_QT_SUPPORT is defined.
798
- */
799
- template<typename Scalar, int Dim, int Mode, int Options>
800
- Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::operator=(const QTransform& other)
801
- {
763
+ *
764
+ * This function is available only if the token EIGEN_QT_SUPPORT is defined.
765
+ */
766
+ template <typename Scalar, int Dim, int Mode, int Options>
767
+ Transform<Scalar, Dim, Mode, Options>& Transform<Scalar, Dim, Mode, Options>::operator=(const QTransform& other) {
802
768
  check_template_params();
803
- EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
804
- if (Mode == int(AffineCompact))
805
- m_matrix << other.m11(), other.m21(), other.dx(),
806
- other.m12(), other.m22(), other.dy();
769
+ EIGEN_STATIC_ASSERT(Dim == 2, YOU_MADE_A_PROGRAMMING_MISTAKE)
770
+ if (EIGEN_CONST_CONDITIONAL(Mode == int(AffineCompact)))
771
+ m_matrix << other.m11(), other.m21(), other.dx(), other.m12(), other.m22(), other.dy();
807
772
  else
808
- m_matrix << other.m11(), other.m21(), other.dx(),
809
- other.m12(), other.m22(), other.dy(),
810
- other.m13(), other.m23(), other.m33();
773
+ m_matrix << other.m11(), other.m21(), other.dx(), other.m12(), other.m22(), other.dy(), other.m13(), other.m23(),
774
+ other.m33();
811
775
  return *this;
812
776
  }
813
777
 
814
778
  /** \returns a QTransform from \c *this assuming the dimension is 2.
815
- *
816
- * This function is available only if the token EIGEN_QT_SUPPORT is defined.
817
- */
818
- template<typename Scalar, int Dim, int Mode, int Options>
819
- QTransform Transform<Scalar,Dim,Mode,Options>::toQTransform(void) const
820
- {
821
- EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
822
- if (Mode == int(AffineCompact))
823
- return QTransform(m_matrix.coeff(0,0), m_matrix.coeff(1,0),
824
- m_matrix.coeff(0,1), m_matrix.coeff(1,1),
825
- m_matrix.coeff(0,2), m_matrix.coeff(1,2));
779
+ *
780
+ * This function is available only if the token EIGEN_QT_SUPPORT is defined.
781
+ */
782
+ template <typename Scalar, int Dim, int Mode, int Options>
783
+ QTransform Transform<Scalar, Dim, Mode, Options>::toQTransform(void) const {
784
+ EIGEN_STATIC_ASSERT(Dim == 2, YOU_MADE_A_PROGRAMMING_MISTAKE)
785
+ if (EIGEN_CONST_CONDITIONAL(Mode == int(AffineCompact)))
786
+ return QTransform(m_matrix.coeff(0, 0), m_matrix.coeff(1, 0), m_matrix.coeff(0, 1), m_matrix.coeff(1, 1),
787
+ m_matrix.coeff(0, 2), m_matrix.coeff(1, 2));
826
788
  else
827
- return QTransform(m_matrix.coeff(0,0), m_matrix.coeff(1,0), m_matrix.coeff(2,0),
828
- m_matrix.coeff(0,1), m_matrix.coeff(1,1), m_matrix.coeff(2,1),
829
- m_matrix.coeff(0,2), m_matrix.coeff(1,2), m_matrix.coeff(2,2));
789
+ return QTransform(m_matrix.coeff(0, 0), m_matrix.coeff(1, 0), m_matrix.coeff(2, 0), m_matrix.coeff(0, 1),
790
+ m_matrix.coeff(1, 1), m_matrix.coeff(2, 1), m_matrix.coeff(0, 2), m_matrix.coeff(1, 2),
791
+ m_matrix.coeff(2, 2));
830
792
  }
831
793
  #endif
832
794
 
@@ -835,84 +797,80 @@ QTransform Transform<Scalar,Dim,Mode,Options>::toQTransform(void) const
835
797
  *********************/
836
798
 
837
799
  /** Applies on the right the non uniform scale transformation represented
838
- * by the vector \a other to \c *this and returns a reference to \c *this.
839
- * \sa prescale()
840
- */
841
- template<typename Scalar, int Dim, int Mode, int Options>
842
- template<typename OtherDerived>
843
- EIGEN_DEVICE_FUNC Transform<Scalar,Dim,Mode,Options>&
844
- Transform<Scalar,Dim,Mode,Options>::scale(const MatrixBase<OtherDerived> &other)
845
- {
846
- EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
847
- EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
800
+ * by the vector \a other to \c *this and returns a reference to \c *this.
801
+ * \sa prescale()
802
+ */
803
+ template <typename Scalar, int Dim, int Mode, int Options>
804
+ template <typename OtherDerived>
805
+ EIGEN_DEVICE_FUNC Transform<Scalar, Dim, Mode, Options>& Transform<Scalar, Dim, Mode, Options>::scale(
806
+ const MatrixBase<OtherDerived>& other) {
807
+ EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived, int(Dim))
808
+ EIGEN_STATIC_ASSERT(Mode != int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
848
809
  linearExt().noalias() = (linearExt() * other.asDiagonal());
849
810
  return *this;
850
811
  }
851
812
 
852
813
  /** Applies on the right a uniform scale of a factor \a c to \c *this
853
- * and returns a reference to \c *this.
854
- * \sa prescale(Scalar)
855
- */
856
- template<typename Scalar, int Dim, int Mode, int Options>
857
- EIGEN_DEVICE_FUNC inline Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::scale(const Scalar& s)
858
- {
859
- EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
814
+ * and returns a reference to \c *this.
815
+ * \sa prescale(Scalar)
816
+ */
817
+ template <typename Scalar, int Dim, int Mode, int Options>
818
+ EIGEN_DEVICE_FUNC inline Transform<Scalar, Dim, Mode, Options>& Transform<Scalar, Dim, Mode, Options>::scale(
819
+ const Scalar& s) {
820
+ EIGEN_STATIC_ASSERT(Mode != int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
860
821
  linearExt() *= s;
861
822
  return *this;
862
823
  }
863
824
 
864
825
  /** Applies on the left the non uniform scale transformation represented
865
- * by the vector \a other to \c *this and returns a reference to \c *this.
866
- * \sa scale()
867
- */
868
- template<typename Scalar, int Dim, int Mode, int Options>
869
- template<typename OtherDerived>
870
- EIGEN_DEVICE_FUNC Transform<Scalar,Dim,Mode,Options>&
871
- Transform<Scalar,Dim,Mode,Options>::prescale(const MatrixBase<OtherDerived> &other)
872
- {
873
- EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
874
- EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
826
+ * by the vector \a other to \c *this and returns a reference to \c *this.
827
+ * \sa scale()
828
+ */
829
+ template <typename Scalar, int Dim, int Mode, int Options>
830
+ template <typename OtherDerived>
831
+ EIGEN_DEVICE_FUNC Transform<Scalar, Dim, Mode, Options>& Transform<Scalar, Dim, Mode, Options>::prescale(
832
+ const MatrixBase<OtherDerived>& other) {
833
+ EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived, int(Dim))
834
+ EIGEN_STATIC_ASSERT(Mode != int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
875
835
  affine().noalias() = (other.asDiagonal() * affine());
876
836
  return *this;
877
837
  }
878
838
 
879
839
  /** Applies on the left a uniform scale of a factor \a c to \c *this
880
- * and returns a reference to \c *this.
881
- * \sa scale(Scalar)
882
- */
883
- template<typename Scalar, int Dim, int Mode, int Options>
884
- EIGEN_DEVICE_FUNC inline Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::prescale(const Scalar& s)
885
- {
886
- EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
840
+ * and returns a reference to \c *this.
841
+ * \sa scale(Scalar)
842
+ */
843
+ template <typename Scalar, int Dim, int Mode, int Options>
844
+ EIGEN_DEVICE_FUNC inline Transform<Scalar, Dim, Mode, Options>& Transform<Scalar, Dim, Mode, Options>::prescale(
845
+ const Scalar& s) {
846
+ EIGEN_STATIC_ASSERT(Mode != int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
887
847
  m_matrix.template topRows<Dim>() *= s;
888
848
  return *this;
889
849
  }
890
850
 
891
851
  /** Applies on the right the translation matrix represented by the vector \a other
892
- * to \c *this and returns a reference to \c *this.
893
- * \sa pretranslate()
894
- */
895
- template<typename Scalar, int Dim, int Mode, int Options>
896
- template<typename OtherDerived>
897
- EIGEN_DEVICE_FUNC Transform<Scalar,Dim,Mode,Options>&
898
- Transform<Scalar,Dim,Mode,Options>::translate(const MatrixBase<OtherDerived> &other)
899
- {
900
- EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
852
+ * to \c *this and returns a reference to \c *this.
853
+ * \sa pretranslate()
854
+ */
855
+ template <typename Scalar, int Dim, int Mode, int Options>
856
+ template <typename OtherDerived>
857
+ EIGEN_DEVICE_FUNC Transform<Scalar, Dim, Mode, Options>& Transform<Scalar, Dim, Mode, Options>::translate(
858
+ const MatrixBase<OtherDerived>& other) {
859
+ EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived, int(Dim))
901
860
  translationExt() += linearExt() * other;
902
861
  return *this;
903
862
  }
904
863
 
905
864
  /** Applies on the left the translation matrix represented by the vector \a other
906
- * to \c *this and returns a reference to \c *this.
907
- * \sa translate()
908
- */
909
- template<typename Scalar, int Dim, int Mode, int Options>
910
- template<typename OtherDerived>
911
- EIGEN_DEVICE_FUNC Transform<Scalar,Dim,Mode,Options>&
912
- Transform<Scalar,Dim,Mode,Options>::pretranslate(const MatrixBase<OtherDerived> &other)
913
- {
914
- EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
915
- if(int(Mode)==int(Projective))
865
+ * to \c *this and returns a reference to \c *this.
866
+ * \sa translate()
867
+ */
868
+ template <typename Scalar, int Dim, int Mode, int Options>
869
+ template <typename OtherDerived>
870
+ EIGEN_DEVICE_FUNC Transform<Scalar, Dim, Mode, Options>& Transform<Scalar, Dim, Mode, Options>::pretranslate(
871
+ const MatrixBase<OtherDerived>& other) {
872
+ EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived, int(Dim))
873
+ if (EIGEN_CONST_CONDITIONAL(int(Mode) == int(Projective)))
916
874
  affine() += other * m_matrix.row(Dim);
917
875
  else
918
876
  translation() += other;
@@ -920,76 +878,73 @@ Transform<Scalar,Dim,Mode,Options>::pretranslate(const MatrixBase<OtherDerived>
920
878
  }
921
879
 
922
880
  /** Applies on the right the rotation represented by the rotation \a rotation
923
- * to \c *this and returns a reference to \c *this.
924
- *
925
- * The template parameter \a RotationType is the type of the rotation which
926
- * must be known by internal::toRotationMatrix<>.
927
- *
928
- * Natively supported types includes:
929
- * - any scalar (2D),
930
- * - a Dim x Dim matrix expression,
931
- * - a Quaternion (3D),
932
- * - a AngleAxis (3D)
933
- *
934
- * This mechanism is easily extendable to support user types such as Euler angles,
935
- * or a pair of Quaternion for 4D rotations.
936
- *
937
- * \sa rotate(Scalar), class Quaternion, class AngleAxis, prerotate(RotationType)
938
- */
939
- template<typename Scalar, int Dim, int Mode, int Options>
940
- template<typename RotationType>
941
- EIGEN_DEVICE_FUNC Transform<Scalar,Dim,Mode,Options>&
942
- Transform<Scalar,Dim,Mode,Options>::rotate(const RotationType& rotation)
943
- {
944
- linearExt() *= internal::toRotationMatrix<Scalar,Dim>(rotation);
881
+ * to \c *this and returns a reference to \c *this.
882
+ *
883
+ * The template parameter \a RotationType is the type of the rotation which
884
+ * must be known by internal::toRotationMatrix<>.
885
+ *
886
+ * Natively supported types includes:
887
+ * - any scalar (2D),
888
+ * - a Dim x Dim matrix expression,
889
+ * - a Quaternion (3D),
890
+ * - a AngleAxis (3D)
891
+ *
892
+ * This mechanism is easily extendable to support user types such as Euler angles,
893
+ * or a pair of Quaternion for 4D rotations.
894
+ *
895
+ * \sa rotate(Scalar), class Quaternion, class AngleAxis, prerotate(RotationType)
896
+ */
897
+ template <typename Scalar, int Dim, int Mode, int Options>
898
+ template <typename RotationType>
899
+ EIGEN_DEVICE_FUNC Transform<Scalar, Dim, Mode, Options>& Transform<Scalar, Dim, Mode, Options>::rotate(
900
+ const RotationType& rotation) {
901
+ linearExt() *= internal::toRotationMatrix<Scalar, Dim>(rotation);
945
902
  return *this;
946
903
  }
947
904
 
948
905
  /** Applies on the left the rotation represented by the rotation \a rotation
949
- * to \c *this and returns a reference to \c *this.
950
- *
951
- * See rotate() for further details.
952
- *
953
- * \sa rotate()
954
- */
955
- template<typename Scalar, int Dim, int Mode, int Options>
956
- template<typename RotationType>
957
- EIGEN_DEVICE_FUNC Transform<Scalar,Dim,Mode,Options>&
958
- Transform<Scalar,Dim,Mode,Options>::prerotate(const RotationType& rotation)
959
- {
960
- m_matrix.template block<Dim,HDim>(0,0) = internal::toRotationMatrix<Scalar,Dim>(rotation)
961
- * m_matrix.template block<Dim,HDim>(0,0);
906
+ * to \c *this and returns a reference to \c *this.
907
+ *
908
+ * See rotate() for further details.
909
+ *
910
+ * \sa rotate()
911
+ */
912
+ template <typename Scalar, int Dim, int Mode, int Options>
913
+ template <typename RotationType>
914
+ EIGEN_DEVICE_FUNC Transform<Scalar, Dim, Mode, Options>& Transform<Scalar, Dim, Mode, Options>::prerotate(
915
+ const RotationType& rotation) {
916
+ m_matrix.template block<Dim, HDim>(0, 0) =
917
+ internal::toRotationMatrix<Scalar, Dim>(rotation) * m_matrix.template block<Dim, HDim>(0, 0);
962
918
  return *this;
963
919
  }
964
920
 
965
921
  /** Applies on the right the shear transformation represented
966
- * by the vector \a other to \c *this and returns a reference to \c *this.
967
- * \warning 2D only.
968
- * \sa preshear()
969
- */
970
- template<typename Scalar, int Dim, int Mode, int Options>
971
- EIGEN_DEVICE_FUNC Transform<Scalar,Dim,Mode,Options>&
972
- Transform<Scalar,Dim,Mode,Options>::shear(const Scalar& sx, const Scalar& sy)
973
- {
974
- EIGEN_STATIC_ASSERT(int(Dim)==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
975
- EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
976
- VectorType tmp = linear().col(0)*sy + linear().col(1);
977
- linear() << linear().col(0) + linear().col(1)*sx, tmp;
922
+ * by the vector \a other to \c *this and returns a reference to \c *this.
923
+ * \warning 2D only.
924
+ * \sa preshear()
925
+ */
926
+ template <typename Scalar, int Dim, int Mode, int Options>
927
+ EIGEN_DEVICE_FUNC Transform<Scalar, Dim, Mode, Options>& Transform<Scalar, Dim, Mode, Options>::shear(
928
+ const Scalar& sx, const Scalar& sy) {
929
+ EIGEN_STATIC_ASSERT(int(Dim) == 2, YOU_MADE_A_PROGRAMMING_MISTAKE)
930
+ EIGEN_STATIC_ASSERT(Mode != int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
931
+ VectorType tmp = linear().col(0) * sy + linear().col(1);
932
+ linear() << linear().col(0) + linear().col(1) * sx, tmp;
978
933
  return *this;
979
934
  }
980
935
 
981
936
  /** Applies on the left the shear transformation represented
982
- * by the vector \a other to \c *this and returns a reference to \c *this.
983
- * \warning 2D only.
984
- * \sa shear()
985
- */
986
- template<typename Scalar, int Dim, int Mode, int Options>
987
- EIGEN_DEVICE_FUNC Transform<Scalar,Dim,Mode,Options>&
988
- Transform<Scalar,Dim,Mode,Options>::preshear(const Scalar& sx, const Scalar& sy)
989
- {
990
- EIGEN_STATIC_ASSERT(int(Dim)==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
991
- EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
992
- m_matrix.template block<Dim,HDim>(0,0) = LinearMatrixType(1, sx, sy, 1) * m_matrix.template block<Dim,HDim>(0,0);
937
+ * by the vector \a other to \c *this and returns a reference to \c *this.
938
+ * \warning 2D only.
939
+ * \sa shear()
940
+ */
941
+ template <typename Scalar, int Dim, int Mode, int Options>
942
+ EIGEN_DEVICE_FUNC Transform<Scalar, Dim, Mode, Options>& Transform<Scalar, Dim, Mode, Options>::preshear(
943
+ const Scalar& sx, const Scalar& sy) {
944
+ EIGEN_STATIC_ASSERT(int(Dim) == 2, YOU_MADE_A_PROGRAMMING_MISTAKE)
945
+ EIGEN_STATIC_ASSERT(Mode != int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
946
+ m_matrix.template block<Dim, HDim>(0, 0) =
947
+ LinearMatrixType({{1, sy}, {sx, 1}}) * m_matrix.template block<Dim, HDim>(0, 0);
993
948
  return *this;
994
949
  }
995
950
 
@@ -997,46 +952,46 @@ Transform<Scalar,Dim,Mode,Options>::preshear(const Scalar& sx, const Scalar& sy)
997
952
  *** Scaling, Translation and Rotation compatibility ***
998
953
  ******************************************************/
999
954
 
1000
- template<typename Scalar, int Dim, int Mode, int Options>
1001
- EIGEN_DEVICE_FUNC inline Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::operator=(const TranslationType& t)
1002
- {
955
+ template <typename Scalar, int Dim, int Mode, int Options>
956
+ EIGEN_DEVICE_FUNC inline Transform<Scalar, Dim, Mode, Options>& Transform<Scalar, Dim, Mode, Options>::operator=(
957
+ const TranslationType& t) {
1003
958
  linear().setIdentity();
1004
959
  translation() = t.vector();
1005
960
  makeAffine();
1006
961
  return *this;
1007
962
  }
1008
963
 
1009
- template<typename Scalar, int Dim, int Mode, int Options>
1010
- EIGEN_DEVICE_FUNC inline Transform<Scalar,Dim,Mode,Options> Transform<Scalar,Dim,Mode,Options>::operator*(const TranslationType& t) const
1011
- {
964
+ template <typename Scalar, int Dim, int Mode, int Options>
965
+ EIGEN_DEVICE_FUNC inline Transform<Scalar, Dim, Mode, Options> Transform<Scalar, Dim, Mode, Options>::operator*(
966
+ const TranslationType& t) const {
1012
967
  Transform res = *this;
1013
968
  res.translate(t.vector());
1014
969
  return res;
1015
970
  }
1016
971
 
1017
- template<typename Scalar, int Dim, int Mode, int Options>
1018
- EIGEN_DEVICE_FUNC inline Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::operator=(const UniformScaling<Scalar>& s)
1019
- {
972
+ template <typename Scalar, int Dim, int Mode, int Options>
973
+ EIGEN_DEVICE_FUNC inline Transform<Scalar, Dim, Mode, Options>& Transform<Scalar, Dim, Mode, Options>::operator=(
974
+ const UniformScaling<Scalar>& s) {
1020
975
  m_matrix.setZero();
1021
976
  linear().diagonal().fill(s.factor());
1022
977
  makeAffine();
1023
978
  return *this;
1024
979
  }
1025
980
 
1026
- template<typename Scalar, int Dim, int Mode, int Options>
1027
- template<typename Derived>
1028
- EIGEN_DEVICE_FUNC inline Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::operator=(const RotationBase<Derived,Dim>& r)
1029
- {
1030
- linear() = internal::toRotationMatrix<Scalar,Dim>(r);
981
+ template <typename Scalar, int Dim, int Mode, int Options>
982
+ template <typename Derived>
983
+ EIGEN_DEVICE_FUNC inline Transform<Scalar, Dim, Mode, Options>& Transform<Scalar, Dim, Mode, Options>::operator=(
984
+ const RotationBase<Derived, Dim>& r) {
985
+ linear() = internal::toRotationMatrix<Scalar, Dim>(r);
1031
986
  translation().setZero();
1032
987
  makeAffine();
1033
988
  return *this;
1034
989
  }
1035
990
 
1036
- template<typename Scalar, int Dim, int Mode, int Options>
1037
- template<typename Derived>
1038
- EIGEN_DEVICE_FUNC inline Transform<Scalar,Dim,Mode,Options> Transform<Scalar,Dim,Mode,Options>::operator*(const RotationBase<Derived,Dim>& r) const
1039
- {
991
+ template <typename Scalar, int Dim, int Mode, int Options>
992
+ template <typename Derived>
993
+ EIGEN_DEVICE_FUNC inline Transform<Scalar, Dim, Mode, Options> Transform<Scalar, Dim, Mode, Options>::operator*(
994
+ const RotationBase<Derived, Dim>& r) const {
1040
995
  Transform res = *this;
1041
996
  res.rotate(r.derived());
1042
997
  return res;
@@ -1046,91 +1001,113 @@ EIGEN_DEVICE_FUNC inline Transform<Scalar,Dim,Mode,Options> Transform<Scalar,Dim
1046
1001
  *** Special functions ***
1047
1002
  ************************/
1048
1003
 
1004
+ namespace internal {
1005
+ template <int Mode>
1006
+ struct transform_rotation_impl {
1007
+ template <typename TransformType>
1008
+ EIGEN_DEVICE_FUNC static inline const typename TransformType::LinearMatrixType run(const TransformType& t) {
1009
+ typedef typename TransformType::LinearMatrixType LinearMatrixType;
1010
+ LinearMatrixType result;
1011
+ t.computeRotationScaling(&result, (LinearMatrixType*)0);
1012
+ return result;
1013
+ }
1014
+ };
1015
+ template <>
1016
+ struct transform_rotation_impl<Isometry> {
1017
+ template <typename TransformType>
1018
+ EIGEN_DEVICE_FUNC static inline typename TransformType::ConstLinearPart run(const TransformType& t) {
1019
+ return t.linear();
1020
+ }
1021
+ };
1022
+ } // namespace internal
1049
1023
  /** \returns the rotation part of the transformation
1050
- *
1051
- *
1052
- * \svd_module
1053
- *
1054
- * \sa computeRotationScaling(), computeScalingRotation(), class SVD
1055
- */
1056
- template<typename Scalar, int Dim, int Mode, int Options>
1057
- EIGEN_DEVICE_FUNC const typename Transform<Scalar,Dim,Mode,Options>::LinearMatrixType
1058
- Transform<Scalar,Dim,Mode,Options>::rotation() const
1059
- {
1060
- LinearMatrixType result;
1061
- computeRotationScaling(&result, (LinearMatrixType*)0);
1062
- return result;
1024
+ *
1025
+ * If Mode==Isometry, then this method is an alias for linear(),
1026
+ * otherwise it calls computeRotationScaling() to extract the rotation
1027
+ * through a SVD decomposition.
1028
+ *
1029
+ * \svd_module
1030
+ *
1031
+ * \sa computeRotationScaling(), computeScalingRotation(), class SVD
1032
+ */
1033
+ template <typename Scalar, int Dim, int Mode, int Options>
1034
+ EIGEN_DEVICE_FUNC typename Transform<Scalar, Dim, Mode, Options>::RotationReturnType
1035
+ Transform<Scalar, Dim, Mode, Options>::rotation() const {
1036
+ return internal::transform_rotation_impl<Mode>::run(*this);
1063
1037
  }
1064
1038
 
1065
-
1066
1039
  /** decomposes the linear part of the transformation as a product rotation x scaling, the scaling being
1067
- * not necessarily positive.
1068
- *
1069
- * If either pointer is zero, the corresponding computation is skipped.
1070
- *
1071
- *
1072
- *
1073
- * \svd_module
1074
- *
1075
- * \sa computeScalingRotation(), rotation(), class SVD
1076
- */
1077
- template<typename Scalar, int Dim, int Mode, int Options>
1078
- template<typename RotationMatrixType, typename ScalingMatrixType>
1079
- EIGEN_DEVICE_FUNC void Transform<Scalar,Dim,Mode,Options>::computeRotationScaling(RotationMatrixType *rotation, ScalingMatrixType *scaling) const
1080
- {
1081
- JacobiSVD<LinearMatrixType> svd(linear(), ComputeFullU | ComputeFullV);
1082
-
1083
- Scalar x = (svd.matrixU() * svd.matrixV().adjoint()).determinant(); // so x has absolute value 1
1040
+ * not necessarily positive.
1041
+ *
1042
+ * If either pointer is zero, the corresponding computation is skipped.
1043
+ *
1044
+ *
1045
+ *
1046
+ * \svd_module
1047
+ *
1048
+ * \sa computeScalingRotation(), rotation(), class SVD
1049
+ */
1050
+ template <typename Scalar, int Dim, int Mode, int Options>
1051
+ template <typename RotationMatrixType, typename ScalingMatrixType>
1052
+ EIGEN_DEVICE_FUNC void Transform<Scalar, Dim, Mode, Options>::computeRotationScaling(RotationMatrixType* rotation,
1053
+ ScalingMatrixType* scaling) const {
1054
+ // Note that JacobiSVD is faster than BDCSVD for small matrices.
1055
+ JacobiSVD<LinearMatrixType, ComputeFullU | ComputeFullV> svd(linear());
1056
+
1057
+ Scalar x = (svd.matrixU() * svd.matrixV().adjoint()).determinant() < Scalar(0)
1058
+ ? Scalar(-1)
1059
+ : Scalar(1); // so x has absolute value 1
1084
1060
  VectorType sv(svd.singularValues());
1085
- sv.coeffRef(0) *= x;
1086
- if(scaling) scaling->lazyAssign(svd.matrixV() * sv.asDiagonal() * svd.matrixV().adjoint());
1087
- if(rotation)
1088
- {
1061
+ sv.coeffRef(Dim - 1) *= x;
1062
+ if (scaling) (*scaling).noalias() = svd.matrixV() * sv.asDiagonal() * svd.matrixV().adjoint();
1063
+ if (rotation) {
1089
1064
  LinearMatrixType m(svd.matrixU());
1090
- m.col(0) /= x;
1091
- rotation->lazyAssign(m * svd.matrixV().adjoint());
1065
+ m.col(Dim - 1) *= x;
1066
+ (*rotation).noalias() = m * svd.matrixV().adjoint();
1092
1067
  }
1093
1068
  }
1094
1069
 
1095
1070
  /** decomposes the linear part of the transformation as a product scaling x rotation, the scaling being
1096
- * not necessarily positive.
1097
- *
1098
- * If either pointer is zero, the corresponding computation is skipped.
1099
- *
1100
- *
1101
- *
1102
- * \svd_module
1103
- *
1104
- * \sa computeRotationScaling(), rotation(), class SVD
1105
- */
1106
- template<typename Scalar, int Dim, int Mode, int Options>
1107
- template<typename ScalingMatrixType, typename RotationMatrixType>
1108
- EIGEN_DEVICE_FUNC void Transform<Scalar,Dim,Mode,Options>::computeScalingRotation(ScalingMatrixType *scaling, RotationMatrixType *rotation) const
1109
- {
1110
- JacobiSVD<LinearMatrixType> svd(linear(), ComputeFullU | ComputeFullV);
1111
-
1112
- Scalar x = (svd.matrixU() * svd.matrixV().adjoint()).determinant(); // so x has absolute value 1
1071
+ * not necessarily positive.
1072
+ *
1073
+ * If either pointer is zero, the corresponding computation is skipped.
1074
+ *
1075
+ *
1076
+ *
1077
+ * \svd_module
1078
+ *
1079
+ * \sa computeRotationScaling(), rotation(), class SVD
1080
+ */
1081
+ template <typename Scalar, int Dim, int Mode, int Options>
1082
+ template <typename ScalingMatrixType, typename RotationMatrixType>
1083
+ EIGEN_DEVICE_FUNC void Transform<Scalar, Dim, Mode, Options>::computeScalingRotation(
1084
+ ScalingMatrixType* scaling, RotationMatrixType* rotation) const {
1085
+ // Note that JacobiSVD is faster than BDCSVD for small matrices.
1086
+ JacobiSVD<LinearMatrixType, ComputeFullU | ComputeFullV> svd(linear());
1087
+
1088
+ Scalar x = (svd.matrixU() * svd.matrixV().adjoint()).determinant() < Scalar(0)
1089
+ ? Scalar(-1)
1090
+ : Scalar(1); // so x has absolute value 1
1113
1091
  VectorType sv(svd.singularValues());
1114
- sv.coeffRef(0) *= x;
1115
- if(scaling) scaling->lazyAssign(svd.matrixU() * sv.asDiagonal() * svd.matrixU().adjoint());
1116
- if(rotation)
1117
- {
1092
+ sv.coeffRef(Dim - 1) *= x;
1093
+ if (scaling) *scaling = svd.matrixU() * sv.asDiagonal() * svd.matrixU().adjoint();
1094
+ if (rotation) {
1118
1095
  LinearMatrixType m(svd.matrixU());
1119
- m.col(0) /= x;
1120
- rotation->lazyAssign(m * svd.matrixV().adjoint());
1096
+ m.col(Dim - 1) *= x;
1097
+ *rotation = m * svd.matrixV().adjoint();
1121
1098
  }
1122
1099
  }
1123
1100
 
1124
1101
  /** Convenient method to set \c *this from a position, orientation and scale
1125
- * of a 3D object.
1126
- */
1127
- template<typename Scalar, int Dim, int Mode, int Options>
1128
- template<typename PositionDerived, typename OrientationType, typename ScaleDerived>
1129
- EIGEN_DEVICE_FUNC Transform<Scalar,Dim,Mode,Options>&
1130
- Transform<Scalar,Dim,Mode,Options>::fromPositionOrientationScale(const MatrixBase<PositionDerived> &position,
1131
- const OrientationType& orientation, const MatrixBase<ScaleDerived> &scale)
1132
- {
1133
- linear() = internal::toRotationMatrix<Scalar,Dim>(orientation);
1102
+ * of a 3D object.
1103
+ */
1104
+ template <typename Scalar, int Dim, int Mode, int Options>
1105
+ template <typename PositionDerived, typename OrientationType, typename ScaleDerived>
1106
+ EIGEN_DEVICE_FUNC Transform<Scalar, Dim, Mode, Options>&
1107
+ Transform<Scalar, Dim, Mode, Options>::fromPositionOrientationScale(const MatrixBase<PositionDerived>& position,
1108
+ const OrientationType& orientation,
1109
+ const MatrixBase<ScaleDerived>& scale) {
1110
+ linear() = internal::toRotationMatrix<Scalar, Dim>(orientation);
1134
1111
  linear() *= scale.asDiagonal();
1135
1112
  translation() = position;
1136
1113
  makeAffine();
@@ -1139,91 +1116,75 @@ Transform<Scalar,Dim,Mode,Options>::fromPositionOrientationScale(const MatrixBas
1139
1116
 
1140
1117
  namespace internal {
1141
1118
 
1142
- template<int Mode>
1143
- struct transform_make_affine
1144
- {
1145
- template<typename MatrixType>
1146
- EIGEN_DEVICE_FUNC static void run(MatrixType &mat)
1147
- {
1148
- static const int Dim = MatrixType::ColsAtCompileTime-1;
1149
- mat.template block<1,Dim>(Dim,0).setZero();
1150
- mat.coeffRef(Dim,Dim) = typename MatrixType::Scalar(1);
1119
+ template <int Mode>
1120
+ struct transform_make_affine {
1121
+ template <typename MatrixType>
1122
+ EIGEN_DEVICE_FUNC static void run(MatrixType& mat) {
1123
+ static const int Dim = MatrixType::ColsAtCompileTime - 1;
1124
+ mat.template block<1, Dim>(Dim, 0).setZero();
1125
+ mat.coeffRef(Dim, Dim) = typename MatrixType::Scalar(1);
1151
1126
  }
1152
1127
  };
1153
1128
 
1154
- template<>
1155
- struct transform_make_affine<AffineCompact>
1156
- {
1157
- template<typename MatrixType> EIGEN_DEVICE_FUNC static void run(MatrixType &) { }
1129
+ template <>
1130
+ struct transform_make_affine<AffineCompact> {
1131
+ template <typename MatrixType>
1132
+ EIGEN_DEVICE_FUNC static void run(MatrixType&) {}
1158
1133
  };
1159
-
1134
+
1160
1135
  // selector needed to avoid taking the inverse of a 3x4 matrix
1161
- template<typename TransformType, int Mode=TransformType::Mode>
1162
- struct projective_transform_inverse
1163
- {
1164
- EIGEN_DEVICE_FUNC static inline void run(const TransformType&, TransformType&)
1165
- {}
1136
+ template <typename TransformType, int Mode = TransformType::Mode>
1137
+ struct projective_transform_inverse {
1138
+ EIGEN_DEVICE_FUNC static inline void run(const TransformType&, TransformType&) {}
1166
1139
  };
1167
1140
 
1168
- template<typename TransformType>
1169
- struct projective_transform_inverse<TransformType, Projective>
1170
- {
1171
- EIGEN_DEVICE_FUNC static inline void run(const TransformType& m, TransformType& res)
1172
- {
1141
+ template <typename TransformType>
1142
+ struct projective_transform_inverse<TransformType, Projective> {
1143
+ EIGEN_DEVICE_FUNC static inline void run(const TransformType& m, TransformType& res) {
1173
1144
  res.matrix() = m.matrix().inverse();
1174
1145
  }
1175
1146
  };
1176
1147
 
1177
- } // end namespace internal
1178
-
1148
+ } // end namespace internal
1179
1149
 
1180
1150
  /**
1181
- *
1182
- * \returns the inverse transformation according to some given knowledge
1183
- * on \c *this.
1184
- *
1185
- * \param hint allows to optimize the inversion process when the transformation
1186
- * is known to be not a general transformation (optional). The possible values are:
1187
- * - #Projective if the transformation is not necessarily affine, i.e., if the
1188
- * last row is not guaranteed to be [0 ... 0 1]
1189
- * - #Affine if the last row can be assumed to be [0 ... 0 1]
1190
- * - #Isometry if the transformation is only a concatenations of translations
1191
- * and rotations.
1192
- * The default is the template class parameter \c Mode.
1193
- *
1194
- * \warning unless \a traits is always set to NoShear or NoScaling, this function
1195
- * requires the generic inverse method of MatrixBase defined in the LU module. If
1196
- * you forget to include this module, then you will get hard to debug linking errors.
1197
- *
1198
- * \sa MatrixBase::inverse()
1199
- */
1200
- template<typename Scalar, int Dim, int Mode, int Options>
1201
- EIGEN_DEVICE_FUNC Transform<Scalar,Dim,Mode,Options>
1202
- Transform<Scalar,Dim,Mode,Options>::inverse(TransformTraits hint) const
1203
- {
1151
+ *
1152
+ * \returns the inverse transformation according to some given knowledge
1153
+ * on \c *this.
1154
+ *
1155
+ * \param hint allows to optimize the inversion process when the transformation
1156
+ * is known to be not a general transformation (optional). The possible values are:
1157
+ * - #Projective if the transformation is not necessarily affine, i.e., if the
1158
+ * last row is not guaranteed to be [0 ... 0 1]
1159
+ * - #Affine if the last row can be assumed to be [0 ... 0 1]
1160
+ * - #Isometry if the transformation is only a concatenations of translations
1161
+ * and rotations.
1162
+ * The default is the template class parameter \c Mode.
1163
+ *
1164
+ * \warning unless \a traits is always set to NoShear or NoScaling, this function
1165
+ * requires the generic inverse method of MatrixBase defined in the LU module. If
1166
+ * you forget to include this module, then you will get hard to debug linking errors.
1167
+ *
1168
+ * \sa MatrixBase::inverse()
1169
+ */
1170
+ template <typename Scalar, int Dim, int Mode, int Options>
1171
+ EIGEN_DEVICE_FUNC Transform<Scalar, Dim, Mode, Options> Transform<Scalar, Dim, Mode, Options>::inverse(
1172
+ TransformTraits hint) const {
1204
1173
  Transform res;
1205
- if (hint == Projective)
1206
- {
1174
+ if (hint == Projective) {
1207
1175
  internal::projective_transform_inverse<Transform>::run(*this, res);
1208
- }
1209
- else
1210
- {
1211
- if (hint == Isometry)
1212
- {
1213
- res.matrix().template topLeftCorner<Dim,Dim>() = linear().transpose();
1214
- }
1215
- else if(hint&Affine)
1216
- {
1217
- res.matrix().template topLeftCorner<Dim,Dim>() = linear().inverse();
1218
- }
1219
- else
1220
- {
1176
+ } else {
1177
+ if (hint == Isometry) {
1178
+ res.matrix().template topLeftCorner<Dim, Dim>() = linear().transpose();
1179
+ } else if (hint & Affine) {
1180
+ res.matrix().template topLeftCorner<Dim, Dim>() = linear().inverse();
1181
+ } else {
1221
1182
  eigen_assert(false && "Invalid transform traits in Transform::Inverse");
1222
1183
  }
1223
1184
  // translation and remaining parts
1224
- res.matrix().template topRightCorner<Dim,1>()
1225
- = - res.matrix().template topLeftCorner<Dim,Dim>() * translation();
1226
- res.makeAffine(); // we do need this, because in the beginning res is uninitialized
1185
+ res.matrix().template topRightCorner<Dim, 1>().noalias() =
1186
+ -res.matrix().template topLeftCorner<Dim, Dim>() * translation();
1187
+ res.makeAffine(); // we do need this, because in the beginning res is uninitialized
1227
1188
  }
1228
1189
  return res;
1229
1190
  }
@@ -1234,95 +1195,93 @@ namespace internal {
1234
1195
  *** Specializations of take affine part ***
1235
1196
  *****************************************************/
1236
1197
 
1237
- template<typename TransformType> struct transform_take_affine_part {
1198
+ template <typename TransformType>
1199
+ struct transform_take_affine_part {
1238
1200
  typedef typename TransformType::MatrixType MatrixType;
1239
1201
  typedef typename TransformType::AffinePart AffinePart;
1240
1202
  typedef typename TransformType::ConstAffinePart ConstAffinePart;
1241
- static inline AffinePart run(MatrixType& m)
1242
- { return m.template block<TransformType::Dim,TransformType::HDim>(0,0); }
1243
- static inline ConstAffinePart run(const MatrixType& m)
1244
- { return m.template block<TransformType::Dim,TransformType::HDim>(0,0); }
1203
+ static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE AffinePart run(MatrixType& m) {
1204
+ return m.template block<TransformType::Dim, TransformType::HDim>(0, 0);
1205
+ }
1206
+ static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ConstAffinePart run(const MatrixType& m) {
1207
+ return m.template block<TransformType::Dim, TransformType::HDim>(0, 0);
1208
+ }
1245
1209
  };
1246
1210
 
1247
- template<typename Scalar, int Dim, int Options>
1248
- struct transform_take_affine_part<Transform<Scalar,Dim,AffineCompact, Options> > {
1249
- typedef typename Transform<Scalar,Dim,AffineCompact,Options>::MatrixType MatrixType;
1250
- static inline MatrixType& run(MatrixType& m) { return m; }
1251
- static inline const MatrixType& run(const MatrixType& m) { return m; }
1211
+ template <typename Scalar, int Dim, int Options>
1212
+ struct transform_take_affine_part<Transform<Scalar, Dim, AffineCompact, Options> > {
1213
+ typedef typename Transform<Scalar, Dim, AffineCompact, Options>::MatrixType MatrixType;
1214
+ static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE MatrixType& run(MatrixType& m) { return m; }
1215
+ static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const MatrixType& run(const MatrixType& m) { return m; }
1252
1216
  };
1253
1217
 
1254
1218
  /*****************************************************
1255
1219
  *** Specializations of construct from matrix ***
1256
1220
  *****************************************************/
1257
1221
 
1258
- template<typename Other, int Mode, int Options, int Dim, int HDim>
1259
- struct transform_construct_from_matrix<Other, Mode,Options,Dim,HDim, Dim,Dim>
1260
- {
1261
- static inline void run(Transform<typename Other::Scalar,Dim,Mode,Options> *transform, const Other& other)
1262
- {
1222
+ template <typename Other, int Mode, int Options, int Dim, int HDim>
1223
+ struct transform_construct_from_matrix<Other, Mode, Options, Dim, HDim, Dim, Dim> {
1224
+ static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(
1225
+ Transform<typename Other::Scalar, Dim, Mode, Options>* transform, const Other& other) {
1263
1226
  transform->linear() = other;
1264
1227
  transform->translation().setZero();
1265
1228
  transform->makeAffine();
1266
1229
  }
1267
1230
  };
1268
1231
 
1269
- template<typename Other, int Mode, int Options, int Dim, int HDim>
1270
- struct transform_construct_from_matrix<Other, Mode,Options,Dim,HDim, Dim,HDim>
1271
- {
1272
- static inline void run(Transform<typename Other::Scalar,Dim,Mode,Options> *transform, const Other& other)
1273
- {
1232
+ template <typename Other, int Mode, int Options, int Dim, int HDim>
1233
+ struct transform_construct_from_matrix<Other, Mode, Options, Dim, HDim, Dim, HDim> {
1234
+ static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(
1235
+ Transform<typename Other::Scalar, Dim, Mode, Options>* transform, const Other& other) {
1274
1236
  transform->affine() = other;
1275
1237
  transform->makeAffine();
1276
1238
  }
1277
1239
  };
1278
1240
 
1279
- template<typename Other, int Mode, int Options, int Dim, int HDim>
1280
- struct transform_construct_from_matrix<Other, Mode,Options,Dim,HDim, HDim,HDim>
1281
- {
1282
- static inline void run(Transform<typename Other::Scalar,Dim,Mode,Options> *transform, const Other& other)
1283
- { transform->matrix() = other; }
1241
+ template <typename Other, int Mode, int Options, int Dim, int HDim>
1242
+ struct transform_construct_from_matrix<Other, Mode, Options, Dim, HDim, HDim, HDim> {
1243
+ static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(
1244
+ Transform<typename Other::Scalar, Dim, Mode, Options>* transform, const Other& other) {
1245
+ transform->matrix() = other;
1246
+ }
1284
1247
  };
1285
1248
 
1286
- template<typename Other, int Options, int Dim, int HDim>
1287
- struct transform_construct_from_matrix<Other, AffineCompact,Options,Dim,HDim, HDim,HDim>
1288
- {
1289
- static inline void run(Transform<typename Other::Scalar,Dim,AffineCompact,Options> *transform, const Other& other)
1290
- { transform->matrix() = other.template block<Dim,HDim>(0,0); }
1249
+ template <typename Other, int Options, int Dim, int HDim>
1250
+ struct transform_construct_from_matrix<Other, AffineCompact, Options, Dim, HDim, HDim, HDim> {
1251
+ static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(
1252
+ Transform<typename Other::Scalar, Dim, AffineCompact, Options>* transform, const Other& other) {
1253
+ transform->matrix() = other.template block<Dim, HDim>(0, 0);
1254
+ }
1291
1255
  };
1292
1256
 
1293
1257
  /**********************************************************
1294
1258
  *** Specializations of operator* with rhs EigenBase ***
1295
1259
  **********************************************************/
1296
1260
 
1297
- template<int LhsMode,int RhsMode>
1298
- struct transform_product_result
1299
- {
1300
- enum
1301
- {
1302
- Mode =
1303
- (LhsMode == (int)Projective || RhsMode == (int)Projective ) ? Projective :
1304
- (LhsMode == (int)Affine || RhsMode == (int)Affine ) ? Affine :
1305
- (LhsMode == (int)AffineCompact || RhsMode == (int)AffineCompact ) ? AffineCompact :
1306
- (LhsMode == (int)Isometry || RhsMode == (int)Isometry ) ? Isometry : Projective
1261
+ template <int LhsMode, int RhsMode>
1262
+ struct transform_product_result {
1263
+ enum {
1264
+ Mode = (LhsMode == (int)Projective || RhsMode == (int)Projective) ? Projective
1265
+ : (LhsMode == (int)Affine || RhsMode == (int)Affine) ? Affine
1266
+ : (LhsMode == (int)AffineCompact || RhsMode == (int)AffineCompact) ? AffineCompact
1267
+ : (LhsMode == (int)Isometry || RhsMode == (int)Isometry) ? Isometry
1268
+ : Projective
1307
1269
  };
1308
1270
  };
1309
1271
 
1310
- template< typename TransformType, typename MatrixType, int RhsCols>
1311
- struct transform_right_product_impl< TransformType, MatrixType, 0, RhsCols>
1312
- {
1272
+ template <typename TransformType, typename MatrixType, int RhsCols>
1273
+ struct transform_right_product_impl<TransformType, MatrixType, 0, RhsCols> {
1313
1274
  typedef typename MatrixType::PlainObject ResultType;
1314
1275
 
1315
- static EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other)
1316
- {
1276
+ static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other) {
1317
1277
  return T.matrix() * other;
1318
1278
  }
1319
1279
  };
1320
1280
 
1321
- template< typename TransformType, typename MatrixType, int RhsCols>
1322
- struct transform_right_product_impl< TransformType, MatrixType, 1, RhsCols>
1323
- {
1324
- enum {
1325
- Dim = TransformType::Dim,
1281
+ template <typename TransformType, typename MatrixType, int RhsCols>
1282
+ struct transform_right_product_impl<TransformType, MatrixType, 1, RhsCols> {
1283
+ enum {
1284
+ Dim = TransformType::Dim,
1326
1285
  HDim = TransformType::HDim,
1327
1286
  OtherRows = MatrixType::RowsAtCompileTime,
1328
1287
  OtherCols = MatrixType::ColsAtCompileTime
@@ -1330,25 +1289,23 @@ struct transform_right_product_impl< TransformType, MatrixType, 1, RhsCols>
1330
1289
 
1331
1290
  typedef typename MatrixType::PlainObject ResultType;
1332
1291
 
1333
- static EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other)
1334
- {
1335
- EIGEN_STATIC_ASSERT(OtherRows==HDim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
1292
+ static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other) {
1293
+ EIGEN_STATIC_ASSERT(OtherRows == HDim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
1336
1294
 
1337
- typedef Block<ResultType, Dim, OtherCols, int(MatrixType::RowsAtCompileTime)==Dim> TopLeftLhs;
1295
+ typedef Block<ResultType, Dim, OtherCols, int(MatrixType::RowsAtCompileTime) == Dim> TopLeftLhs;
1338
1296
 
1339
- ResultType res(other.rows(),other.cols());
1297
+ ResultType res(other.rows(), other.cols());
1340
1298
  TopLeftLhs(res, 0, 0, Dim, other.cols()).noalias() = T.affine() * other;
1341
- res.row(OtherRows-1) = other.row(OtherRows-1);
1342
-
1299
+ res.row(OtherRows - 1) = other.row(OtherRows - 1);
1300
+
1343
1301
  return res;
1344
1302
  }
1345
1303
  };
1346
1304
 
1347
- template< typename TransformType, typename MatrixType, int RhsCols>
1348
- struct transform_right_product_impl< TransformType, MatrixType, 2, RhsCols>
1349
- {
1350
- enum {
1351
- Dim = TransformType::Dim,
1305
+ template <typename TransformType, typename MatrixType, int RhsCols>
1306
+ struct transform_right_product_impl<TransformType, MatrixType, 2, RhsCols> {
1307
+ enum {
1308
+ Dim = TransformType::Dim,
1352
1309
  HDim = TransformType::HDim,
1353
1310
  OtherRows = MatrixType::RowsAtCompileTime,
1354
1311
  OtherCols = MatrixType::ColsAtCompileTime
@@ -1356,37 +1313,37 @@ struct transform_right_product_impl< TransformType, MatrixType, 2, RhsCols>
1356
1313
 
1357
1314
  typedef typename MatrixType::PlainObject ResultType;
1358
1315
 
1359
- static EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other)
1360
- {
1361
- EIGEN_STATIC_ASSERT(OtherRows==Dim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
1316
+ static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other) {
1317
+ EIGEN_STATIC_ASSERT(OtherRows == Dim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
1362
1318
 
1363
1319
  typedef Block<ResultType, Dim, OtherCols, true> TopLeftLhs;
1364
- ResultType res(Replicate<typename TransformType::ConstTranslationPart, 1, OtherCols>(T.translation(),1,other.cols()));
1320
+ ResultType res(
1321
+ Replicate<typename TransformType::ConstTranslationPart, 1, OtherCols>(T.translation(), 1, other.cols()));
1365
1322
  TopLeftLhs(res, 0, 0, Dim, other.cols()).noalias() += T.linear() * other;
1366
1323
 
1367
1324
  return res;
1368
1325
  }
1369
1326
  };
1370
1327
 
1371
- template< typename TransformType, typename MatrixType >
1372
- struct transform_right_product_impl< TransformType, MatrixType, 2, 1> // rhs is a vector of size Dim
1328
+ template <typename TransformType, typename MatrixType>
1329
+ struct transform_right_product_impl<TransformType, MatrixType, 2, 1> // rhs is a vector of size Dim
1373
1330
  {
1374
1331
  typedef typename TransformType::MatrixType TransformMatrix;
1375
1332
  enum {
1376
1333
  Dim = TransformType::Dim,
1377
1334
  HDim = TransformType::HDim,
1378
1335
  OtherRows = MatrixType::RowsAtCompileTime,
1379
- WorkingRows = EIGEN_PLAIN_ENUM_MIN(TransformMatrix::RowsAtCompileTime,HDim)
1336
+ WorkingRows = plain_enum_min(TransformMatrix::RowsAtCompileTime, HDim)
1380
1337
  };
1381
1338
 
1382
1339
  typedef typename MatrixType::PlainObject ResultType;
1383
1340
 
1384
- static EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other)
1385
- {
1386
- EIGEN_STATIC_ASSERT(OtherRows==Dim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
1341
+ static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other) {
1342
+ EIGEN_STATIC_ASSERT(OtherRows == Dim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
1387
1343
 
1388
- Matrix<typename ResultType::Scalar, Dim+1, 1> rhs;
1389
- rhs.template head<Dim>() = other; rhs[Dim] = typename ResultType::Scalar(1);
1344
+ Matrix<typename ResultType::Scalar, Dim + 1, 1> rhs;
1345
+ rhs.template head<Dim>() = other;
1346
+ rhs[Dim] = typename ResultType::Scalar(1);
1390
1347
  Matrix<typename ResultType::Scalar, WorkingRows, 1> res(T.matrix() * rhs);
1391
1348
  return res.template head<Dim>();
1392
1349
  }
@@ -1397,41 +1354,37 @@ struct transform_right_product_impl< TransformType, MatrixType, 2, 1> // rhs is
1397
1354
  **********************************************************/
1398
1355
 
1399
1356
  // generic HDim x HDim matrix * T => Projective
1400
- template<typename Other,int Mode, int Options, int Dim, int HDim>
1401
- struct transform_left_product_impl<Other,Mode,Options,Dim,HDim, HDim,HDim>
1402
- {
1403
- typedef Transform<typename Other::Scalar,Dim,Mode,Options> TransformType;
1357
+ template <typename Other, int Mode, int Options, int Dim, int HDim>
1358
+ struct transform_left_product_impl<Other, Mode, Options, Dim, HDim, HDim, HDim> {
1359
+ typedef Transform<typename Other::Scalar, Dim, Mode, Options> TransformType;
1404
1360
  typedef typename TransformType::MatrixType MatrixType;
1405
- typedef Transform<typename Other::Scalar,Dim,Projective,Options> ResultType;
1406
- static ResultType run(const Other& other,const TransformType& tr)
1407
- { return ResultType(other * tr.matrix()); }
1361
+ typedef Transform<typename Other::Scalar, Dim, Projective, Options> ResultType;
1362
+ static EIGEN_DEVICE_FUNC ResultType run(const Other& other, const TransformType& tr) {
1363
+ return ResultType(other * tr.matrix());
1364
+ }
1408
1365
  };
1409
1366
 
1410
1367
  // generic HDim x HDim matrix * AffineCompact => Projective
1411
- template<typename Other, int Options, int Dim, int HDim>
1412
- struct transform_left_product_impl<Other,AffineCompact,Options,Dim,HDim, HDim,HDim>
1413
- {
1414
- typedef Transform<typename Other::Scalar,Dim,AffineCompact,Options> TransformType;
1368
+ template <typename Other, int Options, int Dim, int HDim>
1369
+ struct transform_left_product_impl<Other, AffineCompact, Options, Dim, HDim, HDim, HDim> {
1370
+ typedef Transform<typename Other::Scalar, Dim, AffineCompact, Options> TransformType;
1415
1371
  typedef typename TransformType::MatrixType MatrixType;
1416
- typedef Transform<typename Other::Scalar,Dim,Projective,Options> ResultType;
1417
- static ResultType run(const Other& other,const TransformType& tr)
1418
- {
1372
+ typedef Transform<typename Other::Scalar, Dim, Projective, Options> ResultType;
1373
+ static EIGEN_DEVICE_FUNC ResultType run(const Other& other, const TransformType& tr) {
1419
1374
  ResultType res;
1420
- res.matrix().noalias() = other.template block<HDim,Dim>(0,0) * tr.matrix();
1375
+ res.matrix().noalias() = other.template block<HDim, Dim>(0, 0) * tr.matrix();
1421
1376
  res.matrix().col(Dim) += other.col(Dim);
1422
1377
  return res;
1423
1378
  }
1424
1379
  };
1425
1380
 
1426
1381
  // affine matrix * T
1427
- template<typename Other,int Mode, int Options, int Dim, int HDim>
1428
- struct transform_left_product_impl<Other,Mode,Options,Dim,HDim, Dim,HDim>
1429
- {
1430
- typedef Transform<typename Other::Scalar,Dim,Mode,Options> TransformType;
1382
+ template <typename Other, int Mode, int Options, int Dim, int HDim>
1383
+ struct transform_left_product_impl<Other, Mode, Options, Dim, HDim, Dim, HDim> {
1384
+ typedef Transform<typename Other::Scalar, Dim, Mode, Options> TransformType;
1431
1385
  typedef typename TransformType::MatrixType MatrixType;
1432
1386
  typedef TransformType ResultType;
1433
- static ResultType run(const Other& other,const TransformType& tr)
1434
- {
1387
+ static EIGEN_DEVICE_FUNC ResultType run(const Other& other, const TransformType& tr) {
1435
1388
  ResultType res;
1436
1389
  res.affine().noalias() = other * tr.matrix();
1437
1390
  res.matrix().row(Dim) = tr.matrix().row(Dim);
@@ -1440,35 +1393,29 @@ struct transform_left_product_impl<Other,Mode,Options,Dim,HDim, Dim,HDim>
1440
1393
  };
1441
1394
 
1442
1395
  // affine matrix * AffineCompact
1443
- template<typename Other, int Options, int Dim, int HDim>
1444
- struct transform_left_product_impl<Other,AffineCompact,Options,Dim,HDim, Dim,HDim>
1445
- {
1446
- typedef Transform<typename Other::Scalar,Dim,AffineCompact,Options> TransformType;
1396
+ template <typename Other, int Options, int Dim, int HDim>
1397
+ struct transform_left_product_impl<Other, AffineCompact, Options, Dim, HDim, Dim, HDim> {
1398
+ typedef Transform<typename Other::Scalar, Dim, AffineCompact, Options> TransformType;
1447
1399
  typedef typename TransformType::MatrixType MatrixType;
1448
1400
  typedef TransformType ResultType;
1449
- static ResultType run(const Other& other,const TransformType& tr)
1450
- {
1401
+ static EIGEN_DEVICE_FUNC ResultType run(const Other& other, const TransformType& tr) {
1451
1402
  ResultType res;
1452
- res.matrix().noalias() = other.template block<Dim,Dim>(0,0) * tr.matrix();
1403
+ res.matrix().noalias() = other.template block<Dim, Dim>(0, 0) * tr.matrix();
1453
1404
  res.translation() += other.col(Dim);
1454
1405
  return res;
1455
1406
  }
1456
1407
  };
1457
1408
 
1458
1409
  // linear matrix * T
1459
- template<typename Other,int Mode, int Options, int Dim, int HDim>
1460
- struct transform_left_product_impl<Other,Mode,Options,Dim,HDim, Dim,Dim>
1461
- {
1462
- typedef Transform<typename Other::Scalar,Dim,Mode,Options> TransformType;
1410
+ template <typename Other, int Mode, int Options, int Dim, int HDim>
1411
+ struct transform_left_product_impl<Other, Mode, Options, Dim, HDim, Dim, Dim> {
1412
+ typedef Transform<typename Other::Scalar, Dim, Mode, Options> TransformType;
1463
1413
  typedef typename TransformType::MatrixType MatrixType;
1464
1414
  typedef TransformType ResultType;
1465
- static ResultType run(const Other& other, const TransformType& tr)
1466
- {
1415
+ static EIGEN_DEVICE_FUNC ResultType run(const Other& other, const TransformType& tr) {
1467
1416
  TransformType res;
1468
- if(Mode!=int(AffineCompact))
1469
- res.matrix().row(Dim) = tr.matrix().row(Dim);
1470
- res.matrix().template topRows<Dim>().noalias()
1471
- = other * tr.matrix().template topRows<Dim>();
1417
+ if (Mode != int(AffineCompact)) res.matrix().row(Dim) = tr.matrix().row(Dim);
1418
+ res.matrix().template topRows<Dim>().noalias() = other * tr.matrix().template topRows<Dim>();
1472
1419
  return res;
1473
1420
  }
1474
1421
  };
@@ -1477,43 +1424,40 @@ struct transform_left_product_impl<Other,Mode,Options,Dim,HDim, Dim,Dim>
1477
1424
  *** Specializations of operator* with another Transform ***
1478
1425
  **********************************************************/
1479
1426
 
1480
- template<typename Scalar, int Dim, int LhsMode, int LhsOptions, int RhsMode, int RhsOptions>
1481
- struct transform_transform_product_impl<Transform<Scalar,Dim,LhsMode,LhsOptions>,Transform<Scalar,Dim,RhsMode,RhsOptions>,false >
1482
- {
1483
- enum { ResultMode = transform_product_result<LhsMode,RhsMode>::Mode };
1484
- typedef Transform<Scalar,Dim,LhsMode,LhsOptions> Lhs;
1485
- typedef Transform<Scalar,Dim,RhsMode,RhsOptions> Rhs;
1486
- typedef Transform<Scalar,Dim,ResultMode,LhsOptions> ResultType;
1487
- static ResultType run(const Lhs& lhs, const Rhs& rhs)
1488
- {
1427
+ template <typename Scalar, int Dim, int LhsMode, int LhsOptions, int RhsMode, int RhsOptions>
1428
+ struct transform_transform_product_impl<Transform<Scalar, Dim, LhsMode, LhsOptions>,
1429
+ Transform<Scalar, Dim, RhsMode, RhsOptions>, false> {
1430
+ enum { ResultMode = transform_product_result<LhsMode, RhsMode>::Mode };
1431
+ typedef Transform<Scalar, Dim, LhsMode, LhsOptions> Lhs;
1432
+ typedef Transform<Scalar, Dim, RhsMode, RhsOptions> Rhs;
1433
+ typedef Transform<Scalar, Dim, ResultMode, LhsOptions> ResultType;
1434
+ static EIGEN_DEVICE_FUNC ResultType run(const Lhs& lhs, const Rhs& rhs) {
1489
1435
  ResultType res;
1490
- res.linear() = lhs.linear() * rhs.linear();
1436
+ res.linear().noalias() = lhs.linear() * rhs.linear();
1491
1437
  res.translation() = lhs.linear() * rhs.translation() + lhs.translation();
1492
1438
  res.makeAffine();
1493
1439
  return res;
1494
1440
  }
1495
1441
  };
1496
1442
 
1497
- template<typename Scalar, int Dim, int LhsMode, int LhsOptions, int RhsMode, int RhsOptions>
1498
- struct transform_transform_product_impl<Transform<Scalar,Dim,LhsMode,LhsOptions>,Transform<Scalar,Dim,RhsMode,RhsOptions>,true >
1499
- {
1500
- typedef Transform<Scalar,Dim,LhsMode,LhsOptions> Lhs;
1501
- typedef Transform<Scalar,Dim,RhsMode,RhsOptions> Rhs;
1502
- typedef Transform<Scalar,Dim,Projective> ResultType;
1503
- static ResultType run(const Lhs& lhs, const Rhs& rhs)
1504
- {
1505
- return ResultType( lhs.matrix() * rhs.matrix() );
1443
+ template <typename Scalar, int Dim, int LhsMode, int LhsOptions, int RhsMode, int RhsOptions>
1444
+ struct transform_transform_product_impl<Transform<Scalar, Dim, LhsMode, LhsOptions>,
1445
+ Transform<Scalar, Dim, RhsMode, RhsOptions>, true> {
1446
+ typedef Transform<Scalar, Dim, LhsMode, LhsOptions> Lhs;
1447
+ typedef Transform<Scalar, Dim, RhsMode, RhsOptions> Rhs;
1448
+ typedef Transform<Scalar, Dim, Projective> ResultType;
1449
+ static EIGEN_DEVICE_FUNC ResultType run(const Lhs& lhs, const Rhs& rhs) {
1450
+ return ResultType(lhs.matrix() * rhs.matrix());
1506
1451
  }
1507
1452
  };
1508
1453
 
1509
- template<typename Scalar, int Dim, int LhsOptions, int RhsOptions>
1510
- struct transform_transform_product_impl<Transform<Scalar,Dim,AffineCompact,LhsOptions>,Transform<Scalar,Dim,Projective,RhsOptions>,true >
1511
- {
1512
- typedef Transform<Scalar,Dim,AffineCompact,LhsOptions> Lhs;
1513
- typedef Transform<Scalar,Dim,Projective,RhsOptions> Rhs;
1514
- typedef Transform<Scalar,Dim,Projective> ResultType;
1515
- static ResultType run(const Lhs& lhs, const Rhs& rhs)
1516
- {
1454
+ template <typename Scalar, int Dim, int LhsOptions, int RhsOptions>
1455
+ struct transform_transform_product_impl<Transform<Scalar, Dim, AffineCompact, LhsOptions>,
1456
+ Transform<Scalar, Dim, Projective, RhsOptions>, true> {
1457
+ typedef Transform<Scalar, Dim, AffineCompact, LhsOptions> Lhs;
1458
+ typedef Transform<Scalar, Dim, Projective, RhsOptions> Rhs;
1459
+ typedef Transform<Scalar, Dim, Projective> ResultType;
1460
+ static EIGEN_DEVICE_FUNC ResultType run(const Lhs& lhs, const Rhs& rhs) {
1517
1461
  ResultType res;
1518
1462
  res.matrix().template topRows<Dim>() = lhs.matrix() * rhs.matrix();
1519
1463
  res.matrix().row(Dim) = rhs.matrix().row(Dim);
@@ -1521,22 +1465,21 @@ struct transform_transform_product_impl<Transform<Scalar,Dim,AffineCompact,LhsOp
1521
1465
  }
1522
1466
  };
1523
1467
 
1524
- template<typename Scalar, int Dim, int LhsOptions, int RhsOptions>
1525
- struct transform_transform_product_impl<Transform<Scalar,Dim,Projective,LhsOptions>,Transform<Scalar,Dim,AffineCompact,RhsOptions>,true >
1526
- {
1527
- typedef Transform<Scalar,Dim,Projective,LhsOptions> Lhs;
1528
- typedef Transform<Scalar,Dim,AffineCompact,RhsOptions> Rhs;
1529
- typedef Transform<Scalar,Dim,Projective> ResultType;
1530
- static ResultType run(const Lhs& lhs, const Rhs& rhs)
1531
- {
1468
+ template <typename Scalar, int Dim, int LhsOptions, int RhsOptions>
1469
+ struct transform_transform_product_impl<Transform<Scalar, Dim, Projective, LhsOptions>,
1470
+ Transform<Scalar, Dim, AffineCompact, RhsOptions>, true> {
1471
+ typedef Transform<Scalar, Dim, Projective, LhsOptions> Lhs;
1472
+ typedef Transform<Scalar, Dim, AffineCompact, RhsOptions> Rhs;
1473
+ typedef Transform<Scalar, Dim, Projective> ResultType;
1474
+ static EIGEN_DEVICE_FUNC ResultType run(const Lhs& lhs, const Rhs& rhs) {
1532
1475
  ResultType res(lhs.matrix().template leftCols<Dim>() * rhs.matrix());
1533
1476
  res.matrix().col(Dim) += lhs.matrix().col(Dim);
1534
1477
  return res;
1535
1478
  }
1536
1479
  };
1537
1480
 
1538
- } // end namespace internal
1481
+ } // end namespace internal
1539
1482
 
1540
- } // end namespace Eigen
1483
+ } // end namespace Eigen
1541
1484
 
1542
- #endif // EIGEN_TRANSFORM_H
1485
+ #endif // EIGEN_TRANSFORM_H