Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
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.
 
 JModuleRotation_t (const JObjectID &id, const JQuaternion3D &rotation)
 Constructor.
 
int getID () const
 Get identifier.
 
int & getID ()
 Get identifier.
 
void setID (const int id)
 Set identifier.
 
bool less (const JObjectID &object) const
 Less than method.
 
bool less (const int id) const
 Less than method.
 
bool more (const int id) const
 More than method.
 
const JQuaternion3DgetQuaternion () const
 Get quaternion.
 
JQuaternion3DgetQuaternion ()
 Get quaternion.
 
void setQuaternion (const JQuaternion3D &quaternion)
 Set quaternion.
 
 operator JVector3D () const
 Type conversion operator.
 
 operator JVersor3D () const
 Type conversion operator.
 
double getAngle () const
 Get rotation angle.
 
double getA () const
 Get a value.
 
double getB () const
 Get b value.
 
double getC () const
 Get c value.
 
double getD () const
 Get d value.
 
JQuaternion3DsetIdentity ()
 Set to identity quaternion.
 
JQuaternion3Dconjugate ()
 Conjugate quaternion.
 
JQuaternion3Dnegate ()
 Negate quaternion.
 
JQuaternion3Dadd (const JQuaternion3D &quaternion)
 Add quaternion.
 
JQuaternion3Dsub (const JQuaternion3D &quaternion)
 Subtract quaternion.
 
JQuaternion3Dmul (const double factor)
 Scale quaternion.
 
JQuaternion3Dmul (const JQuaternion3D &first, const JQuaternion3X &second)
 Quaternion multiplication.
 
JQuaternion3Dmul (const JQuaternion3D &first, const JQuaternion3Y &second)
 Quaternion multiplication.
 
JQuaternion3Dmul (const JQuaternion3D &first, const JQuaternion3Z &second)
 Quaternion multiplication.
 
JQuaternion3Dmul (const JQuaternion3D &first, const JQuaternion3D &second)
 Quaternion multiplication.
 
JQuaternion3Dmul (const JQuaternion3X &qx, const JQuaternion3Y &qy, const JQuaternion3Z &qz)
 Quaternion multiplication.
 
JFirst_t & mul (const JSecond_t &object)
 Multiply with object.
 
JQuaternion3Ddiv (const double factor)
 Scale quaternion.
 
void rotate (double &__x, double &__y, double &__z) const
 Rotate.
 
void rotate_back (double &__x, double &__y, double &__z) const
 Rotate back.
 
bool equals (const JQuaternion3D &quaternion, const double precision=std::numeric_limits< double >::min()) const
 Check equality.
 
bool isIdentity (const double precision=std::numeric_limits< double >::min()) const
 Test identity.
 
double getLengthSquared () const
 Get length squared.
 
double getLength () const
 Get length.
 
double getDistanceSquared (const JQuaternion3D &quaternion) const
 Get squared of distance to quaternion.
 
double getDistance (const JQuaternion3D &quaternion) const
 Get distance to quaternion.
 
double getDot (const JQuaternion3D &quaternion) const
 Get dot product.
 
JQuaternion3D getConjugate () const
 Get conjugate of this quaternion.
 
JQuaternion3Dnormalise ()
 Normalise quaternion.
 
JQuaternion3Dpow (const double y)
 Raise quaternion to given power.
 
JQuaternion3Dinterpolate (const JQuaternion3D &object, const double alpha)
 Interpolation between quaternions.
 

Static Public Member Functions

static const JQuaternion3DgetIdentity ()
 Get identity quaternion.
 

Protected Attributes

int __id
 
double __a
 
double __b
 
double __c
 
double __d
 

Friends

void to_json (json &js, const JModuleRotation_t &object)
 Convert module rotation to JSon.
 
void from_json (const json &js, JModuleRotation_t &object)
 Convert JSon to module rotation.
 

Detailed Description

Auxiliary data structure for module rotation.

Definition at line 560 of file JDetectorCalibration.hh.

Constructor & Destructor Documentation

◆ JModuleRotation_t() [1/2]

JDETECTOR::JModuleRotation_t::JModuleRotation_t ( )
inline

Default constructor.

Definition at line 567 of file JDetectorCalibration.hh.

568 {}

◆ JModuleRotation_t() [2/2]

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

