Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Attributes | List of all members
JDETECTOR::JModuleRotation_t Struct Reference

Auxiliary data structure for module rotation. More...

#include <JDetectorCalibration.hh>

Inheritance diagram for JDETECTOR::JModuleRotation_t:
JLANG::JObjectID JGEOMETRY3D::JQuaternion3D JLANG::JComparable< JObjectID > JLANG::JComparable< JObjectID, int > JMATH::JMath< JFirst_t, JSecond_t > JMATH::JMath< JFirst_t, JSecond_t > JMATH::JMath< JFirst_t, JSecond_t > JMATH::JMath< JFirst_t, JSecond_t > JLANG::JEquals< JFirst_t, JSecond_t >

Public Member Functions

 JModuleRotation_t ()
 Default constructor. More...
 
 JModuleRotation_t (const JObjectID &id, const JQuaternion3D &rotation)
 Constructor. More...
 
int getID () const
 Get identifier. More...
 
void setID (const int id)
 Set identifier. More...
 
bool less (const JObjectID &object) const
 Less than method. More...
 
bool less (const int id) const
 Less than method. More...
 
bool more (const int id) const
 More than method. More...
 
const JQuaternion3D & getQuaternion () const
 Get quaternion. More...
 
JQuaternion3D & getQuaternion ()
 Get quaternion. More...
 
void setQuaternion (const JQuaternion3D &quaternion)
 Set quaternion. More...
 
 operator JVector3D () const
 Type conversion operator. More...
 
 operator JVersor3D () const
 Type conversion operator. More...
 
double getA () const
 Get a value. More...
 
double getB () const
 Get b value. More...
 
double getC () const
 Get c value. More...
 
double getD () const
 Get d value. More...
 
JQuaternion3D & setIdentity ()
 Set to identity matrix. More...
 
JQuaternion3D & conjugate ()
 Conjugate quaternion. More...
 
JQuaternion3D & negate ()
 Negate quaternion. More...
 
JQuaternion3D & add (const JQuaternion3D &quaternion)
 Add quaternion. More...
 
JQuaternion3D & sub (const JQuaternion3D &quaternion)
 Subtract quaternion. More...
 
JQuaternion3D & mul (const double factor)
 Scale quaternion. More...
 
JQuaternion3D & mul (const JQuaternion3D &first, const JQuaternion3X &second)
 Quaternion multiplicaion. More...
 
JQuaternion3D & mul (const JQuaternion3D &first, const JQuaternion3Y &second)
 Quaternion multiplicaion. More...
 
JQuaternion3D & mul (const JQuaternion3D &first, const JQuaternion3Z &second)
 Quaternion multiplicaion. More...
 
JQuaternion3D & mul (const JQuaternion3D &first, const JQuaternion3D &second)
 Quaternion multiplicaion. More...
 
JQuaternion3D & mul (const JQuaternion3X &qx, const JQuaternion3Y &qy, const JQuaternion3Z &qz)
 Quaternion multiplicaion. More...
 
JFirst_t & mul (const JSecond_t &object)
 Multiply with object. More...
 
JQuaternion3D & div (const double factor)
 Scale quaternion. More...
 
void rotate (double &__x, double &__y, double &__z) const
 Rotate. More...
 
void rotate_back (double &__x, double &__y, double &__z) const
 Rotate back. More...
 
bool equals (const JQuaternion3D &quaternion, const double precision=std::numeric_limits< double >::min()) const
 Check equality. More...
 
double getLengthSquared () const
 Get length squared. More...
 
double getLength () const
 Get length. More...
 
double getDistanceSquared (const JQuaternion3D &quaternion) const
 Get squared of distance to quaternion. More...
 
double getDistance (const JQuaternion3D &quaternion) const
 Get distance to quaternion. More...
 
double getDot (const JQuaternion3D &quaternion) const
 Get dot product. More...
 
JQuaternion3D & normalise ()
 Normalise quaternion. More...
 

Protected Attributes

int __id
 
double __a
 
double __b
 
double __c
 
double __d
 

Detailed Description

Auxiliary data structure for module rotation.

Definition at line 358 of file JDetectorCalibration.hh.

Constructor & Destructor Documentation

JDETECTOR::JModuleRotation_t::JModuleRotation_t ( )
inline

Default constructor.

Definition at line 365 of file JDetectorCalibration.hh.

366  {}
JDETECTOR::JModuleRotation_t::JModuleRotation_t ( const JObjectID &  id,
const JQuaternion3D &  rotation 
)
inline

Constructor.

Parameters
idmodule identifier
rotationmodule rotation

