amino
Lightweight Robot Utility Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
tf.h
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) 2010-2014, Georgia Tech Research Corporation
5  * Copyright (c) 2015, Rice University
6  * All rights reserved.
7  *
8  * Author(s): Neil T. Dantam <ntd@gatech.edu>
9  * Georgia Tech Humanoid Robotics Lab
10  * Under Direction of Prof. Mike Stilman <mstilman@cc.gatech.edu>
11  *
12  *
13  * This file is provided under the following "BSD-style" License:
14  *
15  *
16  * Redistribution and use in source and binary forms, with or
17  * without modification, are permitted provided that the following
18  * conditions are met:
19  *
20  * * Redistributions of source code must retain the above copyright
21  * notice, this list of conditions and the following disclaimer.
22  *
23  * * Redistributions in binary form must reproduce the above
24  * copyright notice, this list of conditions and the following
25  * disclaimer in the documentation and/or other materials provided
26  * with the distribution.
27  *
28  * * Neither the name of copyright holder the names of its
29  * contributors may be used to endorse or promote products derived
30  * from this software without specific prior written permission.
31  *
32  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
33  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
34  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
35  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
36  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
37  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
38  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
39  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
40  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
41  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
42  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
43  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
44  * POSSIBILITY OF SUCH DAMAGE.
45  *
46  */
47 
48 #ifndef AMINO_TF_H
49 #define AMINO_TF_H
50 
60 #include <float.h>
61 
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65 
66 /**********/
67 /* Series */
68 /**********/
69 #define AA_TF_DEF_SERIES(name, a0, a1, a2) \
70  static inline double \
71  aa_tf_ ## name ##_series2(double theta2) \
72  { \
73  return aa_horner3( theta2, a0, a1, a2 ); \
74  } \
75  static inline double \
76  aa_tf_ ## name ## _series(double theta) \
77  { \
78  return aa_tf_ ## name ## _series2(theta*theta); \
79  } \
80 
81 AA_TF_DEF_SERIES( sinc, 1., -1./6, 1./120 )
82 AA_TF_DEF_SERIES( cos, 1., -1./2, 1./24 )
83 AA_TF_DEF_SERIES( invsinc, 1., 1./6, 7./360 )
84 
85 static inline void
86 aa_tf_sinccos2( double theta2, double *sc, double *c )
87 {
88  if( theta2 < sqrt(DBL_EPSILON) ) {
89  *sc = aa_tf_sinc_series2(theta2);
90  *c = aa_tf_cos_series2(theta2);
91  } else {
92  double theta = sqrt(theta2);
93  double s = sin(theta);
94  *c = cos(theta);
95  *sc = s / theta;
96  }
97 }
98 
99 static inline void
100 aa_tf_sinccos( double theta, double *sc, double *c )
101 {
102  if( theta*theta < sqrt(DBL_EPSILON) ) {
103  *sc = aa_tf_sinc_series(theta);
104  *c = aa_tf_cos_series(theta);
105  } else {
106  double s = sin(theta);
107  *c = cos(theta);
108  *sc = s / theta;
109  }
110 }
111 
112 static inline double
113 aa_tf_sinc( double theta )
114 {
115  if( fabs(theta) < sqrt(sqrt(DBL_EPSILON)) ) {
116  return aa_tf_sinc_series(theta);
117  } else {
118  return sin(theta)/theta;
119  }
120 }
121 
122 /*********/
123 /* Types */
124 /*********/
125 
127 #define AA_TF_X 0
128 #define AA_TF_Y 1
130 #define AA_TF_Z 2
132 
136 typedef struct aa_tf_vec3 {
137  union {
138  struct {
139  double x;
140  double y;
141  double z;
142  };
143  double data[3];
144  };
145 } aa_tf_vec3_t;
146 
152 typedef struct aa_tf_rotmat {
153  union {
154  struct {
155  struct aa_tf_vec3 col0;
156  struct aa_tf_vec3 col1;
157  struct aa_tf_vec3 col2;
158  };
159  double data[9];
160  };
162 
166 typedef struct aa_tf_axang {
167  union {
168  struct {
169  union {
170  struct aa_tf_vec3 axis;
171  double v[3];
172  };
173  double angle;
174  };
175  double data[4];
176  };
177 } aa_tf_axang_t;
178 
180 #define AA_TF_QUAT_V 0
181 #define AA_TF_QUAT_XYZ AA_TF_QUAT_V
183 #define AA_TF_QUAT_X (AA_TF_QUAT_V + AA_TF_X)
185 #define AA_TF_QUAT_Y (AA_TF_QUAT_V + AA_TF_Y)
187 #define AA_TF_QUAT_Z (AA_TF_QUAT_V + AA_TF_Z)
189 #define AA_TF_QUAT_W 3
191 
195 typedef struct aa_tf_quat {
196  union {
197  struct {
198  double x;
199  double y;
200  double z;
201  double w;
202  };
203  struct {
204  union {
205  struct aa_tf_vec3 vec;
206  double v[3];
207  };
208  double scalar;
209  };
210  double data[4];
211  };
212 } aa_tf_quat_t;
213 
217 typedef struct aa_tf_eulerzyx {
218  union {
219  struct {
220  double y;
221  double p;
222  double r;
223  };
224  double data[3];
225  };
227 
228 
240 typedef struct aa_tf_tfmat {
241  union {
242  struct {
243  double R[9];
245  };
246  double data[12];
247  };
248 } aa_tf_tfmat_t;
249 
253 #define AA_TF_TFMAT_R 0
254 
258 #define AA_TF_TFMAT_V 9
259 
263 #define AA_TF_TFMAT_X 9
264 
268 #define AA_TF_TFMAT_Y 10
269 
273 #define AA_TF_TFMAT_Z 11
274 
278 typedef struct aa_tf_qv {
279  union {
280  struct {
281  aa_tf_quat_t r;
282  aa_tf_vec3_t v;
283  };
284  double data[7];
285  };
286 } aa_tf_qv_t;
287 
288 
289 
293 typedef struct aa_tf_duqu {
294  union {
295  struct {
296  aa_tf_quat_t real;
297  aa_tf_quat_t dual;
298  };
299  double data[8];
300  };
301 } aa_tf_duqu_t;
302 
306 struct aa_tf_dx {
307  union {
308  struct {
309  double dv[3];
310  double omega[3];
311  };
312  double data[6];
313  };
314 };
315 
317 #define AA_TF_DX_V 0
318 #define AA_TF_DX_W 3
320 
322 struct aa_tf_qv_dx {
323  union {
324  struct {
325  struct aa_tf_qv tf;
326  struct aa_tf_dx dx;
327  };
328  double data[13];
329  };
330 };
331 
333 #define AA_TF_QUTR_Q 0
334 #define AA_TF_QUTR_QX (AA_TF_QUTR_Q + AA_TF_QUAT_X)
336 #define AA_TF_QUTR_QY (AA_TF_QUTR_Q + AA_TF_QUAT_Y)
338 #define AA_TF_QUTR_QZ (AA_TF_QUTR_Q + AA_TF_QUAT_Z)
340 #define AA_TF_QUTR_QW (AA_TF_QUTR_Q + AA_TF_QUAT_W)
342 
344 #define AA_TF_QUTR_T 4
345 #define AA_TF_QUTR_TX (AA_TF_QUTR_T + AA_TF_X)
347 #define AA_TF_QUTR_TY (AA_TF_QUTR_T + AA_TF_Y)
349 #define AA_TF_QUTR_TZ (AA_TF_QUTR_T + AA_TF_Z)
351 
353 #define AA_TF_DUQU_REAL 0
354 #define AA_TF_DUQU_DUAL 4
356 
358 #define AA_TF_DUQU_REAL_W (AA_TF_DUQU_REAL + AA_TF_QUAT_W)
359 #define AA_TF_DUQU_REAL_XYZ (AA_TF_DUQU_REAL + AA_TF_QUAT_XYZ)
361 #define AA_TF_DUQU_REAL_X (AA_TF_DUQU_REAL + AA_TF_QUAT_X)
363 #define AA_TF_DUQU_REAL_Y (AA_TF_DUQU_REAL + AA_TF_QUAT_Y)
365 #define AA_TF_DUQU_REAL_Z (AA_TF_DUQU_REAL + AA_TF_QUAT_Z)
367 
369 #define AA_TF_DUQU_DUAL_W (AA_TF_DUQU_DUAL + AA_TF_QUAT_W)
370 #define AA_TF_DUQU_DUAL_XYZ (AA_TF_DUQU_DUAL + AA_TF_QUAT_XYZ)
372 #define AA_TF_DUQU_DUAL_X (AA_TF_DUQU_DUAL + AA_TF_QUAT_X)
374 #define AA_TF_DUQU_DUAL_Y (AA_TF_DUQU_DUAL + AA_TF_QUAT_Y)
376 #define AA_TF_DUQU_DUAL_Z (AA_TF_DUQU_DUAL + AA_TF_QUAT_Z)
378 
380 #define AA_TF_EPSILON .0001
381 
382 
383 
387 #define AA_TF_IDENT_INITIALIZER {1,0,0, 0,1,0, 0,0,1, 0,0,0}
388 
392 #define AA_TF_ROTMAT_IDENT_INITIALIZER {1,0,0, 0,1,0, 0,0,1}
393 
397 #define AA_TF_QUAT_IDENT_INITIALIZER {0,0,0,1}
398 
402 #define AA_TF_DUQU_IDENT_INITIALIZER {0,0,0,1, 0,0,0,0}
403 
407 #define AA_TF_QUTR_IDENT_INITIALIZER {0,0,0,1, 0,0,0}
408 
412 #define AA_TF_AXANG_IDENT_INITIALIZER {1,0,0,0}
413 
417 #define AA_TF_ROTVEC_IDENT_INITIALIZER {0,0,0}
418 
422 #define AA_TF_VEC_IDENT_INITIALIZER {0,0,0}
423 
425 #define AA_TF_IDENT ( (double[12]) AA_TF_IDENT_INITIALIZER )
426 #define AA_TF_ROTMAT_IDENT ( (double[9] AA_TF_ROTMAT_IDENT_INITIALIZER )
428 #define AA_TF_QUAT_IDENT ( (double[4]) AA_TF_QUAT_IDENT_INITIALIZER )
430 #define AA_TF_AXANG_IDENT ( (double[4]) AA_TF_AXANG_IDENT_INITIALIZER )
432 #define AA_TF_ROTVEC_IDENT ( (double[3]) AA_TF_ROTVEC_IDENT_INITIALIZER )
434 
438 static const double aa_tf_ident[12] = AA_TF_IDENT_INITIALIZER;
439 
443 static const double aa_tf_tfmat_ident[12] = AA_TF_IDENT_INITIALIZER;
444 
449 
454 
459 
464 
469 
474 
479 
483 static const double aa_tf_vec_x[3] = {1, 0, 0};
484 
488 static const double aa_tf_vec_y[3] = {0, 1, 0};
489 
493 static const double aa_tf_vec_z[3] = {0, 0, 1};
494 
495 /**************/
496 /* Transforms */
497 /**************/
498 
500 AA_API void aa_tf_12( const double T[AA_RESTRICT 12],
501  const double p0[AA_RESTRICT 3],
502  double p1[AA_RESTRICT 3] );
504 AA_API void aa_tf_93( const double R[AA_RESTRICT 9],
505  const double v[AA_RESTRICT 3],
506  const double p0[AA_RESTRICT 3],
507  double p1[AA_RESTRICT 4] );
509 AA_API void aa_tf_tf_qv( const double quat[AA_RESTRICT 4],
510  const double v[AA_RESTRICT 3],
511  const double p0[AA_RESTRICT 3],
512  double p1[AA_RESTRICT 4] );
513 
515 AA_API void aa_tf_9( const double R[AA_RESTRICT 9],
516  const double p0[AA_RESTRICT 3],
517  double p1[AA_RESTRICT 4] );
518 
520 AA_API void aa_tf_12inv( const double T[AA_RESTRICT 12],
521  double Ti[AA_RESTRICT 12] );
523 AA_API void aa_tf_93inv( const double R[AA_RESTRICT 9],
524  const double v[AA_RESTRICT 3],
525  double Ri[AA_RESTRICT 9], double vi[AA_RESTRICT 3] );
531 AA_API void aa_tf_qv_conj( const double q[AA_RESTRICT 4], const double v[AA_RESTRICT 3],
532  double qc[AA_RESTRICT 4], double vc[AA_RESTRICT 3] );
533 
535 AA_API void aa_tf_12chain( const double T1[AA_RESTRICT 12],
536  const double T2[AA_RESTRICT 12],
537  double T[AA_RESTRICT 12] );
538 
540 AA_API void aa_tf_v12chain( double T[AA_RESTRICT 12] ,
541  const double T1[AA_RESTRICT 12],
542  const double T2[AA_RESTRICT 12],
543  ... );
544 
546 AA_API void aa_tf_93chain( const double R0[AA_RESTRICT 9],
547  const double v0[AA_RESTRICT 3],
548  const double R1[AA_RESTRICT 9],
549  const double v1[AA_RESTRICT 3],
550  double R[AA_RESTRICT 9], double v[AA_RESTRICT 3] );
552 AA_API void aa_tf_qv_chain( const double q0[AA_RESTRICT 4],
553  const double v0[AA_RESTRICT 3],
554  const double q1[AA_RESTRICT 4],
555  const double v1[AA_RESTRICT 3],
556  double q[AA_RESTRICT 4],
557  double v[AA_RESTRICT 3] );
558 
560 AA_API void aa_tf_93rel( const double R1[AA_RESTRICT 9],
561  const double v1[AA_RESTRICT 3],
562  const double R2[AA_RESTRICT 9],
563  const double v2[AA_RESTRICT 3],
564  double Rrel[AA_RESTRICT 9],
565  double vrel[AA_RESTRICT 3] );
566 
568 AA_API void aa_tf_12rel( const double T1[AA_RESTRICT 12],
569  const double T2[AA_RESTRICT 12],
570  double Trel[AA_RESTRICT 12] );
571 
572 /************/
573 /* Matrices */
574 /************/
575 
576 AA_API void aa_tf_skewsym_scal2( double a, double b, const double u[3], double R[9] );
577 
578 AA_API void
579 aa_tf_skewsym_scal_c( const double u[AA_RESTRICT 3],
580  const double a[AA_RESTRICT 3], const double b[AA_RESTRICT 3],
581  double R[9] );
582 
583 
584 /* Multiply */
585 AA_API void aa_tf_rotmat_mul( const double R0[AA_RESTRICT 9],
586  const double R1[AA_RESTRICT 9],
587  double R[AA_RESTRICT 9] );
588 
589 AA_API void aa_tf_tfmat_mul( const double T0[AA_RESTRICT 12],
590  const double T1[AA_RESTRICT 12],
591  double T[AA_RESTRICT 12] );
592 
593 AA_API void aa_tf_tfmat2_mul( const double R0[AA_RESTRICT 9],
594  const double v0[AA_RESTRICT 3],
595  const double R1[AA_RESTRICT 9],
596  const double v1[AA_RESTRICT 3],
597  double R[AA_RESTRICT 9], double v[AA_RESTRICT 3] );
598 
599 
600 /* Inverting Multiply */
601 
602 AA_API void aa_tf_rotmat_imul( const double R0[AA_RESTRICT 9],
603  const double R1[AA_RESTRICT 9],
604  double R[AA_RESTRICT 9] );
605 
606 AA_API void aa_tf_rotmat_muli( const double R0[AA_RESTRICT 9],
607  const double R1[AA_RESTRICT 9],
608  double R[AA_RESTRICT 9] );
609 
610 AA_API void aa_tf_tfmat_imul( const double T0[AA_RESTRICT 12],
611  const double T1[AA_RESTRICT 12],
612  double T[AA_RESTRICT 12] );
613 
614 AA_API void aa_tf_tfmat_muli( const double T0[AA_RESTRICT 12],
615  const double T1[AA_RESTRICT 12],
616  double T[AA_RESTRICT 12] );
617 
618 AA_API void aa_tf_tfmat2_imul( const double R0[AA_RESTRICT 9],
619  const double v0[AA_RESTRICT 3],
620  const double R1[AA_RESTRICT 9],
621  const double v1[AA_RESTRICT 3],
622  double R[AA_RESTRICT 9], double v[AA_RESTRICT 3] );
623 
624 AA_API void aa_tf_tfmat2_muli( const double R0[AA_RESTRICT 9],
625  const double v0[AA_RESTRICT 3],
626  const double R1[AA_RESTRICT 9],
627  const double v1[AA_RESTRICT 3],
628  double R[AA_RESTRICT 9], double v[AA_RESTRICT 3] );
629 
630 /* Transform */
631 
632 AA_API void aa_tf_rotmat_rot( const double R[AA_RESTRICT 9],
633  const double p0[AA_RESTRICT 3],
634  double p1[AA_RESTRICT 3] );
635 
636 AA_API void aa_tf_tfmat_tf( const double T[AA_RESTRICT 12],
637  const double p0[AA_RESTRICT 3],
638  double p1[AA_RESTRICT 3] );
639 
640 AA_API void aa_tf_tfmat2_tf( const double R[AA_RESTRICT 9],
641  const double v[AA_RESTRICT 3],
642  const double p0[AA_RESTRICT 3],
643  double p1[AA_RESTRICT 4] );
644 
648 AA_API void aa_tf_rotmat_inv1( double R[AA_RESTRICT 9] );
649 
653 AA_API void aa_tf_rotmat_inv2( const double R[AA_RESTRICT 9],
654  double Ri[AA_RESTRICT 9] );
655 
659 AA_API void aa_tf_tfmat_inv1( double T[AA_RESTRICT 12] );
660 
664 AA_API void aa_tf_tfmat_inv2( const double T[AA_RESTRICT 12],
665  double Ti[AA_RESTRICT 12] );
666 
668 AA_API int aa_tf_isrotmat( const double R[AA_RESTRICT 9] );
669 
670 
672 AA_API void aa_tf_9mul( const double R0[AA_RESTRICT 9],
673  const double R1[AA_RESTRICT 9],
674  double R[AA_RESTRICT 9] );
676 AA_API void aa_tf_9rot( const double R[AA_RESTRICT 9],
677  const double p0[AA_RESTRICT 3],
678  double p1[AA_RESTRICT 3] );
679 
681 AA_API void aa_tf_9rel( const double R1[AA_RESTRICT 9], const double R2[AA_RESTRICT 9],
682  double Ri[AA_RESTRICT 9] );
683 
685 AA_API void aa_tf_rotmat_exp_aa( const double aa[AA_RESTRICT 4], double R[AA_RESTRICT 9] );
686 
688 AA_API void aa_tf_rotmat_expv( const double rv[AA_RESTRICT 3], double R[AA_RESTRICT 9] );
689 
691 AA_API void aa_tf_rotmat_lnv( const double R[AA_RESTRICT 9], double v[AA_RESTRICT 3] );
692 
694 AA_API void aa_tf_tfmat_expv( const double v[AA_RESTRICT 6], double T[AA_RESTRICT 12] );
695 
697 AA_API void aa_tf_tfmat_lnv( const double T[AA_RESTRICT 12], double v[AA_RESTRICT 6] );
698 
700 AA_API void aa_tf_rotmat_vel2diff( const double R[AA_RESTRICT 9],
701  const double w[AA_RESTRICT 3], double dR[AA_RESTRICT 9] );
702 
704 AA_API void aa_tf_rotmat_diff2vel( const double R[AA_RESTRICT 9],
705  const double dR[AA_RESTRICT 9], double w[AA_RESTRICT 3] );
706 
708 AA_API void aa_tf_rotmat_svel( const double R0[AA_RESTRICT 9],
709  const double w[AA_RESTRICT 3], double dt,
710  double R1[AA_RESTRICT 9] );
711 
712 
713 
715 AA_API void aa_tf_tfmat_svel( const double T0[AA_RESTRICT 12],
716  const double w[AA_RESTRICT 3], double dt,
717  double T1[AA_RESTRICT 12] );
718 
720 AA_API void aa_tf_v9mul( double R[AA_RESTRICT 9],
721  const double R1[AA_RESTRICT 9], const double R2[AA_RESTRICT 9], ... );
722 
723 
727 AA_API void
728 aa_tf_rotmat_xy( const double x_axis[AA_RESTRICT 3],
729  const double y_axis[AA_RESTRICT 3],
730  double R[AA_RESTRICT 9] );
734 AA_API void
735 aa_tf_rotmat_yz( const double y_axis[AA_RESTRICT 3],
736  const double z_axis[AA_RESTRICT 3],
737  double R[AA_RESTRICT 9] );
738 
742 AA_API void
743 aa_tf_rotmat_zx( const double z_axis[AA_RESTRICT 3],
744  const double x_axis[AA_RESTRICT 3],
745  double R[AA_RESTRICT 9] );
746 
747 
748 /***********/
749 /* Vectors */
750 /***********/
751 
757 #define AA_TF_DOTX(a,b) \
758  ((a)[0]*(b)[0] + (a)[1]*(b)[1] + (a)[2]*(b)[2])
759 
763 static inline double
764 AA_TF_VDOT( const double a[AA_RESTRICT 3], const double b[AA_RESTRICT 3] )
765 {
766  return AA_TF_DOTX(a,b);
767 }
768 
772 static inline float
773 AA_TF_VDOTF( const float a[AA_RESTRICT 3], const float b[AA_RESTRICT 3] )
774 {
775  return AA_TF_DOTX(a,b);
776 }
777 
778 
782 AA_API double
783 aa_tf_vdot( const double a[AA_RESTRICT 3], const double b[AA_RESTRICT 3] );
784 
788 AA_API float
789 aa_tf_vdotf( const float a[AA_RESTRICT 3], const float b[AA_RESTRICT 3] );
790 
796 #define AA_TF_CROSSX( a, b, c ) \
797  (c)[0] = (a)[1]*(b)[2] - (a)[2]*(b)[1]; \
798  (c)[1] = (a)[2]*(b)[0] - (a)[0]*(b)[2]; \
799  (c)[2] = (a)[0]*(b)[1] - (a)[1]*(b)[0]; \
800 
801 
805 static inline void
806 AA_TF_CROSS( const double a[AA_RESTRICT 3], const double b[AA_RESTRICT 3], double c[AA_RESTRICT 3] )
807 {
808  AA_TF_CROSSX(a,b,c);
809 }
810 
814 static inline void
815 AA_TF_CROSSF( const float a[AA_RESTRICT 3], const float b[AA_RESTRICT 3], float c[AA_RESTRICT 3] )
816 {
817  AA_TF_CROSSX(a,b,c);
818 }
819 
823 AA_API void aa_tf_cross( const double a[AA_RESTRICT 3], const double b[AA_RESTRICT 3],
824  double c[AA_RESTRICT 3] ) ;
825 
826 
830 AA_API void aa_tf_crossf( const float a[AA_RESTRICT 3], const float b[AA_RESTRICT 3],
831  float c[AA_RESTRICT 3] ) ;
832 
836 AA_API void aa_tf_vnormalize( double v[AA_RESTRICT 3] );
837 
838 
842 AA_API void aa_tf_vnormalizef( float v[AA_RESTRICT 3] );
843 
844 
845 /***************/
846 /* Quaternions */
847 /***************/
848 
852 static inline double
853 AA_TF_QDOT( const double a[AA_RESTRICT 4], const double b[AA_RESTRICT 4] )
854 {
855  return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3];
856 }
857 
861 double
862 aa_tf_qdot( const double a[AA_RESTRICT 4], const double b[AA_RESTRICT 4] );
863 
867 AA_API void aa_tf_qnormalize( double q[AA_RESTRICT 4] );
868 
869 
871 AA_API double aa_tf_qnorm( const double q[AA_RESTRICT 4] );
872 
877 AA_API void aa_tf_qminimize( double q[AA_RESTRICT 4] );
878 
879 AA_API void aa_tf_qminimize2( const double q[AA_RESTRICT 4], double qmin[AA_RESTRICT 4] );
880 
883 AA_API void aa_tf_qnormalize2( const double q[AA_RESTRICT 4], double qnorm[AA_RESTRICT 4] );
884 
886 AA_API void aa_tf_qconj( const double q[AA_RESTRICT 4],
887  double r[AA_RESTRICT 4] );
888 
889 
891 AA_API void aa_tf_qexp( const double q[AA_RESTRICT 4],
892  double r[AA_RESTRICT 4] );
893 
894 
896 AA_API void aa_tf_qln( const double q[AA_RESTRICT 4],
897  double r[AA_RESTRICT 4] );
898 
905 AA_API void aa_tf_qduln( const double q[AA_RESTRICT 4],
906  const double dq[AA_RESTRICT 4],
907  double dln[AA_RESTRICT 3] );
908 
909 AA_API void aa_tf_qdulnj( const double q[AA_RESTRICT 4],
910  const double dq[AA_RESTRICT 4],
911  double dln[AA_RESTRICT 3] );
912 
919 AA_API void aa_tf_qdpexp( const double e[AA_RESTRICT 3],
920  const double de[AA_RESTRICT 3],
921  double dq[AA_RESTRICT 4] );
922 
923 AA_API void aa_tf_qdpexpj( const double e[AA_RESTRICT 3],
924  const double de[AA_RESTRICT 3],
925  double dq[AA_RESTRICT 4] );
926 
931 double aa_tf_qangle( const double q[AA_RESTRICT 4] );
932 
933 /* Relative quaternion angles
934  */
935 double aa_tf_qangle_rel( const double *q, const double *p );
936 
939 double aa_tf_quhypangle2
940 ( const double q[AA_RESTRICT 4], const double p[AA_RESTRICT 4] );
941 
943 AA_API void aa_tf_qinv( const double q[AA_RESTRICT 4],
944  double r[AA_RESTRICT 4] );
945 
947 AA_API void aa_tf_qadd( const double a[AA_RESTRICT 4],
948  const double b[AA_RESTRICT 4],
949  double c[AA_RESTRICT 4] );
950 
952 AA_API void aa_tf_qsub( const double a[AA_RESTRICT 4],
953  const double b[AA_RESTRICT 4],
954  double c[AA_RESTRICT 4] );
955 
957 AA_API void aa_tf_qmul( const double a[AA_RESTRICT 4],
958  const double b[AA_RESTRICT 4],
959  double c[AA_RESTRICT 4] );
960 
962 AA_API void aa_tf_qmulnorm( const double a[AA_RESTRICT 4],
963  const double b[AA_RESTRICT 4],
964  double c[AA_RESTRICT 4] );
965 
967 AA_API void aa_tf_qmul_qv( const double q[AA_RESTRICT 4],
968  const double v[AA_RESTRICT 3],
969  double c[AA_RESTRICT 4] );
970 
972 AA_API void aa_tf_qmul_vq( const double v[AA_RESTRICT 3],
973  const double q[AA_RESTRICT 4],
974  double c[AA_RESTRICT 4] );
975 
977 AA_API void aa_tf_qcmul( const double a[AA_RESTRICT 4],
978  const double b[AA_RESTRICT 4],
979  double c[AA_RESTRICT 4] );
980 
982 AA_API void aa_tf_qmulc( const double a[AA_RESTRICT 4],
983  const double b[AA_RESTRICT 4],
984  double c[AA_RESTRICT 4] );
985 
986 
990 AA_API void
991 aa_tf_qrot1( const double q[AA_RESTRICT 4], double v[AA_RESTRICT 3] );
992 
994 AA_API void aa_tf_qrot( const double q[AA_RESTRICT 4],
995  const double v[AA_RESTRICT 3],
996  double p[AA_RESTRICT 3] );
997 
1001 AA_API void aa_tf_qrel(const double q1[AA_RESTRICT 4],
1002  const double q2[AA_RESTRICT 4],
1003  double q_rel[AA_RESTRICT 4]);
1004 
1006 AA_API void aa_tf_qslerp( double tau, const double a[AA_RESTRICT 4],
1007  const double b[AA_RESTRICT 4],
1008  double c[AA_RESTRICT 4] );
1009 
1010 
1012 AA_API void aa_tf_qslerpalg( double tau, const double a[AA_RESTRICT 4],
1013  const double b[AA_RESTRICT 4],
1014  double c[AA_RESTRICT 4] );
1015 
1021 AA_API void aa_tf_qslerpdiff( double tau, const double a[AA_RESTRICT 4],
1022  const double b[AA_RESTRICT 4],
1023  double c[AA_RESTRICT 4] );
1024 
1025 
1028 AA_API void aa_tf_qslerpdiffalg( double tau, const double a[AA_RESTRICT 4],
1029  const double b[AA_RESTRICT 4],
1030  double c[AA_RESTRICT 4] );
1031 
1033 AA_API void aa_tf_qslerpchaindiff( double u, double du,
1034  const double q1[AA_RESTRICT 4], const double dq1[AA_RESTRICT 4],
1035  const double q2[AA_RESTRICT 4], const double dq2[AA_RESTRICT 4],
1036  double q[AA_RESTRICT 4], double dq[AA_RESTRICT 4] );
1037 
1039 AA_API void aa_tf_qslerp3diff( double u12, double du12,
1040  const double q1[AA_RESTRICT 4], const double q2[AA_RESTRICT 4],
1041  double u34, double du34,
1042  const double q3[AA_RESTRICT 4], const double q4[AA_RESTRICT 4],
1043  double u, double du,
1044  double q[AA_RESTRICT 4], double dq[AA_RESTRICT 4] );
1045 
1046 /* Quaternaion time derivate to angular velocity */
1047 AA_API void aa_tf_qdiff2vel( const double q[AA_RESTRICT 4],
1048  const double dq_dt[AA_RESTRICT 4],
1049  double v[AA_RESTRICT 3] );
1050 
1051 /* Angular velocity to quaternion time derivative */
1052 AA_API void aa_tf_qvel2diff( const double q[AA_RESTRICT 4],
1053  const double v[AA_RESTRICT 3],
1054  double dq_dt[AA_RESTRICT 4] );
1055 
1056 
1057 /* Convert rotation vector derivative to rotational velocity */
1058 AA_API void aa_tf_rotvec_diff2vel( const double v[3], const double dv[3],
1059  double w[3] );
1060 
1068 AA_API void aa_tf_qrk1( const double q0[AA_RESTRICT 4],
1069  const double dq[AA_RESTRICT 4],
1070  double dt,
1071  double q1[AA_RESTRICT 4] );
1072 
1081 AA_API void aa_tf_qvelrk1( const double q0[AA_RESTRICT 4],
1082  const double v[AA_RESTRICT 3],
1083  double dt,
1084  double q1[AA_RESTRICT 4] );
1085 
1086 
1095 AA_API void aa_tf_qvelrk4( const double q0[AA_RESTRICT 4],
1096  const double v[AA_RESTRICT 3],
1097  double dt,
1098  double q1[AA_RESTRICT 4] );
1099 
1100 
1108 AA_API void aa_tf_qsvel( const double q0[AA_RESTRICT 4],
1109  const double v[AA_RESTRICT 3],
1110  double dt,
1111  double q1[AA_RESTRICT 4] );
1112 
1120 AA_API void aa_tf_qsdiff( const double q0[AA_RESTRICT 4],
1121  const double dq[AA_RESTRICT 4],
1122  double dt,
1123  double q1[AA_RESTRICT 4] );
1124 
1125 
1127 AA_API void aa_tf_xangle2quat( double theta_x, double q[AA_RESTRICT 4] );
1129 AA_API void aa_tf_yangle2quat( double theta_y, double q[AA_RESTRICT 4] );
1131 AA_API void aa_tf_zangle2quat( double theta_z, double q[AA_RESTRICT 4] );
1132 
1133 /* Construct matrix for Davenport's q-method */
1134 AA_API void aa_tf_quat_davenport_matrix
1135 ( size_t n, const double *w, const double *q, size_t ldqq, double *M );
1136 
1137 /* Weighted average quaternion using Davenport's q-method
1138  *
1139  * @param n number of quaternions
1140  * @param w weights
1141  * @param Q array of quaternions
1142  * @param ldq leading dimension of Q
1143  * @param y average quaternion
1144  */
1145 AA_API void aa_tf_quat_davenport
1146 ( size_t n, const double *w, const double *Q, size_t ldq, double *y );
1147 
1148 
1149 
1153 AA_API void aa_tf_qmatrix_l( const double *q, double *M, size_t ldm );
1154 
1158 AA_API void aa_tf_qmatrix_r( const double *q, double *M, size_t ldm );
1159 
1160 
1162 void aa_tf_qurand( double q[4] );
1163 
1164 /*********/
1165 /* Axang */
1166 /*********/
1167 
1169 AA_API void aa_tf_axang_make( double x, double y, double z, double theta,
1170  double axang[AA_RESTRICT 4] );
1171 
1174 AA_API void aa_tf_axang_permute( const double rv[AA_RESTRICT 4], int k,
1175  double rv_p[AA_RESTRICT 4] );
1176 
1178 AA_API void aa_tf_rotvec_permute( const double rv[AA_RESTRICT 3], int k,
1179  double rv_p[AA_RESTRICT 3] );
1180 
1183 AA_API void aa_tf_rotvec_near( const double rv[AA_RESTRICT 3],
1184  const double rv_near[AA_RESTRICT 3],
1185  double rv_p[AA_RESTRICT 3] );
1186 
1187 /**************/
1188 /* Quat-Trans */
1189 /**************/
1190 
1192 void aa_tf_qv_conj( const double q[4], const double v[3],
1193  double qc[4], double vc[3] );
1194 
1195 
1196 #define AA_TF_QUTR_Q 0
1197 #define AA_TF_QUTR_V 4
1198 
1200 void aa_tf_qutr2duqu( const double e[7], double s[8] );
1201 
1203 void aa_tf_qutr2tfmat( const double e[7], double T[12] );
1204 
1206 void aa_tf_tfmat2qutr( const double T[12], double e[7] );
1207 
1209 void aa_tf_duqu2qutr( const double s[8], double e[7] );
1210 
1212 void aa_tf_qutr_mul( const double a[7], const double b[7], double c[7] ) ;
1213 
1217 AA_API void
1218 aa_tf_qutr_tf( const double E[AA_RESTRICT 7], const double p0[AA_RESTRICT 3],
1219  double p1[AA_RESTRICT 3] );
1220 
1222 void aa_tf_qutr_mulnorm( const double a[7], const double b[7], double c[7] ) ;
1223 
1225 void aa_tf_qutr_conj( const double a[7], double c[7] ) ;
1226 
1228 void aa_tf_qutr_mulc( const double a[7], const double b[7], double c[7] ) ;
1229 
1231 void aa_tf_qutr_cmul( const double a[7], const double b[7], double c[7] ) ;
1232 
1235 ( const double e[7], const double de[7], double dx[6] );
1236 
1239 ( const double e[7], const double dx[6], double de[7] );
1240 
1242 void aa_tf_qutr_svel
1243 ( const double e0[7], const double dx[6], double dt, double e1[7] );
1244 
1246 void aa_tf_qutr_sdiff
1247 ( const double e0[7], const double de[7], double dt, double e1[7] );
1248 
1250 void aa_tf_qutr_wavg
1251 ( size_t n, const double *w, const double *EE, size_t ldee, double *a );
1252 
1254 void aa_tf_qutr_rand( double E[7] );
1255 
1256 /***************/
1257 /* Conversions */
1258 /***************/
1259 
1261 AA_API void aa_tf_quat2axang( const double q[AA_RESTRICT 4],
1262  double axang[AA_RESTRICT 4] );
1263 
1264 
1266 AA_API void aa_tf_axang2quat( const double axang[AA_RESTRICT 4],
1267  double q[AA_RESTRICT 4] );
1268 
1270 AA_API void aa_tf_axang2quat2( const double axis[AA_RESTRICT 3],
1271  double angle,
1272  double q[AA_RESTRICT 4] );
1273 
1274 
1278 AA_API void
1279 aa_tf_vecs2quat( const double u[AA_RESTRICT 3],
1280  const double v[AA_RESTRICT 3],
1281  double q[AA_RESTRICT 4] );
1282 
1283 
1285 AA_API void aa_tf_axang2rotvec( const double axang[AA_RESTRICT 4],
1286  double rotvec[AA_RESTRICT 3] );
1287 
1289 AA_API void aa_tf_rotvec2axang( const double rotvec[AA_RESTRICT 3],
1290  double axang[AA_RESTRICT 4] );
1291 
1293 AA_API void aa_tf_rotvec2quat( const double rotvec[AA_RESTRICT 3],
1294  double q[AA_RESTRICT 4] );
1296 AA_API void aa_tf_quat2rotvec( const double q[AA_RESTRICT 4],
1297  double rotvec[AA_RESTRICT 3] );
1298 
1299 
1301 AA_API void aa_tf_quat2rotvec_near( const double q[AA_RESTRICT 4],
1302  const double rv_near[AA_RESTRICT 3],
1303  double rotvec[AA_RESTRICT 3] );
1304 
1306 AA_API void aa_tf_quat2rotmat( const double quat[AA_RESTRICT 4],
1307  double rotmat[AA_RESTRICT 9] );
1309 AA_API void aa_tf_rotmat2quat( const double rotmat[AA_RESTRICT 9],
1310  double quat[AA_RESTRICT 4] );
1311 
1313 AA_API void aa_tf_rotmat2axang( const double R[AA_RESTRICT 9],
1314  double ra[AA_RESTRICT 4] );
1316 AA_API void aa_tf_rotmat2rotvec( const double R[AA_RESTRICT 9],
1317  double rv[AA_RESTRICT 3] );
1318 
1320 AA_API void aa_tf_axang2rotmat( const double ra[AA_RESTRICT 4],
1321  double R[AA_RESTRICT 9] );
1323 AA_API void aa_tf_rotvec2rotmat( const double rv[AA_RESTRICT 3],
1324  double R[AA_RESTRICT 9] );
1325 
1326 
1328 AA_API void aa_tf_qv2tfmat( const double q[AA_RESTRICT 4], const double v[AA_RESTRICT 3],
1329  double T[AA_RESTRICT 12] ) ;
1330 
1331 /* AA_API void aa_tf_tfv2tfq( const double vrv[AA_RESTRICT 6], */
1332 /* double x[AA_RESTRICT 3], double quat[AA_RESTRICT 4] ); */
1333 /* AA_API void aa_tf_tfq2tfv( const double x[AA_RESTRICT 3], const double quat[AA_RESTRICT 4], */
1334 /* double vrv[AA_RESTRICT 6] ); */
1335 
1337 AA_API void aa_tf_rotmat2eulerzyx( const double R[AA_RESTRICT 9],
1338  double e[AA_RESTRICT 3] );
1339 
1340 
1342 AA_API void aa_tf_quat2eulerzyx( const double q[AA_RESTRICT 4],
1343  double e[AA_RESTRICT 3] );
1344 
1345 
1346 #define AA_TF_DEF_EULER(letters) \
1347  AA_API void \
1348  aa_tf_euler ## letters ## 2rotmat( double e1, double e2, double e3, \
1349  double R[AA_RESTRICT 9] ); \
1350  AA_API void \
1351  aa_tf_euler ## letters ## 2quat( double e1, double e2, double e3, \
1352  double q[AA_RESTRICT 4] );
1353 
1354 AA_TF_DEF_EULER( xyz )
1355 AA_TF_DEF_EULER( xzy )
1356 
1357 AA_TF_DEF_EULER( yxz )
1358 AA_TF_DEF_EULER( yzx )
1359 
1360 AA_TF_DEF_EULER( zyx )
1361 AA_TF_DEF_EULER( zxy )
1362 
1363 AA_TF_DEF_EULER( xyx )
1364 AA_TF_DEF_EULER( xzx )
1365 
1366 AA_TF_DEF_EULER( yxy )
1367 AA_TF_DEF_EULER( yzy )
1368 
1369 AA_TF_DEF_EULER( zxz )
1370 AA_TF_DEF_EULER( zyz )
1371 
1373 AA_API void aa_tf_xangle2rotmat( double theta_x, double R[AA_RESTRICT 9] );
1375 AA_API void aa_tf_yangle2rotmat( double theta_y, double R[AA_RESTRICT 9] );
1377 AA_API void aa_tf_zangle2rotmat( double theta_z, double R[AA_RESTRICT 9] );
1378 
1384 AA_API void
1385 aa_tf_rotmat_mzlook( const double eye[AA_RESTRICT 3],
1386  const double target[AA_RESTRICT 3],
1387  const double up[AA_RESTRICT 3],
1388  double R[AA_RESTRICT 9] );
1389 
1390 
1394 AA_API void
1395 aa_tf_tfmat_mzlook( const double eye[AA_RESTRICT 3],
1396  const double target[AA_RESTRICT 3],
1397  const double up[AA_RESTRICT 3],
1398  double T[AA_RESTRICT 12] );
1399 
1403 AA_API void
1404 aa_tf_qmzlook( const double eye[AA_RESTRICT 3],
1405  const double target[AA_RESTRICT 3],
1406  const double up[AA_RESTRICT 3],
1407  double q[AA_RESTRICT 4] );
1408 
1412 AA_API void
1413 aa_tf_qv_mzlook( const double eye[AA_RESTRICT 3],
1414  const double target[AA_RESTRICT 3],
1415  const double up[AA_RESTRICT 3],
1416  double q[AA_RESTRICT 4],
1417  double v[AA_RESTRICT 3] );
1418 
1422 AA_API void
1423 aa_tf_qutr_mzlook( const double eye[AA_RESTRICT 3],
1424  const double target[AA_RESTRICT 3],
1425  const double up[AA_RESTRICT 3],
1426  double T[AA_RESTRICT 12] );
1427 
1428 
1429 /* Dual Quaternions */
1430 
1432 AA_API void aa_tf_duqu_add( const double d1[AA_RESTRICT 8], const double d2[AA_RESTRICT 8],
1433  double d3[AA_RESTRICT 8] );
1434 
1436 AA_API void aa_tf_duqu_sub( const double d1[AA_RESTRICT 8], const double d2[AA_RESTRICT 8],
1437  double d3[AA_RESTRICT 8] );
1438 
1440 AA_API void aa_tf_duqu_smul( const double d1[AA_RESTRICT 8], const double d2[AA_RESTRICT 8],
1441  double d3[AA_RESTRICT 8] );
1442 
1444 AA_API void aa_tf_duqu_mul( const double d1[AA_RESTRICT 8], const double d2[AA_RESTRICT 8],
1445  double d3[AA_RESTRICT 8] );
1446 
1450 AA_API void aa_tf_duqu_matrix_l( const double *q, double *M, size_t ldm );
1451 
1455 AA_API void aa_tf_duqu_matrix_r( const double *q, double *M, size_t ldm );
1456 
1458 AA_API void aa_tf_duqu_cmul( const double d1[AA_RESTRICT 8], const double d2[AA_RESTRICT 8],
1459  double d3[AA_RESTRICT 8] );
1460 
1462 AA_API void aa_tf_duqu_mulc( const double d1[AA_RESTRICT 8], const double d2[AA_RESTRICT 8],
1463  double d3[AA_RESTRICT 8] );
1464 
1466 AA_API void aa_tf_duqu_conj( const double d[AA_RESTRICT 8], double dconj[AA_RESTRICT 8] );
1467 
1469 AA_API void aa_tf_duqu_exp( const double d[AA_RESTRICT 8], double e[AA_RESTRICT 8] );
1470 
1472 AA_API void aa_tf_duqu_ln( const double d[AA_RESTRICT 8], double e[AA_RESTRICT 8] );
1473 
1475 AA_API void aa_tf_duqu_norm( const double d[AA_RESTRICT 8], double *nreal, double *ndual );
1476 
1478 AA_API void aa_tf_duqu_normalize( double d[AA_RESTRICT 8] );
1479 
1481 AA_API void aa_tf_duqu_minimize( double d[AA_RESTRICT 8] );
1482 
1484 AA_API void aa_tf_tf_duqu( const double d[AA_RESTRICT 8], const double p0[AA_RESTRICT 3],
1485  double p1[AA_RESTRICT 3] );
1486 
1488 AA_API void aa_tf_duqu_trans( const double d[AA_RESTRICT 8], double v[AA_RESTRICT 3] );
1489 
1491 AA_API void aa_tf_duqu2tfmat( const double d[AA_RESTRICT 8], double T[AA_RESTRICT 12] );
1492 
1494 AA_API void aa_tf_tfmat2duqu( const double T[AA_RESTRICT 12], double d[AA_RESTRICT 8] ) ;
1495 
1497 AA_API void aa_tf_qv2duqu( const double q[AA_RESTRICT 4], const double v[AA_RESTRICT 3],
1498  double d[AA_RESTRICT 8] ) ;
1499 
1501 AA_API void aa_tf_xyz2duqu( double x, double y, double z,
1502  double d[AA_RESTRICT 8] ) ;
1503 
1505 AA_API void aa_tf_xxyz2duqu( double theta, double x, double y, double z,
1506  double d[AA_RESTRICT 8] );
1507 
1509 AA_API void aa_tf_yxyz2duqu( double theta, double x, double y, double z,
1510  double d[AA_RESTRICT 8] );
1511 
1513 AA_API void aa_tf_zxyz2duqu( double theta, double x, double y, double z,
1514  double d[AA_RESTRICT 8] );
1515 
1517 AA_API void aa_tf_duqu2qv( const double d[AA_RESTRICT 8],
1518  double q[AA_RESTRICT 4], double v[AA_RESTRICT 3] ) ;
1519 
1521 void aa_tf_tfmat2av( const double T[12], double q[AA_RESTRICT 4], double v[AA_RESTRICT 3] ) ;
1522 
1524 AA_API void aa_tf_duqu_vel2twist( const double d[AA_RESTRICT 8], const double dx[AA_RESTRICT 6],
1525  double t[AA_RESTRICT 8] ) ;
1526 
1528 AA_API void aa_tf_duqu_twist2vel( const double d[AA_RESTRICT 8], const double t[AA_RESTRICT 8],
1529  double dx[AA_RESTRICT 6] ) ;
1530 
1532 AA_API void aa_tf_duqu_twist2diff( const double d[AA_RESTRICT 8], const double t[AA_RESTRICT 8],
1533  double dd[AA_RESTRICT 8] ) ;
1534 
1536 AA_API void aa_tf_duqu_vel2diff( const double d[AA_RESTRICT 8], const double dx[AA_RESTRICT 6],
1537  double dd[AA_RESTRICT 8] ) ;
1538 
1540 AA_API void aa_tf_duqu_diff2vel( const double d[AA_RESTRICT 8], const double dd[AA_RESTRICT 8],
1541  double dx[AA_RESTRICT 6] ) ;
1542 
1545 AA_API void aa_tf_duqu_diff2twist( const double d[AA_RESTRICT 8], const double dd[AA_RESTRICT 8],
1546  double twist[AA_RESTRICT 8] ) ;
1547 
1554 AA_API void aa_tf_duqu_stwist( const double d0[AA_RESTRICT 8], const double twist[AA_RESTRICT 8],
1555  double dt, double d1[AA_RESTRICT 6] ) ;
1556 
1563 AA_API void aa_tf_duqu_svel( const double d0[AA_RESTRICT 8], const double dx[AA_RESTRICT 6],
1564  double dt, double d1[AA_RESTRICT 6] ) ;
1565 
1572 AA_API void aa_tf_duqu_sdiff( const double d0[AA_RESTRICT 8], const double dd[AA_RESTRICT 8],
1573  double dt, double d1[AA_RESTRICT 6] ) ;
1574 
1575 
1576 
1577 
1578 /* Misc */
1579 
1580 void aa_tf_relx_mean( size_t n, const double *R,
1581  const double *X, size_t ldx,
1582  const double *Y, size_t ldy,
1583  double rel[3]);
1584 
1585 void aa_tf_relx_median( size_t n, const double *R,
1586  const double *X, size_t ldx,
1587  const double *Y, size_t ldy,
1588  double rel[3]);
1589 
1590 #ifdef __cplusplus
1591 }
1592 #endif
1593 
1594 #endif //AMINO_TF_H
AA_API void aa_tf_qminimize(double q[AA_RESTRICT 4])
Minimize angle represented by the quaternion.
void aa_tf_qutr_sdiff(const double e0[7], const double de[7], double dt, double e1[7])
Integrate a quaternion-translation.
AA_API void aa_tf_qv_mzlook(const double eye[AA_RESTRICT 3], const double target[AA_RESTRICT 3], const double up[AA_RESTRICT 3], double q[AA_RESTRICT 4], double v[AA_RESTRICT 3])
Find the camera frame, looking in negative z direction.
static double AA_TF_QDOT(const double a[AA_RESTRICT 4], const double b[AA_RESTRICT 4])
Inlined quaternion dot product.
Definition: tf.h:853
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.
AA_API void aa_tf_duqu_twist2vel(const double d[AA_RESTRICT 8], const double t[AA_RESTRICT 8], double dx[AA_RESTRICT 6])
Dual quaternion twist to velocity.
AA_API void aa_tf_tfmat_lnv(const double T[AA_RESTRICT 12], double v[AA_RESTRICT 6])
Transformation Matrix logarithm.
AA_API void aa_tf_qduln(const double q[AA_RESTRICT 4], const double dq[AA_RESTRICT 4], double dln[AA_RESTRICT 3])
Derivative of the Unit Quaternion Logarithm.
static const double aa_tf_rotvec_ident[3]
Identity rotation vector array.
Definition: tf.h:473
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.
AA_API void aa_tf_tfmat_inv1(double T[AA_RESTRICT 12])
Invert a transform in place.
AA_API void aa_tf_quat2rotvec(const double q[AA_RESTRICT 4], double rotvec[AA_RESTRICT 3])
covert quaternion to rotation vector
AA_API void aa_tf_rotmat_inv1(double R[AA_RESTRICT 9])
Invert a rotation in place.
static const double aa_tf_vec_ident[3]
Identity vector-3 array.
Definition: tf.h:478
AA_API void aa_tf_xyz2duqu(double x, double y, double z, double d[AA_RESTRICT 8])
Pure translation dual quaternion.
AA_API void aa_tf_duqu2tfmat(const double d[AA_RESTRICT 8], double T[AA_RESTRICT 12])
Convert dual quaternion to transformation matrix.
AA_API void aa_tf_9rot(const double R[AA_RESTRICT 9], const double p0[AA_RESTRICT 3], double p1[AA_RESTRICT 3])
rotate p0 by R
#define AA_TF_ROTVEC_IDENT_INITIALIZER
Static initializer for an identity rotation-vector.
Definition: tf.h:417
struct aa_tf_vec3 aa_tf_vec3_t
Memory layout for a vector of length 3.
aa_tf_vec3_t v
the origin vector part
Definition: tf.h:244
struct aa_tf_vec3 col0
column 0
Definition: tf.h:155
void aa_tf_qutr_svel(const double e0[7], const double dx[6], double dt, double e1[7])
Integrate a quaternion-translation.
AA_API void aa_tf_tfmat_mzlook(const double eye[AA_RESTRICT 3], const double target[AA_RESTRICT 3], const double up[AA_RESTRICT 3], double T[AA_RESTRICT 12])
Find the camera frame, looking in negative z direction.
void aa_tf_qutr_conj(const double a[7], double c[7])
quaternion-translation conjugate
struct aa_tf_dx dx
velocity
Definition: tf.h:326
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.
AA_API void aa_tf_vecs2quat(const double u[AA_RESTRICT 3], const double v[AA_RESTRICT 3], double q[AA_RESTRICT 4])
Convert rotation between two vectors to a quaternion.
AA_API float aa_tf_vdotf(const float a[AA_RESTRICT 3], const float b[AA_RESTRICT 3])
Vector dot product.
AA_API void aa_tf_duqu_matrix_l(const double *q, double *M, size_t ldm)
Construct matrix for left dual quaternion multiply q*p = M*p.
double p
pitch
Definition: tf.h:221
void aa_tf_qutr_mul(const double a[7], const double b[7], double c[7])
quaternion-translation multiply
AA_API void aa_tf_qmatrix_l(const double *q, double *M, size_t ldm)
Construct matrix for left quaternion multiply q*p = M*p.
AA_API void aa_tf_qadd(const double a[AA_RESTRICT 4], const double b[AA_RESTRICT 4], double c[AA_RESTRICT 4])
Quaternion addition.
AA_API void aa_tf_qcmul(const double a[AA_RESTRICT 4], const double b[AA_RESTRICT 4], double c[AA_RESTRICT 4])
Quaternion conjugate a and multiply by b.
AA_API void aa_tf_axang_make(double x, double y, double z, double theta, double axang[AA_RESTRICT 4])
copy x,y,z,theta into axang
double data[8]
data array
Definition: tf.h:299
Memory layout for a vector of length 3.
Definition: tf.h:136
static const double aa_tf_rotmat_ident[9]
Identity rotation matrix array.
Definition: tf.h:448
struct aa_tf_vec3 vec
vector part
Definition: tf.h:205
AA_API void aa_tf_93rel(const double R1[AA_RESTRICT 9], const double v1[AA_RESTRICT 3], const double R2[AA_RESTRICT 9], const double v2[AA_RESTRICT 3], double Rrel[AA_RESTRICT 9], double vrel[AA_RESTRICT 3])
relative transform
AA_API void aa_tf_vnormalizef(float v[AA_RESTRICT 3])
Normalize Vector.
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.
void aa_tf_qutr_vel2diff(const double e[7], const double dx[6], double de[7])
Quaternion-translation spatial velocity to derivative.
#define AA_TF_QUTR_IDENT_INITIALIZER
Static initializer for an identity quaternion-translation.
Definition: tf.h:407
static const double aa_tf_ident[12]
Identity transformation matrix array.
Definition: tf.h:438
AA_API void aa_tf_qmul_qv(const double q[AA_RESTRICT 4], const double v[AA_RESTRICT 3], double c[AA_RESTRICT 4])
Quaternion multiplication.
AA_API void aa_tf_tfmat2duqu(const double T[AA_RESTRICT 12], double d[AA_RESTRICT 8])
Convert transformation matrix to dual quaternion.
AA_API void aa_tf_quat2rotvec_near(const double q[AA_RESTRICT 4], const double rv_near[AA_RESTRICT 3], double rotvec[AA_RESTRICT 3])
covert quaternion to rotation vector minimizing distance from rv_near
Memory layout for a transformation matrix.
Definition: tf.h:240
double y
yaw
Definition: tf.h:220
void aa_tf_duqu2qutr(const double s[8], double e[7])
dual quaternion to quaternion-translation
#define AA_TF_IDENT_INITIALIZER
Static initializer for an identity transformation matrix.
Definition: tf.h:387
double x
x component
Definition: tf.h:139
struct aa_tf_duqu aa_tf_duqu_t
Memory layout for a dual quaternion .
AA_API void aa_tf_9rel(const double R1[AA_RESTRICT 9], const double R2[AA_RESTRICT 9], double Ri[AA_RESTRICT 9])
relative transform from R1 to R2
AA_API void aa_tf_rotmat_expv(const double rv[AA_RESTRICT 3], double R[AA_RESTRICT 9])
Rotation Matrix exponential from rotation vector.
AA_API void aa_tf_rotmat_xy(const double x_axis[AA_RESTRICT 3], const double y_axis[AA_RESTRICT 3], double R[AA_RESTRICT 9])
Construct rotation matrix from an x and y axis of the child frame.
AA_API void aa_tf_duqu_diff2vel(const double d[AA_RESTRICT 8], const double dd[AA_RESTRICT 8], double dx[AA_RESTRICT 6])
Dual quaternion derivative to spatial velocity.
AA_API void aa_tf_rotmat_mzlook(const double eye[AA_RESTRICT 3], const double target[AA_RESTRICT 3], const double up[AA_RESTRICT 3], double R[AA_RESTRICT 9])
Find the camera frame, looking in negative z direction.
AA_API void aa_tf_9(const double R[AA_RESTRICT 9], const double p0[AA_RESTRICT 3], double p1[AA_RESTRICT 4])
apply a euclidean transform
AA_API void aa_tf_duqu_matrix_r(const double *q, double *M, size_t ldm)
Construct matrix for right dual quaternion multiply p*q = M*p.
double r
roll
Definition: tf.h:222
AA_API void aa_tf_rotmat_exp_aa(const double aa[AA_RESTRICT 4], double R[AA_RESTRICT 9])
Rotation Matrix exponential from axis angle.
struct aa_tf_quat aa_tf_quat_t
Memory layout for a quaternion, x,y,z,w order.
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.
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
static const double aa_tf_duqu_ident[8]
Identity dual quaternion array.
Definition: tf.h:458
AA_API void aa_tf_qslerp3diff(double u12, double du12, const double q1[AA_RESTRICT 4], const double q2[AA_RESTRICT 4], double u34, double du34, const double q3[AA_RESTRICT 4], const double q4[AA_RESTRICT 4], double u, double du, double q[AA_RESTRICT 4], double dq[AA_RESTRICT 4])
Triad sequence of slerp differentiation.
AA_API void aa_tf_qnormalize2(const double q[AA_RESTRICT 4], double qnorm[AA_RESTRICT 4])
Normailize quaternion.
double data[7]
data array
Definition: tf.h:284
AA_API void aa_tf_qvelrk1(const double q0[AA_RESTRICT 4], const double v[AA_RESTRICT 3], double dt, double q1[AA_RESTRICT 4])
Integrate unit quaternion from angular velocity, Runge-Kutta-1 (euler) integration.
void aa_tf_qutr2duqu(const double e[7], double s[8])
quaternion-translation to dual quaternion
double x
x component
Definition: tf.h:198
double data[4]
data array
Definition: tf.h:210
void aa_tf_qurand(double q[4])
Generate random unit quaternion.
double aa_tf_quhypangle2(const double q[AA_RESTRICT 4], const double p[AA_RESTRICT 4])
Return the angle between unit quaterniosn in 4D space.
AA_API void aa_tf_qutr_tf(const double E[AA_RESTRICT 7], const double p0[AA_RESTRICT 3], double p1[AA_RESTRICT 3])
Transform a point,.
struct aa_tf_rotmat aa_tf_rotmat_t
Memory layout for a rotation matrix.
AA_API void aa_tf_rotmat2axang(const double R[AA_RESTRICT 9], double ra[AA_RESTRICT 4])
convert rotation matrix to axis angle
AA_API void aa_tf_qutr_mzlook(const double eye[AA_RESTRICT 3], const double target[AA_RESTRICT 3], const double up[AA_RESTRICT 3], double T[AA_RESTRICT 12])
Find the camera frame, looking in negative z direction.
AA_API void aa_tf_qmzlook(const double eye[AA_RESTRICT 3], const double target[AA_RESTRICT 3], const double up[AA_RESTRICT 3], double q[AA_RESTRICT 4])
Find the camera frame, looking in negative z direction.
AA_API void aa_tf_axang_permute(const double rv[AA_RESTRICT 4], int k, double rv_p[AA_RESTRICT 4])
Scales angle by k * 2 * pi.
AA_API void aa_tf_duqu_twist2diff(const double d[AA_RESTRICT 8], const double t[AA_RESTRICT 8], double dd[AA_RESTRICT 8])
Dual quaternion twist to derivative.
AA_API void aa_tf_qsvel(const double q0[AA_RESTRICT 4], const double v[AA_RESTRICT 3], double dt, double q1[AA_RESTRICT 4])
Integrate unit quaternion from constant angular velocity.
AA_API void aa_tf_rotvec_permute(const double rv[AA_RESTRICT 3], int k, double rv_p[AA_RESTRICT 3])
find alternate equivalent representations of rv
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.
AA_API void aa_tf_rotmat_yz(const double y_axis[AA_RESTRICT 3], const double z_axis[AA_RESTRICT 3], double R[AA_RESTRICT 9])
Construct rotation matrix from a y and z axis of the child frame.
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.
AA_API void aa_tf_qv_conj(const double q[AA_RESTRICT 4], const double v[AA_RESTRICT 3], double qc[AA_RESTRICT 4], double vc[AA_RESTRICT 3])
Invert transform.
AA_API void aa_tf_qnormalize(double q[AA_RESTRICT 4])
Normalize Quaternion.
AA_API void aa_tf_qdpexp(const double e[AA_RESTRICT 3], const double de[AA_RESTRICT 3], double dq[AA_RESTRICT 4])
Derivative of the Pure Quaternion Exponential.
void aa_tf_tfmat2qutr(const double T[12], double e[7])
transformation matrix to quaternion-translation
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
struct aa_tf_axang aa_tf_axang_t
Axis-Angle rotation.
AA_API void aa_tf_qvelrk4(const double q0[AA_RESTRICT 4], const double v[AA_RESTRICT 3], double dt, double q1[AA_RESTRICT 4])
Integrate unit quaternion from angular velocity, Runge-Kutta-4 (euler) integration.
double aa_tf_qdot(const double a[AA_RESTRICT 4], const double b[AA_RESTRICT 4])
Quaternion dot product.
AA_API void aa_tf_axang2quat2(const double axis[AA_RESTRICT 3], double angle, double q[AA_RESTRICT 4])
axis-angle to quaternion.
AA_API void aa_tf_yangle2rotmat(double theta_y, double R[AA_RESTRICT 9])
Angle about y axis.
AA_API void aa_tf_axang2rotvec(const double axang[AA_RESTRICT 4], double rotvec[AA_RESTRICT 3])
convert axis-angle to rotation vector
struct aa_tf_eulerzyx aa_tf_eulerzyx_t
Memory layout for an Euler Angle in ZYX (yaw-pitch-roll) format.
void aa_tf_qutr_rand(double E[7])
Generate random transform.
struct aa_tf_tfmat aa_tf_tfmat_t
Memory layout for a transformation matrix.
double z
z component
Definition: tf.h:200
AA_API void aa_tf_qrot1(const double q[AA_RESTRICT 4], double v[AA_RESTRICT 3])
Quaternion point rotation, in place.
AA_API void aa_tf_qsub(const double a[AA_RESTRICT 4], const double b[AA_RESTRICT 4], double c[AA_RESTRICT 4])
Quaternion subtraction.
AA_API void aa_tf_12(const double T[AA_RESTRICT 12], const double p0[AA_RESTRICT 3], double p1[AA_RESTRICT 3])
apply a euclidean transform
AA_API void aa_tf_duqu_ln(const double d[AA_RESTRICT 8], double e[AA_RESTRICT 8])
Dual quaternion natural logarithm.
struct aa_tf_qv aa_tf_qv_t
Memory layout for a Transformation as rotation quaternion and translation vector. ...
double z
z component
Definition: tf.h:141
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.
AA_API void aa_tf_duqu_mulc(const double d1[AA_RESTRICT 8], const double d2[AA_RESTRICT 8], double d3[AA_RESTRICT 8])
Dual quaternion multiply d1 by conjugate of d2.
AA_API void aa_tf_duqu_exp(const double d[AA_RESTRICT 8], double e[AA_RESTRICT 8])
Dual quaternion exponential.
static const double aa_tf_axang_ident[4]
Identity axis-angle array.
Definition: tf.h:468
static const double aa_tf_vec_y[3]
A Y axis.
Definition: tf.h:488
AA_API void aa_tf_qmulc(const double a[AA_RESTRICT 4], const double b[AA_RESTRICT 4], double c[AA_RESTRICT 4])
Quaternion multiply a by conjugate b.
AA_API void aa_tf_duqu_add(const double d1[AA_RESTRICT 8], const double d2[AA_RESTRICT 8], double d3[AA_RESTRICT 8])
Dual quaternion addition.
AA_API void aa_tf_duqu_sdiff(const double d0[AA_RESTRICT 8], const double dd[AA_RESTRICT 8], double dt, double d1[AA_RESTRICT 6])
Dual quaternion derivative integration.
AA_API void aa_tf_duqu_svel(const double d0[AA_RESTRICT 8], const double dx[AA_RESTRICT 6], double dt, double d1[AA_RESTRICT 6])
Dual quaternion velocity integration.
static const double aa_tf_tfmat_ident[12]
Identity transformation matrix array.
Definition: tf.h:443
AA_API void aa_tf_qslerpdiffalg(double tau, const double a[AA_RESTRICT 4], const double b[AA_RESTRICT 4], double c[AA_RESTRICT 4])
Derivative of quaternation SLERP WRT tau, computed algebraicly.
AA_API void aa_tf_rotmat_zx(const double z_axis[AA_RESTRICT 3], const double x_axis[AA_RESTRICT 3], double R[AA_RESTRICT 9])
Construct rotation matrix from a z and x axis of the child frame.
AA_API void aa_tf_rotvec2quat(const double rotvec[AA_RESTRICT 3], double q[AA_RESTRICT 4])
covert rotation vector to quaternion
Memory layout for an SE(3) velocity.
Definition: tf.h:306
AA_API void aa_tf_qslerpalg(double tau, const double a[AA_RESTRICT 4], const double b[AA_RESTRICT 4], double c[AA_RESTRICT 4])
Quaternion SLERP, computed algebraicly.
Transform and spatial velocity.
Definition: tf.h:322
Memory layout for a quaternion, x,y,z,w order.
Definition: tf.h:195
#define AA_RESTRICT
Defined restrict keyword based on language flavor.
Definition: amino.h:99
static float AA_TF_VDOTF(const float a[AA_RESTRICT 3], const float b[AA_RESTRICT 3])
Inlined vector dot product.
Definition: tf.h:773
Memory layout for an Euler Angle in ZYX (yaw-pitch-roll) format.
Definition: tf.h:217
static void AA_TF_CROSS(const double a[AA_RESTRICT 3], const double b[AA_RESTRICT 3], double c[AA_RESTRICT 3])
Inlined Vector cross product.
Definition: tf.h:806
static const double aa_tf_vec_z[3]
A Z axis.
Definition: tf.h:493
AA_API void aa_tf_qmulnorm(const double a[AA_RESTRICT 4], const double b[AA_RESTRICT 4], double c[AA_RESTRICT 4])
Quaternion multiplication and normalize.
AA_API void aa_tf_quat2eulerzyx(const double q[AA_RESTRICT 4], double e[AA_RESTRICT 3])
Convert quaternion to ZYX Euler Angles.
double dv[3]
translational velocity
Definition: tf.h:309
AA_API void aa_tf_rotmat_lnv(const double R[AA_RESTRICT 9], double v[AA_RESTRICT 3])
Rotation Matrix logarithm.
AA_API void aa_tf_qmatrix_r(const double *q, double *M, size_t ldm)
Construct matrix for right quaternion multiply p*q = M*p.
double data[12]
data array
Definition: tf.h:246
AA_API void aa_tf_xangle2quat(double theta_x, double q[AA_RESTRICT 4])
Unit quaternion for angle about x axis.
static const double aa_tf_vec_x[3]
An X axis.
Definition: tf.h:483
AA_API void aa_tf_duqu_cmul(const double d1[AA_RESTRICT 8], const double d2[AA_RESTRICT 8], double d3[AA_RESTRICT 8])
Dual quaternion multiply conjugate of d1 by d2.
#define AA_TF_AXANG_IDENT_INITIALIZER
Static initializer for an identity axis-angle.
Definition: tf.h:412
AA_API void aa_tf_12rel(const double T1[AA_RESTRICT 12], const double T2[AA_RESTRICT 12], double Trel[AA_RESTRICT 12])
relative transform
double data[6]
data array
Definition: tf.h:312
AA_API void aa_tf_vnormalize(double v[AA_RESTRICT 3])
Normalize Vector.
Memory layout for a dual quaternion .
Definition: tf.h:293
AA_API void aa_tf_93(const double R[AA_RESTRICT 9], const double v[AA_RESTRICT 3], const double p0[AA_RESTRICT 3], double p1[AA_RESTRICT 4])
apply a euclidean transform
void aa_tf_qutr_diff2vel(const double e[7], const double de[7], double dx[6])
Quaternion-translation derivative to spatial velocity.
AA_API void aa_tf_93chain(const double R0[AA_RESTRICT 9], const double v0[AA_RESTRICT 3], const double R1[AA_RESTRICT 9], const double v1[AA_RESTRICT 3], double R[AA_RESTRICT 9], double v[AA_RESTRICT 3])
chain two transforms
double omega[3]
rotational velocity
Definition: tf.h:310
#define AA_API
calling and name mangling convention for functions
Definition: amino.h:95
AA_API void aa_tf_xangle2rotmat(double theta_x, double R[AA_RESTRICT 9])
Angle about x axis.
AA_API void aa_tf_duqu_diff2twist(const double d[AA_RESTRICT 8], const double dd[AA_RESTRICT 8], double twist[AA_RESTRICT 8])
Convert dual quaternion derivative to dual quaternion twist.
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.
#define AA_TF_DOTX(a, b)
Macro to compute a dot product of length 3 vectors.
Definition: tf.h:757
AA_API void aa_tf_rotmat_svel(const double R0[AA_RESTRICT 9], const double w[AA_RESTRICT 3], double dt, double R1[AA_RESTRICT 9])
Integrate rotational velocity.
AA_API void aa_tf_duqu_sub(const double d1[AA_RESTRICT 8], const double d2[AA_RESTRICT 8], double d3[AA_RESTRICT 8])
Dual quaternion subtraction.
AA_API void aa_tf_rotmat_inv2(const double R[AA_RESTRICT 9], double Ri[AA_RESTRICT 9])
Invert a rotation.
AA_API double aa_tf_vdot(const double a[AA_RESTRICT 3], const double b[AA_RESTRICT 3])
Vector dot product.
double aa_tf_qangle(const double q[AA_RESTRICT 4])
Return the angle of the quaternion.
#define AA_TF_ROTMAT_IDENT_INITIALIZER
Static initializer for an identity rotation matrix.
Definition: tf.h:392
AA_API void aa_tf_tfmat_svel(const double T0[AA_RESTRICT 12], const double w[AA_RESTRICT 3], double dt, double T1[AA_RESTRICT 12])
Integrate rotational velocity.
struct aa_tf_vec3 col2
column 2
Definition: tf.h:157
AA_API void aa_tf_qsdiff(const double q0[AA_RESTRICT 4], const double dq[AA_RESTRICT 4], double dt, double q1[AA_RESTRICT 4])
Integrate unit quaternion from quaternion derivative.
AA_API void aa_tf_qrel(const double q1[AA_RESTRICT 4], const double q2[AA_RESTRICT 4], double q_rel[AA_RESTRICT 4])
Relative orientation.
struct aa_tf_qv tf
transform
Definition: tf.h:325
AA_API void aa_tf_duqu_conj(const double d[AA_RESTRICT 8], double dconj[AA_RESTRICT 8])
Dual quaternion conjugate.
static void AA_TF_CROSSF(const float a[AA_RESTRICT 3], const float b[AA_RESTRICT 3], float c[AA_RESTRICT 3])
Inlined Vector cross product.
Definition: tf.h:815
AA_API void aa_tf_tfmat_inv2(const double T[AA_RESTRICT 12], double Ti[AA_RESTRICT 12])
Invert a transform.
AA_API void aa_tf_axang2quat(const double axang[AA_RESTRICT 4], double q[AA_RESTRICT 4])
axis-angle to quaternion.
AA_API void aa_tf_qmul_vq(const double v[AA_RESTRICT 3], const double q[AA_RESTRICT 4], double c[AA_RESTRICT 4])
Quaternion multiplication.
AA_API void aa_tf_rotmat2rotvec(const double R[AA_RESTRICT 9], double rv[AA_RESTRICT 3])
convert axis rotation matrix to rotation vector
AA_API void aa_tf_qln(const double q[AA_RESTRICT 4], double r[AA_RESTRICT 4])
Quaternion natural log.
AA_API void aa_tf_cross(const double a[AA_RESTRICT 3], const double b[AA_RESTRICT 3], double c[AA_RESTRICT 3])
Vector cross product.
AA_API void aa_tf_zangle2quat(double theta_z, double q[AA_RESTRICT 4])
Unit quaternion for angle about z axis.
AA_API double aa_tf_qnorm(const double q[AA_RESTRICT 4])
Return norm of the quaternion.
Axis-Angle rotation.
Definition: tf.h:166
void aa_tf_qutr_cmul(const double a[7], const double b[7], double c[7])
quaternion-translation conjugate multiply
double w
w component
Definition: tf.h:201
AA_API void aa_tf_duqu_normalize(double d[AA_RESTRICT 8])
Dual quaternion normalization.
AA_API void aa_tf_tf_duqu(const double d[AA_RESTRICT 8], const double p0[AA_RESTRICT 3], double p1[AA_RESTRICT 3])
Dual quaternion transformation.
AA_API void aa_tf_quat2axang(const double q[AA_RESTRICT 4], double axang[AA_RESTRICT 4])
Quaternion to axis-angle.
static const double aa_tf_quat_ident[4]
Identity quaternion array.
Definition: tf.h:453
static const double aa_tf_qutr_ident[7]
Identity quaternion-translation array.
Definition: tf.h:463
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
void aa_tf_qutr_mulc(const double a[7], const double b[7], double c[7])
quaternion-translation conjugate multiply
AA_API void aa_tf_duqu_trans(const double d[AA_RESTRICT 8], double v[AA_RESTRICT 3])
Extract dual quaternion translation vector.
static double AA_TF_VDOT(const double a[AA_RESTRICT 3], const double b[AA_RESTRICT 3])
Inlined vector dot product.
Definition: tf.h:764
double R[9]
the rotation matrix part
Definition: tf.h:243
void aa_tf_qutr2tfmat(const double e[7], double T[12])
quaternion-translation to transformation matrix
#define AA_TF_QUAT_IDENT_INITIALIZER
Static initializer for an identity quaternion.
Definition: tf.h:397
AA_API void aa_tf_crossf(const float a[AA_RESTRICT 3], const float b[AA_RESTRICT 3], float c[AA_RESTRICT 3])
Vector cross product.
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
AA_API void aa_tf_qslerpdiff(double tau, const double a[AA_RESTRICT 4], const double b[AA_RESTRICT 4], double c[AA_RESTRICT 4])
Derivative of quaternation SLERP WRT tau.
AA_API void aa_tf_rotmat_vel2diff(const double R[AA_RESTRICT 9], const double w[AA_RESTRICT 3], double dR[AA_RESTRICT 9])
Velocity to rotation matrix derivative.
AA_API void aa_tf_duqu_vel2twist(const double d[AA_RESTRICT 8], const double dx[AA_RESTRICT 6], double t[AA_RESTRICT 8])
Dual quaternion twist from velocity.
double v[3]
vector part
Definition: tf.h:206
AA_API void aa_tf_duqu_minimize(double d[AA_RESTRICT 8])
Dual quaternion angle minimization.
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
AA_API void aa_tf_v12chain(double T[AA_RESTRICT 12], const double T1[AA_RESTRICT 12], const double T2[AA_RESTRICT 12],...)
Varargs transform chain.
AA_API void aa_tf_tfmat_expv(const double v[AA_RESTRICT 6], double T[AA_RESTRICT 12])
Transformation Matrix exponential.
AA_API void aa_tf_qrot(const double q[AA_RESTRICT 4], const double v[AA_RESTRICT 3], double p[AA_RESTRICT 3])
Quaternion point rotation.
AA_API void aa_tf_duqu_smul(const double d1[AA_RESTRICT 8], const double d2[AA_RESTRICT 8], double d3[AA_RESTRICT 8])
Dual quaternion scalar multiplication.
AA_API void aa_tf_93inv(const double R[AA_RESTRICT 9], const double v[AA_RESTRICT 3], double Ri[AA_RESTRICT 9], double vi[AA_RESTRICT 3])
invert transform
AA_API void aa_tf_duqu_stwist(const double d0[AA_RESTRICT 8], const double twist[AA_RESTRICT 8], double dt, double d1[AA_RESTRICT 6])
Dual quaternion twist integration.
AA_API void aa_tf_v9mul(double R[AA_RESTRICT 9], const double R1[AA_RESTRICT 9], const double R2[AA_RESTRICT 9],...)
Vararg multiply two rotation matrices.
AA_API void aa_tf_qslerpchaindiff(double u, double du, const double q1[AA_RESTRICT 4], const double dq1[AA_RESTRICT 4], const double q2[AA_RESTRICT 4], const double dq2[AA_RESTRICT 4], double q[AA_RESTRICT 4], double dq[AA_RESTRICT 4])
Chain-rule slerp differentiation.
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.
double data[3]
data array
Definition: tf.h:224
double scalar
scalar part
Definition: tf.h:208
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_rotvec_near(const double rv[AA_RESTRICT 3], const double rv_near[AA_RESTRICT 3], double rv_p[AA_RESTRICT 3])
Scales rv by multiple of 2pi to minimized SSD with rv_near.
void aa_tf_qutr_wavg(size_t n, const double *w, const double *EE, size_t ldee, double *a)
Weighted average transform.
AA_API void aa_tf_rotmat2quat(const double rotmat[AA_RESTRICT 9], double quat[AA_RESTRICT 4])
convert rotation matrix to quaternion
struct aa_tf_vec3 col1
column 1
Definition: tf.h:156
AA_API void aa_tf_tf_qv(const double quat[AA_RESTRICT 4], const double v[AA_RESTRICT 3], const double p0[AA_RESTRICT 3], double p1[AA_RESTRICT 4])
apply a euclidean transform
double data[9]
data array
Definition: tf.h:159
AA_API void aa_tf_qrk1(const double q0[AA_RESTRICT 4], const double dq[AA_RESTRICT 4], double dt, double q1[AA_RESTRICT 4])
Integrate unit quaternion, Runge-Kutta-1 (euler) integration.
AA_API void aa_tf_qexp(const double q[AA_RESTRICT 4], double r[AA_RESTRICT 4])
Quaternion exponential.
#define AA_TF_DUQU_IDENT_INITIALIZER
Static initializer for an identity dual quaternion.
Definition: tf.h:402
AA_API int aa_tf_isrotmat(const double R[AA_RESTRICT 9])
tests if R is a rotation matrix
AA_API void aa_tf_qslerp(double tau, const double a[AA_RESTRICT 4], const double b[AA_RESTRICT 4], double c[AA_RESTRICT 4])
Quaternion SLERP.
AA_API void aa_tf_rotmat_diff2vel(const double R[AA_RESTRICT 9], const double dR[AA_RESTRICT 9], double w[AA_RESTRICT 3])
Rotation matrix derivative to velocity.
AA_API void aa_tf_rotmat2eulerzyx(const double R[AA_RESTRICT 9], double e[AA_RESTRICT 3])
Convert Rotation Matrix to ZYX Euler Angles.
AA_API void aa_tf_qconj(const double q[AA_RESTRICT 4], double r[AA_RESTRICT 4])
Quaternion conjugate.
AA_API void aa_tf_qinv(const double q[AA_RESTRICT 4], double r[AA_RESTRICT 4])
Quaternion inverse.
AA_API void aa_tf_12inv(const double T[AA_RESTRICT 12], double Ti[AA_RESTRICT 12])
invert transform
void aa_tf_qutr_mulnorm(const double a[7], const double b[7], double c[7])
quaternion-translation multiply and normalize
AA_API void aa_tf_duqu_norm(const double d[AA_RESTRICT 8], double *nreal, double *ndual)
Dual quaternion norm.
#define AA_TF_CROSSX(a, b, c)
Macro to compute the cross product of length 3 vectors.
Definition: tf.h:796
void aa_tf_tfmat2av(const double T[12], double q[AA_RESTRICT 4], double v[AA_RESTRICT 3])
transformation matrix to quaternion-translation