Constructor.

Parameters
idmodule identifier
rotationmodule rotation

Definition at line 577 of file JDetectorCalibration.hh.

578 :
579 JObjectID (id),
580 JQuaternion3D(rotation)
581 {}
JQuaternion3D()
Default constructor.
JObjectID()
Default constructor.
Definition JObjectID.hh:30

Member Function Documentation

◆ getID() [1/2]

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

Get identifier.

Returns
identifier

Definition at line 50 of file JObjectID.hh.

51 {
52 return __id;
53 }

◆ getID() [2/2]

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

Get identifier.

Returns
identifier

Definition at line 61 of file JObjectID.hh.

62 {
63 return __id;
64 }

◆ setID()

void JLANG::JObjectID::setID ( const int id)
inlineinherited

Set identifier.

Parameters
ididentifier

Definition at line 72 of file JObjectID.hh.

73 {
74 this->__id = id;
75 }

◆ less() [1/2]

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 84 of file JObjectID.hh.

85 {
86 return this->getID() < object.getID();
87 }
int getID() const
Get identifier.
Definition JObjectID.hh:50

◆ less() [2/2]

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 96 of file JObjectID.hh.

97 {
98 return this->getID() < id;
99 }

◆ more()

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 108 of file JObjectID.hh.

109 {
110 return this->getID() > id;
111 }

◆ getIdentity()

static const JQuaternion3D & JGEOMETRY3D::JQuaternion3D::getIdentity ( )
inlinestaticinherited

Get identity quaternion.

Returns
identity quaternion

Definition at line 463 of file JQuaternion3D.hh.

464 {
465 static const JQuaternion3D Q = JQuaternion3D().setIdentity();
466
467 return Q;
468 }

◆ getQuaternion() [1/2]

const JQuaternion3D & JGEOMETRY3D::JQuaternion3D::getQuaternion ( ) const
inlineinherited

Get quaternion.

Returns
quaternion

Definition at line 476 of file JQuaternion3D.hh.

477 {
478 return static_cast<const JQuaternion3D&>(*this);
479 }

◆ getQuaternion() [2/2]

JQuaternion3D & JGEOMETRY3D::JQuaternion3D::getQuaternion ( )
inlineinherited

Get quaternion.

Returns
quaternion

Definition at line 487 of file JQuaternion3D.hh.

488 {
489 return static_cast<JQuaternion3D&>(*this);
490 }

◆ setQuaternion()

void JGEOMETRY3D::JQuaternion3D::setQuaternion ( const JQuaternion3D & quaternion)
inlineinherited

Set quaternion.

Parameters
quaternionquaternion

Definition at line 498 of file JQuaternion3D.hh.

499 {
500 static_cast<JQuaternion3D&>(*this) = quaternion;
501 }

◆ operator JVector3D()

JGEOMETRY3D::JQuaternion3D::operator JVector3D ( ) const
inlineinherited

Type conversion operator.

Returns
position

Definition at line 509 of file JQuaternion3D.hh.

510 {
511 return JVector3D(this->getB(), this->getC(), this->getD());
512 }
double getB() const
Get b value.
double getD() const
Get d value.
double getC() const
Get c value.

◆ operator JVersor3D()

JGEOMETRY3D::JQuaternion3D::operator JVersor3D ( ) const
inlineinherited

Type conversion operator.

Returns
direction

Definition at line 520 of file JQuaternion3D.hh.

521 {
522 return JVersor3D(this->getB(), this->getC(), this->getD());
523 }

◆ getAngle()

double JGEOMETRY3D::JQuaternion3D::getAngle ( ) const
inlineinherited

Get rotation angle.

Returns
angle [rad]

Definition at line 531 of file JQuaternion3D.hh.

532 {
533 return atan2(sqrt(this->getB()*this->getB() +
534 this->getC()*this->getC() +
535 this->getD()*this->getD()),
536 this->getA()) * 2.0;
537 }
double getA() const
Get a value.

◆ getA()

double JGEOMETRY3D::JQuaternion3D::getA ( ) const
inlineinherited

Get a value.

Returns
a value

Definition at line 545 of file JQuaternion3D.hh.

546 {
547 return __a;
548 }

◆ getB()

double JGEOMETRY3D::JQuaternion3D::getB ( ) const
inlineinherited