Definition at line 375 of file JDetectorCalibration.hh.

376  :
377  JObjectID (id),
378  JQuaternion3D(rotation)
379  {}
JObjectID()
Default constructor.
Definition: JObjectID.hh:35
JQuaternion3D()
Default constructor.

Member Function Documentation

int JLANG::JObjectID::getID ( ) const
inlineinherited

Get identifier.

Returns
identifier

Definition at line 55 of file JObjectID.hh.

56  {
57  return __id;
58  }
void JLANG::JObjectID::setID ( const int  id)
inlineinherited

Set identifier.

Parameters
ididentifier

Definition at line 66 of file JObjectID.hh.

67  {
68  this->__id = id;
69  }
bool JLANG::JObjectID::less ( const JObjectID &  object) const
inlineinherited

Less than method.

Parameters
objectobject identifier
Returns
true if this identifier less than given identifier; else false

Definition at line 78 of file JObjectID.hh.

79  {
80  return this->getID() < object.getID();
81  }
int getID() const
Get identifier.
Definition: JObjectID.hh:55
bool JLANG::JObjectID::less ( const int  id) const
inlineinherited

Less than method.

Parameters
ididentifier
Returns
true if this identifier less than given identifier; else false

Definition at line 90 of file JObjectID.hh.

91  {
92  return this->getID() < id;
93  }
int getID() const
Get identifier.
Definition: JObjectID.hh:55
bool JLANG::JObjectID::more ( const int  id) const
inlineinherited

More than method.

Parameters
ididentifier
Returns
true if this identifier greater than given identifier; else false

Definition at line 102 of file JObjectID.hh.

103  {
104  return this->getID() > id;
105  }
int getID() const
Get identifier.
Definition: JObjectID.hh:55
const JQuaternion3D& JGEOMETRY3D::JQuaternion3D::getQuaternion ( ) const
inlineinherited

Get quaternion.

Returns
quaternion

Definition at line 330 of file JQuaternion3D.hh.

331  {
332  return static_cast<const JQuaternion3D&>(*this);
333  }
Data structure for quaternion in three dimensions.
JQuaternion3D& JGEOMETRY3D::JQuaternion3D::getQuaternion ( )
inlineinherited

Get quaternion.

Returns
quaternion

Definition at line 341 of file JQuaternion3D.hh.

342  {
343  return static_cast<JQuaternion3D&>(*this);
344  }
Data structure for quaternion in three dimensions.
void JGEOMETRY3D::JQuaternion3D::setQuaternion ( const JQuaternion3D &  quaternion)
inlineinherited

Set quaternion.

Parameters
quaternionquaternion

Definition at line 352 of file JQuaternion3D.hh.

353  {
354  static_cast<JQuaternion3D&>(*this) = quaternion;
355  }
Data structure for quaternion in three dimensions.
JGEOMETRY3D::JQuaternion3D::operator JVector3D ( ) const
inlineinherited

Type conversion operator.

Returns
position

Definition at line 363 of file JQuaternion3D.hh.

364  {
365  return JVector3D(this->getB(), this->getC(), this->getD());
366  }
double getB() const
Get b value.
Data structure for vector in three dimensions.
Definition: JVector3D.hh:33
double getD() const
Get d value.
double getC() const
Get c value.
JGEOMETRY3D::JQuaternion3D::operator JVersor3D ( ) const
inlineinherited

Type conversion operator.

Returns
direction

Definition at line 374 of file JQuaternion3D.hh.

375  {
376  return JVersor3D(this->getB(), this->getC(), this->getD());
377  }
double getB() const
Get b value.
double getD() const
Get d value.
double getC() const
Get c value.
Data structure for normalised vector in three dimensions.
Definition: JVersor3D.hh:23
double JGEOMETRY3D::JQuaternion3D::getA ( ) const
inlineinherited

Get a value.

Returns
a value

Definition at line 385 of file JQuaternion3D.hh.

386  {
387  return __a;
388  }
double JGEOMETRY3D::JQuaternion3D::getB ( ) const
inlineinherited

Get b value.

Returns
b value

Definition at line 396 of file JQuaternion3D.hh.

397  {
398  return __b;
399  }
double JGEOMETRY3D::JQuaternion3D::getC ( ) const
inlineinherited

Get c value.

Returns
c value

Definition at line 407 of file JQuaternion3D.hh.

408  {
409  return __c;
410  }
double JGEOMETRY3D::JQuaternion3D::getD ( ) const
inlineinherited

Get d value.

Returns
d value

Definition at line 418 of file JQuaternion3D.hh.

