All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RotationMatrix.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ROTATIONMATRIX_H_
36 #define _BLAZE_MATH_ROTATIONMATRIX_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <algorithm>
44 #include <cmath>
45 #include <ostream>
46 #include <limits>
47 #include <blaze/math/Accuracy.h>
48 #include <blaze/math/DenseMatrix.h>
49 #include <blaze/math/Forward.h>
50 #include <blaze/math/shims/Equal.h>
52 #include <blaze/math/shims/IsNaN.h>
57 #include <blaze/system/Precision.h>
58 #include <blaze/util/Assert.h>
62 #include <blaze/util/Types.h>
63 
64 
65 namespace blaze {
66 
67 //=================================================================================================
68 //
69 // EULER ROTATIONS
70 //
71 //=================================================================================================
72 
73 //*************************************************************************************************
81  XYZs = 0,
82  ZYXr = 1,
83  XYXs = 2,
84  XYXr = 3,
85  XZYs = 4,
86  YZXr = 5,
87  XZXs = 6,
88  XZXr = 7,
89  YZXs = 8,
90  XZYr = 9,
91  YZYs = 10,
92  YZYr = 11,
93  YXZs = 12,
94  ZXYr = 13,
95  YXYs = 14,
96  YXYr = 15,
97  ZXYs = 16,
98  YXZr = 17,
99  ZXZs = 18,
100  ZXZr = 19,
101  ZYXs = 20,
102  XYZr = 21,
103  ZYZs = 22,
104  ZYZr = 23
105 };
106 //*************************************************************************************************
107 
108 
109 
110 
111 //=================================================================================================
112 //
113 // CLASS DEFINITION
114 //
115 //=================================================================================================
116 
117 //*************************************************************************************************
153 template< typename Type > // Data type of the rotation matrix
154 class RotationMatrix : public DenseMatrix< RotationMatrix<Type>, false >
155 {
156  public:
157  //**Type definitions****************************************************************************
159  typedef This ResultType;
160  typedef Type ElementType;
161  typedef const RotationMatrix& CompositeType;
162  //**********************************************************************************************
163 
164  //**Constructors********************************************************************************
167  explicit inline RotationMatrix();
168 
169  template< typename Axis >
170  explicit RotationMatrix( StaticVector<Axis,3UL> axis, Type angle );
171 
172  inline RotationMatrix( const RotationMatrix& m );
173 
174  template< typename Other >
175  inline RotationMatrix( const RotationMatrix<Other>& m );
177  //**********************************************************************************************
178 
179  //**Destructor**********************************************************************************
180  // No explicitly declared destructor.
181  //**********************************************************************************************
182 
183  //**Operators***********************************************************************************
186  inline RotationMatrix& operator= ( const RotationMatrix& rhs );
187  template< typename Other > inline RotationMatrix& operator= ( const RotationMatrix<Other>& rhs );
188  inline Type operator[]( size_t index ) const;
189  inline Type operator()( size_t i, size_t j ) const;
190  template< typename Other > inline RotationMatrix& operator*=( const RotationMatrix<Other>& rhs );
192  //**********************************************************************************************
193 
194  //**Utility functions***************************************************************************
197  inline size_t rows() const;
198  inline size_t columns() const;
199  inline void reset();
200  inline Type getDeterminant() const;
201  inline RotationMatrix& transpose();
202  inline RotationMatrix& invert();
203  inline void swap( RotationMatrix& m ) /* throw() */;
205  //**********************************************************************************************
206 
207  //**Expression template evaluation functions****************************************************
210  template< typename Other > inline bool isAliased( const Other* alias ) const;
212  //**********************************************************************************************
213 
214  //**Math functions******************************************************************************
217  template< typename Other >
218  inline const StaticMatrix< typename MultTrait<Type,Other>::Type, 3UL, 3UL, false >
219  rotate( const StaticMatrix<Other,3UL,3UL,false>& m ) const;
220 
221  template< typename Other >
222  inline const StaticMatrix< typename MultTrait<Type,Other>::Type, 3UL, 3UL, false >
225  //**********************************************************************************************
226 
227  //**Euler rotations*****************************************************************************
248  inline const StaticVector<Type,3UL> getEulerAnglesXYZ() const;
251  //**********************************************************************************************
252 
253  private:
254  //**Constructors********************************************************************************
257  explicit inline RotationMatrix( Type xx, Type xy, Type xz,
258  Type yx, Type yy, Type yz,
259  Type zx, Type zy, Type zz );
261  //**********************************************************************************************
262 
263  //**Member variables****************************************************************************
266  Type v_[9];
267 
275  //**********************************************************************************************
276 
277  //**Friend declarations*************************************************************************
279  template< typename Other > friend class Quaternion;
280 
281  template< typename Other >
282  friend const RotationMatrix<Other> trans( const RotationMatrix<Other>& m );
283 
284  template< typename Other >
285  friend const RotationMatrix<Other> inv( const RotationMatrix<Other>& m );
286 
287  template< typename T1, typename T2 >
289  operator*( const RotationMatrix<T1>& lhs, const RotationMatrix<T2>& rhs );
291  //**********************************************************************************************
292 
293  //**Compile time checks*************************************************************************
299  //**********************************************************************************************
300 };
301 //*************************************************************************************************
302 
303 
304 
305 
306 //=================================================================================================
307 //
308 // CONSTRUCTORS
309 //
310 //=================================================================================================
311 
312 //*************************************************************************************************
318 template< typename Type > // Data type of the rotation matrix
320 {
321  v_[0] = v_[4] = v_[8] = Type(1);
322  v_[1] = v_[2] = v_[3] = v_[5] = v_[6] = v_[7] = Type(0);
323 }
324 //*************************************************************************************************
325 
326 
327 //*************************************************************************************************
344 template< typename Type > // Data type of the rotation matrix
345 template< typename Axis > // Data type of the rotation axis
347 {
349 
350  BLAZE_USER_ASSERT( ( axis.sqrLength() > Axis(0) || angle == Type(0) ), "Invalid matrix parameters" );
351 
352  const Type sina( std::sin(angle) );
353  const Type cosa( std::cos(angle) );
354  const Type tmp( Type(1)-cosa );
355 
356  axis.normalize();
357 
358  v_[0] = cosa + axis[0]*axis[0]*tmp;
359  v_[1] = axis[0]*axis[1]*tmp - axis[2]*sina;
360  v_[2] = axis[0]*axis[2]*tmp + axis[1]*sina;
361  v_[3] = axis[1]*axis[0]*tmp + axis[2]*sina;
362  v_[4] = cosa + axis[1]*axis[1]*tmp;
363  v_[5] = axis[1]*axis[2]*tmp - axis[0]*sina;
364  v_[6] = axis[2]*axis[0]*tmp - axis[1]*sina;
365  v_[7] = axis[2]*axis[1]*tmp + axis[0]*sina;
366  v_[8] = cosa + axis[2]*axis[2]*tmp;
367 }
368 //*************************************************************************************************
369 
370 
371 //*************************************************************************************************
378 template< typename Type > // Data type of the rotation matrix
380 {
381  v_[0] = m.v_[0];
382  v_[1] = m.v_[1];
383  v_[2] = m.v_[2];
384  v_[3] = m.v_[3];
385  v_[4] = m.v_[4];
386  v_[5] = m.v_[5];
387  v_[6] = m.v_[6];
388  v_[7] = m.v_[7];
389  v_[8] = m.v_[8];
390 }
391 //*************************************************************************************************
392 
393 
394 //*************************************************************************************************
399 template< typename Type > // Data type of the rotation matrix
400 template< typename Other > // Data type of the foreign rotation matrix
402 {
403  v_[0] = m[0];
404  v_[1] = m[1];
405  v_[2] = m[2];
406  v_[3] = m[3];
407  v_[4] = m[4];
408  v_[5] = m[5];
409  v_[6] = m[6];
410  v_[7] = m[7];
411  v_[8] = m[8];
412 }
413 //*************************************************************************************************
414 
415 
416 //*************************************************************************************************
429 template< typename Type > // Data type of the rotation matrix
430 inline RotationMatrix<Type>::RotationMatrix( Type xx, Type xy, Type xz,
431  Type yx, Type yy, Type yz,
432  Type zx, Type zy, Type zz )
433 {
434  v_[0] = xx; v_[1] = xy; v_[2] = xz;
435  v_[3] = yx; v_[4] = yy; v_[5] = yz;
436  v_[6] = zx; v_[7] = zy; v_[8] = zz;
437 }
438 //*************************************************************************************************
439 
440 
441 
442 
443 //=================================================================================================
444 //
445 // OPERATORS
446 //
447 //=================================================================================================
448 
449 //*************************************************************************************************
457 template< typename Type > // Data type of the rotation matrix
459 {
460  // This implementation is faster than the synthesized default copy assignment operator and
461  // faster than an implementation with the C library function 'memcpy' in combination with a
462  // protection against self-assignment. Additionally, this version goes without a protection
463  // against self-assignment.
464  v_[0] = rhs.v_[0];
465  v_[1] = rhs.v_[1];
466  v_[2] = rhs.v_[2];
467  v_[3] = rhs.v_[3];
468  v_[4] = rhs.v_[4];
469  v_[5] = rhs.v_[5];
470  v_[6] = rhs.v_[6];
471  v_[7] = rhs.v_[7];
472  v_[8] = rhs.v_[8];
473  return *this;
474 }
475 //*************************************************************************************************
476 
477 
478 //*************************************************************************************************
484 template< typename Type > // Data type of the rotation matrix
485 template< typename Other > // Data type of the foreign rotation matrix
487 {
488  // This implementation is faster than the synthesized default copy assignment operator and
489  // faster than an implementation with the C library function 'memcpy' in combination with a
490  // protection against self-assignment. Additionally, this version goes without a protection
491  // against self-assignment.
492  v_[0] = rhs[0];
493  v_[1] = rhs[1];
494  v_[2] = rhs[2];
495  v_[3] = rhs[3];
496  v_[4] = rhs[4];
497  v_[5] = rhs[5];
498  v_[6] = rhs[6];
499  v_[7] = rhs[7];
500  v_[8] = rhs[8];
501  return *this;
502 }
503 //*************************************************************************************************
504 
505 
506 //*************************************************************************************************
514 template< typename Type > // Data type of the rotation matrix
515 inline Type RotationMatrix<Type>::operator[]( size_t index ) const
516 {
517  BLAZE_USER_ASSERT( index < 9, "Invalid rotation matrix access index" );
518  return v_[index];
519 }
520 //*************************************************************************************************
521 
522 
523 //*************************************************************************************************
530 template< typename Type > // Data type of the rotation matrix
531 inline Type RotationMatrix<Type>::operator()( size_t i, size_t j ) const
532 {
533  BLAZE_USER_ASSERT( i<3 && j<3, "Invalid rotation matrix access index" );
534  return v_[i*3+j];
535 }
536 //*************************************************************************************************
537 
538 
539 //*************************************************************************************************
546 template< typename Type > // Data type of the rotation matrix
547 template< typename Other > // Data type of the right-hand side rotation matrix
549 {
550  // Creating a temporary due to data dependencies
551  const RotationMatrix tmp( v_[0]*rhs[0] + v_[1]*rhs[3] + v_[2]*rhs[6],
552  v_[0]*rhs[1] + v_[1]*rhs[4] + v_[2]*rhs[7],
553  v_[0]*rhs[2] + v_[1]*rhs[5] + v_[2]*rhs[8],
554  v_[3]*rhs[0] + v_[4]*rhs[3] + v_[5]*rhs[6],
555  v_[3]*rhs[1] + v_[4]*rhs[4] + v_[5]*rhs[7],
556  v_[3]*rhs[2] + v_[4]*rhs[5] + v_[5]*rhs[8],
557  v_[6]*rhs[0] + v_[7]*rhs[3] + v_[8]*rhs[6],
558  v_[6]*rhs[1] + v_[7]*rhs[4] + v_[8]*rhs[7],
559  v_[6]*rhs[2] + v_[7]*rhs[5] + v_[8]*rhs[8] );
560 
561  return this->operator=( tmp );
562 }
563 //*************************************************************************************************
564 
565 
566 
567 
568 //=================================================================================================
569 //
570 // UTILITY FUNCTIONS
571 //
572 //=================================================================================================
573 
574 //*************************************************************************************************
579 template< typename Type > // Data type of the rotation matrix
580 inline size_t RotationMatrix<Type>::rows() const
581 {
582  return size_t(3);
583 }
584 //*************************************************************************************************
585 
586 
587 //*************************************************************************************************
592 template< typename Type > // Data type of the rotation matrix
593 inline size_t RotationMatrix<Type>::columns() const
594 {
595  return size_t(3);
596 }
597 //*************************************************************************************************
598 
599 
600 //*************************************************************************************************
613 template< typename Type > // Data type of the rotation matrix
615 {
616  v_[0] = v_[4] = v_[8] = Type(1);
617  v_[1] = v_[2] = v_[3] = v_[5] = v_[6] = v_[7] = Type(0);
618 }
619 //*************************************************************************************************
620 
621 
622 //*************************************************************************************************
627 template< typename Type > // Data type of the rotation matrix
629 {
630  // Although the determinant of a rotation matrix should always be exactly one, the
631  // function calculates the actual determinant to enable checks.
632  return v_[0]*v_[4]*v_[8] + v_[1]*v_[5]*v_[6] + v_[2]*v_[3]*v_[7] -
633  v_[6]*v_[4]*v_[2] - v_[7]*v_[5]*v_[0] - v_[8]*v_[3]*v_[1];
634 }
635 //*************************************************************************************************
636 
637 
638 //*************************************************************************************************
645 template< typename Type > // Data type of the rotation matrix
647 {
648  std::swap( v_[1], v_[3] );
649  std::swap( v_[2], v_[6] );
650  std::swap( v_[5], v_[7] );
651  return *this;
652 }
653 //*************************************************************************************************
654 
655 
656 //*************************************************************************************************
663 template< typename Type > // Data type of the rotation matrix
665 {
666  std::swap( v_[1], v_[3] );
667  std::swap( v_[2], v_[6] );
668  std::swap( v_[5], v_[7] );
669  return *this;
670 }
671 //*************************************************************************************************
672 
673 
674 //*************************************************************************************************
681 template< typename Type > // Data type of the rotation matrix
682 inline void RotationMatrix<Type>::swap( RotationMatrix& m ) /* throw() */
683 {
684  std::swap( v_[0], m.v_[0] );
685  std::swap( v_[1], m.v_[1] );
686  std::swap( v_[2], m.v_[2] );
687  std::swap( v_[3], m.v_[3] );
688  std::swap( v_[4], m.v_[4] );
689  std::swap( v_[5], m.v_[5] );
690  std::swap( v_[6], m.v_[6] );
691  std::swap( v_[7], m.v_[7] );
692  std::swap( v_[8], m.v_[8] );
693 }
694 //*************************************************************************************************
695 
696 
697 
698 
699 //=================================================================================================
700 //
701 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
702 //
703 //=================================================================================================
704 
705 //*************************************************************************************************
711 template< typename Type > // Data type of the matrix
712 template< typename Other > // Data type of the foreign expression
713 inline bool RotationMatrix<Type>::isAliased( const Other* alias ) const
714 {
715  return static_cast<const void*>( this ) == static_cast<const void*>( alias );
716 }
717 //*************************************************************************************************
718 
719 
720 
721 
722 //=================================================================================================
723 //
724 // MATH FUNCTIONS
725 //
726 //=================================================================================================
727 
728 //*************************************************************************************************
741 template< typename Type > // Data type of the rotation matrix
742 template< typename Other > // Data type of the standard matrix
743 inline const StaticMatrix< typename MultTrait<Type,Other>::Type, 3UL, 3UL, false >
745 {
747 
748  typedef StaticMatrix<typename MultTrait<Type,Other>::Type,3UL,3UL,false> MT;
749 
750  //--Multiplication in two steps (number of FLOP = 90, 1 additional temporary matrix)------------
751 
752  // Precalculation of tmp = m * R(-1)
753  const MT tmp( m.v_[0]*v_[0] + m.v_[1]*v_[1] + m.v_[2]*v_[2],
754  m.v_[0]*v_[3] + m.v_[1]*v_[4] + m.v_[2]*v_[5],
755  m.v_[0]*v_[6] + m.v_[1]*v_[7] + m.v_[2]*v_[8],
756  m.v_[3]*v_[0] + m.v_[4]*v_[1] + m.v_[5]*v_[2],
757  m.v_[3]*v_[3] + m.v_[4]*v_[4] + m.v_[5]*v_[5],
758  m.v_[3]*v_[6] + m.v_[4]*v_[7] + m.v_[5]*v_[8],
759  m.v_[6]*v_[0] + m.v_[7]*v_[1] + m.v_[8]*v_[2],
760  m.v_[6]*v_[3] + m.v_[7]*v_[4] + m.v_[8]*v_[5],
761  m.v_[6]*v_[6] + m.v_[7]*v_[7] + m.v_[8]*v_[8] );
762 
763  // Calculating ROT = R * tmp
764  return MT( v_[0]*tmp.v_[0] + v_[1]*tmp.v_[3] + v_[2]*tmp.v_[6],
765  v_[0]*tmp.v_[1] + v_[1]*tmp.v_[4] + v_[2]*tmp.v_[7],
766  v_[0]*tmp.v_[2] + v_[1]*tmp.v_[5] + v_[2]*tmp.v_[8],
767  v_[3]*tmp.v_[0] + v_[4]*tmp.v_[3] + v_[5]*tmp.v_[6],
768  v_[3]*tmp.v_[1] + v_[4]*tmp.v_[4] + v_[5]*tmp.v_[7],
769  v_[3]*tmp.v_[2] + v_[4]*tmp.v_[5] + v_[5]*tmp.v_[8],
770  v_[6]*tmp.v_[0] + v_[7]*tmp.v_[3] + v_[8]*tmp.v_[6],
771  v_[6]*tmp.v_[1] + v_[7]*tmp.v_[4] + v_[8]*tmp.v_[7],
772  v_[6]*tmp.v_[2] + v_[7]*tmp.v_[5] + v_[8]*tmp.v_[8] );
773 
774  //--Multiplication in one step (number of FLOP = 180, no additional temporary matrix)-----------
775  /*
776  return MT( m.v_[0]*v_[0]*v_[0] + m.v_[4]*v_[1]*v_[1] + m.v_[8]*v_[2]*v_[2] + v_[0]*v_[1]*( m.v_[1]+m.v_[3] ) + v_[0]*v_[2]*( m.v_[2]+m.v_[6] ) + v_[1]*v_[2]*( m.v_[5]+m.v_[7] ),
777  v_[0]*( m.v_[0]*v_[3] + m.v_[1]*v_[4] + m.v_[2]*v_[5] ) + v_[1]*( m.v_[3]*v_[3] + m.v_[4]*v_[4] + m.v_[5]*v_[5] ) + v_[2]*( m.v_[6]*v_[3] + m.v_[7]*v_[4] + m.v_[8]*v_[5] ),
778  v_[0]*( m.v_[0]*v_[6] + m.v_[1]*v_[7] + m.v_[2]*v_[8] ) + v_[1]*( m.v_[3]*v_[6] + m.v_[4]*v_[7] + m.v_[5]*v_[8] ) + v_[2]*( m.v_[6]*v_[6] + m.v_[7]*v_[7] + m.v_[8]*v_[8] ),
779  v_[3]*( m.v_[0]*v_[0] + m.v_[1]*v_[1] + m.v_[2]*v_[2] ) + v_[4]*( m.v_[3]*v_[0] + m.v_[4]*v_[1] + m.v_[5]*v_[2] ) + v_[5]*( m.v_[6]*v_[0] + m.v_[7]*v_[1] + m.v_[8]*v_[2] ),
780  m.v_[0]*v_[3]*v_[3] + m.v_[4]*v_[4]*v_[4] + m.v_[8]*v_[5]*v_[5] + v_[3]*v_[4]*( m.v_[1]+m.v_[3] ) + v_[3]*v_[5]*( m.v_[2]+m.v_[6] ) + v_[4]*v_[5]*( m.v_[5]+m.v_[7] ),
781  v_[3]*( m.v_[0]*v_[6] + m.v_[1]*v_[7] + m.v_[2]*v_[8] ) + v_[4]*( m.v_[3]*v_[6] + m.v_[4]*v_[7] + m.v_[5]*v_[8] ) + v_[5]*( m.v_[6]*v_[6] + m.v_[7]*v_[7] + m.v_[8]*v_[8] ),
782  v_[6]*( m.v_[0]*v_[0] + m.v_[1]*v_[1] + m.v_[2]*v_[2] ) + v_[7]*( m.v_[3]*v_[0] + m.v_[4]*v_[1] + m.v_[5]*v_[2] ) + v_[8]*( m.v_[6]*v_[0] + m.v_[7]*v_[1] + m.v_[8]*v_[2] ),
783  v_[6]*( m.v_[0]*v_[3] + m.v_[1]*v_[4] + m.v_[2]*v_[5] ) + v_[7]*( m.v_[3]*v_[3] + m.v_[4]*v_[4] + m.v_[5]*v_[5] ) + v_[8]*( m.v_[6]*v_[3] + m.v_[7]*v_[4] + m.v_[8]*v_[5] ),
784  m.v_[0]*v_[6]*v_[6] + m.v_[4]*v_[7]*v_[7] + m.v_[8]*v_[8]*v_[8] + v_[6]*v_[7]*( m.v_[1]+m.v_[3] ) + v_[6]*v_[8]*( m.v_[2]+m.v_[6] ) + v_[7]*v_[8]*( m.v_[5]+m.v_[7] ) );
785  */
786 }
787 //*************************************************************************************************
788 
789 
790 //*************************************************************************************************
805 template< typename Type > // Data type of the rotation matrix
806 template< typename Other > // Data type of the diagonal standard matrix
807 inline const StaticMatrix< typename MultTrait<Type,Other>::Type, 3UL, 3UL, false >
809 {
811 
812  typedef StaticMatrix<typename MultTrait<Type,Other>::Type,3UL,3UL,false> MT;
813 
814  // Precalculating tmp = m * R(-1)
815  const MT tmp( m.v_[0]*v_[0], m.v_[0]*v_[3], m.v_[0]*v_[6],
816  m.v_[4]*v_[1], m.v_[4]*v_[4], m.v_[4]*v_[7],
817  m.v_[8]*v_[2], m.v_[8]*v_[5], m.v_[8]*v_[8] );
818 
819  // Calculating ROT = R * tmp
820  return MT( v_[0]*tmp.v_[0] + v_[1]*tmp.v_[3] + v_[2]*tmp.v_[6],
821  v_[0]*tmp.v_[1] + v_[1]*tmp.v_[4] + v_[2]*tmp.v_[7],
822  v_[0]*tmp.v_[2] + v_[1]*tmp.v_[5] + v_[2]*tmp.v_[8],
823  v_[3]*tmp.v_[0] + v_[4]*tmp.v_[3] + v_[5]*tmp.v_[6],
824  v_[3]*tmp.v_[1] + v_[4]*tmp.v_[4] + v_[5]*tmp.v_[7],
825  v_[3]*tmp.v_[2] + v_[4]*tmp.v_[5] + v_[5]*tmp.v_[8],
826  v_[6]*tmp.v_[0] + v_[7]*tmp.v_[3] + v_[8]*tmp.v_[6],
827  v_[6]*tmp.v_[1] + v_[7]*tmp.v_[4] + v_[8]*tmp.v_[7],
828  v_[6]*tmp.v_[2] + v_[7]*tmp.v_[5] + v_[8]*tmp.v_[8] );
829 }
830 //*************************************************************************************************
831 
832 
833 
834 
835 //=================================================================================================
836 //
837 // EULER ROTATIONS
838 //
839 //=================================================================================================
840 
841 //*************************************************************************************************
848 template< typename Type > // Data type of the rotation matrix
850 {
851  const Type cy( std::sqrt( v_[0]*v_[0] + v_[3]*v_[3] ) );
852 
853  if( cy > accuracy ) {
854  return StaticVector<Type,3UL>( std::atan2( v_[7], v_[8] ), std::atan2( -v_[6], cy ), std::atan2( v_[3], v_[0] ) );
855  }
856  else {
857  return StaticVector<Type,3UL>( std::atan2( -v_[5], v_[4] ), std::atan2( -v_[6], cy ), Type(0) );
858  }
859 }
860 //*************************************************************************************************
861 
862 
863 //*************************************************************************************************
869 template< typename Type > // Data type of the rotation matrix
871 {
872  static const unsigned int eulSafe[4] = { 0, 1, 2, 0 };
873  static const unsigned int eulNext[4] = { 1, 2, 0, 1 };
874 
876 
877  // Unpacking the euler order
878  const unsigned int frame( order&1 );
879  const unsigned int repetition( (order&2)>>1 );
880  const unsigned int parity( (order&4)>>2 );
881  const unsigned int i( eulSafe[(order&24)>>3] );
882  const unsigned int j( eulNext[i+parity] );
883  const unsigned int k( eulNext[i+1-parity] );
884 
885  // Treatment of rotations with repetition
886  if( repetition ) {
887  const Type sy( std::sqrt( v_[i*3+j]*v_[i*3+j] + v_[i*3+k]*v_[i*3+k] ) );
888  if( sy > accuracy ) {
889  ea[0] = std::atan2( v_[i*3+j], v_[i*3+k] );
890  ea[1] = std::atan2( sy, v_[i*3+i] );
891  ea[2] = std::atan2( v_[j*3+i], -v_[k*3+i] );
892  }
893  else {
894  ea[0] = std::atan2( -v_[j*3+k], v_[j*3+j] );
895  ea[1] = std::atan2( sy, v_[i*3+i] );
896  ea[2] = Type(0);
897  }
898  }
899 
900  // Treatment of rotations without repetition
901  else {
902  const Type cy( std::sqrt( v_[i*3+i]*v_[i*3+i] + v_[j*3+i]*v_[j*3+i] ) );
903  if( cy > accuracy ) {
904  ea[0] = std::atan2( v_[k*3+j], v_[k*3+k] );
905  ea[1] = std::atan2( -v_[k*3+i], cy );
906  ea[2] = std::atan2( v_[j*3+i], v_[i*3+i] );
907  }
908  else {
909  ea[0] = std::atan2( -v_[j*3+k], v_[j*3+j] );
910  ea[1] = std::atan2( -v_[k*3+i], cy );
911  ea[2] = Type(0);
912  }
913  }
914 
915  // Treatment of an odd partity
916  if( parity ) {
917  ea[0] = -ea[0];
918  ea[1] = -ea[1];
919  ea[2] = -ea[2];
920  }
921 
922  // Treatment of a rotating frame
923  if( frame ) {
924  Type tmp = ea[0];
925  ea[0] = ea[2];
926  ea[2] = tmp;
927  }
928 
929  return ea;
930 }
931 //*************************************************************************************************
932 
933 
934 
935 
936 //=================================================================================================
937 //
938 // GLOBAL OPERATORS
939 //
940 //=================================================================================================
941 
942 //*************************************************************************************************
945 template< typename T1, typename T2 >
946 inline bool operator==( const RotationMatrix<T1>& lhs, const RotationMatrix<T2>& rhs );
947 
948 template< typename T1, typename T2 >
949 inline bool operator!=( const RotationMatrix<T1>& lhs, const RotationMatrix<T2>& rhs );
950 
951 template< typename Type >
952 std::ostream& operator<<( std::ostream& os, const RotationMatrix<Type>& m );
953 
954 template< typename Type >
955 inline bool isnan( const RotationMatrix<Type>& m );
956 
957 template< typename Type >
959 
960 template< typename Type >
962 
963 template< typename Type >
964 inline void reset( RotationMatrix<Type>& m );
965 
966 template< typename Type >
967 inline void clear( RotationMatrix<Type>& m );
968 
969 template< typename Type >
970 inline bool isDefault( const RotationMatrix<Type>& m );
971 
972 template< typename Type >
973 inline const RotationMatrix<Type> trans( const RotationMatrix<Type>& m );
974 
975 template< typename Type >
976 inline const RotationMatrix<Type> inv( const RotationMatrix<Type>& m );
977 
978 template< typename Type >
979 inline const RotationMatrix<Type> sq( const RotationMatrix<Type>& m );
980 
981 template< typename Type >
982 inline void swap( RotationMatrix<Type>& a, RotationMatrix<Type>& b ) /* throw() */;
984 //*************************************************************************************************
985 
986 
987 //*************************************************************************************************
995 template< typename T1 // Data type of the left-hand side rotation matrix
996  , typename T2 > // Data type of the right-hand side rotation matrix
997 inline bool operator==( const RotationMatrix<T1>& lhs, const RotationMatrix<T2>& rhs )
998 {
999  // In order to compare the two matrices, the data values of the lower-order data
1000  // type are converted to the higher-order data type within the equal function.
1001  if( !equal( lhs[0], rhs[0] ) ||
1002  !equal( lhs[1], rhs[1] ) ||
1003  !equal( lhs[2], rhs[2] ) ||
1004  !equal( lhs[3], rhs[3] ) ||
1005  !equal( lhs[4], rhs[4] ) ||
1006  !equal( lhs[5], rhs[5] ) ||
1007  !equal( lhs[6], rhs[6] ) ||
1008  !equal( lhs[7], rhs[7] ) ||
1009  !equal( lhs[8], rhs[8] ) )
1010  return false;
1011  else return true;
1012 }
1013 //*************************************************************************************************
1014 
1015 
1016 //*************************************************************************************************
1024 template< typename T1 // Data type of the left-hand side rotation matrix
1025  , typename T2 > // Data type of the right-hand side rotation matrix
1026 inline bool operator!=( const RotationMatrix<T1>& lhs, const RotationMatrix<T2>& rhs )
1027 {
1028  return !( lhs == rhs );
1029 }
1030 //*************************************************************************************************
1031 
1032 
1033 //*************************************************************************************************
1041 template< typename Type > // Data type of the rotation matrix
1042 std::ostream& operator<<( std::ostream& os, const RotationMatrix<Type>& m )
1043 {
1044  return os << " ( " << m[0] << " , " << m[1] << " , " << m[2] << " )\n"
1045  << " ( " << m[3] << " , " << m[4] << " , " << m[5] << " )\n"
1046  << " ( " << m[6] << " , " << m[7] << " , " << m[8] << " )\n";
1047 }
1048 //*************************************************************************************************
1049 
1050 
1051 //*************************************************************************************************
1058 template< typename Type > // Data type of the rotation matrix
1059 inline bool isnan( const RotationMatrix<Type>& m )
1060 {
1061  if( isnan( m[0] ) || isnan( m[1] ) || isnan( m[2] ) ||
1062  isnan( m[3] ) || isnan( m[4] ) || isnan( m[5] ) ||
1063  isnan( m[6] ) || isnan( m[7] ) || isnan( m[8] ) )
1064  return true;
1065  else return false;
1066 }
1067 //*************************************************************************************************
1068 
1069 
1070 //*************************************************************************************************
1080 template< typename Type > // Data type of the rotation matrix
1082 {
1083  using std::abs;
1084  return StaticMatrix<Type,3UL,3UL,false>( abs(m[0]), abs(m[1]), abs(m[2]),
1085  abs(m[3]), abs(m[4]), abs(m[5]),
1086  abs(m[6]), abs(m[7]), abs(m[8]) );
1087 }
1088 //*************************************************************************************************
1089 
1090 
1091 //*************************************************************************************************
1101 template< typename Type > // Data type of the rotation matrix
1103 {
1104  using std::fabs;
1105  return StaticMatrix<Type,3UL,3UL,false>( fabs(m[0]), fabs(m[1]), fabs(m[2]),
1106  fabs(m[3]), fabs(m[4]), fabs(m[5]),
1107  fabs(m[6]), fabs(m[7]), fabs(m[8]) );
1108 }
1109 //*************************************************************************************************
1110 
1111 
1112 //*************************************************************************************************
1119 template< typename Type > // Data type of the rotation matrix
1120 inline void reset( RotationMatrix<Type>& m )
1121 {
1122  m.reset();
1123 }
1124 //*************************************************************************************************
1125 
1126 
1127 //*************************************************************************************************
1136 template< typename Type > // Data type of the rotation matrix
1137 inline void clear( RotationMatrix<Type>& m )
1138 {
1139  m.reset();
1140 }
1141 //*************************************************************************************************
1142 
1143 
1144 //*************************************************************************************************
1151 template< typename Type > // Data type of the rotation matrix
1152 inline bool isDefault( const RotationMatrix<Type>& m )
1153 {
1154  return ( m[0] == Type(1) ) && ( m[1] == Type(0) ) && ( m[2] == Type(0) ) &&
1155  ( m[3] == Type(0) ) && ( m[4] == Type(1) ) && ( m[5] == Type(0) ) &&
1156  ( m[6] == Type(0) ) && ( m[7] == Type(0) ) && ( m[8] == Type(1) );
1157 }
1158 //*************************************************************************************************
1159 
1160 
1161 //*************************************************************************************************
1178 template< typename Type > // Data type of the rotation matrix
1180 {
1181  return RotationMatrix<Type>( m[0], m[3], m[6],
1182  m[1], m[4], m[7],
1183  m[2], m[5], m[8] );
1184 }
1185 //*************************************************************************************************
1186 
1187 
1188 //*************************************************************************************************
1205 template< typename Type > // Data type of the rotation matrix
1207 {
1208  return RotationMatrix<Type>( m[0], m[3], m[6], m[1], m[4], m[7], m[2], m[5], m[8] );
1209 }
1210 //*************************************************************************************************
1211 
1212 
1213 //*************************************************************************************************
1223 template< typename Type > // Data type of the rotation matrix
1225 {
1226  return m * m;
1227 }
1228 //*************************************************************************************************
1229 
1230 
1231 //*************************************************************************************************
1240 template< typename Type > // Data type of the rotation matrices
1241 inline void swap( RotationMatrix<Type>& a, RotationMatrix<Type>& b ) /* throw() */
1242 {
1243  a.swap( b );
1244 }
1245 //*************************************************************************************************
1246 
1247 
1248 
1249 
1250 //=================================================================================================
1251 //
1252 // GLOBAL ARITHMETIC OPERATORS
1253 //
1254 //=================================================================================================
1255 
1256 //*************************************************************************************************
1259 template< typename T1, typename T2 >
1260 inline const StaticVector< typename MultTrait<T1,T2>::Type, 3UL, false >
1261  operator*( const RotationMatrix<T1>& lhs, const StaticVector<T2,3UL,false>& rhs );
1262 
1263 template< typename T1, typename T2 >
1264 inline const StaticVector< typename MultTrait<T1,T2>::Type, 3UL, true >
1265  operator*( const StaticVector<T1,3UL,true>& lhs, const RotationMatrix<T2>& rhs );
1266 
1267 template< typename T1, typename T2 >
1268 inline const StaticMatrix< typename MultTrait<T1,T2>::Type, 3UL, 3UL, false >
1269  operator*( const RotationMatrix<T1>& lhs, const StaticMatrix<T2,3UL,3UL,false>& rhs );
1270 
1271 template< typename T1, typename T2 >
1272 inline const StaticMatrix< typename MultTrait<T1,T2>::Type, 3UL, 3UL, false >
1273  operator*( const StaticMatrix<T1,3UL,3UL,false>& lhs, const RotationMatrix<T2>& rhs );
1274 
1275 template< typename T1, typename T2 >
1276 inline const RotationMatrix< typename MultTrait<T1,T2>::Type >
1277  operator*( const RotationMatrix<T1>& lhs, const RotationMatrix<T2>& rhs );
1279 //*************************************************************************************************
1280 
1281 
1282 //*************************************************************************************************
1295 template< typename T1 // Data type of the left-hand side rotation matrix
1296  , typename T2 > // Data type of the right-hand side vector
1297 inline const StaticVector< typename MultTrait<T1,T2>::Type, 3UL, false >
1299 {
1300  typedef typename MultTrait<T1,T2>::Type MT;
1301  return StaticVector<MT,3UL,false>( lhs[0]*rhs[0] + lhs[1]*rhs[1] + lhs[2]*rhs[2],
1302  lhs[3]*rhs[0] + lhs[4]*rhs[1] + lhs[5]*rhs[2],
1303  lhs[6]*rhs[0] + lhs[7]*rhs[1] + lhs[8]*rhs[2] );
1304 }
1305 //*************************************************************************************************
1306 
1307 
1308 //*************************************************************************************************
1321 template< typename T1 // Data type of the left-hand side vector
1322  , typename T2 > // Data type of the right-hand side rotation matrix
1323 inline const StaticVector< typename MultTrait<T1,T2>::Type, 3UL, true >
1325 {
1326  typedef typename MultTrait<T1,T2>::Type MT;
1327  return StaticVector<MT,3UL,true>( lhs[0]*rhs[0] + lhs[1]*rhs[3] + lhs[2]*rhs[6],
1328  lhs[0]*rhs[1] + lhs[1]*rhs[4] + lhs[2]*rhs[7],
1329  lhs[0]*rhs[2] + lhs[1]*rhs[5] + lhs[2]*rhs[8] );
1330 }
1331 //*************************************************************************************************
1332 
1333 
1334 //*************************************************************************************************
1347 template< typename T1 // Data type of the left-hand side rotation matrix
1348  , typename T2 > // Data type of the right-hand side standard matrix
1349 inline const StaticMatrix< typename MultTrait<T1,T2>::Type, 3UL, 3UL, false >
1351 {
1352  typedef StaticMatrix<typename MultTrait<T1,T2>::Type,3UL,3UL,false> MT;
1353  return MT( lhs[0]*rhs[0] + lhs[1]*rhs[3] + lhs[2]*rhs[6],
1354  lhs[0]*rhs[1] + lhs[1]*rhs[4] + lhs[2]*rhs[7],
1355  lhs[0]*rhs[2] + lhs[1]*rhs[5] + lhs[2]*rhs[8],
1356  lhs[3]*rhs[0] + lhs[4]*rhs[3] + lhs[5]*rhs[6],
1357  lhs[3]*rhs[1] + lhs[4]*rhs[4] + lhs[5]*rhs[7],
1358  lhs[3]*rhs[2] + lhs[4]*rhs[5] + lhs[5]*rhs[8],
1359  lhs[6]*rhs[0] + lhs[7]*rhs[3] + lhs[8]*rhs[6],
1360  lhs[6]*rhs[1] + lhs[7]*rhs[4] + lhs[8]*rhs[7],
1361  lhs[6]*rhs[2] + lhs[7]*rhs[5] + lhs[8]*rhs[8] );
1362 }
1363 //*************************************************************************************************
1364 
1365 
1366 //*************************************************************************************************
1379 template< typename T1 // Data type of the left-hand side standard matrix
1380  , typename T2 > // Data type of the right-hand side rotation matrix
1381 inline const StaticMatrix< typename MultTrait<T1,T2>::Type, 3UL, 3UL, false >
1383 {
1384  typedef StaticMatrix<typename MultTrait<T1,T2>::Type,3UL,3UL,false> MT;
1385  return MT( lhs[0]*rhs[0] + lhs[1]*rhs[3] + lhs[2]*rhs[6],
1386  lhs[0]*rhs[1] + lhs[1]*rhs[4] + lhs[2]*rhs[7],
1387  lhs[0]*rhs[2] + lhs[1]*rhs[5] + lhs[2]*rhs[8],
1388  lhs[3]*rhs[0] + lhs[4]*rhs[3] + lhs[5]*rhs[6],
1389  lhs[3]*rhs[1] + lhs[4]*rhs[4] + lhs[5]*rhs[7],
1390  lhs[3]*rhs[2] + lhs[4]*rhs[5] + lhs[5]*rhs[8],
1391  lhs[6]*rhs[0] + lhs[7]*rhs[3] + lhs[8]*rhs[6],
1392  lhs[6]*rhs[1] + lhs[7]*rhs[4] + lhs[8]*rhs[7],
1393  lhs[6]*rhs[2] + lhs[7]*rhs[5] + lhs[8]*rhs[8] );
1394 }
1395 //*************************************************************************************************
1396 
1397 
1398 //*************************************************************************************************
1410 template< typename T1 // Data type of the left-hand side rotation matrix
1411  , typename T2 > // Data type of the right-hand side rotation matrix
1412 inline const RotationMatrix< typename MultTrait<T1,T2>::Type >
1414 {
1415  typedef typename MultTrait<T1,T2>::Type MT;
1416  return RotationMatrix<MT>( lhs.v_[0]*rhs.v_[0] + lhs.v_[1]*rhs.v_[3] + lhs.v_[2]*rhs.v_[6],
1417  lhs.v_[0]*rhs.v_[1] + lhs.v_[1]*rhs.v_[4] + lhs.v_[2]*rhs.v_[7],
1418  lhs.v_[0]*rhs.v_[2] + lhs.v_[1]*rhs.v_[5] + lhs.v_[2]*rhs.v_[8],
1419  lhs.v_[3]*rhs.v_[0] + lhs.v_[4]*rhs.v_[3] + lhs.v_[5]*rhs.v_[6],
1420  lhs.v_[3]*rhs.v_[1] + lhs.v_[4]*rhs.v_[4] + lhs.v_[5]*rhs.v_[7],
1421  lhs.v_[3]*rhs.v_[2] + lhs.v_[4]*rhs.v_[5] + lhs.v_[5]*rhs.v_[8],
1422  lhs.v_[6]*rhs.v_[0] + lhs.v_[7]*rhs.v_[3] + lhs.v_[8]*rhs.v_[6],
1423  lhs.v_[6]*rhs.v_[1] + lhs.v_[7]*rhs.v_[4] + lhs.v_[8]*rhs.v_[7],
1424  lhs.v_[6]*rhs.v_[2] + lhs.v_[7]*rhs.v_[5] + lhs.v_[8]*rhs.v_[8] );
1425 }
1426 //*************************************************************************************************
1427 
1428 
1429 
1430 
1431 //=================================================================================================
1432 //
1433 // MULTTRAIT SPECIALIZATIONS
1434 //
1435 //=================================================================================================
1436 
1437 //*************************************************************************************************
1439 template< typename T1, typename T2 >
1440 struct MultTrait< RotationMatrix<T1>, StaticVector<T2,3UL,false> >
1441 {
1442  typedef StaticVector< typename MultTrait<T1,T2>::Type, 3UL, false > Type;
1443 };
1444 
1445 template< typename T1, typename T2 >
1446 struct MultTrait< StaticVector<T1,3UL,true>, RotationMatrix<T2> >
1447 {
1448  typedef StaticVector< typename MultTrait<T1,T2>::Type, 3UL, true > Type;
1449 };
1450 
1451 template< typename T1, typename T2 >
1452 struct MultTrait< RotationMatrix<T1>, DynamicVector<T2,false> >
1453 {
1454  typedef StaticVector< typename MultTrait<T1,T2>::Type, 3UL, false > Type;
1455 };
1456 
1457 template< typename T1, typename T2 >
1458 struct MultTrait< DynamicVector<T1,true>, RotationMatrix<T2> >
1459 {
1460  typedef StaticVector< typename MultTrait<T1,T2>::Type, 3UL, true > Type;
1461 };
1462 
1463 template< typename T1, typename T2 >
1464 struct MultTrait< RotationMatrix<T1>, CompressedVector<T2,false> >
1465 {
1466  typedef StaticVector< typename MultTrait<T1,T2>::Type, 3UL, false > Type;
1467 };
1468 
1469 template< typename T1, typename T2 >
1470 struct MultTrait< CompressedVector<T1,true>, RotationMatrix<T2> >
1471 {
1472  typedef StaticVector< typename MultTrait<T1,T2>::Type, 3UL, true > Type;
1473 };
1474 
1475 template< typename T1, typename T2 >
1476 struct MultTrait< RotationMatrix<T1>, StaticMatrix<T2,3UL,3UL,false> >
1477 {
1478  typedef StaticMatrix< typename MultTrait<T1,T2>::Type, 3UL, 3UL, false > Type;
1479 };
1480 
1481 template< typename T1, typename T2 >
1482 struct MultTrait< StaticMatrix<T1,3UL,3UL,false>, RotationMatrix<T2> >
1483 {
1484  typedef StaticMatrix< typename MultTrait<T1,T2>::Type, 3UL, 3UL, false > Type;
1485 };
1486 
1487 template< typename T1, typename T2, bool SO >
1488 struct MultTrait< RotationMatrix<T1>, DynamicMatrix<T2,SO> >
1489 {
1490  typedef DynamicMatrix< typename MultTrait<T1,T2>::Type, false > Type;
1491 };
1492 
1493 template< typename T1, bool SO, typename T2 >
1494 struct MultTrait< DynamicMatrix<T1,SO>, RotationMatrix<T2> >
1495 {
1496  typedef DynamicMatrix< typename MultTrait<T1,T2>::Type, false > Type;
1497 };
1498 
1499 template< typename T1, typename T2, bool SO >
1500 struct MultTrait< RotationMatrix<T1>, CompressedMatrix<T2,SO> >
1501 {
1502  typedef DynamicMatrix< typename MultTrait<T1,T2>::Type, false > Type;
1503 };
1504 
1505 template< typename T1, bool SO, typename T2 >
1506 struct MultTrait< CompressedMatrix<T1,SO>, RotationMatrix<T2> >
1507 {
1508  typedef DynamicMatrix< typename MultTrait<T1,T2>::Type, false > Type;
1509 };
1510 
1511 template< typename T1, typename T2 >
1512 struct MultTrait< RotationMatrix<T1>, RotationMatrix<T2> >
1513 {
1514  typedef RotationMatrix< typename MultTrait<T1,T2>::Type > Type;
1515 };
1517 //*************************************************************************************************
1518 
1519 
1520 
1521 
1522 //=================================================================================================
1523 //
1524 // MATHTRAIT SPECIALIZATIONS
1525 //
1526 //=================================================================================================
1527 
1528 //*************************************************************************************************
1530 template< typename T1, typename T2 >
1531 struct MathTrait< RotationMatrix<T1>, RotationMatrix<T2> >
1532 {
1533  typedef RotationMatrix< typename MathTrait<T1,T2>::HighType > HighType;
1534  typedef RotationMatrix< typename MathTrait<T1,T2>::LowType > LowType;
1535 };
1537 //*************************************************************************************************
1538 
1539 
1540 
1541 
1542 //=================================================================================================
1543 //
1544 // TYPE DEFINITIONS
1545 //
1546 //=================================================================================================
1547 
1548 //*************************************************************************************************
1553 //*************************************************************************************************
1554 
1555 } // namespace blaze
1556 
1557 #endif
Header file for the isnan shim.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type, a compilation error is created.
Definition: Const.h:116
Computation accuracy for floating point data types.
Rotation order x, z, y in a static frame.
Definition: RotationMatrix.h:85
Type getDeterminant() const
Calculation of the determinant of the rotation matrix.
Definition: RotationMatrix.h:628
Type ElementType
Type of the matrix elements.
Definition: RotationMatrix.h:160
Rotation order x, z, x in a rotating frame.
Definition: RotationMatrix.h:88
void reset(DynamicMatrix< Type, SO > &m)
Resetting the given dense matrix.
Definition: DynamicMatrix.h:4579
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
const DMatDMatMultExpr< T1, T2 > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:4075
const StaticVector< Type, 3UL > getEulerAngles(EulerRotation order) const
Calculation of the Euler angles for a specific rotation order.
Definition: RotationMatrix.h:870
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:751
RotationMatrix< real > Rot3
Rotation matrix of real type.
Definition: RotationMatrix.h:1552
bool isDefault(const DynamicMatrix< Type, SO > &m)
Returns whether the given dense matrix is in default state.
Definition: DynamicMatrix.h:4622
Efficient, generic implementation of a 3x3 rotation matrix.The RotationMatrix class is the representa...
Definition: Forward.h:57
const Quaternion< Type > sq(const Quaternion< Type > &m)
Squaring the given quaternion.
Definition: Quaternion.h:1034
void swap(RotationMatrix &m)
Swapping the contents of two 3x3 matrices.
Definition: RotationMatrix.h:682
const StaticMatrix< typename MultTrait< Type, Other >::Type, 3UL, 3UL, false > diagRotate(const StaticMatrix< Other, 3UL, 3UL, false > &m) const
Rotation of a diagonal matrix M ( ).
Definition: RotationMatrix.h:808
const DMatAbsExpr< MT, SO > abs(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the absolute values of each single element of dm.
Definition: DMatAbsExpr.h:764
AlignedArray< Type, M *NN > v_
The statically allocated matrix elements.
Definition: StaticMatrix.h:431
const StaticMatrix< Type, 3UL, 3UL, false > fabs(const RotationMatrix< Type > &m)
Returns a matrix containing the absolute values of each single element of m.
Definition: RotationMatrix.h:1102
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type, a compilation error is created.
Definition: Volatile.h:116
bool isnan(const DenseMatrix< MT, SO > &dm)
Checks the given dense matrix for not-a-number elements.
Definition: DenseMatrix.h:637
Rotation order x, y, z in a rotating frame.
Definition: RotationMatrix.h:102
Rotation order y, x, z in a static frame.
Definition: RotationMatrix.h:93
void reset()
Reset to the default initial values.
Definition: RotationMatrix.h:614
Rotation order y, z, y in a static frame.
Definition: RotationMatrix.h:91
void clear(DynamicMatrix< Type, SO > &m)
Clearing the given dense matrix.
Definition: DynamicMatrix.h:4595
Rotation order z, x, z in a rotating frame.
Definition: RotationMatrix.h:100
Rotation order x, y, z in a static frame.
Definition: RotationMatrix.h:81
Efficient implementation of a fixed-sized vector.The StaticVector class template is the representatio...
Definition: Forward.h:51
size_t columns() const
Returns the current number of columns of the rotation matrix.
Definition: RotationMatrix.h:593
Rotation order x, z, y in a rotating frame.
Definition: RotationMatrix.h:90
Rotation order y, x, z in a rotating frame.
Definition: RotationMatrix.h:98
const RotationMatrix & CompositeType
Data type for composite expression templates.
Definition: RotationMatrix.h:161
Header file for the floating point precision of the Blaze library.
const StaticVector< Type, 3UL > getEulerAnglesXYZ() const
Calculation of the Euler angles (in radian measure).
Definition: RotationMatrix.h:849
RotationMatrix & operator=(const RotationMatrix &rhs)
Copy assignment operator for RotationMatrix.
Definition: RotationMatrix.h:458
Rotation order z, y, x in a static frame.
Definition: RotationMatrix.h:101
Rotation order z, x, y in a static frame.
Definition: RotationMatrix.h:97
Header file for the multiplication trait.
Rotation order x, y, x in a static frame.
Definition: RotationMatrix.h:83
Rotation order z, y, z in a static frame.
Definition: RotationMatrix.h:103
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b)
Swapping the contents of two sparse matrices.
Definition: CompressedMatrix.h:4558
Header file for all forward declarations of the math module.
Rotation order z, y, z in a rotating frame.
Definition: RotationMatrix.h:104
Efficient implementation of a fixed-sized matrix.The StaticMatrix class template is the representatio...
Definition: Forward.h:50
Rotation order y, x, y in a static frame.
Definition: RotationMatrix.h:95
Rotation order y, x, y in a rotating frame.
Definition: RotationMatrix.h:96
Constraint on the data type.
RotationMatrix & transpose()
Transposing the rotation matrix.
Definition: RotationMatrix.h:646
EulerRotation
Order of the Euler rotationThis codes are needed for the EulerAngles function in order to calculate t...
Definition: RotationMatrix.h:80
Type v_[9]
The nine statically allocated matrix elements.
Definition: RotationMatrix.h:266
RotationMatrix & invert()
Inverting the matrix.
Definition: RotationMatrix.h:664
Header file for the equal shim.
Rotation order x, z, x in a static frame.
Definition: RotationMatrix.h:87
Rotation order y, z, y in a rotating frame.
Definition: RotationMatrix.h:92
Header file for run time assertion macros.
Base template for the MultTrait class.
Definition: MultTrait.h:141
bool equal(const T1 &a, const T2 &b)
Generic equality check.
Definition: Equal.h:352
Rotation order z, x, z in a static frame.
Definition: RotationMatrix.h:99
void swap(DynamicMatrix< Type, SO > &a, DynamicMatrix< Type, SO > &b)
Swapping the contents of two matrices.
Definition: DynamicMatrix.h:4651
Constraint on the data type.
Efficient implementation of a quaternion.Quaternions are a superior way to deal with rotations and or...
Definition: Forward.h:56
Constraint on the data type.
Header file for the complete StaticVector implementation.
size_t rows() const
Returns the current number of rows of the rotation matrix.
Definition: RotationMatrix.h:580
Header file for the isDefault shim.
Rotation order y, z, x in a rotating frame.
Definition: RotationMatrix.h:86
Header file for the DenseMatrix CRTP base class.
Header file for the mathematical trait.
Rotation order z, x, y in a rotating frame.
Definition: RotationMatrix.h:94
Header file for the complete StaticMatrix implementation.
Rotation order x, y, z in a rotating frame.
Definition: RotationMatrix.h:84
RotationMatrix()
The default constructor for RotationMatrix.
Definition: RotationMatrix.h:319
const Accuracy accuracy
Global Accuracy instance.The blaze::accuracy instance can be used wherever a floating point data type...
Definition: Accuracy.h:901
Rotation order y, z, x in a static frame.
Definition: RotationMatrix.h:89
This ResultType
Result type for expression template evaluations.
Definition: RotationMatrix.h:159
bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:249
Type operator[](size_t index) const
1D-access to the rotation matrix elements.
Definition: RotationMatrix.h:515
bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:289
Header file for basic type definitions.
bool isAliased(const Other *alias) const
Returns whether the rotation matrix is aliased with the given address alias.
Definition: RotationMatrix.h:713
RotationMatrix< Type > This
Type of this RotationMatrix instance.
Definition: RotationMatrix.h:158
Type operator()(size_t i, size_t j) const
2D-access to the rotation matrix elements.
Definition: RotationMatrix.h:531
Size type of the Blaze library.
Rotation order z, y, x in a rotating frame.
Definition: RotationMatrix.h:82
const StaticMatrix< typename MultTrait< Type, Other >::Type, 3UL, 3UL, false > rotate(const StaticMatrix< Other, 3UL, 3UL, false > &m) const
Rotation of a matrix M ( ).
Definition: RotationMatrix.h:744
#define BLAZE_CONSTRAINT_MUST_BE_FLOATING_POINT_TYPE(T)
Constraint on the data type.In case the given data type T is not a floating point data type...
Definition: FloatingPoint.h:79
const Quaternion< Type > inv(const Quaternion< Type > &m)
Inverting the given quaternion ( ).
Definition: Quaternion.h:1016