STIR  6.2.0
Quaternion.h
Go to the documentation of this file.
1 //
2 //
3 /*
4  Copyright (C) 2000- 2005, Hammersmith Imanet Ltd
5  SPDX-License-Identifier: Apache-2.0
6  See STIR/LICENSE.txt for details
7 */
18 #ifndef __stir_Quaternion_H__
19 #define __stir_Quaternion_H__
20 
21 #include "stir/BasicCoordinate.h"
22 
23 START_NAMESPACE_STIR
24 
25 template <typename coordT>
26 class Quaternion : public BasicCoordinate<4, coordT> // TODO kris wants private inheritance
27 {
28 protected:
29  typedef BasicCoordinate<4, coordT> base_type;
30 
31 public:
32  Quaternion();
33  Quaternion(const coordT&, const coordT&, const coordT&, const coordT&);
34  Quaternion(const base_type& q);
35 
36  /*coordT component_1() const;
37  coordT component_2() const;
38  coordT component_3() const;
39  coordT component_4() const;*/
40 
41  // Overload multiplication
42  inline Quaternion& operator*=(const coordT& a);
43  inline Quaternion& operator*=(const Quaternion& q);
44  inline Quaternion operator*(const Quaternion& q) const;
45  inline Quaternion operator*(const coordT& a) const;
46  // Overload division
47  inline Quaternion& operator/=(const coordT& a);
48  inline Quaternion& operator/=(const Quaternion& q);
49  inline Quaternion operator/(const Quaternion& q) const;
50  inline Quaternion operator/(const coordT& a) const;
51 
52  inline void neg_quaternion();
53  inline void conjugate();
54  inline void normalise();
55  inline void inverse();
56  inline static coordT dot_product(const Quaternion&, const Quaternion&);
57 
58 private:
59 };
60 
61 template <typename coordT>
62 inline Quaternion<coordT> conjugate(const Quaternion<coordT>&);
63 
64 template <typename coordT>
65 inline Quaternion<coordT> inverse(const Quaternion<coordT>&);
66 
67 template <typename coordT>
68 inline coordT norm_squared(const Quaternion<coordT>& q);
69 
70 template <typename coordT>
71 inline coordT norm(const Quaternion<coordT>& q);
72 
73 END_NAMESPACE_STIR
74 
76 
77 #endif
This file declares class stir::BasicCoordinate and some functions acting on stir::BasicCoordinate obj...
Implementation of class stir::Quaternion.
double norm_squared(const BasicCoordinate< num_dimensions, coordT > &p1)
compute (inner_product(p1,p1))
Definition: BasicCoordinate.inl:415
double norm(const BasicCoordinate< num_dimensions, coordT > &p1)
compute sqrt(inner_product(p1,p1))
Definition: BasicCoordinate.inl:426