419  {
420  return __d;
421  }
JQuaternion3D& JGEOMETRY3D::JQuaternion3D::setIdentity ( )
inlineinherited

Set to identity matrix.

Returns
this quaternion

Definition at line 429 of file JQuaternion3D.hh.

430  {
431  __a = 1.0;
432  __b = 0.0;
433  __c = 0.0;
434  __d = 0.0;
435 
436  return *this;
437  }
JQuaternion3D& JGEOMETRY3D::JQuaternion3D::conjugate ( )
inlineinherited

Conjugate quaternion.

Returns
this quaternion

Definition at line 445 of file JQuaternion3D.hh.

446  {
447  __b = -__b;
448  __c = -__c;
449  __d = -__d;
450 
451  return *this;
452  }
JQuaternion3D& JGEOMETRY3D::JQuaternion3D::negate ( )
inlineinherited

Negate quaternion.

Returns
this quaternion

Definition at line 460 of file JQuaternion3D.hh.

461  {
462  __a = -__a;
463  __b = -__b;
464  __c = -__c;
465  __d = -__d;
466 
467  return *this;
468  }
JQuaternion3D& JGEOMETRY3D::JQuaternion3D::add ( const JQuaternion3D &  quaternion)
inlineinherited

Add quaternion.

Parameters
quaternionquaternion
Returns
this quaternion

Definition at line 477 of file JQuaternion3D.hh.

478  {
479  __a += quaternion.getA();
480  __b += quaternion.getB();
481  __c += quaternion.getC();
482  __d += quaternion.getD();
483 
484  return *this;
485  }
double getB() const
Get b value.
double getD() const
Get d value.
double getC() const
Get c value.
double getA() const
Get a value.
JQuaternion3D& JGEOMETRY3D::JQuaternion3D::sub ( const JQuaternion3D &  quaternion)
inlineinherited

Subtract quaternion.

Parameters
quaternionquaternion
Returns
this quaternion

Definition at line 494 of file JQuaternion3D.hh.

495  {
496  __a -= quaternion.getA();
497  __b -= quaternion.getB();
498  __c -= quaternion.getC();
499  __d -= quaternion.getD();
500 
501  return *this;
502  }
double getB() const
Get b value.
double getD() const
Get d value.
double getC() const
Get c value.
double getA() const
Get a value.
JQuaternion3D& JGEOMETRY3D::JQuaternion3D::mul ( const double  factor)
inlineinherited

Scale quaternion.

Parameters
factormultiplication factor
Returns
this quaternion

Definition at line 511 of file JQuaternion3D.hh.

512  {
513  __a *= factor;
514  __b *= factor;
515  __c *= factor;
516  __d *= factor;
517 
518  return *this;
519  }
JQuaternion3D& JGEOMETRY3D::JQuaternion3D::mul ( const JQuaternion3D &  first,
const JQuaternion3X &  second 
)
inlineinherited

Quaternion multiplicaion.

This method evaluates the Hamilton product (also called cross product).

Parameters
firstfirst quaternion
secondsecond quaternion
Returns
this quaternion

Definition at line 548 of file JQuaternion3D.hh.

549  {
550  __a = first.getA() * second.getA() - first.getB() * second.getB();
551  __b = first.getA() * second.getB() + first.getB() * second.getA();
552  __c = first.getC() * second.getA() + first.getD() * second.getB();
553  __d = -first.getC() * second.getB() + first.getD() * second.getA();
554 
555  return *this;
556  }
double getB() const
Get b value.
double getB() const
Get b value.
double getA() const
Get a value.
double getD() const
Get d value.
double getC() const
Get c value.
double getA() const
Get a value.
JQuaternion3D& JGEOMETRY3D::JQuaternion3D::mul ( const JQuaternion3D &  first,
const JQuaternion3Y &  second 
)
inlineinherited

Quaternion multiplicaion.

This method evaluates the Hamilton product (or cross product).

Parameters
firstfirst quaternion
secondsecond quaternion
Returns
this quaternion

Definition at line 568 of file JQuaternion3D.hh.

570  {
571  __a = first.getA() * second.getA() - first.getC() * second.getC();
572  __b = first.getB() * second.getA() - first.getD() * second.getC();
573  __c = first.getA() * second.getC() + first.getC() * second.getA();
574  __d = first.getB() * second.getC() + first.getD() * second.getA();
575 
576  return *this;
577  }
double getB() const
Get b value.
double getA() const
Get a value.
double getC() const
Get c value.
double getD() const
Get d value.
double getC() const
Get c value.
double getA() const
Get a value.
JQuaternion3D& JGEOMETRY3D::JQuaternion3D::mul ( const JQuaternion3D &  first,
const JQuaternion3Z &  second 
)
inlineinherited

