AGXDynamics  2.35.0.3
QuatTemplate.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 
18 
19 #ifndef AGX_QUATTEMPLATE_H
20 #define AGX_QUATTEMPLATE_H
21 
22 #include <agx/agxCore_export.h>
23 
24 #include <agx/agx.h>
25 #include <agx/Vec3.h>
26 #include <agx/Vec4.h>
27 #include <agx/EulerConvention.h>
28 
29 #ifdef _MSC_VER
30 # pragma warning(push)
31 # pragma warning(disable: 6385) // Disable warning C6385: Reading invalid data
32 #endif
33 
34 
35 namespace agx
36 {
37  class EulerAngles;
38  class OrthoMatrix3x3;
39 
40  template <typename T>
41  class AffineMatrix4x4T;
42 
55  template <typename T>
56  class QuatT
57  {
58  public:
59 
60  typedef T Type;
61 
63  QuatT();
64 
66  QuatT( T x, T y, T z, T w );
67 
69  explicit QuatT( const Vec4T<T>& v );
70 
72  QuatT( T angle, const Vec3T<T>& axis );
73 
77  QuatT( T angle1, const Vec3T<T>& axis1,
78  T angle2, const Vec3T<T>& axis2,
79  T angle3, const Vec3T<T>& axis3 );
80 
84  QuatT( const Vec3T<T>& from, const Vec3T<T>& to );
85 
89  explicit QuatT( const EulerAngles& euler);
90 
91 
93  QuatT(const QuatT<T>& copy ) = default;
94 
96  template <typename T2>
97  explicit QuatT(const QuatT<T2>& copy );
98 
102  explicit QuatT( const AffineMatrix4x4T<T>& matrix );
103 
105  QuatT<T>& operator = ( const QuatT<T>& v );
106 
111  bool operator == ( const QuatT<T>& v ) const;
112 
116  bool operator != ( const QuatT<T>& v ) const;
117 
118  /* ----------------------------------
119  Methods to access data members
120  ---------------------------------- */
121 
123  Vec4T<T> asVec4() const;
124 
126  Vec3T<T> asVec3() const;
127 
129  void set( T x, T y, T z, T w );
130 
132  void set( const Vec4T<T>& v );
133 
138  void get( EulerAngles& euler ) const;
139 
144  Vec3T<T> getAsEulerAngles(agx::EulerConvention::Convention convention = agx::EulerConvention::Convention::DEFAULT_CONVENTION) const;
145 
150  void get( AffineMatrix4x4T<T>& matrix ) const;
151 
156  void get(OrthoMatrix3x3& matrix) const;
157 
163  void get( T& angle, agx::Vec3T<T>& axis ) const;
164 
165 
170  QuatT<T>& set( const EulerAngles& euler );
171 
176  QuatT<T>& set( const AffineMatrix4x4T<T>& matrix );
177 
182  QuatT<T>& set( const OrthoMatrix3x3& matrix );
183 
184 
186  T& operator [] ( size_t i );
187 
189  T operator [] ( size_t i ) const;
190 
192  T& x();
193 
195  T& y();
196 
198  T& z();
199 
201  T& w();
202 
203 
205  T x() const;
206 
208  T y() const;
209 
211  T z() const;
212 
214  T w() const;
215 
219  bool zeroRotation() const;
220 
221 
222  /* -------------------------------------------------------------
223  BASIC ARITHMETIC METHODS
224  Implemented in terms of Vec4s. Some Vec4 operators, e.g.
225  operator* are not appropriate for quaternions (as
226  mathematical objects) so they are implemented differently.
227  Also define methods for conjugate and the multiplicative inverse.
228  ------------------------------------------------------------- */
230  const QuatT<T> operator * ( T rhs ) const;
231 
233  QuatT<T>& operator *= ( T rhs );
234 
239  const QuatT<T> operator*( const QuatT<T>& rhs ) const;
240 
245  QuatT<T>& operator*=( const QuatT<T>& rhs );
246 
251  const QuatT<T> leftMult( const QuatT<T>& rhs ) const;
252 
257  const QuatT<T> rightMult( const QuatT<T>& rhs ) const;
258 
259 
261  QuatT<T> operator / ( T rhs ) const;
262 
264  QuatT<T>& operator /= ( T rhs );
265 
267  const QuatT<T> operator/( const QuatT<T>& denom ) const;
268 
270  QuatT<T>& operator/=( const QuatT<T>& denom );
271 
273  const QuatT<T> operator + ( const QuatT<T>& rhs ) const;
274 
276  QuatT<T>& operator += ( const QuatT<T>& rhs );
277 
279  const QuatT<T> operator - ( const QuatT<T>& rhs ) const;
280 
282  QuatT<T>& operator -= ( const QuatT<T>& rhs );
283 
288  const QuatT<T> operator - () const;
289 
291  T length() const;
292 
294  T length2() const;
295 
297  QuatT<T> conj () const;
298 
300  QuatT<T> inverse () const;
301 
305  void setRotate( T angle, T x, T y, T z );
306 
310  void setRotate( T angle, const Vec3T<T>& vec );
311 
317  void setRotate ( T angle1, const Vec3T<T>& axis1,
318  T angle2, const Vec3T<T>& axis2,
319  T angle3, const Vec3T<T>& axis3 );
320 
328  void setRotate( const Vec3T<T>& from, const Vec3T<T>& to );
329 
333  static QuatT<T> rotate( T angle, T x, T y, T z );
334 
338  static QuatT<T> rotate( T angle, const Vec3T<T>& vec );
339 
345  static QuatT<T> rotate( T angle1, const Vec3T<T>& axis1,
346  T angle2, const Vec3T<T>& axis2,
347  T angle3, const Vec3T<T>& axis3 );
348 
352  static QuatT<T> rotate( const Vec3T<T>& from, const Vec3T<T>& to );
353 
357  void getRotate( T& angle, T& x, T& y, T& z ) const;
358 
362  void getRotate( T& angle, Vec3T<T>& vec ) const;
363 
367  agx::Real getAngle() const;
368 
373 
378  void slerp( T t, const QuatT<T>& from, const QuatT<T>& to );
379 
383  Vec3T<T> operator* ( const Vec3T<T>& v ) const;
384 
389  T normalize();
390 
391 
393  T at( size_t i );
394 
396  void set( T val, size_t i );
397 
401  T* ptr();
402 
406  const T* ptr() const;
407 
408  protected:
409  T m_data[4];
410  };
411 
412 
413  /* Implementation */
414  template <typename T>
416  {
417  m_data[0] = 0.0;
418  m_data[1] = 0.0;
419  m_data[2] = 0.0;
420  m_data[3] = 1.0;
421  }
422 
423  template <typename T>
424  AGX_FORCE_INLINE QuatT<T>::QuatT( T x, T y, T z, T w )
425  {
426  m_data[0] = x;
427  m_data[1] = y;
428  m_data[2] = z;
429  m_data[3] = w;
430  }
431 
432  template <typename T>
434  {
435  m_data[0] = v.x();
436  m_data[1] = v.y();
437  m_data[2] = v.z();
438  m_data[3] = v.w();
439  }
440 
441  template <typename T>
442  AGX_FORCE_INLINE QuatT<T>::QuatT( T angle, const Vec3T<T>& axis )
443  {
444  setRotate( angle, axis );
445  }
446 
447  template <typename T>
448  AGX_FORCE_INLINE QuatT<T>::QuatT( T angle1, const Vec3T<T>& axis1,
449  T angle2, const Vec3T<T>& axis2,
450  T angle3, const Vec3T<T>& axis3 )
451  {
452  setRotate( angle1, axis1, angle2, axis2, angle3, axis3 );
453  }
454 
455  template <typename T>
457  {
458  setRotate( from, to );
459  }
460 
461 
462  template <typename T>
463  template <typename T2>
465  {
466  m_data[ 0 ] = (T)copy[ 0 ];
467  m_data[ 1 ] = (T)copy[ 1 ];
468  m_data[ 2 ] = (T)copy[ 2 ];
469  m_data[ 3 ] = (T)copy[ 3 ];
470  }
471 
472  template <typename T>
474  {
475  set( matrix );
476  }
477 
478 
479  template <typename T>
481  {
482  m_data[0] = v.m_data[0];
483  m_data[1] = v.m_data[1];
484  m_data[2] = v.m_data[2];
485  m_data[3] = v.m_data[3];
486  return *this;
487  }
488 
489  template <typename T>
491  {
492  return m_data[0] == v.m_data[0] && m_data[1] == v.m_data[1] && m_data[2] == v.m_data[2] && m_data[3] == v.m_data[3];
493  }
494 
495  template <typename T>
497  {
498  return m_data[0] != v.m_data[0] || m_data[1] != v.m_data[1] || m_data[2] != v.m_data[2] || m_data[3] != v.m_data[3];
499  }
500 
501  template <typename T>
503  {
504  return Vec4T<T>( m_data[0], m_data[1], m_data[2], m_data[3] );
505  }
506 
507  template <typename T>
509  {
510  return Vec3T<T>( m_data[0], m_data[1], m_data[2] );
511  }
512 
513  template <typename T>
514  AGX_FORCE_INLINE void QuatT<T>::set( T x, T y, T z, T w )
515  {
516  m_data[0] = x;
517  m_data[1] = y;
518  m_data[2] = z;
519  m_data[3] = w;
520  }
521 
522  template <typename T>
524  {
525  m_data[0] = v.x();
526  m_data[1] = v.y();
527  m_data[2] = v.z();
528  m_data[3] = v.w();
529  }
530 
531  template <typename T>
533  {
534  agxAssert( i < 4 );
535  return m_data[i];
536  }
537 
538  template <typename T>
540  {
541  agxAssert( i < 4 );
542  return m_data[i];
543  }
544 
545  template <typename T>
547  {
548  return m_data[0];
549  }
550 
551  template <typename T>
553  {
554  return m_data[1];
555  }
556 
557  template <typename T>
559  {
560  return m_data[2];
561  }
562 
563  template <typename T>
565  {
566  return m_data[3];
567  }
568 
569  template <typename T>
570  AGX_FORCE_INLINE T QuatT<T>::x() const
571  {
572  return m_data[0];
573  }
574 
575  template <typename T>
576  AGX_FORCE_INLINE T QuatT<T>::y() const
577  {
578  return m_data[1];
579  }
580 
581  template <typename T>
582  AGX_FORCE_INLINE T QuatT<T>::z() const
583  {
584  return m_data[2];
585  }
586 
587  template <typename T>
588  AGX_FORCE_INLINE T QuatT<T>::w() const
589  {
590  return m_data[3];
591  }
592 
593  template <typename T>
594  inline bool QuatT<T>::zeroRotation() const
595  {
596  return m_data[0] == 0.0 && m_data[1] == 0.0 && m_data[2] == 0.0 && m_data[3] == 1.0;
597  }
598 
599 
600  template <typename T>
602  {
603  return QuatT( m_data[0] * rhs, m_data[1] * rhs, m_data[2] * rhs, m_data[3] * rhs );
604  }
605 
606  template <typename T>
608  {
609  m_data[0] *= rhs;
610  m_data[1] *= rhs;
611  m_data[2] *= rhs;
612  m_data[3] *= rhs;
613  return *this; // enable nesting
614  }
615 
616  template <typename T>
618  {
619  return QuatT( rhs.m_data[3] * m_data[0] + rhs.m_data[0] * m_data[3] + rhs.m_data[1] * m_data[2] - rhs.m_data[2] * m_data[1],
620  rhs.m_data[3] * m_data[1] - rhs.m_data[0] * m_data[2] + rhs.m_data[1] * m_data[3] + rhs.m_data[2] * m_data[0],
621  rhs.m_data[3] * m_data[2] + rhs.m_data[0] * m_data[1] - rhs.m_data[1] * m_data[0] + rhs.m_data[2] * m_data[3],
622  rhs.m_data[3] * m_data[3] - rhs.m_data[0] * m_data[0] - rhs.m_data[1] * m_data[1] - rhs.m_data[2] * m_data[2] );
623  }
624 
625  template <typename T>
627  {
628  T x = rhs.m_data[3] * m_data[0] + rhs.m_data[0] * m_data[3] + rhs.m_data[1] * m_data[2] - rhs.m_data[2] * m_data[1];
629  T y = rhs.m_data[3] * m_data[1] - rhs.m_data[0] * m_data[2] + rhs.m_data[1] * m_data[3] + rhs.m_data[2] * m_data[0];
630  T z = rhs.m_data[3] * m_data[2] + rhs.m_data[0] * m_data[1] - rhs.m_data[1] * m_data[0] + rhs.m_data[2] * m_data[3];
631  m_data[3] = rhs.m_data[3] * m_data[3] - rhs.m_data[0] * m_data[0] - rhs.m_data[1] * m_data[1] - rhs.m_data[2] * m_data[2];
632 
633  m_data[2] = z;
634  m_data[1] = y;
635  m_data[0] = x;
636 
637  return ( *this ); // enable nesting
638  }
639 
640  template <typename T>
642  {
643  return (*this) * rhs ;
644  }
645 
646  template <typename T>
648  {
649  return rhs * (*this) ;
650  }
651 
652 
653  template <typename T>
655  {
656  T div = T(1) / rhs;
657  return QuatT( m_data[0] * div, m_data[1] * div, m_data[2] * div, m_data[3] * div );
658  }
659 
660  template <typename T>
662  {
663  T div = T(1) / rhs;
664  m_data[0] *= div;
665  m_data[1] *= div;
666  m_data[2] *= div;
667  m_data[3] *= div;
668  return *this;
669  }
670 
671  template <typename T>
673  {
674  return ( ( *this ) * denom.inverse() );
675  }
676 
677  template <typename T>
679  {
680  ( *this ) = ( *this ) * denom.inverse();
681  return ( *this ); // enable nesting
682  }
683 
684  template <typename T>
686  {
687  return QuatT( m_data[0] + rhs.m_data[0], m_data[1] + rhs.m_data[1],
688  m_data[2] + rhs.m_data[2], m_data[3] + rhs.m_data[3] );
689  }
690 
691  template <typename T>
693  {
694  m_data[0] += rhs.m_data[0];
695  m_data[1] += rhs.m_data[1];
696  m_data[2] += rhs.m_data[2];
697  m_data[3] += rhs.m_data[3];
698  return *this; // enable nesting
699  }
700 
701  template <typename T>
703  {
704  return QuatT( m_data[0] - rhs.m_data[0], m_data[1] - rhs.m_data[1],
705  m_data[2] - rhs.m_data[2], m_data[3] - rhs.m_data[3] );
706  }
707 
708  template <typename T>
710  {
711  m_data[0] -= rhs.m_data[0];
712  m_data[1] -= rhs.m_data[1];
713  m_data[2] -= rhs.m_data[2];
714  m_data[3] -= rhs.m_data[3];
715  return *this; // enable nesting
716  }
717 
718  template <typename T>
720  {
721  return QuatT<T> ( -m_data[0], -m_data[1], -m_data[2], -m_data[3] );
722  }
723 
724  template <typename T>
726  {
727  return std::sqrt( m_data[0] * m_data[0] + m_data[1] * m_data[1] + m_data[2] * m_data[2] + m_data[3] * m_data[3] );
728  }
729 
730  template <typename T>
732  {
733  return m_data[0] * m_data[0] + m_data[1] * m_data[1] + m_data[2] * m_data[2] + m_data[3] * m_data[3];
734  }
735 
736  template <typename T>
738  {
739  return QuatT( -m_data[0], -m_data[1], -m_data[2], m_data[3] );
740  }
741 
742  template <typename T>
744  {
745  return conj() / length2();
746  }
747 
748 
749  template <typename T>
750  AGX_FORCE_INLINE QuatT<T> QuatT<T>::rotate( T angle, T x, T y, T z )
751  {
752  return rotate( angle, Vec3T<T>( x, y, z ) );
753  }
754 
755  template <typename T>
757  {
758  QuatT<T> q;
759  q.setRotate( angle, vec );
760  return q;
761  }
762 
763  template <typename T>
765  T angle2, const Vec3T<T>& axis2,
766  T angle3, const Vec3T<T>& axis3 )
767  {
768  QuatT<T> q;
769  q.setRotate( angle1, axis1, angle2, axis2, angle3, axis3 );
770  return q;
771  }
772 
773  template <typename T>
775  {
776  QuatT<T> q;
777  q.setRotate( from, to );
778  return q;
779  }
780 
781 
782  template <typename T>
783  inline Vec3T<T> QuatT<T>::operator* ( const Vec3T<T>& v ) const
784  {
785  // nVidia SDK implementation
786  Vec3T<T> uv, uuv;
787  Vec3T<T> qvec( m_data[0], m_data[1], m_data[2] );
788  uv = qvec ^ v;
789  uuv = qvec ^ uv;
790  uv *= ( 2.0f * m_data[3] );
791  uuv *= 2.0f;
792  return v + uv + uuv;
793  }
794 
795  template <typename T>
797  {
798  T norm = this->length();
799  if ( norm > 0.0 ) {
800  T inv = 1.0f / norm;
801  m_data[0] *= inv;
802  m_data[1] *= inv;
803  m_data[2] *= inv;
804  m_data[3] *= inv;
805  }
806  return( norm );
807  }
808 
809 
810  template <typename T>
812  {
813  return (*this)[i];
814  }
815 
816  template <typename T>
817  AGX_FORCE_INLINE void QuatT<T>::set( T val, size_t i )
818  {
819  (*this)[i] = val;
820  }
821 
822  template <typename T>
824  {
825  return m_data;
826  }
827 
828  template <typename T>
829  AGX_FORCE_INLINE const T* QuatT<T>::ptr() const
830  {
831  return m_data;
832  }
833 
834 
835  template <typename T>
837  {
838  return
839  agx::equivalent(a[0], b[0], epsilon) &&
840  agx::equivalent(a[1], b[1], epsilon) &&
841  agx::equivalent(a[2], b[2], epsilon) &&
842  agx::equivalent(a[3], b[3], epsilon);
843  }
844 
845 
846  template <typename T>
847  inline std::ostream& operator << ( std::ostream& output, const QuatT<T>& quat )
848  {
849  output << quat[0] << " "
850  << quat[1] << " "
851  << quat[2] << " "
852  << quat[3];
853  return output; // to enable cascading
854  }
855 
856 }
857 
858 #ifdef _MSC_VER
859 # pragma warning(pop)
860 #endif
861 
862 #endif /* AGX_QUATTEMPLATE_H */
agx::QuatT::set
void set(T x, T y, T z, T w)
Set the 4 elements of the quaternion as 4 scalars.
Definition: QuatTemplate.h:514
agx::QuatT::normalize
T normalize()
Normalize the quat so that it has unit length.
Definition: QuatTemplate.h:796
agx::Vec4T::w
T & w()
Definition: Vec4Template.h:508
agx::QuatT::inverse
QuatT< T > inverse() const
Multiplicative inverse method: q^(-1) = q^*‍/(q.q^*)
Definition: QuatTemplate.h:743
agx::Vec4T::y
T & y()
Definition: Vec4Template.h:496
agx::QuatT::operator/
QuatT< T > operator/(T rhs) const
Divide by scalar rhs.
Definition: QuatTemplate.h:654
agx::QuatT::operator-
const QuatT< T > operator-() const
Negation operator - returns the negative of the quaternion.
Definition: QuatTemplate.h:719
agx::QuatT::operator==
bool operator==(const QuatT< T > &v) const
Test for equality.
Definition: QuatTemplate.h:490
agx::Real
double Real
Definition: Real.h:42
agx::equivalent
AGXPHYSICS_EXPORT agx::Bool equivalent(const agx::AddedMassInteraction::Matrix6x6 &lhs, const agx::AddedMassInteraction::Matrix6x6 &rhs, agx::Real eps=agx::RealEpsilon)
agx::QuatT::leftMult
const QuatT< T > leftMult(const QuatT< T > &rhs) const
Binary left multiplication: q = p * rhs; results in the OTHER WAY AROUND: q = rhs quatmultiply p;.
Definition: QuatTemplate.h:641
agx::OrthoMatrix3x3
Specialized types of matrices for holding orthogonal transformation matrices.
Definition: OrthoMatrix3x3.h:33
agx::QuatT::rotate
static QuatT< T > rotate(T angle, T x, T y, T z)
Static method which constructs and returns a Quaternion from a rotation given as angle radians around...
Definition: QuatTemplate.h:750
agx::Vec4T::z
T & z()
Definition: Vec4Template.h:502
agx::QuatT::slerp
void slerp(T t, const QuatT< T > &from, const QuatT< T > &to)
Spherical Linear Interpolation.
agx::AffineMatrix4x4T
Matrix class for rigid transformations (translation, rotation).
Definition: AffineMatrix4x4.h:52
agxAssert
#define agxAssert(expr)
Definition: debug.h:143
EulerConvention.h
agx::QuatT::zeroRotation
bool zeroRotation() const
Definition: QuatTemplate.h:594
agx::Vec4T
A class holding 4 dimensional vectors and providing basic arithmetic.
Definition: Vec4Template.h:34
agx::QuatT::operator*=
QuatT< T > & operator*=(T rhs)
Unary multiply by scalar rhs.
Definition: QuatTemplate.h:607
agx::QuatT::at
T at(size_t i)
Definition: QuatTemplate.h:811
agx::QuatT::setRotate
void setRotate(T angle, T x, T y, T z)
Set the rotation of the Quaternion as a rotation angle radians around the vector (x,...
agx::QuatT::asVec3
Vec3T< T > asVec3() const
Definition: QuatTemplate.h:508
agx
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Definition: AddedMassInteraction.h:22
Vec4.h
agx::EulerConvention::Convention
Convention
The 24 Euler conventions.
Definition: EulerConvention.h:33
agx::operator<<
std::ostream & operator<<(std::ostream &stream, const AtomicValueT< T > &value)
Definition: AtomicValue.h:109
agx::QuatT::conj
QuatT< T > conj() const
Definition: QuatTemplate.h:737
agx::QuatT::getAngle
agx::Real getAngle() const
Get the rotation angle represented by the quaternion.
agx::QuatT::operator*
const QuatT< T > operator*(T rhs) const
Multiply by scalar rhs.
Definition: QuatTemplate.h:601
agx::QuatT::operator+=
QuatT< T > & operator+=(const QuatT< T > &rhs)
Unary addition.
Definition: QuatTemplate.h:692
Vec3.h
agx::AGX_EQUIVALENT_EPSILON
const Real AGX_EQUIVALENT_EPSILON
Definition: Math.h:57
agx::QuatT::length2
T length2() const
Definition: QuatTemplate.h:731
agx::QuatT::getUnitVector
agx::Vec3T< T > getUnitVector() const
Get the rotation unit vector represented by the quaternion.
agx::QuatT::ptr
T * ptr()
Definition: QuatTemplate.h:823
agx::QuatT::operator=
QuatT< T > & operator=(const QuatT< T > &v)
Assignment operator.
Definition: QuatTemplate.h:480
agx::QuatT::w
T & w()
Definition: QuatTemplate.h:564
agxCore_export.h
agx::QuatT::QuatT
QuatT()
Default constructor. Create a Quaternion with an identity rotation.
Definition: QuatTemplate.h:415
agx::QuatT::operator/=
QuatT< T > & operator/=(T rhs)
Unary divide by scalar rhs.
Definition: QuatTemplate.h:661
agx::QuatT::operator[]
T & operator[](size_t i)
Definition: QuatTemplate.h:532
agx::QuatT::x
T & x()
Definition: QuatTemplate.h:546
agx::EulerAngles
This class provides conversion services between Euler angles in any of the 24 conventions and corresp...
Definition: EulerAngles.h:69
agx::QuatT::get
void get(EulerAngles &euler) const
Convert this quaternion to an EulerAngles representation.
agx::QuatT
The object holding quaternions and providing operations on these.
Definition: QuatTemplate.h:56
agx::QuatT::operator-=
QuatT< T > & operator-=(const QuatT< T > &rhs)
Unary subtraction.
Definition: QuatTemplate.h:709
agx::QuatT::length
T length() const
Definition: QuatTemplate.h:725
agx.h
agx::QuatT::z
T & z()
Definition: QuatTemplate.h:558
agx::QuatT::Type
T Type
Definition: QuatTemplate.h:60
agx::QuatT::y
T & y()
Definition: QuatTemplate.h:552
agx::QuatT::rightMult
const QuatT< T > rightMult(const QuatT< T > &rhs) const
Binary RIGHT multiplication: q = p * rhs ; results in q = p quatmultiply rhs ;.
Definition: QuatTemplate.h:647
agx::Vec3T
A class holding 3 dimensional vectors and providing basic arithmetic.
Definition: Vec3Template.h:45
agx::QuatT::m_data
T m_data[4]
Definition: QuatTemplate.h:409
agx::QuatT::operator+
const QuatT< T > operator+(const QuatT< T > &rhs) const
Binary addition.
Definition: QuatTemplate.h:685
agx::QuatT::getRotate
void getRotate(T &angle, T &x, T &y, T &z) const
Get the angle and vector components represented by the quaternion.
agx::QuatT::asVec4
Vec4T< T > asVec4() const
Definition: QuatTemplate.h:502
agx::QuatT::operator!=
bool operator!=(const QuatT< T > &v) const
Definition: QuatTemplate.h:496
AGX_FORCE_INLINE
#define AGX_FORCE_INLINE
Definition: macros.h:58
agx::Vec4T::x
T & x()
Definition: Vec4Template.h:490
agx::QuatT::getAsEulerAngles
Vec3T< T > getAsEulerAngles(agx::EulerConvention::Convention convention=agx::EulerConvention::Convention::DEFAULT_CONVENTION) const
Convert to Euler anglers.