EstervQrCode 1.1.1
Library for qr code manipulation
dualquaternion.inl.hpp
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 
27 #ifndef OPENCV_CORE_DUALQUATERNION_INL_HPP
28 #define OPENCV_CORE_DUALQUATERNION_INL_HPP
29 
30 #ifndef OPENCV_CORE_DUALQUATERNION_HPP
31 #error This is not a standalone header. Include dualquaternion.hpp instead.
32 #endif
33 
35 //Implementation
36 namespace cv {
37 
38 template <typename T>
39 DualQuat<T>::DualQuat():w(0), x(0), y(0), z(0), w_(0), x_(0), y_(0), z_(0){}
40 
41 template <typename T>
42 DualQuat<T>::DualQuat(const T vw, const T vx, const T vy, const T vz, const T _w, const T _x, const T _y, const T _z):
43  w(vw), x(vx), y(vy), z(vz), w_(_w), x_(_x), y_(_y), z_(_z){}
44 
45 template <typename T>
46 DualQuat<T>::DualQuat(const Vec<T, 8> &q):w(q[0]), x(q[1]), y(q[2]), z(q[3]),
47  w_(q[4]), x_(q[5]), y_(q[6]), z_(q[7]){}
48 
49 template <typename T>
50 DualQuat<T> DualQuat<T>::createFromQuat(const Quat<T> &realPart, const Quat<T> &dualPart)
51 {
52  T w = realPart.w;
53  T x = realPart.x;
54  T y = realPart.y;
55  T z = realPart.z;
56  T w_ = dualPart.w;
57  T x_ = dualPart.x;
58  T y_ = dualPart.y;
59  T z_ = dualPart.z;
60  return DualQuat<T>(w, x, y, z, w_, x_, y_, z_);
61 }
62 
63 template <typename T>
65 {
67  Quat<T> t{0, trans[0], trans[1], trans[2]};
68  return createFromQuat(r, t * r * T(0.5));
69 }
70 
71 template <typename T>
73 {
74  CV_CheckTypeEQ(_R.type(), cv::traits::Type<T>::value, "");
75  if (_R.size() != Size(4, 4))
76  {
77  CV_Error(Error::StsBadArg, "The input matrix must have 4 columns and 4 rows");
78  }
79  Mat R = _R.getMat();
80  Quat<T> r = Quat<T>::createFromRotMat(R.colRange(0, 3).rowRange(0, 3));
81  Quat<T> trans(0, R.at<T>(0, 3), R.at<T>(1, 3), R.at<T>(2, 3));
82  return createFromQuat(r, trans * r * T(0.5));
83 }
84 
85 template <typename T>
87 {
88  return createFromMat(R.matrix);
89 }
90 
91 template <typename T>
92 DualQuat<T> DualQuat<T>::createFromPitch(const T angle, const T d, const Vec<T, 3> &axis, const Vec<T, 3> &moment)
93 {
94  T half_angle = angle * T(0.5), half_d = d * T(0.5);
95  Quat<T> qaxis = Quat<T>(0, axis[0], axis[1], axis[2]).normalize();
96  Quat<T> qmoment = Quat<T>(0, moment[0], moment[1], moment[2]);
97  qmoment -= qaxis * axis.dot(moment);
98  Quat<T> dual = -half_d * std::sin(half_angle) + std::sin(half_angle) * qmoment +
99  half_d * std::cos(half_angle) * qaxis;
100  return createFromQuat(Quat<T>::createFromAngleAxis(angle, axis), dual);
101 }
102 
103 template <typename T>
104 inline bool DualQuat<T>::operator==(const DualQuat<T> &q) const
105 {
106  return (abs(w - q.w) < CV_DUAL_QUAT_EPS && abs(x - q.x) < CV_DUAL_QUAT_EPS &&
107  abs(y - q.y) < CV_DUAL_QUAT_EPS && abs(z - q.z) < CV_DUAL_QUAT_EPS &&
108  abs(w_ - q.w_) < CV_DUAL_QUAT_EPS && abs(x_ - q.x_) < CV_DUAL_QUAT_EPS &&
109  abs(y_ - q.y_) < CV_DUAL_QUAT_EPS && abs(z_ - q.z_) < CV_DUAL_QUAT_EPS);
110 }
111 
112 template <typename T>
114 {
115  return Quat<T>(w, x, y, z);
116 }
117 
118 template <typename T>
120 {
121  return Quat<T>(w_, x_, y_, z_);
122 }
123 
124 template <typename T>
126 {
127  return dq.conjugate();
128 }
129 
130 template <typename T>
132 {
133  return DualQuat<T>(w, -x, -y, -z, w_, -x_, -y_, -z_);
134 }
135 
136 template <typename T>
138 {
139  Quat<T> real = getRealPart();
140  T realNorm = real.norm();
141  Quat<T> dual = getDualPart();
142  if (realNorm < CV_DUAL_QUAT_EPS){
143  return DualQuat<T>(0, 0, 0, 0, 0, 0, 0, 0);
144  }
145  return DualQuat<T>(realNorm, 0, 0, 0, real.dot(dual) / realNorm, 0, 0, 0);
146 }
147 
148 template <typename T>
150 {
151  if (assumeUnit)
152  {
153  return getRealPart();
154  }
155  return getRealPart().normalize();
156 }
157 
158 template <typename T>
160 {
161  Quat<T> trans = T(2.0) * (getDualPart() * getRealPart().inv(assumeUnit));
162  return Vec<T, 3>{trans[1], trans[2], trans[3]};
163 }
164 
165 template <typename T>
167 {
168  Quat<T> p = getRealPart();
169  Quat<T> q = getDualPart();
170  T p_norm = p.norm();
171  if (p_norm < CV_DUAL_QUAT_EPS)
172  {
173  CV_Error(Error::StsBadArg, "Cannot normalize this dual quaternion: the norm is too small.");
174  }
175  Quat<T> p_nr = p / p_norm;
176  Quat<T> q_nr = q / p_norm;
177  return createFromQuat(p_nr, q_nr - p_nr * p_nr.dot(q_nr));
178 }
179 
180 template <typename T>
182 {
183  return q.w * w + q.x * x + q.y * y + q.z * z + q.w_ * w_ + q.x_ * x_ + q.y_ * y_ + q.z_ * z_;
184 }
185 
186 template <typename T>
188 {
189  return dq.inv(assumeUnit);
190 }
191 
192 template <typename T>
194 {
195  Quat<T> real = getRealPart();
196  Quat<T> dual = getDualPart();
197  return createFromQuat(real.inv(assumeUnit), -real.inv(assumeUnit) * dual * real.inv(assumeUnit));
198 }
199 
200 template <typename T>
201 inline DualQuat<T> DualQuat<T>::operator-(const DualQuat<T> &q) const
202 {
203  return DualQuat<T>(w - q.w, x - q.x, y - q.y, z - q.z, w_ - q.w_, x_ - q.x_, y_ - q.y_, z_ - q.z_);
204 }
205 
206 template <typename T>
208 {
209  return DualQuat<T>(-w, -x, -y, -z, -w_, -x_, -y_, -z_);
210 }
211 
212 template <typename T>
214 {
215  return DualQuat<T>(w + q.w, x + q.x, y + q.y, z + q.z, w_ + q.w_, x_ + q.x_, y_ + q.y_, z_ + q.z_);
216 }
217 
218 template <typename T>
220 {
221  *this = *this + q;
222  return *this;
223 }
224 
225 template <typename T>
227 {
228  Quat<T> A = getRealPart();
229  Quat<T> B = getDualPart();
230  Quat<T> C = q.getRealPart();
231  Quat<T> D = q.getDualPart();
232  return DualQuat<T>::createFromQuat(A * C, A * D + B * C);
233 }
234 
235 template <typename T>
237 {
238  *this = *this * q;
239  return *this;
240 }
241 
242 template <typename T>
243 inline DualQuat<T> operator+(const T a, const DualQuat<T> &q)
244 {
245  return DualQuat<T>(a + q.w, q.x, q.y, q.z, q.w_, q.x_, q.y_, q.z_);
246 }
247 
248 template <typename T>
249 inline DualQuat<T> operator+(const DualQuat<T> &q, const T a)
250 {
251  return DualQuat<T>(a + q.w, q.x, q.y, q.z, q.w_, q.x_, q.y_, q.z_);
252 }
253 
254 template <typename T>
255 inline DualQuat<T> operator-(const DualQuat<T> &q, const T a)
256 {
257  return DualQuat<T>(q.w - a, q.x, q.y, q.z, q.w_, q.x_, q.y_, q.z_);
258 }
259 
260 template <typename T>
262 {
263  *this = *this - q;
264  return *this;
265 }
266 
267 template <typename T>
268 inline DualQuat<T> operator-(const T a, const DualQuat<T> &q)
269 {
270  return DualQuat<T>(a - q.w, -q.x, -q.y, -q.z, -q.w_, -q.x_, -q.y_, -q.z_);
271 }
272 
273 template <typename T>
274 inline DualQuat<T> operator*(const T a, const DualQuat<T> &q)
275 {
276  return DualQuat<T>(q.w * a, q.x * a, q.y * a, q.z * a, q.w_ * a, q.x_ * a, q.y_ * a, q.z_ * a);
277 }
278 
279 template <typename T>
280 inline DualQuat<T> operator*(const DualQuat<T> &q, const T a)
281 {
282  return DualQuat<T>(q.w * a, q.x * a, q.y * a, q.z * a, q.w_ * a, q.x_ * a, q.y_ * a, q.z_ * a);
283 }
284 
285 template <typename T>
286 inline DualQuat<T> DualQuat<T>::operator/(const T a) const
287 {
288  return DualQuat<T>(w / a, x / a, y / a, z / a, w_ / a, x_ / a, y_ / a, z_ / a);
289 }
290 
291 template <typename T>
292 inline DualQuat<T> DualQuat<T>::operator/(const DualQuat<T> &q) const
293 {
294  return *this * q.inv();
295 }
296 
297 template <typename T>
298 inline DualQuat<T>& DualQuat<T>::operator/=(const DualQuat<T> &q)
299 {
300  *this = *this / q;
301  return *this;
302 }
303 
304 template <typename T>
306 {
307  os << "DualQuat " << Vec<T, 8>{q.w, q.x, q.y, q.z, q.w_, q.x_, q.y_, q.z_};
308  return os;
309 }
310 
311 template <typename T>
312 inline DualQuat<T> exp(const DualQuat<T> &dq)
313 {
314  return dq.exp();
315 }
316 
317 namespace detail {
318 
319 template <typename _Tp>
321 {
322  _Tp nv = std::sqrt(q.x * q.x + q.y * q.y + q.z * q.z);
323  _Tp sinc_nv = abs(nv) < cv::DualQuat<_Tp>::CV_DUAL_QUAT_EPS ? _Tp(1.0) - nv * nv * _Tp(1.0/6.0) : std::sin(nv) / nv;
324  _Tp csiii_nv = abs(nv) < cv::DualQuat<_Tp>::CV_DUAL_QUAT_EPS ? -_Tp(1.0/3.0) : (std::cos(nv) - sinc_nv) / nv / nv;
325  Matx<_Tp, 4, 4> J_exp_quat {
326  std::cos(nv), -sinc_nv * q.x, -sinc_nv * q.y, -sinc_nv * q.z,
327  sinc_nv * q.x, csiii_nv * q.x * q.x + sinc_nv, csiii_nv * q.x * q.y, csiii_nv * q.x * q.z,
328  sinc_nv * q.y, csiii_nv * q.y * q.x, csiii_nv * q.y * q.y + sinc_nv, csiii_nv * q.y * q.z,
329  sinc_nv * q.z, csiii_nv * q.z * q.x, csiii_nv * q.z * q.y, csiii_nv * q.z * q.z + sinc_nv
330  };
331  return std::exp(q.w) * J_exp_quat;
332 }
333 
334 } // namespace detail
335 
336 template <typename T>
338 {
339  Quat<T> real = getRealPart();
340  return createFromQuat(real.exp(), Quat<T>(detail::jacob_exp(real) * getDualPart().toVec()));
341 }
342 
343 template <typename T>
345 {
346  return dq.log(assumeUnit);
347 }
348 
349 template <typename T>
351 {
352  Quat<T> plog = getRealPart().log(assumeUnit);
353  Matx<T, 4, 4> jacob = detail::jacob_exp(plog);
354  return createFromQuat(plog, Quat<T>(jacob.inv() * getDualPart().toVec()));
355 }
356 
357 template <typename T>
358 inline DualQuat<T> power(const DualQuat<T> &dq, const T t, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT)
359 {
360  return dq.power(t, assumeUnit);
361 }
362 
363 template <typename T>
364 inline DualQuat<T> DualQuat<T>::power(const T t, QuatAssumeType assumeUnit) const
365 {
366  return (t * log(assumeUnit)).exp();
367 }
368 
369 template <typename T>
371 {
372  return p.power(q, assumeUnit);
373 }
374 
375 template <typename T>
376 inline DualQuat<T> DualQuat<T>::power(const DualQuat<T> &q, QuatAssumeType assumeUnit) const
377 {
378  return (q * log(assumeUnit)).exp();
379 }
380 
381 template <typename T>
383 {
384  return Vec<T, 8>(w, x, y, z, w_, x_, y_, z_);
385 }
386 
387 template <typename T>
388 Affine3<T> DualQuat<T>::toAffine3(QuatAssumeType assumeUnit) const
389 {
390  return Affine3<T>(toMat(assumeUnit));
391 }
392 
393 template <typename T>
395 {
396  Matx<T, 4, 4> rot44 = getRotation(assumeUnit).toRotMat4x4();
397  Vec<T, 3> translation = getTranslation(assumeUnit);
398  rot44(0, 3) = translation[0];
399  rot44(1, 3) = translation[1];
400  rot44(2, 3) = translation[2];
401  return rot44;
402 }
403 
404 template <typename T>
405 DualQuat<T> DualQuat<T>::sclerp(const DualQuat<T> &q0, const DualQuat<T> &q1, const T t, bool directChange, QuatAssumeType assumeUnit)
406 {
407  DualQuat<T> v0(q0), v1(q1);
408  if (!assumeUnit)
409  {
410  v0 = v0.normalize();
411  v1 = v1.normalize();
412  }
413  Quat<T> v0Real = v0.getRealPart();
414  Quat<T> v1Real = v1.getRealPart();
415  if (directChange && v1Real.dot(v0Real) < 0)
416  {
417  v0 = -v0;
418  }
419  DualQuat<T> v0inv1 = v0.inv() * v1;
420  return v0 * v0inv1.power(t, QUAT_ASSUME_UNIT);
421 }
422 
423 template <typename T>
424 DualQuat<T> DualQuat<T>::dqblend(const DualQuat<T> &q1, const DualQuat<T> &q2, const T t, QuatAssumeType assumeUnit)
425 {
426  DualQuat<T> v1(q1), v2(q2);
427  if (!assumeUnit)
428  {
429  v1 = v1.normalize();
430  v2 = v2.normalize();
431  }
432  if (v1.getRotation(assumeUnit).dot(v2.getRotation(assumeUnit)) < 0)
433  {
434  return ((1 - t) * v1 - t * v2).normalize();
435  }
436  return ((1 - t) * v1 + t * v2).normalize();
437 }
438 
439 template <typename T>
441 {
442  CV_CheckTypeEQ(_weight.type(), cv::traits::Type<T>::value, "");
443  CV_CheckTypeEQ(_dualquat.type(), CV_MAKETYPE(CV_MAT_DEPTH(cv::traits::Type<T>::value), 8), "");
444  Size dq_s = _dualquat.size();
445  if (dq_s != _weight.size() || (dq_s.height != 1 && dq_s.width != 1))
446  {
447  CV_Error(Error::StsBadArg, "The size of weight must be the same as dualquat, both of them should be (1, n) or (n, 1)");
448  }
449  Mat dualquat = _dualquat.getMat(), weight = _weight.getMat();
450  const int cn = std::max(dq_s.width, dq_s.height);
451  if (!assumeUnit)
452  {
453  for (int i = 0; i < cn; ++i)
454  {
455  dualquat.at<Vec<T, 8>>(i) = DualQuat<T>{dualquat.at<Vec<T, 8>>(i)}.normalize().toVec();
456  }
457  }
458  Vec<T, 8> dq_blend = dualquat.at<Vec<T, 8>>(0) * weight.at<T>(0);
459  Quat<T> q0 = DualQuat<T> {dualquat.at<Vec<T, 8>>(0)}.getRotation(assumeUnit);
460  for (int i = 1; i < cn; ++i)
461  {
462  T k = q0.dot(DualQuat<T>{dualquat.at<Vec<T, 8>>(i)}.getRotation(assumeUnit)) < 0 ? -1: 1;
463  dq_blend = dq_blend + dualquat.at<Vec<T, 8>>(i) * k * weight.at<T>(i);
464  }
465  return DualQuat<T>{dq_blend}.normalize();
466 }
467 
468 template <typename T>
469 template <int cn>
470 DualQuat<T> DualQuat<T>::gdqblend(const Vec<DualQuat<T>, cn> &_dualquat, InputArray _weight, QuatAssumeType assumeUnit)
471 {
472  Vec<DualQuat<T>, cn> dualquat(_dualquat);
473  if (cn == 0)
474  {
475  return DualQuat<T>(1, 0, 0, 0, 0, 0, 0, 0);
476  }
477  Mat dualquat_mat(cn, 1, CV_64FC(8));
478  for (int i = 0; i < cn ; ++i)
479  {
480  dualquat_mat.at<Vec<T, 8>>(i) = dualquat[i].toVec();
481  }
482  return gdqblend(dualquat_mat, _weight, assumeUnit);
483 }
484 
485 } //namespace cv
486 
487 #endif /*OPENCV_CORE_DUALQUATERNION_INL_HPP*/
Definition: dualquaternion.hpp:146
_Tp y_
Definition: dualquaternion.hpp:165
Vec< _Tp, 3 > getTranslation(QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const
return the translation vector. The rotation in this dual quaternion is applied before translation ....
Definition: dualquaternion.inl.hpp:159
static DualQuat< _Tp > createFromAffine3(const Affine3< _Tp > &R)
create dual quaternion from an affine matrix. The definition of affine matrix can refer to createFrom...
Definition: dualquaternion.inl.hpp:86
_Tp y
Definition: dualquaternion.hpp:165
friend DualQuat< T > log(const DualQuat< T > &dq, QuatAssumeType assumeUnit)
return the value of logarithm function value
Definition: dualquaternion.inl.hpp:344
Quat< _Tp > getRealPart() const
return a quaternion which represent the real part of dual quaternion. The definition of real part is ...
Definition: dualquaternion.inl.hpp:113
static DualQuat< _Tp > gdqblend(const Vec< DualQuat< _Tp >, cn > &dualquat, InputArray weights, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT)
The generalized Dual Quaternion linear Blending works for more than two rigid transformations....
static DualQuat< _Tp > createFromAngleAxisTrans(const _Tp angle, const Vec< _Tp, 3 > &axis, const Vec< _Tp, 3 > &translation)
create a dual quaternion from a rotation angle , a rotation axis and a translation ....
Definition: dualquaternion.inl.hpp:64
_Tp w_
Definition: dualquaternion.hpp:165
DualQuat< _Tp > operator-() const
Return opposite dual quaternion which satisfies .
Definition: dualquaternion.inl.hpp:207
DualQuat< _Tp > & operator/=(const DualQuat< _Tp > &)
Division assignment operator of two dual quaternions p and q; It divides left operand with the right ...
DualQuat< _Tp > operator/(const _Tp s) const
Division operator of a dual quaternions and a scalar. It divides left operand with the right operand ...
_Tp z_
Definition: dualquaternion.hpp:165
Affine3< _Tp > toAffine3(QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const
Transform this dual quaternion to a instance of Affine3.
Definition: dualquaternion.inl.hpp:388
friend DualQuat< T > power(const DualQuat< T > &dq, const T t, QuatAssumeType assumeUnit)
return the value of where p is a dual quaternion. This could be calculated as:
Definition: dualquaternion.inl.hpp:358
Vec< _Tp, 8 > toVec() const
Transform this dual quaternion to a vector.
Definition: dualquaternion.inl.hpp:382
DualQuat< _Tp > & operator+=(const DualQuat< _Tp > &)
Addition assignment operator of two dual quaternions p and q. It adds right operand to the left opera...
Definition: dualquaternion.inl.hpp:219
_Tp x_
Definition: dualquaternion.hpp:165
Quat< _Tp > getDualPart() const
return a quaternion which represent the dual part of dual quaternion. The definition of dual part is ...
Definition: dualquaternion.inl.hpp:119
_Tp dot(DualQuat< _Tp > p) const
return the dot product of two dual quaternion.
Definition: dualquaternion.inl.hpp:181
static DualQuat< _Tp > createFromMat(InputArray _R)
Transform this dual quaternion to an affine transformation matrix . Dual quaternion consists of a rot...
Definition: dualquaternion.inl.hpp:72
DualQuat< _Tp > exp() const
return the value of exponential function value
Definition: dualquaternion.inl.hpp:337
static DualQuat< _Tp > dqblend(const DualQuat< _Tp > &q1, const DualQuat< _Tp > &q2, const _Tp t, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT)
The method of Dual Quaternion linear Blending(DQB) is to compute a transformation between dual quater...
Definition: dualquaternion.inl.hpp:424
DualQuat< _Tp > & operator*=(const DualQuat< _Tp > &)
Multiplication assignment operator of two quaternions. It multiplies right operand with the left oper...
friend DualQuat< T > exp(const DualQuat< T > &dq)
return the value of exponential function value
Definition: dualquaternion.inl.hpp:312
bool operator==(const DualQuat< _Tp > &) const
return true if two dual quaternions p and q are nearly equal, i.e. when the absolute value of each a...
Definition: dualquaternion.inl.hpp:104
friend DualQuat< T > conjugate(const DualQuat< T > &dq)
return the conjugate of a dual quaternion.
Definition: dualquaternion.inl.hpp:125
_Tp x
Definition: dualquaternion.hpp:165
DualQuat< _Tp > & operator-=(const DualQuat< _Tp > &)
Subtraction assignment operator of two dual quaternions p and q. It subtracts right operand from the ...
Definition: dualquaternion.inl.hpp:261
friend DualQuat< T > inv(const DualQuat< T > &dq, QuatAssumeType assumeUnit)
if is a dual quaternion, p is not zero, the inverse dual quaternion is
Definition: dualquaternion.inl.hpp:187
static DualQuat< _Tp > createFromPitch(const _Tp angle, const _Tp d, const Vec< _Tp, 3 > &axis, const Vec< _Tp, 3 > &moment)
A dual quaternion is a vector in form of.
Definition: dualquaternion.inl.hpp:92
DualQuat< _Tp > operator+(const DualQuat< _Tp > &) const
Addition operator of two dual quaternions p and q. It returns a new dual quaternion that each value i...
Definition: dualquaternion.inl.hpp:213
DualQuat< _Tp > conjugate() const
return the conjugate of a dual quaternion.
Definition: dualquaternion.inl.hpp:131
static DualQuat< _Tp > sclerp(const DualQuat< _Tp > &q1, const DualQuat< _Tp > &q2, const _Tp t, bool directChange=true, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT)
The screw linear interpolation(ScLERP) is an extension of spherical linear interpolation of dual quat...
Definition: dualquaternion.inl.hpp:405
Matx< _Tp, 4, 4 > toMat(QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const
Transform this dual quaternion to a affine transformation matrix the form of matrix,...
Definition: dualquaternion.inl.hpp:394
DualQuat< _Tp > norm() const
return the norm of dual quaternion .
Definition: dualquaternion.inl.hpp:137
_Tp z
Definition: dualquaternion.hpp:165
Quat< _Tp > getRotation(QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const
return the rotation in quaternion form.
Definition: dualquaternion.inl.hpp:149
DualQuat< _Tp > normalize() const
return a normalized dual quaternion. A dual quaternion can be expressed as
Definition: dualquaternion.inl.hpp:166
DualQuat< _Tp > operator*(const DualQuat< _Tp > &) const
Multiplication operator of two dual quaternions q and p. Multiplies values on either side of the oper...
Definition: dualquaternion.inl.hpp:226
_Tp w
Definition: dualquaternion.hpp:165
DualQuat()
Definition: dualquaternion.inl.hpp:39
static DualQuat< _Tp > createFromQuat(const Quat< _Tp > &realPart, const Quat< _Tp > &dualPart)
create Dual Quaternion from two same type quaternions p and q. A Dual Quaternion has the form:
Definition: dualquaternion.inl.hpp:50
n-dimensional dense array class
Definition: mat.hpp:812
_Tp & at(int i0=0)
Returns a reference to the specified array element.
Template class for small matrices whose type and size are known at compilation time.
Definition: matx.hpp:100
Matx< _Tp, n, m > inv(int method=DECOMP_LU, bool *p_is_ok=NULL) const
invert the matrix
_Tp dot(const Matx< _Tp, m, n > &v) const
dot product computed with the default precision
Definition: matx.inl.hpp:328
Definition: quaternion.hpp:211
_Tp dot(Quat< _Tp > q) const
return the dot between quaternion and this quaternion.
static Quat< _Tp > createFromRotMat(InputArray R)
from a 3x3 rotation matrix.
_Tp z
Definition: quaternion.hpp:1618
_Tp y
Definition: quaternion.hpp:1618
Quat< _Tp > normalize() const
return a normalized .
friend Quat< T > exp(const Quat< T > &q)
return the value of exponential value.
friend Quat< T > inv(const Quat< T > &q, QuatAssumeType assumeUnit)
return which is an inverse of which satisfies .
_Tp x
Definition: quaternion.hpp:1618
static Quat< _Tp > createFromAngleAxis(const _Tp angle, const Vec< _Tp, 3 > &axis)
from an angle, axis. Axis will be normalized in this function. And it generates
friend Quat< T > log(const Quat< T > &q, QuatAssumeType assumeUnit)
return the value of logarithm function.
_Tp norm() const
return the norm of quaternion.
_Tp w
Definition: quaternion.hpp:1618
Template class for specifying the size of an image or rectangle.
Definition: types.hpp:335
_Tp height
the height
Definition: types.hpp:363
_Tp width
the width
Definition: types.hpp:362
Template class for short numerical vectors, a partial case of Matx.
Definition: matx.hpp:369
Mat getMat(int idx=-1) const
T cos(T... args)
T exp(T... args)
InputArrayOfArrays InputArrayOfArrays InputOutputArray InputOutputArray InputOutputArray InputOutputArray Size InputOutputArray InputOutputArray T
Definition: calib3d.hpp:1867
InputArrayOfArrays InputArrayOfArrays InputOutputArray InputOutputArray InputOutputArray InputOutputArray Size InputOutputArray R
Definition: calib3d.hpp:1867
CV__DEBUG_NS_END typedef const _InputArray & InputArray
Definition: mat.hpp:442
const CvArr * angle
Definition: core_c.h:1194
const CvArr const CvArr const CvArr * B
Definition: core_c.h:1341
const CvArr CvArr * x
Definition: core_c.h:1195
const CvArr * y
Definition: core_c.h:1187
#define CV_MAT_DEPTH(flags)
Definition: interface.h:83
#define CV_64FC(n)
Definition: interface.h:128
#define CV_MAKETYPE(depth, cn)
Definition: interface.h:85
#define CV_Error(code, msg)
Call the error handler.
Definition: base.hpp:320
QuatAssumeType
Unit quaternion flag.
Definition: quaternion.hpp:39
std::ostream & operator<<(std::ostream &, const DualQuat< _Tp > &)
@ QUAT_ASSUME_NOT_UNIT
Definition: quaternion.hpp:46
@ QUAT_ASSUME_UNIT
Definition: quaternion.hpp:52
CvRect r
Definition: imgproc_c.h:984
CV_EXPORTS OutputArray int double double InputArray OutputArray int int bool double k
Definition: imgproc.hpp:2133
T max(T... args)
@ StsBadArg
function arg/param is bad
Definition: base.hpp:74
Matx< _Tp, 4, 4 > jacob_exp(const Quat< _Tp > &q)
Definition: dualquaternion.inl.hpp:320
"black box" representation of the file storage associated with a file on disk.
Definition: calib3d.hpp:441
DualQuat< T > operator+(const T a, const DualQuat< T > &q)
Definition: dualquaternion.inl.hpp:243
DualQuat< T > power(const DualQuat< T > &dq, const T t, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT)
Definition: dualquaternion.inl.hpp:358
DualQuat< T > inv(const DualQuat< T > &dq, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT)
Definition: dualquaternion.inl.hpp:187
DualQuat< T > operator*(const T a, const DualQuat< T > &q)
Definition: dualquaternion.inl.hpp:274
DualQuat< T > log(const DualQuat< T > &dq, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT)
Definition: dualquaternion.inl.hpp:344
DualQuat< T > operator-(const DualQuat< T > &q, const T a)
Definition: dualquaternion.inl.hpp:255
DualQuat< T > conjugate(const DualQuat< T > &dq)
Definition: dualquaternion.inl.hpp:125
DualQuat< T > exp(const DualQuat< T > &dq)
Definition: dualquaternion.inl.hpp:312
static uchar abs(uchar a)
Definition: cvstd.hpp:66
T sin(T... args)
T sqrt(T... args)
Definition: traits.hpp:386