Quaternion multiplicaion.

This method evaluates the Hamilton product (or cross product).

Parameters
firstfirst quaternion
secondsecond quaternion
Returns
this quaternion

Definition at line 589 of file JQuaternion3D.hh.

591  {
592  __a = first.getA() * second.getA() - first.getD() * second.getD();
593  __b = first.getB() * second.getA() + first.getC() * second.getD();
594  __c = -first.getB() * second.getD() + first.getC() * second.getA();
595  __d = first.getA() * second.getD() + first.getD() * second.getA();
596 
597  return *this;
598  }
double getB() const
Get b value.
double getA() const
Get a value.
double getD() const
Get d value.
double getD() const
Get d value.
double getC() const
Get c value.
double getA() const
Get a value.
JQuaternion3D& JGEOMETRY3D::JQuaternion3D::mul ( const JQuaternion3D &  first,
const JQuaternion3D &  second 
)
inlineinherited

Quaternion multiplicaion.

This method evaluates the Hamilton product (or cross product).

Parameters
firstfirst quaternion
secondsecond quaternion
Returns
this quaternion

Definition at line 610 of file JQuaternion3D.hh.

612  {
613  __a = first.getA() * second.getA() - first.getB() * second.getB() - first.getC() * second.getC() - first.getD() * second.getD();
614  __b = first.getA() * second.getB() + first.getB() * second.getA() + first.getC() * second.getD() - first.getD() * second.getC();
615  __c = first.getA() * second.getC() - first.getB() * second.getD() + first.getC() * second.getA() + first.getD() * second.getB();
616  __d = first.getA() * second.getD() + first.getB() * second.getC() - first.getC() * second.getB() + first.getD() * second.getA();
617 
618  return *this;
619  }
double getB() const
Get b value.
double getD() const
Get d value.
double getC() const
Get c value.
double getA() const
Get a value.
JQuaternion3D& JGEOMETRY3D::JQuaternion3D::mul ( const JQuaternion3X &  qx,
const JQuaternion3Y &  qy,
const JQuaternion3Z &  qz 
)
inlineinherited

Quaternion multiplicaion.

Parameters
qxrotation around x-axis
qyrotation around y-axis
qzrotation around x-axis
Returns
this quaternion

Definition at line 630 of file JQuaternion3D.hh.

