node-native-win-utils 1.1.0 → 1.3.0

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 (174) hide show
  1. package/README.md +144 -27
  2. package/binding.gyp +18 -5
  3. package/dist/index.d.ts +146 -4
  4. package/dist/index.js +107 -3
  5. package/include/opencv2/core/affine.hpp +678 -0
  6. package/include/opencv2/core/async.hpp +105 -0
  7. package/include/opencv2/core/base.hpp +664 -0
  8. package/include/opencv2/core/bindings_utils.hpp +325 -0
  9. package/include/opencv2/core/bufferpool.hpp +40 -0
  10. package/include/opencv2/core/check.hpp +170 -0
  11. package/include/opencv2/core/core.hpp +48 -0
  12. package/include/opencv2/core/core_c.h +3128 -0
  13. package/include/opencv2/core/cuda/block.hpp +211 -0
  14. package/include/opencv2/core/cuda/border_interpolate.hpp +722 -0
  15. package/include/opencv2/core/cuda/color.hpp +309 -0
  16. package/include/opencv2/core/cuda/common.hpp +131 -0
  17. package/include/opencv2/core/cuda/datamov_utils.hpp +113 -0
  18. package/include/opencv2/core/cuda/detail/color_detail.hpp +2018 -0
  19. package/include/opencv2/core/cuda/detail/reduce.hpp +365 -0
  20. package/include/opencv2/core/cuda/detail/reduce_key_val.hpp +502 -0
  21. package/include/opencv2/core/cuda/detail/transform_detail.hpp +392 -0
  22. package/include/opencv2/core/cuda/detail/type_traits_detail.hpp +191 -0
  23. package/include/opencv2/core/cuda/detail/vec_distance_detail.hpp +121 -0
  24. package/include/opencv2/core/cuda/dynamic_smem.hpp +88 -0
  25. package/include/opencv2/core/cuda/emulation.hpp +269 -0
  26. package/include/opencv2/core/cuda/filters.hpp +293 -0
  27. package/include/opencv2/core/cuda/funcattrib.hpp +79 -0
  28. package/include/opencv2/core/cuda/functional.hpp +805 -0
  29. package/include/opencv2/core/cuda/limits.hpp +128 -0
  30. package/include/opencv2/core/cuda/reduce.hpp +209 -0
  31. package/include/opencv2/core/cuda/saturate_cast.hpp +292 -0
  32. package/include/opencv2/core/cuda/scan.hpp +258 -0
  33. package/include/opencv2/core/cuda/simd_functions.hpp +869 -0
  34. package/include/opencv2/core/cuda/transform.hpp +75 -0
  35. package/include/opencv2/core/cuda/type_traits.hpp +90 -0
  36. package/include/opencv2/core/cuda/utility.hpp +230 -0
  37. package/include/opencv2/core/cuda/vec_distance.hpp +232 -0
  38. package/include/opencv2/core/cuda/vec_math.hpp +923 -0
  39. package/include/opencv2/core/cuda/vec_traits.hpp +288 -0
  40. package/include/opencv2/core/cuda/warp.hpp +139 -0
  41. package/include/opencv2/core/cuda/warp_reduce.hpp +76 -0
  42. package/include/opencv2/core/cuda/warp_shuffle.hpp +162 -0
  43. package/include/opencv2/core/cuda.hpp +1279 -0
  44. package/include/opencv2/core/cuda.inl.hpp +763 -0
  45. package/include/opencv2/core/cuda_stream_accessor.hpp +86 -0
  46. package/include/opencv2/core/cuda_types.hpp +144 -0
  47. package/include/opencv2/core/cv_cpu_dispatch.h +381 -0
  48. package/include/opencv2/core/cv_cpu_helper.h +550 -0
  49. package/include/opencv2/core/cvdef.h +973 -0
  50. package/include/opencv2/core/cvstd.hpp +190 -0
  51. package/include/opencv2/core/cvstd.inl.hpp +197 -0
  52. package/include/opencv2/core/cvstd_wrapper.hpp +154 -0
  53. package/include/opencv2/core/detail/async_promise.hpp +71 -0
  54. package/include/opencv2/core/detail/dispatch_helper.impl.hpp +49 -0
  55. package/include/opencv2/core/detail/exception_ptr.hpp +27 -0
  56. package/include/opencv2/core/directx.hpp +184 -0
  57. package/include/opencv2/core/dualquaternion.hpp +979 -0
  58. package/include/opencv2/core/dualquaternion.inl.hpp +487 -0
  59. package/include/opencv2/core/eigen.hpp +402 -0
  60. package/include/opencv2/core/fast_math.hpp +433 -0
  61. package/include/opencv2/core/hal/hal.hpp +256 -0
  62. package/include/opencv2/core/hal/interface.h +190 -0
  63. package/include/opencv2/core/hal/intrin.hpp +939 -0
  64. package/include/opencv2/core/hal/intrin_avx.hpp +3177 -0
  65. package/include/opencv2/core/hal/intrin_avx512.hpp +3090 -0
  66. package/include/opencv2/core/hal/intrin_cpp.hpp +3321 -0
  67. package/include/opencv2/core/hal/intrin_forward.hpp +191 -0
  68. package/include/opencv2/core/hal/intrin_lasx.hpp +3236 -0
  69. package/include/opencv2/core/hal/intrin_msa.hpp +1887 -0
  70. package/include/opencv2/core/hal/intrin_neon.hpp +2610 -0
  71. package/include/opencv2/core/hal/intrin_rvv.hpp +3320 -0
  72. package/include/opencv2/core/hal/intrin_rvv071.hpp +2545 -0
  73. package/include/opencv2/core/hal/intrin_rvv_scalable.hpp +2080 -0
  74. package/include/opencv2/core/hal/intrin_sse.hpp +3467 -0
  75. package/include/opencv2/core/hal/intrin_sse_em.hpp +180 -0
  76. package/include/opencv2/core/hal/intrin_vsx.hpp +1608 -0
  77. package/include/opencv2/core/hal/intrin_wasm.hpp +2782 -0
  78. package/include/opencv2/core/hal/msa_macros.h +1558 -0
  79. package/include/opencv2/core/hal/simd_utils.impl.hpp +186 -0
  80. package/include/opencv2/core/llapi/llapi.h +102 -0
  81. package/include/opencv2/core/mat.hpp +3775 -0
  82. package/include/opencv2/core/mat.inl.hpp +3422 -0
  83. package/include/opencv2/core/matx.hpp +1536 -0
  84. package/include/opencv2/core/neon_utils.hpp +128 -0
  85. package/include/opencv2/core/ocl.hpp +917 -0
  86. package/include/opencv2/core/ocl_genbase.hpp +69 -0
  87. package/include/opencv2/core/opencl/ocl_defs.hpp +82 -0
  88. package/include/opencv2/core/opencl/opencl_info.hpp +212 -0
  89. package/include/opencv2/core/opencl/opencl_svm.hpp +81 -0
  90. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_clblas.hpp +602 -0
  91. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_clfft.hpp +146 -0
  92. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_core.hpp +371 -0
  93. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_core_wrappers.hpp +272 -0
  94. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl.hpp +62 -0
  95. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl_wrappers.hpp +42 -0
  96. package/include/opencv2/core/opencl/runtime/opencl_clblas.hpp +53 -0
  97. package/include/opencv2/core/opencl/runtime/opencl_clfft.hpp +53 -0
  98. package/include/opencv2/core/opencl/runtime/opencl_core.hpp +84 -0
  99. package/include/opencv2/core/opencl/runtime/opencl_core_wrappers.hpp +47 -0
  100. package/include/opencv2/core/opencl/runtime/opencl_gl.hpp +53 -0
  101. package/include/opencv2/core/opencl/runtime/opencl_gl_wrappers.hpp +47 -0
  102. package/include/opencv2/core/opencl/runtime/opencl_svm_20.hpp +48 -0
  103. package/include/opencv2/core/opencl/runtime/opencl_svm_definitions.hpp +42 -0
  104. package/include/opencv2/core/opencl/runtime/opencl_svm_hsa_extension.hpp +166 -0
  105. package/include/opencv2/core/opengl.hpp +733 -0
  106. package/include/opencv2/core/openvx/ovx_defs.hpp +48 -0
  107. package/include/opencv2/core/operations.hpp +610 -0
  108. package/include/opencv2/core/optim.hpp +302 -0
  109. package/include/opencv2/core/ovx.hpp +28 -0
  110. package/include/opencv2/core/parallel/backend/parallel_for.openmp.hpp +72 -0
  111. package/include/opencv2/core/parallel/backend/parallel_for.tbb.hpp +153 -0
  112. package/include/opencv2/core/parallel/parallel_backend.hpp +90 -0
  113. package/include/opencv2/core/persistence.hpp +1350 -0
  114. package/include/opencv2/core/private/cv_cpu_include_simd_declarations.hpp +30 -0
  115. package/include/opencv2/core/private.cuda.hpp +169 -0
  116. package/include/opencv2/core/private.hpp +896 -0
  117. package/include/opencv2/core/quaternion.hpp +1696 -0
  118. package/include/opencv2/core/quaternion.inl.hpp +1063 -0
  119. package/include/opencv2/core/saturate.hpp +180 -0
  120. package/include/opencv2/core/simd_intrinsics.hpp +87 -0
  121. package/include/opencv2/core/softfloat.hpp +514 -0
  122. package/include/opencv2/core/sse_utils.hpp +652 -0
  123. package/include/opencv2/core/traits.hpp +417 -0
  124. package/include/opencv2/core/types.hpp +2457 -0
  125. package/include/opencv2/core/types_c.h +2126 -0
  126. package/include/opencv2/core/utility.hpp +1229 -0
  127. package/include/opencv2/core/utils/allocator_stats.hpp +29 -0
  128. package/include/opencv2/core/utils/allocator_stats.impl.hpp +158 -0
  129. package/include/opencv2/core/utils/buffer_area.private.hpp +136 -0
  130. package/include/opencv2/core/utils/configuration.private.hpp +22 -0
  131. package/include/opencv2/core/utils/filesystem.hpp +82 -0
  132. package/include/opencv2/core/utils/filesystem.private.hpp +66 -0
  133. package/include/opencv2/core/utils/fp_control.private.hpp +29 -0
  134. package/include/opencv2/core/utils/fp_control_utils.hpp +69 -0
  135. package/include/opencv2/core/utils/instrumentation.hpp +125 -0
  136. package/include/opencv2/core/utils/lock.private.hpp +119 -0
  137. package/include/opencv2/core/utils/logger.defines.hpp +42 -0
  138. package/include/opencv2/core/utils/logger.hpp +218 -0
  139. package/include/opencv2/core/utils/logtag.hpp +28 -0
  140. package/include/opencv2/core/utils/plugin_loader.private.hpp +165 -0
  141. package/include/opencv2/core/utils/tls.hpp +235 -0
  142. package/include/opencv2/core/utils/trace.hpp +252 -0
  143. package/include/opencv2/core/utils/trace.private.hpp +421 -0
  144. package/include/opencv2/core/va_intel.hpp +75 -0
  145. package/include/opencv2/core/version.hpp +26 -0
  146. package/include/opencv2/core/vsx_utils.hpp +1047 -0
  147. package/include/opencv2/core.hpp +3365 -0
  148. package/include/opencv2/imgcodecs/imgcodecs.hpp +48 -0
  149. package/include/opencv2/imgcodecs/imgcodecs_c.h +1 -0
  150. package/include/opencv2/imgcodecs/ios.h +59 -0
  151. package/include/opencv2/imgcodecs/legacy/constants_c.h +54 -0
  152. package/include/opencv2/imgcodecs/macosx.h +20 -0
  153. package/include/opencv2/imgcodecs.hpp +407 -0
  154. package/include/opencv2/imgproc/bindings.hpp +34 -0
  155. package/include/opencv2/imgproc/detail/gcgraph.hpp +395 -0
  156. package/include/opencv2/imgproc/hal/hal.hpp +246 -0
  157. package/include/opencv2/imgproc/hal/interface.h +46 -0
  158. package/include/opencv2/imgproc/imgproc.hpp +48 -0
  159. package/include/opencv2/imgproc/imgproc_c.h +1177 -0
  160. package/include/opencv2/imgproc/segmentation.hpp +141 -0
  161. package/include/opencv2/imgproc/types_c.h +659 -0
  162. package/include/opencv2/imgproc.hpp +5035 -0
  163. package/include/opencv2/opencv_modules.hpp +17 -0
  164. package/libs/libjpeg-turbo.lib +0 -0
  165. package/libs/libpng.lib +0 -0
  166. package/libs/opencv_core470.lib +0 -0
  167. package/libs/opencv_imgcodecs470.lib +0 -0
  168. package/libs/opencv_imgproc470.lib +0 -0
  169. package/libs/zlib.lib +0 -0
  170. package/package.json +14 -3
  171. package/prebuilds/win32-x64/node.napi.node +0 -0
  172. package/src/cpp/capturewindow.cpp +36 -46
  173. package/src/cpp/main.cpp +10 -2
  174. package/src/cpp/opencv.cpp +425 -0
