aimsdata 6.0.0
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
41namespace aims
42{
44
45
47 {
48 public:
49 friend Quaternion operator * ( const Quaternion &, const Quaternion & );
50
52 Quaternion( const Point4df & q );
53 Quaternion( const Quaternion & q );
54 Quaternion( float x, float y, float z, float t );
57
59 const Point4df & vector() const { return( _vector ); }
60 void setVector( const Point4df & vec );
65 void buildFromMatrix( const float* m );
70
71 Point3df transform( float x, float y, float z ) const
72 { return transform( Point3df( x, y, z ) ); }
73
74 Point3df transform( 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
96
97}
98
99
100#endif
static Point4df cross(const Point4df &a, const Point4df &b)
Quaternion(const AffineTransformation3d &tr)
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 > inverseRotationMatrix() const
Quaternion(const Quaternion &q)
Quaternion & operator*=(const Quaternion &q)
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.
friend Quaternion operator*(const Quaternion &, const Quaternion &)
Quaternion & operator=(const Quaternion &q)
void buildFromMotion(const AffineTransformation3d &m)
Obsolete in aims 5.2: use buildFromTransformation() instead.
Definition quaternion.h:68
AimsVector< float, 16 > rotationMatrix() const
in OpenGL style: in columns
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
void buildFromTransformation(const AffineTransformation3d &m)
float angle() const
static Point3df norm(const Point3df &a)
Quaternion normalized() const
void setVector(const Point4df &vec)
const Point4df & vector() const
Definition quaternion.h:59
static float dot(const Quaternion &a, const Quaternion &b)
Definition quaternion.h:84
The class for EcatSino data write operation.
Quaternion operator*(const Quaternion &a, const Quaternion &b)
AimsVector< float, 3 > Point3df
AimsVector< float, 4 > Point4df