633  {
634  return *this = JQuaternion3D().setIdentity().mul(qz).mul(qy).mul(qx);
635  }
JQuaternion3D()
Default constructor.
template<class JFirst_t, class JSecond_t = JNullType>
JFirst_t& JMATH::JMath< JFirst_t, JSecond_t >::mul ( const JSecond_t &  object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 273 of file JMath.hh.

274  {
275  return static_cast<JFirst_t&>(*this) = JCalculator<JFirst_t>::calculator.mul(static_cast<const JFirst_t&>(*this), object);
276  }
Auxiliary class for arithmetic operations on objects.
Definition: JCalculator.hh:18
JQuaternion3D& JGEOMETRY3D::JQuaternion3D::div ( const double  factor)
inlineinherited

Scale quaternion.

Parameters
factordivision factor
Returns
this quaternion

Definition at line 528 of file JQuaternion3D.hh.

529  {
530  __a /= factor;
531  __b /= factor;
532  __c /= factor;
533  __d /= factor;
534 
535  return *this;
536  }
void JGEOMETRY3D::JQuaternion3D::rotate ( double &  __x,
double &  __y,
double &  __z 
) const
inlineinherited

Rotate.

Parameters
__xx value
__yy value
__zz value

Definition at line 645 of file JQuaternion3D.hh.

646  {
647  const double qx = 2.0 * (__c*__z - __d*__y);
648  const double qy = 2.0 * (__d*__x - __b*__z);
649  const double qz = 2.0 * (__b*__y - __c*__x);
650 
651  const double x = __x + __c*qz - __d*qy + __a*qx;
652  const double y = __y - __b*qz + __a*qy + __d*qx;
653  const double z = __z + __a*qz + __b*qy - __c*qx;
654 
655  __x = x;
656  __y = y;
657  __z = z;
658  }
void JGEOMETRY3D::JQuaternion3D::rotate_back ( double &  __x,
double &  __y,
double &  __z 
) const
inlineinherited

Rotate back.

Parameters
__xx value
__yy value
__zz value

Definition at line 668 of file JQuaternion3D.hh.

669  {
670  const double qx = 2.0 * (__d*__y - __c*__z);
671  const double qy = 2.0 * (__b*__z - __d*__x);
672  const double qz = 2.0 * (__c*__x - __b*__y);
673 
674  const double x = __x - __c*qz + __d*qy + __a*qx;
675  const double y = __y + __b*qz + __a*qy - __d*qx;
676  const double z = __z + __a*qz - __b*qy + __c*qx;
677 
678  __x = x;
679  __y = y;
680  __z = z;
681  }
bool JGEOMETRY3D::JQuaternion3D::equals ( const JQuaternion3D &  quaternion,
const double  precision = std::numeric_limits<double>::min() 
) const
inlineinherited

Check equality.

Parameters
quaternionquaternion
precisionnumerical precision
Returns
true if quaternions are equal; else false

Definition at line 691 of file JQuaternion3D.hh.

693  {
694  return (fabs(getA() - quaternion.getA()) <= precision &&
695  fabs(getB() - quaternion.getB()) <= precision &&
696  fabs(getC() - quaternion.getC()) <= precision &&
697  fabs(getD() - quaternion.getD()) <= precision);
698  }
double getB() const
Get b value.
double getD() const
Get d value.
double getC() const
Get c value.
double getA() const
Get a value.
double JGEOMETRY3D::JQuaternion3D::getLengthSquared ( ) const
inlineinherited

Get length squared.

Returns
square of length

Definition at line 706 of file JQuaternion3D.hh.

707  {
708  return getA()*getA() + getB()*getB() + getC()*getC() + getD()*getD();
709  }
double getB() const
Get b value.
double getD() const
Get d value.
double getC() const
Get c value.
double getA() const
Get a value.
double JGEOMETRY3D::JQuaternion3D::getLength ( ) const
inlineinherited

Get length.

Returns
length

Definition at line 717 of file JQuaternion3D.hh.

718  {
719  return sqrt(getLengthSquared());
720  }
double getLengthSquared() const
Get length squared.
double JGEOMETRY3D::JQuaternion3D::getDistanceSquared ( const JQuaternion3D &  quaternion) const
inlineinherited

Get squared of distance to quaternion.

Parameters
quaternionquaternion
Returns
square of distance

Definition at line 729 of file JQuaternion3D.hh.

730  {
731  return JQuaternion3D(quaternion).sub(*this).getLengthSquared();
732  }
JQuaternion3D()
Default constructor.
double JGEOMETRY3D::JQuaternion3D::getDistance ( const JQuaternion3D &  quaternion) const
inlineinherited

Get distance to quaternion.

Parameters
quaternionquaternion
Returns
distance

Definition at line 741 of file JQuaternion3D.hh.

742  {
743  return sqrt(getDistanceSquared(quaternion));
744  }
double getDistanceSquared(const JQuaternion3D &quaternion) const
Get squared of distance to quaternion.
double JGEOMETRY3D::JQuaternion3D::getDot ( const JQuaternion3D &  quaternion) const
inlineinherited

Get dot product.

Parameters
quaternionquaternion
Returns
dot product

Definition at line 753 of file JQuaternion3D.hh.

754  {
755  return
756  getA() * quaternion.getA() -
757  getB() * quaternion.getB() -
758  getC() * quaternion.getC() -
759  getD() * quaternion.getD();
760  }
double getB() const
Get b value.
double getD() const
Get d value.
double getC() const
Get c value.
double getA() const
Get a value.
JQuaternion3D& JGEOMETRY3D::JQuaternion3D::normalise ( )
inlineinherited

Normalise quaternion.

Returns
this quaternion

Definition at line 840 of file JQuaternion3D.hh.

841  {
842  const double v = getLength();
843 
844  if (v != 0.0) {
845  mul(1.0 / v);
846  }
847 
848  return *this;
849  }
JQuaternion3D & mul(const double factor)
Scale quaternion.
data_type v[N+1][M+1]
Definition: JPolint.hh:707
double getLength() const
Get length.

Member Data Documentation

int JLANG::JObjectID::__id
protectedinherited

Definition at line 160 of file JObjectID.hh.

double JGEOMETRY3D::JQuaternion3D::__a
protectedinherited

Definition at line 852 of file JQuaternion3D.hh.

double JGEOMETRY3D::JQuaternion3D::__b
protectedinherited

Definition at line 853 of file JQuaternion3D.hh.

double JGEOMETRY3D::JQuaternion3D::__c
protectedinherited

Definition at line 854 of file JQuaternion3D.hh.

double JGEOMETRY3D::JQuaternion3D::__d
protectedinherited

Definition at line 855 of file JQuaternion3D.hh.


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