amino
Lightweight Robot Utility Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
tf.hpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 4 -*- */
2 /* ex: set shiftwidth=4 tabstop=4 expandtab: */
3 /*
4  * Copyright (c) 2013, Georgia Tech Research Corporation
5  * All rights reserved.
6  *
7  * Author(s): Neil T. Dantam <ntd@gatech.edu>
8  * Georgia Tech Humanoid Robotics Lab
9  * Under Direction of Prof. Mike Stilman <mstilman@cc.gatech.edu>
10  *
11  *
12  * This file is provided under the following "BSD-style" License:
13  *
14  *
15  * Redistribution and use in source and binary forms, with or
16  * without modification, are permitted provided that the following
17  * conditions are met:
18  *
19  * * Redistributions of source code must retain the above copyright
20  * notice, this list of conditions and the following disclaimer.
21  *
22  * * Redistributions in binary form must reproduce the above
23  * copyright notice, this list of conditions and the following
24  * disclaimer in the documentation and/or other materials provided
25  * with the distribution.
26  *
27  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
28  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
29  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
31  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
32  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
35  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
36  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39  * POSSIBILITY OF SUCH DAMAGE.
40  *
41  */
42 
43 #ifndef AA_TF_HPP
44 #define AA_TF_HPP
45 
59 namespace amino {
60 
61 
62 
66 struct Vec3 : aa_tf_vec3 {
67  Vec3() {}
68 
72  Vec3( const struct aa_tf_duqu *S ) : aa_tf_vec3(from_duqu(S->data)) {}
73 
77  Vec3( const struct aa_tf_duqu &S ) : aa_tf_vec3(from_duqu(S.data)) {}
78 
82  Vec3( const struct aa_tf_tfmat *T ) : aa_tf_vec3(from_tfmat(T->data)) {}
83 
87  Vec3( const struct aa_tf_tfmat &T ) : aa_tf_vec3(from_tfmat(T.data)) {}
88 
92  Vec3( double _x, double _y, double _z ) : aa_tf_vec3(from_xyz(_x,_y,_z)) {}
93 
94 
98  Vec3( const double *_xyz ) : aa_tf_vec3(from_vec3(_xyz)) {}
99 
103  static aa_tf_vec3 from_xyz( double x, double y, double z ) {
104  aa_tf_vec3 V;
105  V.x = x;
106  V.y = y;
107  V.z = z;
108  return V;
109  }
110 
114  static aa_tf_vec3 from_vec3( const double a_x[3] ) {
115  aa_tf_vec3 V;
116  memcpy( V.data, a_x, 3*sizeof(V.data[0]) );
117  return V;
118  }
119 
123  static aa_tf_vec3 from_duqu( const double S[8] ) {
124  aa_tf_vec3 V;
125  aa_tf_duqu_trans( S, V.data );
126  return V;
127  }
128 
132  static aa_tf_vec3 from_tfmat( const double T[12] ) {
133  return from_vec3( T+9 );
134  }
135 };
136 
137 /*------------------------------*/
138 /*-------- ORIENTATIONS --------*/
139 /*------------------------------*/
140 
144 struct XAngle {
145  double value;
146  XAngle(double v) : value(v) {}
147 };
148 
152 struct YAngle {
153  double value;
154  YAngle(double v) : value(v) {}
155 };
156 
160 struct ZAngle {
161  double value;
162  ZAngle(double v) : value(v) {}
163 };
164 
168 struct Quat : aa_tf_quat {
172  Quat() : aa_tf_quat(from_xyzw(0,0,0,1)) {}
173 
177  Quat( const aa_tf_quat *p ) : aa_tf_quat(from_quat(p->data)) {}
178 
182  Quat( const aa_tf_quat &p ) : aa_tf_quat(from_quat(p.data)) {}
183 
188 
193 
197  Quat( const aa_tf_axang *p ) : aa_tf_quat(from_axang(p->data)) {}
198 
203 
207  Quat( const XAngle &p ) : aa_tf_quat(from_xangle(p.value)) {}
208 
212  Quat( const YAngle &p ) : aa_tf_quat(from_yangle(p.value)) {}
213 
217  Quat( const ZAngle &p ) : aa_tf_quat(from_zangle(p.value)) {}
218 
219 
223  static aa_tf_quat from_quat( const double x[4] ) {
224  aa_tf_quat y;
225  memcpy(y.data, x, 4*sizeof(y.data[0]));
226  return y;
227  }
228 
232  static aa_tf_quat from_xyzw( double x, double y, double z, double w ) {
233  aa_tf_quat q;
234  q.x = x;
235  q.y = y;
236  q.z = z;
237  q.w = w;
238  return q;
239  }
240 
244  static aa_tf_quat from_rotmat( const double x[9] ) {
245  aa_tf_quat y;
246  aa_tf_rotmat2quat(x, y.data);
247  return y;
248  }
249 
253  static aa_tf_quat from_axang( const double x[4] ) {
254  aa_tf_quat y;
255  aa_tf_axang2quat(x, y.data);
256  return y;
257  }
258 
262  static aa_tf_quat from_axang( const double a[3], double angle ) {
263  double x[4] = {a[0], a[1], a[2], angle};
264  return from_axang(x);
265  }
266 
270  static aa_tf_quat from_rotvec( const double x[3] ) {
271  aa_tf_quat y;
272  aa_tf_rotvec2quat(x, y.data);
273  return y;
274  }
275 
279  static aa_tf_quat from_xangle( const double v ) {
280  aa_tf_quat y;
281  aa_tf_xangle2quat(v, y.data);
282  return y;
283  }
284 
288  static aa_tf_quat from_yangle( const double v ) {
289  aa_tf_quat y;
290  aa_tf_yangle2quat(v, y.data);
291  return y;
292  }
293 
297  static aa_tf_quat from_zangle( const double v ) {
298  aa_tf_quat y;
299  aa_tf_zangle2quat(v, y.data);
300  return y;
301  }
302 };
303 
311  RotMat() : aa_tf_rotmat( from_rotmat(1,0,0, 0,1,0, 0,0,1) )
312  {}
313 
318 
323 
328 
333 
338 
343 
347  RotMat( const XAngle &p ) : aa_tf_rotmat(from_xangle(p.value)) {}
348 
352  RotMat( const YAngle &p ) : aa_tf_rotmat(from_yangle(p.value)) {}
353 
357  RotMat( const ZAngle &p ) : aa_tf_rotmat(from_zangle(p.value)) {}
358 
362  RotMat( double r11, double r12, double r13,
363  double r21, double r22, double r23,
364  double r31, double r32, double r33 ) :
365  aa_tf_rotmat(from_rotmat(r11, r12, r13,
366  r21, r22, r23,
367  r31, r32, r33))
368  {}
369 
370 
374  static aa_tf_rotmat from_rotmat( double r11, double r12, double r13,
375  double r21, double r22, double r23,
376  double r31, double r32, double r33 )
377  {
378  aa_tf_rotmat R;
379  R.data[0] = r11;
380  R.data[1] = r21;
381  R.data[2] = r31;
382 
383  R.data[3] = r12;
384  R.data[4] = r22;
385  R.data[5] = r32;
386 
387  R.data[6] = r13;
388  R.data[7] = r23;
389  R.data[8] = r33;
390  return R;
391  }
392 
393 
397  static aa_tf_rotmat from_quat( const double x[4] ) {
398  aa_tf_rotmat y;
399  aa_tf_quat2rotmat(x, y.data);
400  return y;
401  }
402 
406  static aa_tf_rotmat from_rotmat( const double x[9] ) {
407  aa_tf_rotmat y;
408  memcpy(y.data, x, 9*sizeof(y.data[0]));
409  return y;
410  }
411 
415  static aa_tf_rotmat from_axang( const double x[4] ) {
416  aa_tf_rotmat y;
417  aa_tf_axang2rotmat(x, y.data);
418  return y;
419  }
420 
424  static aa_tf_rotmat from_rotvec( const double x[3] ) {
425  aa_tf_rotmat y;
427  return y;
428  }
429 
433  static aa_tf_rotmat from_xangle( const double v ) {
434  aa_tf_rotmat y;
436  return y;
437  }
438 
442  static aa_tf_rotmat from_yangle( const double v ) {
443  aa_tf_rotmat y;
445  return y;
446  }
447 
451  static aa_tf_rotmat from_zangle( const double v ) {
452  aa_tf_rotmat y;
454  return y;
455  }
456 };
457 
462 
467  {}
468 
472  AxisAngle( const aa_tf_quat *p ) : aa_tf_axang(from_quat(p->data)) {}
473 
477  AxisAngle( const aa_tf_quat &p ) : aa_tf_axang(from_quat(p.data)) {}
478 
482  AxisAngle( const aa_tf_rotmat *p ) : aa_tf_axang(from_rotmat(p->data)) {}
483 
487  AxisAngle( const aa_tf_rotmat &p ) : aa_tf_axang(from_rotmat(p.data)) {}
488 
492  AxisAngle( const aa_tf_axang *p ) : aa_tf_axang(from_axang(p->data)) {}
493 
497  AxisAngle( const aa_tf_axang &p ) : aa_tf_axang(from_axang(p.data)) {}
498 
502  AxisAngle( double x, double y, double z, double theta ) :
503  aa_tf_axang(from_axang(x,y,z,theta))
504  {}
505 
509  AxisAngle( const double *_axis, double _angle ) :
510  aa_tf_axang(from_axang(_axis,_angle))
511  {}
512 
516  static aa_tf_axang from_quat( const double x[4] ) {
517  aa_tf_axang y;
518  aa_tf_quat2axang(x, y.data);
519  return y;
520  }
521 
525  static aa_tf_axang from_rotmat( const double x[9] ) {
526  aa_tf_axang y;
527  aa_tf_rotmat2axang(x, y.data);
528  return y;
529  }
530 
534  static aa_tf_axang from_axang( double x, double y, double z, double theta ) {
535  double n = sqrt( x*x + y*y + z*z );
536  double a[4] = {x/n, y/n, z/n, theta};
537  return from_axang(a);
538  }
539 
543  static aa_tf_axang from_axang( const double x[4] ) {
544  aa_tf_axang y;
545  memcpy(y.data, x, 4*sizeof(y.data[0]));
546  return y;
547  }
548 
552  static aa_tf_axang from_axang( const double axis[3], double angle ) {
553  aa_tf_axang y;
554  y.axis.x = axis[0];
555  y.axis.y = axis[1];
556  y.axis.z = axis[2];
557  y.angle = angle;
558  return y;
559  }
560 
564  static aa_tf_axang from_rotvec( const double x[3] ) {
565  aa_tf_axang y;
566  aa_tf_rotvec2axang(x, y.data);
567  return y;
568  }
569 };
570 
571 /*-----------------------------*/
572 /*------ TRANSFORMATIONS ------*/
573 /*-----------------------------*/
574 
582  DualQuat() : aa_tf_duqu(from_xyzw(0,0,0,1, 0,0,0,0))
583  {}
584 
588  DualQuat(const double *S) : aa_tf_duqu(from_duqu(S)) {}
589 
593  DualQuat(const struct aa_tf_duqu *S) : aa_tf_duqu(from_duqu(S->data)) {}
594 
598  DualQuat(const struct aa_tf_duqu &S) : aa_tf_duqu(from_duqu(S.data)) {}
599 
603  DualQuat(const struct aa_tf_qv *S) : aa_tf_duqu(from_qv(S->r.data, S->v.data)) {}
604 
608  DualQuat(const struct aa_tf_qv &S) : aa_tf_duqu(from_qv(S.r.data, S.v.data)) {}
609 
613  DualQuat(const struct aa_tf_quat *r, const struct aa_tf_vec3 *v) :
614  aa_tf_duqu(from_qv(r->data, v->data))
615  {}
616 
620  DualQuat(const struct aa_tf_quat &r, const struct aa_tf_vec3 &v) :
621  aa_tf_duqu(from_qv(r.data, v.data))
622  {}
623 
627  DualQuat(const struct aa_tf_tfmat *T) : aa_tf_duqu(from_tfmat(T->data)) {}
628 
632  DualQuat(const struct aa_tf_tfmat &T) : aa_tf_duqu(from_tfmat(T.data)) {}
633 
637  DualQuat(const XAngle &r, const struct aa_tf_vec3 &v) : aa_tf_duqu(from_xxyz(r.value, v.x, v.y, v.z)) {}
638 
642  DualQuat(const YAngle &r, const struct aa_tf_vec3 &v) : aa_tf_duqu(from_yxyz(r.value, v.x, v.y, v.z)) {}
643 
647  DualQuat(const ZAngle &r, const struct aa_tf_vec3 &v) : aa_tf_duqu(from_zxyz(r.value, v.x, v.y, v.z)) {}
648 
652  DualQuat(const struct aa_tf_vec3 &v) : aa_tf_duqu(from_xyz(v.x, v.y, v.z)) {}
653 
657  DualQuat(const aa_tf_axang &r, const struct aa_tf_vec3 &v) :
658  aa_tf_duqu(from_qv(Quat::from_axang(r.data).data,
659  v.data))
660  {}
661 
666  {
667  DualQuat S;
668  aa_tf_duqu_conj(this->data, S.data);
669  return S;
670  }
671 
676  aa_tf_vec3 V;
677  aa_tf_duqu_trans( this->data, V.data );
678  return V;
679  }
680 
684  static aa_tf_duqu from_xyzw( double x_real, double y_real, double z_real, double w_real,
685  double x_dual, double y_dual, double z_dual, double w_dual ) {
686  DualQuat S;
687  S.real = Quat::from_xyzw(x_real,y_real,z_real,w_real);
688  S.dual = Quat::from_xyzw(x_dual,y_dual,z_dual,w_dual);
689  return S;
690  }
691 
695  static aa_tf_duqu from_duqu( const double s[8] ) {
696  DualQuat S;
697  memcpy(S.data, s, 8*sizeof(s[0]));
698  return S;
699  }
700 
704  static aa_tf_duqu from_qv(const double q[4], const double v[3]) {
705  DualQuat S;
706  aa_tf_qv2duqu(q,v,S.data);
707  return S;
708  }
709 
713  static aa_tf_duqu from_tfmat(const double T[12] ) {
714  DualQuat S;
715  aa_tf_tfmat2duqu(T,S.data);
716  return S;
717  }
718 
722  static aa_tf_duqu from_xxyz(double theta, double x, double y, double z) {
723  DualQuat S;
724  aa_tf_xxyz2duqu(theta, x, y, z, S.data);
725  return S;
726  }
727 
731  static aa_tf_duqu from_yxyz(double theta, double x, double y, double z) {
732  DualQuat S;
733  aa_tf_yxyz2duqu(theta, x, y, z, S.data);
734  return S;
735  }
736 
740  static aa_tf_duqu from_zxyz(double theta, double x, double y, double z) {
741  DualQuat S;
742  aa_tf_zxyz2duqu(theta, x, y, z, S.data);
743  return S;
744  }
745 
749  static aa_tf_duqu from_xyz(double x, double y, double z) {
750  DualQuat S;
751  aa_tf_xyz2duqu(x, y, z, S.data);
752  return S;
753  }
754 
758  static aa_tf_duqu from_dx(double *s, double *dx )
759  {
760  DualQuat S;
761  aa_tf_duqu_vel2diff( s, dx, S.data );
762  return S;
763  }
764 };
765 
766 
770 struct QuatTran : aa_tf_qv {
774  QuatTran() : aa_tf_qv(from_xyzw(0,0,0,1, 0,0,0))
775  {}
776 
780  QuatTran(const struct aa_tf_qv *S) : aa_tf_qv(from_qv(S->r.data, S->v.data)) {}
781 
785  QuatTran(const struct aa_tf_qv &S) : aa_tf_qv(from_qv(S.r.data, S.v.data)) {}
786 
790  QuatTran(const struct aa_tf_quat *_r, const struct aa_tf_vec3 *_v) :
791  aa_tf_qv(from_qv(_r->data, _v->data))
792  {}
793 
797  QuatTran(const struct aa_tf_quat &_r, const struct aa_tf_vec3 &_v) :
798  aa_tf_qv(from_qv(_r.data, _v.data))
799  {}
800 
804  QuatTran(const struct aa_tf_duqu *S) : aa_tf_qv(from_duqu(S->data)) {}
805 
809  QuatTran(const struct aa_tf_duqu &S) : aa_tf_qv(from_duqu(S.data)) {}
810 
814  QuatTran(const struct aa_tf_tfmat *T) : aa_tf_qv(from_tfmat(T->data)) {}
815 
819  QuatTran(const struct aa_tf_tfmat &T) : aa_tf_qv(from_tfmat(T.data)) {}
820 
825  aa_tf_qv qv;
826  aa_tf_qutr_conj(this->data, qv.data);
827  return qv;
828  }
829 
833  static aa_tf_qv from_xyzw( double q_x, double q_y, double q_z, double q_w,
834  double t_x, double t_y, double t_z )
835  {
836  aa_tf_qv qv;
837  qv.r = Quat::from_xyzw(q_x, q_y, q_z, q_w);
838  qv.v = Vec3::from_xyz(t_x, t_y, t_z);
839  return qv;
840  }
841 
845  static aa_tf_qv from_qv(const double a_r[4], const double a_v[3])
846  {
847  aa_tf_qv qv;
848  memcpy(qv.r.data, a_r, 4*sizeof(qv.r.data[0]));
849  memcpy(qv.v.data, a_v, 3*sizeof(qv.v.data[0]));
850  return qv;
851  }
852 
856  static aa_tf_qv from_qv(const double e[7])
857  {
858  return from_qv(e, e+4);
859  }
860 
864  static aa_tf_qv from_duqu(const double s[8]) {
865  aa_tf_qv qv;
866  aa_tf_duqu2qv( s, qv.r.data, qv.v.data );
867  return qv;
868  }
869 
873  static aa_tf_qv from_tfmat(const double t[12]) {
874  aa_tf_qv qv;
875  aa_tf_tfmat2duqu( t, qv.data );
876  return qv;
877  }
878 };
879 
883 struct TfMat : aa_tf_tfmat {
888 
892  TfMat(const struct aa_tf_tfmat *T) : aa_tf_tfmat(from_tfmat(T->data)) {}
893 
897  TfMat(const struct aa_tf_tfmat &T) : aa_tf_tfmat(from_tfmat(T.data)) {}
898 
902  TfMat(const struct aa_tf_duqu *S) : aa_tf_tfmat(from_duqu(S->data)) {}
903 
907  TfMat(const struct aa_tf_duqu &S) : aa_tf_tfmat(from_duqu(S.data)) {}
908 
912  TfMat(const struct aa_tf_qv *S) : aa_tf_tfmat(from_qv(S->r.data, S->v.data)) {}
913 
917  TfMat(const struct aa_tf_qv &S) : aa_tf_tfmat(from_qv(S.r.data, S.v.data)) {}
918 
922  TfMat(const struct aa_tf_quat *_r, const struct aa_tf_vec3 *_v) :
923  aa_tf_tfmat(from_qv(_r->data, _v->data))
924  {}
925 
929  TfMat(const struct aa_tf_quat &_r, const struct aa_tf_vec3 &_v) :
930  aa_tf_tfmat(from_qv(_r.data, _v.data))
931  {}
932 
936  static aa_tf_tfmat from_duqu( const double s[8] ) {
937  aa_tf_tfmat T;
938  aa_tf_duqu2tfmat(s, T.data);
939  return T;
940  }
941 
945  static aa_tf_tfmat from_qv(const double q[4], const double v[3]) {
946  aa_tf_tfmat T;
947  aa_tf_qv2tfmat(q,v,T.data);
948  return T;
949  }
950 
954  static aa_tf_tfmat from_tfmat(const double t[12] ) {
955  aa_tf_tfmat T;
956  memcpy(T.data, t, 12*sizeof(T.data[0]));
957  return T;
958  }
959 };
960 
961 /*---- OPERATORS -----*/
962 
963 
967 static inline struct aa_tf_vec3
968 operator+(const struct aa_tf_vec3 &a, const struct aa_tf_vec3 &b) {
969  struct aa_tf_vec3 c;
970  c.x = a.x + b.x;
971  c.y = a.y + b.y;
972  c.z = a.z + b.z;
973  return c;
974 }
975 
979 static inline struct aa_tf_vec3
980 operator/(const struct aa_tf_vec3 &a, double b ) {
981  struct aa_tf_vec3 c;
982  c.x = a.x / b;
983  c.y = a.y / b;
984  c.z = a.z / b;
985  return c;
986 }
987 
988 
992 static inline struct aa_tf_rotmat
993 operator*(const struct aa_tf_rotmat &a, const struct aa_tf_rotmat &b) {
994  struct aa_tf_rotmat c;
995  aa_tf_9mul(a.data, b.data, c.data);
996  return c;
997 }
998 
1002 static inline struct aa_tf_quat
1003 operator*(const struct aa_tf_quat &a, const struct aa_tf_quat &b) {
1004  struct aa_tf_quat c;
1005  aa_tf_qmul(a.data, b.data, c.data);
1006  return c;
1007 }
1008 
1012 static inline struct aa_tf_tfmat
1013 operator*(const struct aa_tf_tfmat &a, const struct aa_tf_tfmat &b) {
1014  struct aa_tf_tfmat c;
1015  aa_tf_12chain(a.data, b.data, c.data);
1016  return c;
1017 }
1018 
1022 static inline struct aa_tf_duqu
1023 operator*(const struct aa_tf_duqu &a, const struct aa_tf_duqu &b) {
1024  struct aa_tf_duqu c;
1025  aa_tf_duqu_mul(a.data, b.data, c.data);
1026  return c;
1027 }
1028 
1036 static inline struct aa_tf_qv
1037 operator*(const struct aa_tf_qv &a, const struct aa_tf_qv &b) {
1038  struct aa_tf_qv c;
1039  aa_tf_qv_chain(a.r.data, a.v.data,
1040  b.r.data, b.v.data,
1041  c.r.data, c.v.data);
1042  return c;
1043 }
1044 
1045 };
1046 
1047 #endif //AA_MEM_HPP
RotMat(const aa_tf_quat &p)
Construct a rotation matrix from a unit quaternion.
Definition: tf.hpp:322
static aa_tf_axang from_axang(double x, double y, double z, double theta)
Create an axis angle from individual components.
Definition: tf.hpp:534
AA_API void aa_tf_duqu_mul(const double d1[AA_RESTRICT 8], const double d2[AA_RESTRICT 8], double d3[AA_RESTRICT 8])
Dual quaternion multiplication.
QuatTran(const struct aa_tf_duqu *S)
Construct from a dual quaternion.
Definition: tf.hpp:804
QuatTran(const struct aa_tf_qv &S)
Construct from another quaternion-translation.
Definition: tf.hpp:785
static aa_tf_quat from_zangle(const double v)
Create a quaternion object rotation about z.
Definition: tf.hpp:297
double y
y component
Definition: tf.h:199
AA_API void aa_tf_quat2rotmat(const double quat[AA_RESTRICT 4], double rotmat[AA_RESTRICT 9])
convert quaternion to rotation matrix
AA_API void aa_tf_yxyz2duqu(double theta, double x, double y, double z, double d[AA_RESTRICT 8])
Convert y angle and translation to dual quaternion.
TfMat(const struct aa_tf_quat &_r, const struct aa_tf_vec3 &_v)
Construct a transformation matrix from a quaternion-translation.
Definition: tf.hpp:929
static aa_tf_duqu from_dx(double *s, double *dx)
Create a dual quaternion derivative from a dual quaternion and the spatial velocity.
Definition: tf.hpp:758
RotMat(const aa_tf_axang &p)
Construct a rotation matrix from an axis-angle.
Definition: tf.hpp:342
Quat(const aa_tf_rotmat &p)
Construct from a rotation matrix.
Definition: tf.hpp:192
AA_API void aa_tf_xyz2duqu(double x, double y, double z, double d[AA_RESTRICT 8])
Pure translation dual quaternion.
Vec3(const struct aa_tf_tfmat &T)
Extract the translation part of a transformation matrix.
Definition: tf.hpp:87
AA_API void aa_tf_duqu2tfmat(const double d[AA_RESTRICT 8], double T[AA_RESTRICT 12])
Convert dual quaternion to transformation matrix.
QuatTran(const struct aa_tf_qv *S)
Construct from another quaternion-translation.
Definition: tf.hpp:780
aa_tf_vec3_t v
the origin vector part
Definition: tf.h:244
AxisAngle(const aa_tf_axang &p)
Construct an axis-angle from another axis-angle.
Definition: tf.hpp:497
DualQuat(const struct aa_tf_duqu *S)
Construct from another dual quaternion.
Definition: tf.hpp:593
static aa_tf_vec3 from_vec3(const double a_x[3])
Create a Vec3 from array.
Definition: tf.hpp:114
RotMat(const aa_tf_quat *p)
Construct a rotation matrix from a unit quaternion.
Definition: tf.hpp:317
static aa_tf_rotmat from_xangle(const double v)
Create a rotation matrix from a rotation about X.
Definition: tf.hpp:433
static aa_tf_vec3 from_tfmat(const double T[12])
Create a Vec3 from translation part of transformation matrix.
Definition: tf.hpp:132
AxisAngle()
Construct an idenity axis-angle.
Definition: tf.hpp:466
void aa_tf_qutr_conj(const double a[7], double c[7])
quaternion-translation conjugate
AA_API void aa_tf_9mul(const double R0[AA_RESTRICT 9], const double R1[AA_RESTRICT 9], double R[AA_RESTRICT 9])
Multiply two rotation matrices.
A transformation matrix object.
Definition: tf.hpp:883
aa_tf_qv conj()
Return the conjugate (inverse).
Definition: tf.hpp:824
static aa_tf_duqu from_zxyz(double theta, double x, double y, double z)
Create a dual quaternion an Z axis rotation and translation components.
Definition: tf.hpp:740
AxisAngle(const aa_tf_quat *p)
Construct an axis-angle from a unit quaternion.
Definition: tf.hpp:472
TfMat(const struct aa_tf_duqu *S)
Construct a transformation matrix from a dual quaternion.
Definition: tf.hpp:902
static aa_tf_duqu from_xyzw(double x_real, double y_real, double z_real, double w_real, double x_dual, double y_dual, double z_dual, double w_dual)
Create a dual quaternion from components.
Definition: tf.hpp:684
double data[8]
data array
Definition: tf.h:299
Memory layout for a vector of length 3.
Definition: tf.h:136
QuatTran(const struct aa_tf_quat &_r, const struct aa_tf_vec3 &_v)
Construct from another quaternion-translation.
Definition: tf.hpp:797
AA_API void aa_tf_qmul(const double a[AA_RESTRICT 4], const double b[AA_RESTRICT 4], double c[AA_RESTRICT 4])
Quaternion multiplication.
Vec3(const struct aa_tf_duqu &S)
Extract the translation part of a unit dual quaternion.
Definition: tf.hpp:77
QuatTran(const struct aa_tf_tfmat &T)
Construct from a transformation matrix.
Definition: tf.hpp:819
static aa_tf_duqu from_qv(const double q[4], const double v[3])
Create a dual quaternion from a rotation quaternion and a translation vector.
Definition: tf.hpp:704
TfMat(const struct aa_tf_duqu &S)
Construct a transformation matrix from a dual quaternion.
Definition: tf.hpp:907
static const double aa_tf_ident[12]
Identity transformation matrix array.
Definition: tf.h:438
static aa_tf_axang from_rotvec(const double x[3])
Create an axis angle from a rotation vector.
Definition: tf.hpp:564
A rotation about the Y axis.
Definition: tf.hpp:152
AA_API void aa_tf_tfmat2duqu(const double T[AA_RESTRICT 12], double d[AA_RESTRICT 8])
Convert transformation matrix to dual quaternion.
TfMat(const struct aa_tf_tfmat &T)
Construct a transformation matrix from another transformation matrix.
Definition: tf.hpp:897
Memory layout for a transformation matrix.
Definition: tf.h:240
DualQuat(const YAngle &r, const struct aa_tf_vec3 &v)
Construct from a rotation about Y and a translation vector.
Definition: tf.hpp:642
static aa_tf_quat from_rotmat(const double x[9])
Create a quaternion object a rotation matrix.
Definition: tf.hpp:244
RotMat(const aa_tf_rotmat *p)
Construct a rotation matrix from another rotation matrix.
Definition: tf.hpp:327
static aa_tf_duqu from_xyz(double x, double y, double z)
Create a dual quaternion from and identity rotation and translation components.
Definition: tf.hpp:749
DualQuat(const double *S)
Construct from another dual quaternion.
Definition: tf.hpp:588
double x
x component
Definition: tf.h:139
An axis-angle object.
Definition: tf.hpp:461
static aa_tf_rotmat from_rotmat(double r11, double r12, double r13, double r21, double r22, double r23, double r31, double r32, double r33)
Create a rotation matrix from individual components.
Definition: tf.hpp:374
static aa_tf_tfmat from_tfmat(const double t[12])
Construct a transformation matrix from another transformation matrix.
Definition: tf.hpp:954
static aa_tf_quat from_axang(const double x[4])
Create a quaternion object an axis-angle.
Definition: tf.hpp:253
Vec3(const struct aa_tf_tfmat *T)
Extract the translation part of a transformation matrix.
Definition: tf.hpp:82
Quat(const aa_tf_axang &p)
Construct from an axix angle rotation.
Definition: tf.hpp:202
Quat(const aa_tf_axang *p)
Construct from an axix angle rotation.
Definition: tf.hpp:197
AA_API void aa_tf_duqu_vel2diff(const double d[AA_RESTRICT 8], const double dx[AA_RESTRICT 6], double dd[AA_RESTRICT 8])
Dual quaternion derivative from velocity.
Quat(const XAngle &p)
Construct from a rotation about the x axis.
Definition: tf.hpp:207
QuatTran()
Construct an idenity object.
Definition: tf.hpp:774
A dual quaternion object.
Definition: tf.hpp:578
static aa_tf_quat from_rotvec(const double x[3])
Create a quaternion object a rotation vector.
Definition: tf.hpp:270
AA_API void aa_tf_axang2rotmat(const double ra[AA_RESTRICT 4], double R[AA_RESTRICT 9])
convert axis angle to rotation matrix
double data[3]
data array
Definition: tf.h:143
Vec3(const double *_xyz)
Construct from array.
Definition: tf.hpp:98
AxisAngle(const double *_axis, double _angle)
Construct an axis-angle from an axis array and an angle.
Definition: tf.hpp:509
double data[7]
data array
Definition: tf.h:284
RotMat(const ZAngle &p)
Construct a rotation matrix from a rotation about Z.
Definition: tf.hpp:357
A vector of length 3.
Definition: tf.hpp:66
QuatTran(const struct aa_tf_quat *_r, const struct aa_tf_vec3 *_v)
Construct from another quaternion-translation.
Definition: tf.hpp:790
static aa_tf_duqu from_duqu(const double s[8])
Create a dual quaternion from another dual quaternion.
Definition: tf.hpp:695
TfMat(const struct aa_tf_qv *S)
Construct a transformation matrix from a quaternion-translation.
Definition: tf.hpp:912
A quaternion object.
Definition: tf.hpp:168
DualQuat()
Construct an identity dual quaternion.
Definition: tf.hpp:582
static aa_tf_qv from_duqu(const double s[8])
Create a quaternion-translation from a dual quaternion.
Definition: tf.hpp:864
double x
x component
Definition: tf.h:198
static aa_tf_rotmat from_quat(const double x[4])
Create a rotation matrix from a unit quaternion.
Definition: tf.hpp:397
double data[4]
data array
Definition: tf.h:210
TfMat(const struct aa_tf_quat *_r, const struct aa_tf_vec3 *_v)
Construct a transformation matrix from a quaternion-translation.
Definition: tf.hpp:922
TfMat()
Construct an identity transformation matrix.
Definition: tf.hpp:887
TfMat(const struct aa_tf_tfmat *T)
Construct a transformation matrix from another transformation matrix.
Definition: tf.hpp:892
AA_API void aa_tf_rotmat2axang(const double R[AA_RESTRICT 9], double ra[AA_RESTRICT 4])
convert rotation matrix to axis angle
DualQuat(const struct aa_tf_qv &S)
Construct from a quaternion-vector.
Definition: tf.hpp:608
AA_API void aa_tf_zangle2rotmat(double theta_z, double R[AA_RESTRICT 9])
Angle about z axis.
double y
y component
Definition: tf.h:140
AA_API void aa_tf_yangle2quat(double theta_y, double q[AA_RESTRICT 4])
Unit quaternion for angle about y axis.
RotMat(const YAngle &p)
Construct a rotation matrix from a rotation about Y.
Definition: tf.hpp:352
AA_API void aa_tf_qv2duqu(const double q[AA_RESTRICT 4], const double v[AA_RESTRICT 3], double d[AA_RESTRICT 8])
Convert orientation unit quaternion and translation vector to dual quaternion.
DualQuat(const struct aa_tf_duqu &S)
Construct from another dual quaternion.
Definition: tf.hpp:598
Memory layout for a rotation matrix.
Definition: tf.h:152
AA_API void aa_tf_rotvec2rotmat(const double rv[AA_RESTRICT 3], double R[AA_RESTRICT 9])
convert rotatoin vector to rotation matrix
AA_API void aa_tf_yangle2rotmat(double theta_y, double R[AA_RESTRICT 9])
Angle about y axis.
static aa_tf_qv from_tfmat(const double t[12])
Create a quaternion-translation from a transformation matrix.
Definition: tf.hpp:873
DualQuat(const struct aa_tf_qv *S)
Construct from a quaternion-vector.
Definition: tf.hpp:603
double z
z component
Definition: tf.h:200
A rotation matrix object.
Definition: tf.hpp:307
DualQuat(const ZAngle &r, const struct aa_tf_vec3 &v)
Construct from a rotation about Z and a translation vector.
Definition: tf.hpp:647
double z
z component
Definition: tf.h:141
AxisAngle(double x, double y, double z, double theta)
Construct an axis-angle from individual components.
Definition: tf.hpp:502
AA_API void aa_tf_zxyz2duqu(double theta, double x, double y, double z, double d[AA_RESTRICT 8])
Convert z angle and translation to dual quaternion.
AxisAngle(const aa_tf_rotmat &p)
Construct an axis-angle from a rotation matrix.
Definition: tf.hpp:487
AxisAngle(const aa_tf_axang *p)
Construct an axis-angle from another axis-angle.
Definition: tf.hpp:492
Quat(const YAngle &p)
Construct from a rotation about the Y axis.
Definition: tf.hpp:212
amino namespace
Definition: amino.hpp:60
AA_API void aa_tf_rotvec2quat(const double rotvec[AA_RESTRICT 3], double q[AA_RESTRICT 4])
covert rotation vector to quaternion
static aa_tf_duqu from_xxyz(double theta, double x, double y, double z)
Create a dual quaternion an X axis rotation and translation components.
Definition: tf.hpp:722
Memory layout for a quaternion, x,y,z,w order.
Definition: tf.h:195
static aa_tf_rotmat from_axang(const double x[4])
Create a rotation matrix from an axis-angle.
Definition: tf.hpp:415
static aa_tf_tfmat from_duqu(const double s[8])
Construct a transformation matrix from a dual quaternion.
Definition: tf.hpp:936
QuatTran(const struct aa_tf_tfmat *T)
Construct from a transformation matrix.
Definition: tf.hpp:814
static aa_tf_axang from_quat(const double x[4])
Create an axis angle from a unit quaternion.
Definition: tf.hpp:516
static aa_tf_quat from_quat(const double x[4])
Create a quaternion object from a quaternion array.
Definition: tf.hpp:223
double data[12]
data array
Definition: tf.h:246
Quat(const ZAngle &p)
Construct from a rotation about the Z axis.
Definition: tf.hpp:217
AA_API void aa_tf_xangle2quat(double theta_x, double q[AA_RESTRICT 4])
Unit quaternion for angle about x axis.
AxisAngle(const aa_tf_rotmat *p)
Construct an axis-angle from a rotation matrix.
Definition: tf.hpp:482
RotMat(double r11, double r12, double r13, double r21, double r22, double r23, double r31, double r32, double r33)
Construct a rotation matrix from individual components.
Definition: tf.hpp:362
static aa_tf_rotmat from_yangle(const double v)
Create a rotation matrix from a rotation about Y.
Definition: tf.hpp:442
Memory layout for a dual quaternion .
Definition: tf.h:293
Quat(const aa_tf_rotmat *p)
Construct from a rotation matrix.
Definition: tf.hpp:187
DualQuat(const struct aa_tf_quat *r, const struct aa_tf_vec3 *v)
Construct from a quaternion-vector.
Definition: tf.hpp:613
static aa_tf_qv from_qv(const double e[7])
Create a quaternion-translation from a rotation quaternion and a translation vector.
Definition: tf.hpp:856
AA_API void aa_tf_xangle2rotmat(double theta_x, double R[AA_RESTRICT 9])
Angle about x axis.
AA_API void aa_tf_xxyz2duqu(double theta, double x, double y, double z, double d[AA_RESTRICT 8])
Convert x angle and translation to dual quaternion.
static aa_tf_tfmat from_qv(const double q[4], const double v[3])
Construct a transformation matrix from a rotation quaternion and translation vector.
Definition: tf.hpp:945
static aa_tf_qv from_qv(const double a_r[4], const double a_v[3])
Create a quaternion-translation from a rotation quaternion and a translation vector.
Definition: tf.hpp:845
Vec3(double _x, double _y, double _z)
Construct from individual components.
Definition: tf.hpp:92
static aa_tf_vec3 from_duqu(const double S[8])
Create a Vec3 from translation part of unit dual quation.
Definition: tf.hpp:123
DualQuat(const struct aa_tf_tfmat &T)
Construct from a transformation matrix.
Definition: tf.hpp:632
static aa_tf_rotmat from_rotvec(const double x[3])
Create a rotation matrix from a rotation vector.
Definition: tf.hpp:424
static aa_tf_axang from_rotmat(const double x[9])
Create an axis angle from a rotation matrix.
Definition: tf.hpp:525
static aa_tf_duqu from_yxyz(double theta, double x, double y, double z)
Create a dual quaternion an Y axis rotation and translation components.
Definition: tf.hpp:731
DualQuat conj()
Return the conjugate of this.
Definition: tf.hpp:665
RotMat(const XAngle &p)
Construct a rotation matrix from a rotation about X.
Definition: tf.hpp:347
AA_API void aa_tf_duqu_conj(const double d[AA_RESTRICT 8], double dconj[AA_RESTRICT 8])
Dual quaternion conjugate.
static aa_tf_quat from_yangle(const double v)
Create a quaternion object rotation about y.
Definition: tf.hpp:288
static aa_tf_axang from_axang(const double x[4])
Create an axis angle from an axis angle array.
Definition: tf.hpp:543
TfMat(const struct aa_tf_qv &S)
Construct a transformation matrix from a quaternion-translation.
Definition: tf.hpp:917
AA_API void aa_tf_axang2quat(const double axang[AA_RESTRICT 4], double q[AA_RESTRICT 4])
axis-angle to quaternion.
static aa_tf_vec3 from_xyz(double x, double y, double z)
Create a Vec3 from components.
Definition: tf.hpp:103
RotMat(const aa_tf_axang *p)
Construct a rotation matrix from an axis-angle.
Definition: tf.hpp:337
A rotation about the X axis.
Definition: tf.hpp:144
RotMat()
Construct an identity rotation matrix.
Definition: tf.hpp:311
static aa_tf_qv from_xyzw(double q_x, double q_y, double q_z, double q_w, double t_x, double t_y, double t_z)
Create a quaternion-translation from components.
Definition: tf.hpp:833
AA_API void aa_tf_zangle2quat(double theta_z, double q[AA_RESTRICT 4])
Unit quaternion for angle about z axis.
Quat(const aa_tf_quat *p)
Construct from another quaternion.
Definition: tf.hpp:177
Axis-Angle rotation.
Definition: tf.h:166
aa_tf_vec3 translation()
Return the translation part of a unit dual quaternion.
Definition: tf.hpp:675
Vec3(const struct aa_tf_duqu *S)
Extract the translation part of a unit dual quaternion.
Definition: tf.hpp:72
AxisAngle(const aa_tf_quat &p)
Construct an axis-angle from a unit quaternion.
Definition: tf.hpp:477
DualQuat(const XAngle &r, const struct aa_tf_vec3 &v)
Construct from a rotation about X and a translation vector.
Definition: tf.hpp:637
double w
w component
Definition: tf.h:201
Quat()
Construct an identity quaternion.
Definition: tf.hpp:172
AA_API void aa_tf_quat2axang(const double q[AA_RESTRICT 4], double axang[AA_RESTRICT 4])
Quaternion to axis-angle.
AA_API void aa_tf_12chain(const double T1[AA_RESTRICT 12], const double T2[AA_RESTRICT 12], double T[AA_RESTRICT 12])
chain two transforms
Quat(const aa_tf_quat &p)
Construct from another quaternion.
Definition: tf.hpp:182
AA_API void aa_tf_duqu_trans(const double d[AA_RESTRICT 8], double v[AA_RESTRICT 3])
Extract dual quaternion translation vector.
QuatTran(const struct aa_tf_duqu &S)
Construct from a dual quaternion.
Definition: tf.hpp:809
static aa_tf_quat from_xangle(const double v)
Create a quaternion object rotation about x.
Definition: tf.hpp:279
A rotation quaternion and translation vector object.
Definition: tf.hpp:770
AA_API void aa_tf_qv2tfmat(const double q[AA_RESTRICT 4], const double v[AA_RESTRICT 3], double T[AA_RESTRICT 12])
Convert orientation unit quaternion and translation vector to transformation matrix.
Memory layout for a Transformation as rotation quaternion and translation vector. ...
Definition: tf.h:278
static aa_tf_rotmat from_rotmat(const double x[9])
Create a rotation matrix object from a rotation matrix array.
Definition: tf.hpp:406
DualQuat(const struct aa_tf_tfmat *T)
Construct from a transformation matrix.
Definition: tf.hpp:627
DualQuat(const aa_tf_axang &r, const struct aa_tf_vec3 &v)
Construct from an axis-angle rotation and a translation vector.
Definition: tf.hpp:657
double v[3]
vector part
Definition: tf.h:206
A rotation about the Z axis.
Definition: tf.hpp:160
DualQuat(const struct aa_tf_quat &r, const struct aa_tf_vec3 &v)
Construct from a quaternion-vector.
Definition: tf.hpp:620
AA_API void aa_tf_qv_chain(const double q0[AA_RESTRICT 4], const double v0[AA_RESTRICT 3], const double q1[AA_RESTRICT 4], const double v1[AA_RESTRICT 3], double q[AA_RESTRICT 4], double v[AA_RESTRICT 3])
chain two transforms
RotMat(const aa_tf_rotmat &p)
Construct a rotation matrix from another rotation matrix.
Definition: tf.hpp:332
static aa_tf_quat from_axang(const double a[3], double angle)
Create a quaternion object an axis-angle.
Definition: tf.hpp:262
static aa_tf_quat from_xyzw(double x, double y, double z, double w)
Create a quaternion object from components.
Definition: tf.hpp:232
DualQuat(const struct aa_tf_vec3 &v)
Construct from an identity rotation and a translation vector.
Definition: tf.hpp:652
static aa_tf_duqu from_tfmat(const double T[12])
Create a dual quaternion from a transformation matrix.
Definition: tf.hpp:713
AA_API void aa_tf_duqu2qv(const double d[AA_RESTRICT 8], double q[AA_RESTRICT 4], double v[AA_RESTRICT 3])
Convert dual quaternion to orientation unit quaternion and translation vector.
AA_API void aa_tf_rotvec2axang(const double rotvec[AA_RESTRICT 3], double axang[AA_RESTRICT 4])
convert rotation vector to axis-angle
AA_API void aa_tf_rotmat2quat(const double rotmat[AA_RESTRICT 9], double quat[AA_RESTRICT 4])
convert rotation matrix to quaternion
double data[9]
data array
Definition: tf.h:159
static aa_tf_axang from_axang(const double axis[3], double angle)
Create an axis angle from an axis array and an angle.
Definition: tf.hpp:552
static aa_tf_rotmat from_zangle(const double v)
Create a rotation matrix from a rotation about Z.
Definition: tf.hpp:451