Get b value.

Returns
b value

Definition at line 556 of file JQuaternion3D.hh.

557 {
558 return __b;
559 }

◆ getC()

double JGEOMETRY3D::JQuaternion3D::getC ( ) const
inlineinherited

Get c value.

Returns
c value

Definition at line 567 of file JQuaternion3D.hh.

568 {
569 return __c;
570 }

◆ getD()

double JGEOMETRY3D::JQuaternion3D::getD ( ) const
inlineinherited

Get d value.

Returns
d value

Definition at line 578 of file JQuaternion3D.hh.

579 {
580 return __d;
581 }

◆ setIdentity()

JQuaternion3D & JGEOMETRY3D::JQuaternion3D::setIdentity ( )
inlineinherited

Set to identity quaternion.

Returns
this quaternion

Definition at line 589 of file JQuaternion3D.hh.

590 {
591 __a = 1.0;
592 __b = 0.0;
593 __c = 0.0;
594 __d = 0.0;
595
596 return *this;
597 }

◆ conjugate()

JQuaternion3D & JGEOMETRY3D::JQuaternion3D::conjugate ( )
inlineinherited

Conjugate quaternion.

Returns
this quaternion

Definition at line 605 of file JQuaternion3D.hh.

606 {
607 __b = -__b;
608 __c = -__c;
609 __d = -__d;
610
611 return *this;
612 }

◆ negate()

JQuaternion3D & JGEOMETRY3D::JQuaternion3D::negate ( )
inlineinherited

Negate quaternion.

Returns
this quaternion

Definition at line 620 of file JQuaternion3D.hh.

621 {
622 __a = -__a;
623 __b = -__b;
624 __c = -__c;
625 __d = -__d;
626
627 return *this;
628 }

◆ add()

JQuaternion3D & JGEOMETRY3D::JQuaternion3D::add ( const JQuaternion3D & quaternion)
inlineinherited

Add quaternion.

Parameters
quaternionquaternion
Returns
this quaternion

Definition at line 637 of file JQuaternion3D.hh.

638 {
639 __a += quaternion.getA();
640 __b += quaternion.getB();
641 __c += quaternion.getC();
642 __d += quaternion.getD();
643
644 return *this;
645 }

◆ sub()

JQuaternion3D & JGEOMETRY3D::JQuaternion3D::sub ( const JQuaternion3D & quaternion)
inlineinherited

Subtract quaternion.

Parameters
quaternionquaternion
Returns
this quaternion

Definition at line 654 of file JQuaternion3D.hh.

655 {
656 __a -= quaternion.getA();
657 __b -= quaternion.getB();
658 __c -= quaternion.getC();
659 __d -= quaternion.getD();
660
661 return *this;
662 }

◆ mul() [1/7]

JQuaternion3D & JGEOMETRY3D::JQuaternion3D::mul ( const double factor)
inlineinherited

Scale quaternion.

Parameters
factormultiplication factor
Returns
this quaternion

Definition at line 671 of file JQuaternion3D.hh.

672 {
673 __a *= factor;
674 __b *= factor;
675 __c *= factor;
676 __d *= factor;
677
678 return *this;
679 }

◆ mul() [2/7]

JQuaternion3D & JGEOMETRY3D::JQuaternion3D::mul ( const JQuaternion3D & first,
const JQuaternion3X & second )
inlineinherited

Quaternion multiplication.

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

Parameters
firstfirst quaternion
secondsecond quaternion
Returns
this quaternion

Definition at line 708 of file JQuaternion3D.hh.

709 {
710 __a = first.getA() * second.getA() - first.getB() * second.getB();
711 __b = first.getA() * second.getB() + first.getB() * second.getA();
712 __c = first.getC() * second.getA() + first.getD() * second.getB();
713 __d = -first.getC() * second.getB() + first.getD() * second.getA();
714
715 return *this;
716 }

◆ mul() [3/7]

JQuaternion3D & JGEOMETRY3D::JQuaternion3D::mul ( const JQuaternion3D & first,
const JQuaternion3Y & second )
inlineinherited

Quaternion multiplication.

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

Parameters
firstfirst quaternion
secondsecond quaternion
Returns
this quaternion

Definition at line 728 of file JQuaternion3D.hh.

