aimsdata  5.1.2
Neuroimaging data handling
quaternion.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 
35 #ifndef AIMS_RESAMPLING_QUATERNION_H
36 #define AIMS_RESAMPLING_QUATERNION_H
37 
38 
39 #include <aims/vector/vector.h>
40 
41 namespace aims
42 {
43  class AffineTransformation3d;
44 }
46 
47 namespace aims
48 {
49 
50  class Quaternion
51  {
52  public:
53  friend Quaternion operator * ( const Quaternion &, const Quaternion & );
54 
56  Quaternion( const Point4df & q );
57  Quaternion( const Quaternion & q );
58  Quaternion( float x, float y, float z, float t );
60 
62  const Point4df & vector() const { return( _vector ); }
63  void setVector( const Point4df & vec );
68  void buildFromMatrix( const float* m );
69  void buildFromMotion( const Motion & m );
71  Point3df transform( float x, float y, float z ) const
72  { return transform( Point3df( x, y, z ) ); }
74  Point3df transform( const Point3df & p ) const;
75  Point3df transformInverse( const Point3df & p ) const;
77  void norm();
79  void fromAxis( const Point3df & c, float phi );
81  Point3df axis() const;
82  float angle() const;
83 
84  static float dot( const Quaternion & a, const Quaternion & b )
85  { return( dot( a._vector, b._vector ) ); }
86  static float dot( const Point4df & a, const Point4df & b );
87  static Point4df cross( const Point4df & a, const Point4df & b );
88  static Point3df norm( const Point3df & a );
89 
90  protected:
92  };
93 
94 
95  Quaternion operator * ( const Quaternion & a, const Quaternion & b );
96 
97 }
98 
99 
100 #endif
static Point4df cross(const Point4df &a, const Point4df &b)
static float dot(const Point4df &a, const Point4df &b)
Point4df _vector
Definition: quaternion.h:91
Point3df axis() const
void fromAxis(const Point3df &c, float phi)
AimsVector< float, 16 > rotationMatrix() const
in OpenGL style: in columns
void buildFromMotion(const Motion &m)
Quaternion(const Quaternion &q)
friend Quaternion operator*(const Quaternion &, const Quaternion &)
Quaternion(float x, float y, float z, float t)
Quaternion(const Point4df &q)
Quaternion inverse() const
Point3df transform(const Point3df &p) const
Rotates vecotor p.
AimsVector< float, 16 > inverseRotationMatrix() const
Quaternion & operator=(const Quaternion &q)
Quaternion & operator*=(const Quaternion &q)
void buildFromMatrix(const float *m)
4x4 matrix in columns (OpenGL-style)
Point3df transformInverse(const Point3df &p) const
Point3df transform(float x, float y, float z) const
Rotates vecotor (x,y,z)
Definition: quaternion.h:71
const Point4df & vector() const
Definition: quaternion.h:62
float angle() const
static Point3df norm(const Point3df &a)
Quaternion normalized() const
void setVector(const Point4df &vec)
static float dot(const Quaternion &a, const Quaternion &b)
Definition: quaternion.h:84
The class for EcatSino data write operation.
Definition: borderfiller.h:13
Quaternion operator*(const Quaternion &a, const Quaternion &b)
aims::AffineTransformation3d Motion
Definition: quaternion.h:45