@@ -0,0 +1,979 @@
1
+ // This file is part of OpenCV project.
2
+ // It is subject to the license terms in the LICENSE file found in the top-level directory
3
+ // of this distribution and at http://opencv.org/license.html.
4
+ //
5
+ //
6
+ // License Agreement
7
+ // For Open Source Computer Vision Library
8
+ //
9
+ // Copyright (C) 2020, Huawei Technologies Co., Ltd. All rights reserved.
10
+ // Third party copyrights are property of their respective owners.
11
+ //
12
+ // Licensed under the Apache License, Version 2.0 (the "License");
13
+ // you may not use this file except in compliance with the License.
14
+ // You may obtain a copy of the License at
15
+ //
16
+ // http://www.apache.org/licenses/LICENSE-2.0
17
+ //
18
+ // Unless required by applicable law or agreed to in writing, software
19
+ // distributed under the License is distributed on an "AS IS" BASIS,
20
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ // See the License for the specific language governing permissions and
22
+ // limitations under the License.
23
+ //
24
+ // Author: Liangqian Kong <kongliangqian@huawei.com>
25
+ // Longbu Wang <wanglongbu@huawei.com>
26
+ #ifndef OPENCV_CORE_DUALQUATERNION_HPP
27
+ #define OPENCV_CORE_DUALQUATERNION_HPP
28
+
29
+ #include <opencv2/core/quaternion.hpp>
30
+ #include <opencv2/core/affine.hpp>
31
+
32
+ namespace cv{
33
+ //! @addtogroup core
34
+ //! @{
35
+
36
+ template <typename _Tp> class DualQuat;
37
+ template <typename _Tp> std::ostream& operator<<(std::ostream&, const DualQuat<_Tp>&);
38
+
39
+ /**
40
+ * Dual quaternions were introduced to describe rotation together with translation while ordinary
41
+ * quaternions can only describe rotation. It can be used for shortest path pose interpolation,
42
+ * local pose optimization or volumetric deformation. More details can be found
43
+ * - https://en.wikipedia.org/wiki/Dual_quaternion
44
+ * - ["A beginners guide to dual-quaternions: what they are, how they work, and how to use them for 3D character hierarchies", Ben Kenwright, 2012](https://borodust.org/public/shared/beginner_dual_quats.pdf)
45
+ * - ["Dual Quaternions", Yan-Bin Jia, 2013](http://web.cs.iastate.edu/~cs577/handouts/dual-quaternion.pdf)
46
+ * - ["Geometric Skinning with Approximate Dual Quaternion Blending", Kavan, 2008](https://www.cs.utah.edu/~ladislav/kavan08geometric/kavan08geometric)
47
+ * - http://rodolphe-vaillant.fr/?e=29
48
+ *
49
+ * A unit dual quaternion can be classically represented as:
50
+ * \f[
51
+ * \begin{equation}
52
+ * \begin{split}
53
+ * \sigma &= \left(r+\frac{\epsilon}{2}tr\right)\\
54
+ * &= [w, x, y, z, w\_, x\_, y\_, z\_]
55
+ * \end{split}
56
+ * \end{equation}
57
+ * \f]
58
+ * where \f$r, t\f$ represents the rotation (ordinary unit quaternion) and translation (pure ordinary quaternion) respectively.
59
+ *
60
+ * A general dual quaternions which consist of two quaternions is usually represented in form of:
61
+ * \f[
62
+ * \sigma = p + \epsilon q
63
+ * \f]
64
+ * where the introduced dual unit \f$\epsilon\f$ satisfies \f$\epsilon^2 = \epsilon^3 =...=0\f$, and \f$p, q\f$ are quaternions.
65
+ *
66
+ * Alternatively, dual quaternions can also be interpreted as four components which are all [dual numbers](https://www.cs.utah.edu/~ladislav/kavan08geometric/kavan08geometric):
67
+ * \f[
68
+ * \sigma = \hat{q}_w + \hat{q}_xi + \hat{q}_yj + \hat{q}_zk
69
+ * \f]
70
+ * If we set \f$\hat{q}_x, \hat{q}_y\f$ and \f$\hat{q}_z\f$ equal to 0, a dual quaternion is transformed to a dual number. see normalize().
71
+ *
72
+ * If you want to create a dual quaternion, you can use:
73
+ *
74
+ * ```
75
+ * using namespace cv;
76
+ * double angle = CV_PI;
77
+ *
78
+ * // create from eight number
79
+ * DualQuatd dq1(1, 2, 3, 4, 5, 6, 7, 8); //p = [1,2,3,4]. q=[5,6,7,8]
80
+ *
81
+ * // create from Vec
82
+ * Vec<double, 8> v{1,2,3,4,5,6,7,8};
83
+ * DualQuatd dq_v{v};
84
+ *
85
+ * // create from two quaternion
86
+ * Quatd p(1, 2, 3, 4);
87
+ * Quatd q(5, 6, 7, 8);
88
+ * DualQuatd dq2 = DualQuatd::createFromQuat(p, q);
89
+ *
90
+ * // create from an angle, an axis and a translation
91
+ * Vec3d axis{0, 0, 1};
92
+ * Vec3d trans{3, 4, 5};
93
+ * DualQuatd dq3 = DualQuatd::createFromAngleAxisTrans(angle, axis, trans);
94
+ *
95
+ * // If you already have an instance of class Affine3, then you can use
96
+ * Affine3d R = dq3.toAffine3();
97
+ * DualQuatd dq4 = DualQuatd::createFromAffine3(R);
98
+ *
99
+ * // or create directly by affine transformation matrix Rt
100
+ * // see createFromMat() in detail for the form of Rt
101
+ * Matx44d Rt = dq3.toMat();
102
+ * DualQuatd dq5 = DualQuatd::createFromMat(Rt);
103
+ *
104
+ * // Any rotation + translation movement can
105
+ * // be expressed as a rotation + translation around the same line in space (expressed by Plucker
106
+ * // coords), and here's a way to represent it this way.
107
+ * Vec3d axis{1, 1, 1}; // axis will be normalized in createFromPitch
108
+ * Vec3d trans{3, 4 ,5};
109
+ * axis = axis / std::sqrt(axis.dot(axis));// The formula for computing moment that I use below requires a normalized axis
110
+ * Vec3d moment = 1.0 / 2 * (trans.cross(axis) + axis.cross(trans.cross(axis)) *
111
+ * std::cos(rotation_angle / 2) / std::sin(rotation_angle / 2));
112
+ * double d = trans.dot(qaxis);
113
+ * DualQuatd dq6 = DualQuatd::createFromPitch(angle, d, axis, moment);
114
+ * ```
115
+ *
116
+ * A point \f$v=(x, y, z)\f$ in form of dual quaternion is \f$[1+\epsilon v]=[1,0,0,0,0,x,y,z]\f$.
117
+ * The transformation of a point \f$v_1\f$ to another point \f$v_2\f$ under the dual quaternion \f$\sigma\f$ is
118
+ * \f[
119
+ * 1 + \epsilon v_2 = \sigma * (1 + \epsilon v_1) * \sigma^{\star}
120
+ * \f]
121
+ * where \f$\sigma^{\star}=p^*-\epsilon q^*.\f$
122
+ *
123
+ * A line in the \f$Pl\ddot{u}cker\f$ coordinates \f$(\hat{l}, m)\f$ defined by the dual quaternion \f$l=\hat{l}+\epsilon m\f$.
124
+ * To transform a line, \f[l_2 = \sigma * l_1 * \sigma^*,\f] where \f$\sigma=r+\frac{\epsilon}{2}rt\f$ and
125
+ * \f$\sigma^*=p^*+\epsilon q^*\f$.
126
+ *
127
+ * To extract the Vec<double, 8> or Vec<float, 8>, see toVec();
128
+ *
129
+ * To extract the affine transformation matrix, see toMat();
130
+ *
131
+ * To extract the instance of Affine3, see toAffine3();
132
+ *
133
+ * If two quaternions \f$q_0, q_1\f$ are needed to be interpolated, you can use sclerp()
134
+ * ```
135
+ * DualQuatd::sclerp(q0, q1, t)
136
+ * ```
137
+ * or dqblend().
138
+ * ```
139
+ * DualQuatd::dqblend(q0, q1, t)
140
+ * ```
141
+ * With more than two dual quaternions to be blended, you can use generalize linear dual quaternion blending
142
+ * with the corresponding weights, i.e. gdqblend().
143
+ *
144
+ */
145
+ template <typename _Tp>
146
+ class CV_EXPORTS DualQuat{
147
+ static_assert(std::is_floating_point<_Tp>::value, "Dual quaternion only make sense with type of float or double");
148
+ using value_type = _Tp;
149
+
150
+ public:
151
+ static constexpr _Tp CV_DUAL_QUAT_EPS = (_Tp)1.e-6;
152
+
153
+ DualQuat();
154
+
155
+ /**
156
+ * @brief create from eight same type numbers.
157
+ */
158
+ DualQuat(const _Tp w, const _Tp x, const _Tp y, const _Tp z, const _Tp w_, const _Tp x_, const _Tp y_, const _Tp z_);
159
+
160
+ /**
161
+ * @brief create from a double or float vector.
162
+ */
163
+ DualQuat(const Vec<_Tp, 8> &q);
164
+
165
+ _Tp w, x, y, z, w_, x_, y_, z_;
166
+
167
+ /**
168
+ * @brief create Dual Quaternion from two same type quaternions p and q.
169
+ * A Dual Quaternion \f$\sigma\f$ has the form:
170
+ * \f[\sigma = p + \epsilon q\f]
171
+ * where p and q are defined as follows:
172
+ * \f[\begin{equation}
173
+ * \begin{split}
174
+ * p &= w + x\boldsymbol{i} + y\boldsymbol{j} + z\boldsymbol{k}\\
175
+ * q &= w\_ + x\_\boldsymbol{i} + y\_\boldsymbol{j} + z\_\boldsymbol{k}.
176
+ * \end{split}
177
+ * \end{equation}
178
+ * \f]
179
+ * The p and q are the real part and dual part respectively.
180
+ * @param realPart a quaternion, real part of dual quaternion.
181
+ * @param dualPart a quaternion, dual part of dual quaternion.
182
+ * @sa Quat
183
+ */
184
+ static DualQuat<_Tp> createFromQuat(const Quat<_Tp> &realPart, const Quat<_Tp> &dualPart);
185
+
186
+ /**
187
+ * @brief create a dual quaternion from a rotation angle \f$\theta\f$, a rotation axis
188
+ * \f$\boldsymbol{u}\f$ and a translation \f$\boldsymbol{t}\f$.
189
+ * It generates a dual quaternion \f$\sigma\f$ in the form of
190
+ * \f[\begin{equation}
191
+ * \begin{split}
192
+ * \sigma &= r + \frac{\epsilon}{2}\boldsymbol{t}r \\
193
+ * &= [\cos(\frac{\theta}{2}), \boldsymbol{u}\sin(\frac{\theta}{2})]
194
+ * + \frac{\epsilon}{2}[0, \boldsymbol{t}][[\cos(\frac{\theta}{2}),
195
+ * \boldsymbol{u}\sin(\frac{\theta}{2})]]\\
196
+ * &= \cos(\frac{\theta}{2}) + \boldsymbol{u}\sin(\frac{\theta}{2})
197
+ * + \frac{\epsilon}{2}(-(\boldsymbol{t} \cdot \boldsymbol{u})\sin(\frac{\theta}{2})
198
+ * + \boldsymbol{t}\cos(\frac{\theta}{2}) + \boldsymbol{u} \times \boldsymbol{t} \sin(\frac{\theta}{2})).
199
+ * \end{split}
200
+ * \end{equation}\f]
201
+ * @param angle rotation angle.
202
+ * @param axis rotation axis.
203
+ * @param translation a vector of length 3.
204
+ * @note Axis will be normalized in this function. And translation is applied
205
+ * after the rotation. Use @ref createFromQuat(r, r * t / 2) to create a dual quaternion
206
+ * which translation is applied before rotation.
207
+ * @sa Quat
208
+ */
209
+ static DualQuat<_Tp> createFromAngleAxisTrans(const _Tp angle, const Vec<_Tp, 3> &axis, const Vec<_Tp, 3> &translation);
210
+
211
+ /**
212
+ * @brief Transform this dual quaternion to an affine transformation matrix \f$M\f$.
213
+ * Dual quaternion consists of a rotation \f$r=[a,b,c,d]\f$ and a translation \f$t=[\Delta x,\Delta y,\Delta z]\f$. The
214
+ * affine transformation matrix \f$M\f$ has the form
215
+ * \f[
216
+ * \begin{bmatrix}
217
+ * 1-2(e_2^2 +e_3^2) &2(e_1e_2-e_0e_3) &2(e_0e_2+e_1e_3) &\Delta x\\
218
+ * 2(e_0e_3+e_1e_2) &1-2(e_1^2+e_3^2) &2(e_2e_3-e_0e_1) &\Delta y\\
219
+ * 2(e_1e_3-e_0e_2) &2(e_0e_1+e_2e_3) &1-2(e_1^2-e_2^2) &\Delta z\\
220
+ * 0&0&0&1
221
+ * \end{bmatrix}
222
+ * \f]
223
+ * if A is a matrix consisting of n points to be transformed, this could be achieved by
224
+ * \f[
225
+ * new\_A = M * A
226
+ * \f]
227
+ * where A has the form
228
+ * \f[
229
+ * \begin{bmatrix}
230
+ * x_0& x_1& x_2&...&x_n\\
231
+ * y_0& y_1& y_2&...&y_n\\
232
+ * z_0& z_1& z_2&...&z_n\\
233
+ * 1&1&1&...&1
234
+ * \end{bmatrix}
235
+ * \f]
236
+ * where the same subscript represent the same point. The size of A should be \f$[4,n]\f$.
237
+ * and the same size for matrix new_A.
238
+ * @param _R 4x4 matrix that represents rotations and translation.
239
+ * @note Translation is applied after the rotation. Use createFromQuat(r, r * t / 2) to create
240
+ * a dual quaternion which translation is applied before rotation.
241
+ */
242
+ static DualQuat<_Tp> createFromMat(InputArray _R);
243
+
244
+ /**
245
+ * @brief create dual quaternion from an affine matrix. The definition of affine matrix can refer to createFromMat()
246
+ */
247
+ static DualQuat<_Tp> createFromAffine3(const Affine3<_Tp> &R);
248
+
249
+ /**
250
+ * @brief A dual quaternion is a vector in form of
251
+ * \f[
252
+ * \begin{equation}
253
+ * \begin{split}
254
+ * \sigma &=\boldsymbol{p} + \epsilon \boldsymbol{q}\\
255
+ * &= \cos\hat{\frac{\theta}{2}}+\overline{\hat{l}}\sin\frac{\hat{\theta}}{2}
256
+ * \end{split}
257
+ * \end{equation}
258
+ * \f]
259
+ * where \f$\hat{\theta}\f$ is dual angle and \f$\overline{\hat{l}}\f$ is dual axis:
260
+ * \f[
261
+ * \hat{\theta}=\theta + \epsilon d,\\
262
+ * \overline{\hat{l}}= \hat{l} +\epsilon m.
263
+ * \f]
264
+ * In this representation, \f$\theta\f$ is rotation angle and \f$(\hat{l},m)\f$ is the screw axis, d is the translation distance along the axis.
265
+ *
266
+ * @param angle rotation angle.
267
+ * @param d translation along the rotation axis.
268
+ * @param axis rotation axis represented by quaternion with w = 0.
269
+ * @param moment the moment of line, and it should be orthogonal to axis.
270
+ * @note Translation is applied after the rotation. Use createFromQuat(r, r * t / 2) to create
271
+ * a dual quaternion which translation is applied before rotation.
272
+ */
273
+ static DualQuat<_Tp> createFromPitch(const _Tp angle, const _Tp d, const Vec<_Tp, 3> &axis, const Vec<_Tp, 3> &moment);
274
+
275
+ /**
276
+ * @brief return a quaternion which represent the real part of dual quaternion.
277
+ * The definition of real part is in createFromQuat().
278
+ * @sa createFromQuat, getDualPart
279
+ */
280
+ Quat<_Tp> getRealPart() const;
281
+
282
+ /**
283
+ * @brief return a quaternion which represent the dual part of dual quaternion.
284
+ * The definition of dual part is in createFromQuat().
285
+ * @sa createFromQuat, getRealPart
286
+ */
287
+ Quat<_Tp> getDualPart() const;
288
+
289
+ /**
290
+ * @brief return the conjugate of a dual quaternion.
291
+ * \f[
292
+ * \begin{equation}
293
+ * \begin{split}
294
+ * \sigma^* &= (p + \epsilon q)^*
295
+ * &= (p^* + \epsilon q^*)
296
+ * \end{split}
297
+ * \end{equation}
298
+ * \f]
299
+ * @param dq a dual quaternion.
300
+ */
301
+ template <typename T>
302
+ friend DualQuat<T> conjugate(const DualQuat<T> &dq);
303
+
304
+ /**
305
+ * @brief return the conjugate of a dual quaternion.
306
+ * \f[
307
+ * \begin{equation}
308
+ * \begin{split}
309
+ * \sigma^* &= (p + \epsilon q)^*
310
+ * &= (p^* + \epsilon q^*)
311
+ * \end{split}
312
+ * \end{equation}
313
+ * \f]
314
+ */
315
+ DualQuat<_Tp> conjugate() const;
316
+
317
+ /**
318
+ * @brief return the rotation in quaternion form.
319
+ */
320
+ Quat<_Tp> getRotation(QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const;
321
+
322
+ /**
323
+ * @brief return the translation vector.
324
+ * The rotation \f$r\f$ in this dual quaternion \f$\sigma\f$ is applied before translation \f$t\f$.
325
+ * The dual quaternion \f$\sigma\f$ is defined as
326
+ * \f[\begin{equation}
327
+ * \begin{split}
328
+ * \sigma &= p + \epsilon q \\
329
+ * &= r + \frac{\epsilon}{2}{t}r.
330
+ * \end{split}
331
+ * \end{equation}\f]
332
+ * Thus, the translation can be obtained as follows
333
+ * \f[t = 2qp^*.\f]
334
+ * @param assumeUnit if @ref QUAT_ASSUME_UNIT, this dual quaternion assume to be a unit dual quaternion
335
+ * and this function will save some computations.
336
+ * @note This dual quaternion's translation is applied after the rotation.
337
+ */
338
+ Vec<_Tp, 3> getTranslation(QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const;
339
+
340
+ /**
341
+ * @brief return the norm \f$||\sigma||\f$ of dual quaternion \f$\sigma = p + \epsilon q\f$.
342
+ * \f[
343
+ * \begin{equation}
344
+ * \begin{split}
345
+ * ||\sigma|| &= \sqrt{\sigma * \sigma^*} \\
346
+ * &= ||p|| + \epsilon \frac{p \cdot q}{||p||}.
347
+ * \end{split}
348
+ * \end{equation}
349
+ * \f]
350
+ * Generally speaking, the norm of a not unit dual
351
+ * quaternion is a dual number. For convenience, we return it in the form of a dual quaternion
352
+ * , i.e.
353
+ * \f[ ||\sigma|| = [||p||, 0, 0, 0, \frac{p \cdot q}{||p||}, 0, 0, 0].\f]
354
+ *
355
+ * @note The data type of dual number is dual quaternion.
356
+ */
357
+ DualQuat<_Tp> norm() const;
358
+
359
+ /**
360
+ * @brief return a normalized dual quaternion.
361
+ * A dual quaternion can be expressed as
362
+ * \f[
363
+ * \begin{equation}
364
+ * \begin{split}
365
+ * \sigma &= p + \epsilon q\\
366
+ * &=||\sigma||\left(r+\frac{1}{2}tr\right)
367
+ * \end{split}
368
+ * \end{equation}
369
+ * \f]
370
+ * where \f$r, t\f$ represents the rotation (ordinary quaternion) and translation (pure ordinary quaternion) respectively,
371
+ * and \f$||\sigma||\f$ is the norm of dual quaternion(a dual number).
372
+ * A dual quaternion is unit if and only if
373
+ * \f[
374
+ * ||p||=1, p \cdot q=0
375
+ * \f]
376
+ * where \f$\cdot\f$ means dot product.
377
+ * The process of normalization is
378
+ * \f[
379
+ * \sigma_{u}=\frac{\sigma}{||\sigma||}
380
+ * \f]
381
+ * Next, we simply proof \f$\sigma_u\f$ is a unit dual quaternion:
382
+ * \f[
383
+ * \renewcommand{\Im}{\operatorname{Im}}
384
+ * \begin{equation}
385
+ * \begin{split}
386
+ * \sigma_{u}=\frac{\sigma}{||\sigma||}&=\frac{p + \epsilon q}{||p||+\epsilon\frac{p\cdot q}{||p||}}\\
387
+ * &=\frac{p}{||p||}+\epsilon\left(\frac{q}{||p||}-p\frac{p\cdot q}{||p||^3}\right)\\
388
+ * &=\frac{p}{||p||}+\epsilon\frac{1}{||p||^2}\left(qp^{*}-p\cdot q\right)\frac{p}{||p||}\\
389
+ * &=\frac{p}{||p||}+\epsilon\frac{1}{||p||^2}\Im(qp^*)\frac{p}{||p||}.\\
390
+ * \end{split}
391
+ * \end{equation}
392
+ * \f]
393
+ * As expected, the real part is a rotation and dual part is a pure quaternion.
394
+ */
395
+ DualQuat<_Tp> normalize() const;
396
+
397
+ /**
398
+ * @brief if \f$\sigma = p + \epsilon q\f$ is a dual quaternion, p is not zero,
399
+ * the inverse dual quaternion is
400
+ * \f[\sigma^{-1} = \frac{\sigma^*}{||\sigma||^2}, \f]
401
+ * or equivalentlly,
402
+ * \f[\sigma^{-1} = p^{-1} - \epsilon p^{-1}qp^{-1}.\f]
403
+ * @param dq a dual quaternion.
404
+ * @param assumeUnit if @ref QUAT_ASSUME_UNIT, dual quaternion dq assume to be a unit dual quaternion
405
+ * and this function will save some computations.
406
+ */
407
+ template <typename T>
408
+ friend DualQuat<T> inv(const DualQuat<T> &dq, QuatAssumeType assumeUnit);
409
+
410
+ /**
411
+ * @brief if \f$\sigma = p + \epsilon q\f$ is a dual quaternion, p is not zero,
412
+ * the inverse dual quaternion is
413
+ * \f[\sigma^{-1} = \frac{\sigma^*}{||\sigma||^2}, \f]
414
+ * or equivalentlly,
415
+ * \f[\sigma^{-1} = p^{-1} - \epsilon p^{-1}qp^{-1}.\f]
416
+ * @param assumeUnit if @ref QUAT_ASSUME_UNIT, this dual quaternion assume to be a unit dual quaternion
417
+ * and this function will save some computations.
418
+ */
419
+ DualQuat<_Tp> inv(QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const;
420
+
421
+ /**
422
+ * @brief return the dot product of two dual quaternion.
423
+ * @param p other dual quaternion.
424
+ */
425
+ _Tp dot(DualQuat<_Tp> p) const;
426
+
427
+ /**
428
+ ** @brief return the value of \f$p^t\f$ where p is a dual quaternion.
429
+ * This could be calculated as:
430
+ * \f[
431
+ * p^t = \exp(t\ln p)
432
+ * \f]
433
+ * @param dq a dual quaternion.
434
+ * @param t index of power function.
435
+ * @param assumeUnit if @ref QUAT_ASSUME_UNIT, dual quaternion dq assume to be a unit dual quaternion
436
+ * and this function will save some computations.
437
+ */
438
+ template <typename T>
439
+ friend DualQuat<T> power(const DualQuat<T> &dq, const T t, QuatAssumeType assumeUnit);
440
+
441
+ /**
442
+ ** @brief return the value of \f$p^t\f$ where p is a dual quaternion.
443
+ * This could be calculated as:
444
+ * \f[
445
+ * p^t = \exp(t\ln p)
446
+ * \f]
447
+ *
448
+ * @param t index of power function.
449
+ * @param assumeUnit if @ref QUAT_ASSUME_UNIT, this dual quaternion assume to be a unit dual quaternion
450
+ * and this function will save some computations.
451
+ */
452
+ DualQuat<_Tp> power(const _Tp t, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const;
453
+
454
+ /**
455
+ * @brief return the value of \f$p^q\f$ where p and q are dual quaternions.
456
+ * This could be calculated as:
457
+ * \f[
458
+ * p^q = \exp(q\ln p)
459
+ * \f]
460
+ * @param p a dual quaternion.
461
+ * @param q a dual quaternion.
462
+ * @param assumeUnit if @ref QUAT_ASSUME_UNIT, dual quaternion p assume to be a dual unit quaternion
463
+ * and this function will save some computations.
464
+ */
465
+ template <typename T>
466
+ friend DualQuat<T> power(const DualQuat<T>& p, const DualQuat<T>& q, QuatAssumeType assumeUnit);
467
+
468
+ /**
469
+ * @brief return the value of \f$p^q\f$ where p and q are dual quaternions.
470
+ * This could be calculated as:
471
+ * \f[
472
+ * p^q = \exp(q\ln p)
473
+ * \f]
474
+ *
475
+ * @param q a dual quaternion
476
+ * @param assumeUnit if @ref QUAT_ASSUME_UNIT, this dual quaternion assume to be a dual unit quaternion
477
+ * and this function will save some computations.
478
+ */
479
+ DualQuat<_Tp> power(const DualQuat<_Tp>& q, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const;
480
+
481
+ /**
482
+ * @brief return the value of exponential function value
483
+ * @param dq a dual quaternion.
484
+ */
485
+ template <typename T>
486
+ friend DualQuat<T> exp(const DualQuat<T> &dq);
487
+
488
+ /**
489
+ * @brief return the value of exponential function value
490
+ */
491
+ DualQuat<_Tp> exp() const;
492
+
493
+ /**
494
+ * @brief return the value of logarithm function value
495
+ *
496
+ * @param dq a dual quaternion.
497
+ * @param assumeUnit if @ref QUAT_ASSUME_UNIT, dual quaternion dq assume to be a unit dual quaternion
498
+ * and this function will save some computations.
499
+ */
500
+ template <typename T>
501
+ friend DualQuat<T> log(const DualQuat<T> &dq, QuatAssumeType assumeUnit);
502
+
503
+ /**
504
+ * @brief return the value of logarithm function value
505
+ * @param assumeUnit if @ref QUAT_ASSUME_UNIT, this dual quaternion assume to be a unit dual quaternion
506
+ * and this function will save some computations.
507
+ */
508
+ DualQuat<_Tp> log(QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const;
509
+
510
+ /**
511
+ * @brief Transform this dual quaternion to a vector.
512
+ */
513
+ Vec<_Tp, 8> toVec() const;
514
+
515
+ /**
516
+ * @brief Transform this dual quaternion to a affine transformation matrix
517
+ * the form of matrix, see createFromMat().
518
+ */
519
+ Matx<_Tp, 4, 4> toMat(QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const;
520
+
521
+ /**
522
+ * @brief Transform this dual quaternion to a instance of Affine3.
523
+ */
524
+ Affine3<_Tp> toAffine3(QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const;
525
+
526
+ /**
527
+ * @brief The screw linear interpolation(ScLERP) is an extension of spherical linear interpolation of dual quaternion.
528
+ * If \f$\sigma_1\f$ and \f$\sigma_2\f$ are two dual quaternions representing the initial and final pose.
529
+ * The interpolation of ScLERP function can be defined as:
530
+ * \f[
531
+ * ScLERP(t;\sigma_1,\sigma_2) = \sigma_1 * (\sigma_1^{-1} * \sigma_2)^t, t\in[0,1]
532
+ * \f]
533
+ *
534
+ * @param q1 a dual quaternion represents a initial pose.
535
+ * @param q2 a dual quaternion represents a final pose.
536
+ * @param t interpolation parameter
537
+ * @param directChange if true, it always return the shortest path.
538
+ * @param assumeUnit if @ref QUAT_ASSUME_UNIT, this dual quaternion assume to be a unit dual quaternion
539
+ * and this function will save some computations.
540
+ *
541
+ * For example
542
+ * ```
543
+ * double angle1 = CV_PI / 2;
544
+ * Vec3d axis{0, 0, 1};
545
+ * Vec3d t(0, 0, 3);
546
+ * DualQuatd initial = DualQuatd::createFromAngleAxisTrans(angle1, axis, t);
547
+ * double angle2 = CV_PI;
548
+ * DualQuatd final = DualQuatd::createFromAngleAxisTrans(angle2, axis, t);
549
+ * DualQuatd inter = DualQuatd::sclerp(initial, final, 0.5);
550
+ * ```
551
+ */
552
+ static DualQuat<_Tp> sclerp(const DualQuat<_Tp> &q1, const DualQuat<_Tp> &q2, const _Tp t,
553
+ bool directChange=true, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT);
554
+ /**
555
+ * @brief The method of Dual Quaternion linear Blending(DQB) is to compute a transformation between dual quaternion
556
+ * \f$q_1\f$ and \f$q_2\f$ and can be defined as:
557
+ * \f[
558
+ * DQB(t;{\boldsymbol{q}}_1,{\boldsymbol{q}}_2)=
559
+ * \frac{(1-t){\boldsymbol{q}}_1+t{\boldsymbol{q}}_2}{||(1-t){\boldsymbol{q}}_1+t{\boldsymbol{q}}_2||}.
560
+ * \f]
561
+ * where \f$q_1\f$ and \f$q_2\f$ are unit dual quaternions representing the input transformations.
562
+ * If you want to use DQB that works for more than two rigid transformations, see @ref gdqblend
563
+ *
564
+ * @param q1 a unit dual quaternion representing the input transformations.
565
+ * @param q2 a unit dual quaternion representing the input transformations.
566
+ * @param t parameter \f$t\in[0,1]\f$.
567
+ * @param assumeUnit if @ref QUAT_ASSUME_UNIT, this dual quaternion assume to be a unit dual quaternion
568
+ * and this function will save some computations.
569
+ *
570
+ * @sa gdqblend
571
+ */
572
+ static DualQuat<_Tp> dqblend(const DualQuat<_Tp> &q1, const DualQuat<_Tp> &q2, const _Tp t,
573
+ QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT);
574
+
575
+ /**
576
+ * @brief The generalized Dual Quaternion linear Blending works for more than two rigid transformations.
577
+ * If these transformations are expressed as unit dual quaternions \f$q_1,...,q_n\f$ with convex weights
578
+ * \f$w = (w_1,...,w_n)\f$, the generalized DQB is simply
579
+ * \f[
580
+ * gDQB(\boldsymbol{w};{\boldsymbol{q}}_1,...,{\boldsymbol{q}}_n)=\frac{w_1{\boldsymbol{q}}_1+...+w_n{\boldsymbol{q}}_n}
581
+ * {||w_1{\boldsymbol{q}}_1+...+w_n{\boldsymbol{q}}_n||}.
582
+ * \f]
583
+ * @param dualquat vector of dual quaternions
584
+ * @param weights vector of weights, the size of weights should be the same as dualquat, and the weights should
585
+ * satisfy \f$\sum_0^n w_{i} = 1\f$ and \f$w_i>0\f$.
586
+ * @param assumeUnit if @ref QUAT_ASSUME_UNIT, these dual quaternions assume to be unit quaternions
587
+ * and this function will save some computations.
588
+ * @note the type of weights' element should be the same as the date type of dual quaternion inside the dualquat.
589
+ */
590
+ template <int cn>
591
+ static DualQuat<_Tp> gdqblend(const Vec<DualQuat<_Tp>, cn> &dualquat, InputArray weights,
592
+ QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT);
593
+
594
+ /**
595
+ * @brief The generalized Dual Quaternion linear Blending works for more than two rigid transformations.
596
+ * If these transformations are expressed as unit dual quaternions \f$q_1,...,q_n\f$ with convex weights
597
+ * \f$w = (w_1,...,w_n)\f$, the generalized DQB is simply
598
+ * \f[
599
+ * gDQB(\boldsymbol{w};{\boldsymbol{q}}_1,...,{\boldsymbol{q}}_n)=\frac{w_1{\boldsymbol{q}}_1+...+w_n{\boldsymbol{q}}_n}
600
+ * {||w_1{\boldsymbol{q}}_1+...+w_n{\boldsymbol{q}}_n||}.
601
+ * \f]
602
+ * @param dualquat The dual quaternions which have 8 channels and 1 row or 1 col.
603
+ * @param weights vector of weights, the size of weights should be the same as dualquat, and the weights should
604
+ * satisfy \f$\sum_0^n w_{i} = 1\f$ and \f$w_i>0\f$.
605
+ * @param assumeUnit if @ref QUAT_ASSUME_UNIT, these dual quaternions assume to be unit quaternions
606
+ * and this function will save some computations.
607
+ * @note the type of weights' element should be the same as the date type of dual quaternion inside the dualquat.
608
+ */
609
+ static DualQuat<_Tp> gdqblend(InputArray dualquat, InputArray weights,
610
+ QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT);
611
+
612
+ /**
613
+ * @brief Return opposite dual quaternion \f$-p\f$
614
+ * which satisfies \f$p + (-p) = 0.\f$
615
+ *
616
+ * For example
617
+ * ```
618
+ * DualQuatd q{1, 2, 3, 4, 5, 6, 7, 8};
619
+ * std::cout << -q << std::endl; // [-1, -2, -3, -4, -5, -6, -7, -8]
620
+ * ```
621
+ */
622
+ DualQuat<_Tp> operator-() const;
623
+
624
+ /**
625
+ * @brief return true if two dual quaternions p and q are nearly equal, i.e. when the absolute
626
+ * value of each \f$p_i\f$ and \f$q_i\f$ is less than CV_DUAL_QUAT_EPS.
627
+ */
628
+ bool operator==(const DualQuat<_Tp>&) const;
629
+
630
+ /**
631
+ * @brief Subtraction operator of two dual quaternions p and q.
632
+ * It returns a new dual quaternion that each value is the sum of \f$p_i\f$ and \f$-q_i\f$.
633
+ *
634
+ * For example
635
+ * ```
636
+ * DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
637
+ * DualQuatd q{5, 6, 7, 8, 9, 10, 11, 12};
638
+ * std::cout << p - q << std::endl; //[-4, -4, -4, -4, 4, -4, -4, -4]
639
+ * ```
640
+ */
641
+ DualQuat<_Tp> operator-(const DualQuat<_Tp>&) const;
642
+
643
+ /**
644
+ * @brief Subtraction assignment operator of two dual quaternions p and q.
645
+ * It subtracts right operand from the left operand and assign the result to left operand.
646
+ *
647
+ * For example
648
+ * ```
649
+ * DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
650
+ * DualQuatd q{5, 6, 7, 8, 9, 10, 11, 12};
651
+ * p -= q; // equivalent to p = p - q
652
+ * std::cout << p << std::endl; //[-4, -4, -4, -4, 4, -4, -4, -4]
653
+ *
654
+ * ```
655
+ */
656
+ DualQuat<_Tp>& operator-=(const DualQuat<_Tp>&);
657
+
658
+ /**
659
+ * @brief Addition operator of two dual quaternions p and q.
660
+ * It returns a new dual quaternion that each value is the sum of \f$p_i\f$ and \f$q_i\f$.
661
+ *
662
+ * For example
663
+ * ```
664
+ * DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
665
+ * DualQuatd q{5, 6, 7, 8, 9, 10, 11, 12};
666
+ * std::cout << p + q << std::endl; //[6, 8, 10, 12, 14, 16, 18, 20]
667
+ * ```
668
+ */
669
+ DualQuat<_Tp> operator+(const DualQuat<_Tp>&) const;
670
+
671
+ /**
672
+ * @brief Addition assignment operator of two dual quaternions p and q.
673
+ * It adds right operand to the left operand and assign the result to left operand.
674
+ *
675
+ * For example
676
+ * ```
677
+ * DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
678
+ * DualQuatd q{5, 6, 7, 8, 9, 10, 11, 12};
679
+ * p += q; // equivalent to p = p + q
680
+ * std::cout << p << std::endl; //[6, 8, 10, 12, 14, 16, 18, 20]
681
+ *
682
+ * ```
683
+ */
684
+ DualQuat<_Tp>& operator+=(const DualQuat<_Tp>&);
685
+
686
+ /**
687
+ * @brief Multiplication assignment operator of two quaternions.
688
+ * It multiplies right operand with the left operand and assign the result to left operand.
689
+ *
690
+ * Rule of dual quaternion multiplication:
691
+ * The dual quaternion can be written as an ordered pair of quaternions [A, B]. Thus
692
+ * \f[
693
+ * \begin{equation}
694
+ * \begin{split}
695
+ * p * q &= [A, B][C, D]\\
696
+ * &=[AC, AD + BC]
697
+ * \end{split}
698
+ * \end{equation}
699
+ * \f]
700
+ *
701
+ * For example
702
+ * ```
703
+ * DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
704
+ * DualQuatd q{5, 6, 7, 8, 9, 10, 11, 12};
705
+ * p *= q;
706
+ * std::cout << p << std::endl; //[-60, 12, 30, 24, -216, 80, 124, 120]
707
+ * ```
708
+ */
709
+ DualQuat<_Tp>& operator*=(const DualQuat<_Tp>&);
710
+
711
+ /**
712
+ * @brief Multiplication assignment operator of a quaternions and a scalar.
713
+ * It multiplies right operand with the left operand and assign the result to left operand.
714
+ *
715
+ * Rule of dual quaternion multiplication with a scalar:
716
+ * \f[
717
+ * \begin{equation}
718
+ * \begin{split}
719
+ * p * s &= [w, x, y, z, w\_, x\_, y\_, z\_] * s\\
720
+ * &=[w s, x s, y s, z s, w\_ \space s, x\_ \space s, y\_ \space s, z\_ \space s].
721
+ * \end{split}
722
+ * \end{equation}
723
+ * \f]
724
+ *
725
+ * For example
726
+ * ```
727
+ * DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
728
+ * double s = 2.0;
729
+ * p *= s;
730
+ * std::cout << p << std::endl; //[2, 4, 6, 8, 10, 12, 14, 16]
731
+ * ```
732
+ * @note the type of scalar should be equal to the dual quaternion.
733
+ */
734
+ DualQuat<_Tp> operator*=(const _Tp s);
735
+
736
+
737
+ /**
738
+ * @brief Multiplication operator of two dual quaternions q and p.
739
+ * Multiplies values on either side of the operator.
740
+ *
741
+ * Rule of dual quaternion multiplication:
742
+ * The dual quaternion can be written as an ordered pair of quaternions [A, B]. Thus
743
+ * \f[
744
+ * \begin{equation}
745
+ * \begin{split}
746
+ * p * q &= [A, B][C, D]\\
747
+ * &=[AC, AD + BC]
748
+ * \end{split}
749
+ * \end{equation}
750
+ * \f]
751
+ *
752
+ * For example
753
+ * ```
754
+ * DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
755
+ * DualQuatd q{5, 6, 7, 8, 9, 10, 11, 12};
756
+ * std::cout << p * q << std::endl; //[-60, 12, 30, 24, -216, 80, 124, 120]
757
+ * ```
758
+ */
759
+ DualQuat<_Tp> operator*(const DualQuat<_Tp>&) const;
760
+
761
+ /**
762
+ * @brief Division operator of a dual quaternions and a scalar.
763
+ * It divides left operand with the right operand and assign the result to left operand.
764
+ *
765
+ * Rule of dual quaternion division with a scalar:
766
+ * \f[
767
+ * \begin{equation}
768
+ * \begin{split}
769
+ * p / s &= [w, x, y, z, w\_, x\_, y\_, z\_] / s\\
770
+ * &=[w/s, x/s, y/s, z/s, w\_/s, x\_/s, y\_/s, z\_/s].
771
+ * \end{split}
772
+ * \end{equation}
773
+ * \f]
774
+ *
775
+ * For example
776
+ * ```
777
+ * DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
778
+ * double s = 2.0;
779
+ * p /= s; // equivalent to p = p / s
780
+ * std::cout << p << std::endl; //[0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4]
781
+ * ```
782
+ * @note the type of scalar should be equal to this dual quaternion.
783
+ */
784
+ DualQuat<_Tp> operator/(const _Tp s) const;
785
+
786
+ /**
787
+ * @brief Division operator of two dual quaternions p and q.
788
+ * Divides left hand operand by right hand operand.
789
+ *
790
+ * Rule of dual quaternion division with a dual quaternion:
791
+ * \f[
792
+ * \begin{equation}
793
+ * \begin{split}
794
+ * p / q &= p * q.inv()\\
795
+ * \end{split}
796
+ * \end{equation}
797
+ * \f]
798
+ *
799
+ * For example
800
+ * ```
801
+ * DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
802
+ * DualQuatd q{5, 6, 7, 8, 9, 10, 11, 12};
803
+ * std::cout << p / q << std::endl; // equivalent to p * q.inv()
804
+ * ```
805
+ */
806
+ DualQuat<_Tp> operator/(const DualQuat<_Tp>&) const;
807
+
808
+ /**
809
+ * @brief Division assignment operator of two dual quaternions p and q;
810
+ * It divides left operand with the right operand and assign the result to left operand.
811
+ *
812
+ * Rule of dual quaternion division with a quaternion:
813
+ * \f[
814
+ * \begin{equation}
815
+ * \begin{split}
816
+ * p / q&= p * q.inv()\\
817
+ * \end{split}
818
+ * \end{equation}
819
+ * \f]
820
+ *
821
+ * For example
822
+ * ```
823
+ * DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
824
+ * DualQuatd q{5, 6, 7, 8, 9, 10, 11, 12};
825
+ * p /= q; // equivalent to p = p * q.inv()
826
+ * std::cout << p << std::endl;
827
+ * ```
828
+ */
829
+ DualQuat<_Tp>& operator/=(const DualQuat<_Tp>&);
830
+
831
+ /**
832
+ * @brief Division assignment operator of a dual quaternions and a scalar.
833
+ * It divides left operand with the right operand and assign the result to left operand.
834
+ *
835
+ * Rule of dual quaternion division with a scalar:
836
+ * \f[
837
+ * \begin{equation}
838
+ * \begin{split}
839
+ * p / s &= [w, x, y, z, w\_, x\_, y\_ ,z\_] / s\\
840
+ * &=[w / s, x / s, y / s, z / s, w\_ / \space s, x\_ / \space s, y\_ / \space s, z\_ / \space s].
841
+ * \end{split}
842
+ * \end{equation}
843
+ * \f]
844
+ *
845
+ * For example
846
+ * ```
847
+ * DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
848
+ * double s = 2.0;;
849
+ * p /= s; // equivalent to p = p / s
850
+ * std::cout << p << std::endl; //[0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0]
851
+ * ```
852
+ * @note the type of scalar should be equal to the dual quaternion.
853
+ */
854
+ Quat<_Tp>& operator/=(const _Tp s);
855
+
856
+ /**
857
+ * @brief Addition operator of a scalar and a dual quaternions.
858
+ * Adds right hand operand from left hand operand.
859
+ *
860
+ * For example
861
+ * ```
862
+ * DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
863
+ * double scalar = 2.0;
864
+ * std::cout << scalar + p << std::endl; //[3.0, 2, 3, 4, 5, 6, 7, 8]
865
+ * ```
866
+ * @note the type of scalar should be equal to the dual quaternion.
867
+ */
868
+ template <typename T>
869
+ friend DualQuat<T> cv::operator+(const T s, const DualQuat<T>&);
870
+
871
+ /**
872
+ * @brief Addition operator of a dual quaternions and a scalar.
873
+ * Adds right hand operand from left hand operand.
874
+ *
875
+ * For example
876
+ * ```
877
+ * DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
878
+ * double scalar = 2.0;
879
+ * std::cout << p + scalar << std::endl; //[3.0, 2, 3, 4, 5, 6, 7, 8]
880
+ * ```
881
+ * @note the type of scalar should be equal to the dual quaternion.
882
+ */
883
+ template <typename T>
884
+ friend DualQuat<T> cv::operator+(const DualQuat<T>&, const T s);
885
+
886
+ /**
887
+ * @brief Multiplication operator of a scalar and a dual quaternions.
888
+ * It multiplies right operand with the left operand and assign the result to left operand.
889
+ *
890
+ * Rule of dual quaternion multiplication with a scalar:
891
+ * \f[
892
+ * \begin{equation}
893
+ * \begin{split}
894
+ * p * s &= [w, x, y, z, w\_, x\_, y\_, z\_] * s\\
895
+ * &=[w s, x s, y s, z s, w\_ \space s, x\_ \space s, y\_ \space s, z\_ \space s].
896
+ * \end{split}
897
+ * \end{equation}
898
+ * \f]
899
+ *
900
+ * For example
901
+ * ```
902
+ * DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
903
+ * double s = 2.0;
904
+ * std::cout << s * p << std::endl; //[2, 4, 6, 8, 10, 12, 14, 16]
905
+ * ```
906
+ * @note the type of scalar should be equal to the dual quaternion.
907
+ */
908
+ template <typename T>
909
+ friend DualQuat<T> cv::operator*(const T s, const DualQuat<T>&);
910
+
911
+ /**
912
+ * @brief Subtraction operator of a dual quaternion and a scalar.
913
+ * Subtracts right hand operand from left hand operand.
914
+ *
915
+ * For example
916
+ * ```
917
+ * DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
918
+ * double scalar = 2.0;
919
+ * std::cout << p - scalar << std::endl; //[-1, 2, 3, 4, 5, 6, 7, 8]
920
+ * ```
921
+ * @note the type of scalar should be equal to the dual quaternion.
922
+ */
923
+ template <typename T>
924
+ friend DualQuat<T> cv::operator-(const DualQuat<T>&, const T s);
925
+
926
+ /**
927
+ * @brief Subtraction operator of a scalar and a dual quaternions.
928
+ * Subtracts right hand operand from left hand operand.
929
+ *
930
+ * For example
931
+ * ```
932
+ * DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
933
+ * double scalar = 2.0;
934
+ * std::cout << scalar - p << std::endl; //[1.0, -2, -3, -4, -5, -6, -7, -8]
935
+ * ```
936
+ * @note the type of scalar should be equal to the dual quaternion.
937
+ */
938
+ template <typename T>
939
+ friend DualQuat<T> cv::operator-(const T s, const DualQuat<T>&);
940
+
941
+ /**
942
+ * @brief Multiplication operator of a dual quaternions and a scalar.
943
+ * It multiplies right operand with the left operand and assign the result to left operand.
944
+ *
945
+ * Rule of dual quaternion multiplication with a scalar:
946
+ * \f[
947
+ * \begin{equation}
948
+ * \begin{split}
949
+ * p * s &= [w, x, y, z, w\_, x\_, y\_, z\_] * s\\
950
+ * &=[w s, x s, y s, z s, w\_ \space s, x\_ \space s, y\_ \space s, z\_ \space s].
951
+ * \end{split}
952
+ * \end{equation}
953
+ * \f]
954
+ *
955
+ * For example
956
+ * ```
957
+ * DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
958
+ * double s = 2.0;
959
+ * std::cout << p * s << std::endl; //[2, 4, 6, 8, 10, 12, 14, 16]
960
+ * ```
961
+ * @note the type of scalar should be equal to the dual quaternion.
962
+ */
963
+ template <typename T>
964
+ friend DualQuat<T> cv::operator*(const DualQuat<T>&, const T s);
965
+
966
+ template <typename S>
967
+ friend std::ostream& cv::operator<<(std::ostream&, const DualQuat<S>&);
968
+
969
+ };
970
+
971
+ using DualQuatd = DualQuat<double>;
972
+ using DualQuatf = DualQuat<float>;
973
+
974
+ //! @} core
975
+ }//namespace
976
+
977
+ #include "dualquaternion.inl.hpp"
978
+
979
+ #endif /* OPENCV_CORE_QUATERNION_HPP */