730 {
731 __a = first.getA() * second.getA() - first.getC() * second.getC();
732 __b = first.getB() * second.getA() - first.getD() * second.getC();
733 __c = first.getA() * second.getC() + first.getC() * second.getA();
734 __d = first.getB() * second.getC() + first.getD() * second.getA();
735
736 return *this;
737 }

◆ mul() [4/7]

JQuaternion3D & JGEOMETRY3D::JQuaternion3D::mul ( const JQuaternion3D & first,
const JQuaternion3Z & second )
inlineinherited

Quaternion multiplication.

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

Parameters
firstfirst quaternion
secondsecond quaternion
Returns
this quaternion

Definition at line 749 of file JQuaternion3D.hh.

751 {
752 __a = first.getA() * second.getA() - first.getD() * second.getD();
753 __b = first.getB() * second.getA() + first.getC() * second.getD();
754 __c = -first.getB() * second.getD() + first.getC() * second.getA();
755 __d = first.getA() * second.getD() + first.getD() * second.getA();
756
757 return *this;
758 }

◆ mul() [5/7]

JQuaternion3D & JGEOMETRY3D::JQuaternion3D::mul ( const JQuaternion3D & first,
const JQuaternion3D & second )
inlineinherited

Quaternion multiplication.

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

Parameters
firstfirst quaternion
secondsecond quaternion
Returns
this quaternion

Definition at line 770 of file JQuaternion3D.hh.

772 {
773 __a = first.getA() * second.getA() - first.getB() * second.getB() - first.getC() * second.getC() - first.getD() * second.getD();
774 __b = first.getA() * second.getB() + first.getB() * second.getA() + first.getC() * second.getD() - first.getD() * second.getC();
775 __c = first.getA() * second.getC() - first.getB() * second.getD() + first.getC() * second.getA() + first.getD() * second.getB();
776 __d = first.getA() * second.getD() + first.getB() * second.getC() - first.getC() * second.getB() + first.getD() * second.getA();
777
778 return *this;
779 }

◆ mul() [6/7]

JQuaternion3D & JGEOMETRY3D::JQuaternion3D::mul ( const JQuaternion3X & qx,
const JQuaternion3Y & qy,
const JQuaternion3Z & qz )
inlineinherited

Quaternion multiplication.

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

Definition at line 790 of file JQuaternion3D.hh.

793 {
794 return *this = JQuaternion3D().setIdentity().mul(qz).mul(qy).mul(qx);
795 }

◆ mul() [7/7]

template<class JFirst_t , class JSecond_t >
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 354 of file JMath.hh.

355 {
356 return static_cast<JFirst_t&>(*this) = JFirst_t().mul(static_cast<const JFirst_t&>(*this), object);
357 }

◆ div()

JQuaternion3D & JGEOMETRY3D::JQuaternion3D::div ( const double factor)
inlineinherited

Scale quaternion.

Parameters
factordivision factor
Returns
this quaternion

Definition at line 688 of file JQuaternion3D.hh.

689 {
690 __a /= factor;
691 __b /= factor;
692 __c /= factor;
693 __d /= factor;
694
695 return *this;
696 }

◆ rotate()

void JGEOMETRY3D::JQuaternion3D::rotate ( double & __x,
double & __y,
double & __z ) const
inlineinherited

Rotate.

Parameters
__xx value
__yy value
__zz value

Definition at line 805 of file JQuaternion3D.hh.

806 {
807 const double qx = 2.0 * (__c*__z - __d*__y);
808 const double qy = 2.0 * (__d*__x - __b*__z);
809 const double qz = 2.0 * (__b*__y - __c*__x);
810
811 __x = __x + __c*qz - __d*qy + __a*qx;
812 __y = __y - __b*qz + __a*qy + __d*qx;
813 __z = __z + __a*qz + __b*qy - __c*qx;
814 }

◆ rotate_back()

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 824 of file JQuaternion3D.hh.

825 {
826 const double qx = 2.0 * (__d*__y - __c*__z);
827 const double qy = 2.0 * (__b*__z - __d*__x);
828 const double qz = 2.0 * (__c*__x - __b*__y);
829
830 __x = __x - __c*qz + __d*qy + __a*qx;
831 __y = __y + __b*qz + __a*qy - __d*qx;
832 __z = __z + __a*qz - __b*qy + __c*qx;
833 }

◆ equals()

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 843 of file JQuaternion3D.hh.

845 {
846 return (fabs(getA() - quaternion.getA()) <= precision &&
847 fabs(getB() - quaternion.getB()) <= precision &&
848 fabs(getC() - quaternion.getC()) <= precision &&
849 fabs(getD() - quaternion.getD()) <= precision);
850 }

◆ isIdentity()

bool JGEOMETRY3D::JQuaternion3D::isIdentity ( const double precision = std::numeric_limits<double>::min()) const
inlineinherited

Test identity.

Parameters
precisionprecision
Returns
true if identity quaternion; else false

Definition at line 859 of file JQuaternion3D.hh.

860 {
861 if (fabs(getA()) <= precision) {
862
863 if (fabs(getB()) <= precision)
864 return ((fabs(getC()) <= precision && fabs(fabs(getD()) - 1.0) <= precision) ||
865 (fabs(fabs(getC()) - 1.0) <= precision && fabs(getD()) <= precision));
866 else
867 return (fabs(fabs(getB()) - 1.0) <= precision &&
868 fabs(getC()) <= precision &&
869 fabs(getD()) <= precision);
870
871 } else {
872
873 return (fabs(fabs(getA()) - 1.0) <= precision &&
874 fabs(getB()) <= precision &&
875 fabs(getC()) <= precision &&
876 fabs(getD()) <= precision);
877 }
878 }

◆ getLengthSquared()

double JGEOMETRY3D::JQuaternion3D::getLengthSquared ( ) const
inlineinherited

Get length squared.

Returns
square of length

Definition at line 886 of file JQuaternion3D.hh.

887 {
888 return getA()*getA() + getB()*getB() + getC()*getC() + getD()*getD();
889 }

◆ getLength()

double JGEOMETRY3D::JQuaternion3D::getLength ( ) const
inlineinherited

Get length.

Returns
length

Definition at line 897 of file JQuaternion3D.hh.

898 {
899 return sqrt(getLengthSquared());
900 }
double getLengthSquared() const
Get length squared.

◆ getDistanceSquared()

double JGEOMETRY3D::JQuaternion3D::getDistanceSquared ( const JQuaternion3D & quaternion) const
inlineinherited

Get squared of distance to quaternion.

Parameters
quaternionquaternion
Returns
square of distance

Definition at line 909 of file JQuaternion3D.hh.

910 {
911 return JQuaternion3D(quaternion).sub(*this).getLengthSquared();
912 }

◆ getDistance()

double JGEOMETRY3D::JQuaternion3D::getDistance ( const JQuaternion3D & quaternion) const
inlineinherited

Get distance to quaternion.

Parameters
quaternionquaternion
Returns
distance

Definition at line 921 of file JQuaternion3D.hh.

922 {
923 return sqrt(getDistanceSquared(quaternion));
924 }
double getDistanceSquared(const JQuaternion3D &quaternion) const
Get squared of distance to quaternion.

◆ getDot()

double JGEOMETRY3D::JQuaternion3D::getDot ( const JQuaternion3D & quaternion) const
inlineinherited

Get dot product.

Parameters
quaternionquaternion
Returns
dot product

Definition at line 933 of file JQuaternion3D.hh.

934 {
935 return
936 getA() * quaternion.getA() -
937 getB() * quaternion.getB() -
938 getC() * quaternion.getC() -
939 getD() * quaternion.getD();
940 }

◆ getConjugate()

JQuaternion3D JGEOMETRY3D::JQuaternion3D::getConjugate ( ) const
inlineinherited

Get conjugate of this quaternion.

Returns
conjugate quaternion

Definition at line 948 of file JQuaternion3D.hh.

949 {
950 return JQuaternion3D(*this).conjugate();
951 }

◆ normalise()

JQuaternion3D & JGEOMETRY3D::JQuaternion3D::normalise ( )
inlineinherited

Normalise quaternion.

Returns
this quaternion

Definition at line 959 of file JQuaternion3D.hh.

960 {
961 const double v = getLength();
962
963 if (v != 0.0) {
964 mul(1.0 / v);
965 }
966
967 return *this;
968 }
double getLength() const
Get length.
JQuaternion3D & mul(const double factor)
Scale quaternion.

◆ pow()

JQuaternion3D & JGEOMETRY3D::JQuaternion3D::pow ( const double y)
inlineinherited

Raise quaternion to given power.

Parameters
ypower
Returns
this object

Definition at line 977 of file JQuaternion3D.hh.

978 {
979 const double v = sqrt(getB() * getB() +
980 getC() * getC() +
981 getD() * getD());
982
983 if (v != 0.0) {
984
985 const JVersor3D u(getB(), getC(), getD());
986
987 const double theta = atan2(v, getA());
988
989 *this = JQuaternion3D(2.0 * theta * y, u);
990 }
991
992 return *this;
993 }

◆ interpolate()

JQuaternion3D & JGEOMETRY3D::JQuaternion3D::interpolate ( const JQuaternion3D & object,
const double alpha )
inlineinherited

Interpolation between quaternions.

The result is equal to *this = (1 - alpha) * (*this) + (alpha) * (object).

Parameters
objectobject
alphainterpolation factor [0, 1]
Returns
this object

Definition at line 1004 of file JQuaternion3D.hh.

1006 {
1007 const double MAXIMAL_DOT_PRODUCT = 0.9995;
1008
1009 JQuaternion3D v0(*this);
1010 JQuaternion3D v1(object);
1011
1012 v0.normalise();
1013 v1.normalise();
1014
1015 double dot = v0.getDot(v1);
1016
1017 if (dot < 0.0) {
1018 v1 = -v1;
1019 dot = -dot;
1020 }
1021
1022 double s1 = alpha;
1023 double s0 = 1.0 - alpha;
1024
1025 if (dot <= MAXIMAL_DOT_PRODUCT) {
1026
1027 const double theta_0 = acos(dot);
1028 const double theta_1 = theta_0 * alpha;
1029
1030 s1 = sin(theta_1) / sin(theta_0);
1031 s0 = cos(theta_1) - dot * s1;
1032 }
1033
1034 *this = (s0 * v0) + (s1 * v1);
1035
1036 return normalise();
1037 }
JQuaternion3D & normalise()
Normalise quaternion.

Friends And Related Symbol Documentation

◆ to_json

void to_json ( json & js,
const JModuleRotation_t & object )
friend

Convert module rotation to JSon.

Parameters
jsjson
objectmodule rotation

Definition at line 590 of file JDetectorCalibration.hh.

591 {
592 js = json{ { Id_t, object.getID() },
593 { Q0_t, object.getA() },
594 { QX_t, object.getB() },
595 { QY_t, object.getC() },
596 { QZ_t, object.getD() } };
597 }
nlohmann::json json
static const std::string Id_t
static const std::string QX_t
static const std::string QZ_t
static const std::string Q0_t
static const std::string QY_t

◆ from_json

void from_json ( const json & js,
JModuleRotation_t & object )
friend

Convert JSon to module rotation.

Parameters
jsjson
objectmodule rotation

Definition at line 606 of file JDetectorCalibration.hh.

607 {
608 if (js.contains(DOMId_t))
609 object.setID(js.at(DOMId_t).get<int>());
610 else if (js.contains(Id_t))
611 object.setID(js.at(Id_t) .get<int>());
612 else
613 THROW(JNoValue, "Missing module identifier.");
614
615 object.setQuaternion(JQuaternion3D(js.at(Q0_t).get<double>(),
616 js.at(QX_t).get<double>(),
617 js.at(QY_t).get<double>(),
618 js.at(QZ_t).get<double>()));
619 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
static const std::string DOMId_t

Member Data Documentation

◆ __id

int JLANG::JObjectID::__id
protectedinherited

Definition at line 140 of file JObjectID.hh.

◆ __a

double JGEOMETRY3D::JQuaternion3D::__a
protectedinherited

Definition at line 1117 of file JQuaternion3D.hh.

◆ __b

double JGEOMETRY3D::JQuaternion3D::__b
protectedinherited

Definition at line 1118 of file JQuaternion3D.hh.

◆ __c

double JGEOMETRY3D::JQuaternion3D::__c
protectedinherited

Definition at line 1119 of file JQuaternion3D.hh.

◆ __d

double JGEOMETRY3D::JQuaternion3D::__d
protectedinherited

Definition at line 1120 of file JQuaternion3D.hh.


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