Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JMATH::JAverage< JQuaternion3D > Struct Reference

Template spacialisation for averaging quaternions. More...

#include <JEigen3D.hh>

Public Member Functions

 JAverage ()
 Default constructor.
 
template<class T >
 JAverage (T __begin, T __end)
 Constructor.
 
void reset ()
 Reset.
 
 operator JQuaternion3D () const
 Type conversion operator.
 
void put (const JQuaternion3D &Q, const double w=1.0)
 Put quaternion.
 

Static Public Attributes

static double MINIMAL_EIGEN_VALUE
 Numerical precision for eigen value evaluation.
 

Private Attributes

TMatrixDSym A
 
double W
 

Detailed Description

Template spacialisation for averaging quaternions.

Definition at line 98 of file JEigen3D.hh.

Constructor & Destructor Documentation

◆ JAverage() [1/2]

JMATH::JAverage< JQuaternion3D >::JAverage ( )
inline

Default constructor.

Definition at line 108 of file JEigen3D.hh.

108 :
109 A(4),
110 W(0.0)
111 {}

◆ JAverage() [2/2]

template<class T >
JMATH::JAverage< JQuaternion3D >::JAverage ( T __begin,
T __end )
inline

Constructor.

Parameters
__beginbegin of data
__endend of data

Definition at line 121 of file JEigen3D.hh.

121 :
122 A(4),
123 W(0.0)
124 {
125 for (T i = __begin; i != __end; ++i) {
126 this->put(*i);
127 }
128 }
void put(const JQuaternion3D &Q, const double w=1.0)
Put quaternion.
Definition JEigen3D.hh:180

Member Function Documentation

◆ reset()

void JMATH::JAverage< JQuaternion3D >::reset ( )
inline

Reset.

Definition at line 134 of file JEigen3D.hh.

135 {
136 A = 0.0;
137 W = 0.0;
138 }

◆ operator JQuaternion3D()

JMATH::JAverage< JQuaternion3D >::operator JQuaternion3D ( ) const
inline

Type conversion operator.

Returns
quaternion

Definition at line 146 of file JEigen3D.hh.

147 {
148 JQuaternion3D Q;
149
150 const TMatrixDSymEigen result(A);
151
152 const TVectorD& u = result.GetEigenValues();
153 const TMatrixD& V = result.GetEigenVectors();
154
155 if (u.GetNoElements() != 0 && fabs(u[0]) > MINIMAL_EIGEN_VALUE) {
156
157 Q = JQuaternion3D(V(0,0), V(1,0), V(2,0), V(3,0));
158
159 if (Q.getA() < 0.0) {
160 Q.negate();
161 }
162
163 Q.pow(u[0] / W);
164
165 } else {
166
167 //THROW(JDivisionByZero, "Invalid eigen value.");
168 }
169
170 return Q;
171 }
static double MINIMAL_EIGEN_VALUE
Numerical precision for eigen value evaluation.
Definition JEigen3D.hh:103

◆ put()

void JMATH::JAverage< JQuaternion3D >::put ( const JQuaternion3D & Q,
const double w = 1.0 )
inline

Put quaternion.

Parameters
Qquaternion
wweight

Definition at line 180 of file JEigen3D.hh.

181 {
182 TMatrixDSym a(4);
183
184 a(0,0) = Q.getA()*Q.getA(); a(0,1) = Q.getA()*Q.getB(); a(0,2) = Q.getA()*Q.getC(); a(0,3) = Q.getA()*Q.getD();
185 a(1,0) = a(0,1); a(1,1) = Q.getB()*Q.getB(); a(1,2) = Q.getB()*Q.getC(); a(1,3) = Q.getB()*Q.getD();
186 a(2,0) = a(0,2); a(2,1) = a(1,2); a(2,2) = Q.getC()*Q.getC(); a(2,3) = Q.getC()*Q.getD();
187 a(3,0) = a(0,3); a(3,1) = a(1,3); a(3,2) = a(2,3); a(3,3) = Q.getD()*Q.getD();
188
189 a *= w;
190 A += a;
191 W += w*w;
192 }
const double a

Member Data Documentation

◆ MINIMAL_EIGEN_VALUE

double JMATH::JAverage< JQuaternion3D >::MINIMAL_EIGEN_VALUE
static

Numerical precision for eigen value evaluation.

Definition at line 103 of file JEigen3D.hh.

◆ A

TMatrixDSym JMATH::JAverage< JQuaternion3D >::A
private

Definition at line 195 of file JEigen3D.hh.

◆ W

double JMATH::JAverage< JQuaternion3D >::W
private

Definition at line 196 of file JEigen3D.hh.


The documentation for this struct was generated from the following file: