Jpp  18.4.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
JCOMPASS::JHit Struct Reference

Hit. More...

#include <JHit.hh>

Inheritance diagram for JCOMPASS::JHit:
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

 JHit ()
 Default constructor. More...
 
 JHit (const int id, const double z, const JQuaternion3D &Q, const double sigma)
 Constructor. More...
 
double getZ () const
 Get z-position. More...
 
double getSigma () const
 Get resolution. More...
 
int getID () const
 Get identifier. More...
 
int & getID ()
 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 JQuaternion3DgetQuaternion () const
 Get quaternion. More...
 
JQuaternion3DgetQuaternion ()
 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 getAngle () const
 Get rotation angle. 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...
 
JQuaternion3DsetIdentity ()
 Set to identity quaternion. More...
 
JQuaternion3Dconjugate ()
 Conjugate quaternion. More...
 
JQuaternion3Dnegate ()
 Negate quaternion. More...
 
JQuaternion3Dadd (const JQuaternion3D &quaternion)
 Add quaternion. More...
 
JQuaternion3Dsub (const JQuaternion3D &quaternion)
 Subtract quaternion. More...
 
JQuaternion3Dmul (const double factor)
 Scale quaternion. More...
 
JQuaternion3Dmul (const JQuaternion3D &first, const JQuaternion3X &second)
 Quaternion multiplication. More...
 
JQuaternion3Dmul (const JQuaternion3D &first, const JQuaternion3Y &second)
 Quaternion multiplication. More...
 
JQuaternion3Dmul (const JQuaternion3D &first, const JQuaternion3Z &second)
 Quaternion multiplication. More...
 
JQuaternion3Dmul (const JQuaternion3D &first, const JQuaternion3D &second)
 Quaternion multiplication. More...
 
JQuaternion3Dmul (const JQuaternion3X &qx, const JQuaternion3Y &qy, const JQuaternion3Z &qz)
 Quaternion multiplication. More...
 
JFirst_t & mul (const JSecond_t &object)
 Multiply with object. More...
 
JQuaternion3Ddiv (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...
 
bool isIdentity (const double precision=std::numeric_limits< double >::min()) const
 Test identity. 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 getConjugate () const
 Get conjugate of this quaternion. More...
 
JQuaternion3Dnormalise ()
 Normalise quaternion. More...
 
JQuaternion3Dpow (const double y)
 Raise quaternion to given power. More...
 
JQuaternion3Dinterpolate (const JQuaternion3D &object, const double alpha)
 Interpolation between quaternions. More...
 

Static Public Member Functions

static const JQuaternion3DgetIdentity ()
 Get identity quaternion. More...
 

Protected Attributes

double z
 
double sigma
 
int __id
 
double __a
 
double __b
 
double __c
 
double __d
 

Detailed Description

Hit.

Definition at line 22 of file JCompass/JHit.hh.

Constructor & Destructor Documentation

JCOMPASS::JHit::JHit ( )
inline

Default constructor.

Definition at line 29 of file JCompass/JHit.hh.

29  :
30  JObjectID(),
31  JQuaternion3D(),
32  z(0.0),
33  sigma(0.0)
34  {}
JObjectID()
Default constructor.
Definition: JObjectID.hh:30
JQuaternion3D()
Default constructor.
JCOMPASS::JHit::JHit ( const int  id,
const double  z,
const JQuaternion3D Q,
const double  sigma 
)
inline

Constructor.

Parameters
ididentifier
zz-position
Qquaternion
sigmaresolution [deg]

Definition at line 45 of file JCompass/JHit.hh.

48  :
49  JObjectID(id),
51  z(z),
52  sigma(sigma)
53  {}
Q(UTCMax_s-UTCMin_s)-livetime_s
JObjectID()
Default constructor.
Definition: JObjectID.hh:30
JQuaternion3D()
Default constructor.

Member Function Documentation

double JCOMPASS::JHit::getZ ( ) const
inline

Get z-position.

Returns
z-position

Definition at line 61 of file JCompass/JHit.hh.

62  {
63  return z;
64  }
double JCOMPASS::JHit::getSigma ( ) const
inline

Get resolution.

Returns
sigma

Definition at line 72 of file JCompass/JHit.hh.

73  {
74  return sigma;
75  }
int JLANG::JObjectID::getID ( ) const
inlineinherited

Get identifier.

Returns
identifier

Definition at line 50 of file JObjectID.hh.

51  {
52  return __id;
53  }
int& JLANG::JObjectID::getID ( )
inlineinherited

Get identifier.

Returns
identifier

Definition at line 61 of file JObjectID.hh.

62  {
63  return __id;
64  }
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  }
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
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  }
int getID() const
Get identifier.
Definition: JObjectID.hh:50
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  }
int getID() const
Get identifier.
Definition: JObjectID.hh:50
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  }
Q(UTCMax_s-UTCMin_s)-livetime_s
Data structure for unit quaternion in three dimensions.
JQuaternion3D()
Default constructor.
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  }
Data structure for unit quaternion in three dimensions.
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  }
Data structure for unit quaternion in three dimensions.
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  }
Data structure for unit quaternion in three dimensions.
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.
Data structure for vector in three dimensions.
Definition: JVector3D.hh:34
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 520 of file JQuaternion3D.hh.

521  {
522  return JVersor3D(this->getB(), this->getC(), this->getD());
523  }
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:26
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 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::getA ( ) const
inlineinherited

Get a value.

Returns
a value

Definition at line 545 of file JQuaternion3D.hh.

546  {
547  return __a;
548  }
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  }
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  }
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  }
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  }
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  }
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  }
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  }
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 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  }
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 671 of file JQuaternion3D.hh.

672  {
673  __a *= factor;
674  __b *= factor;
675  __c *= factor;
676  __d *= factor;
677 
678  return *this;
679  }
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  }
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 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  }
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 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  }
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 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  }
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 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  }
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 354 of file JMath.hh.

355  {
356  return static_cast<JFirst_t&>(*this) = JFirst_t().mul(static_cast<const JFirst_t&>(*this), object);
357  }
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  }
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  }
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  }
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  }
double getB() const
Get b value.
double getD() const
Get d value.
double getC() const
Get c value.
double getA() const
Get a value.
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  }
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 886 of file JQuaternion3D.hh.

887  {
888  return getA()*getA() + getB()*getB() + getC()*getC() + getD()*getD();
889  }
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 897 of file JQuaternion3D.hh.

898  {
899  return sqrt(getLengthSquared());
900  }
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 909 of file JQuaternion3D.hh.

910  {
911  return JQuaternion3D(quaternion).sub(*this).getLengthSquared();
912  }
JQuaternion3D()
Default constructor.
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.
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  }
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::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  }
JQuaternion3D()
Default constructor.
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  }
JQuaternion3D & mul(const double factor)
Scale quaternion.
data_type v[N+1][M+1]
Definition: JPolint.hh:866
double getLength() const
Get length.
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  }
double getB() const
Get b value.
double getD() const
Get d value.
double getC() const
Get c value.
JQuaternion3D()
Default constructor.
double getA() const
Get a value.
data_type v[N+1][M+1]
Definition: JPolint.hh:866
Data structure for normalised vector in three dimensions.
Definition: JVersor3D.hh:26
double u[N+1]
Definition: JPolint.hh:865
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  }
then usage set_variable ACOUSTICS_WORKDIR $WORKDIR set_variable FORMULA sin([0]+2 *$PI *([1]+[2]*x)*x)" set_variable DY 1.0e-8 mkdir $WORKDIR for DETECTOR in $DETECTORS[*]
Data structure for unit quaternion in three dimensions.
JQuaternion3D & normalise()
Normalise quaternion.

Member Data Documentation

double JCOMPASS::JHit::z
protected

Definition at line 78 of file JCompass/JHit.hh.

double JCOMPASS::JHit::sigma
protected

Definition at line 79 of file JCompass/JHit.hh.

int JLANG::JObjectID::__id
protectedinherited

Definition at line 140 of file JObjectID.hh.

double JGEOMETRY3D::JQuaternion3D::__a
protectedinherited

Definition at line 1117 of file JQuaternion3D.hh.

double JGEOMETRY3D::JQuaternion3D::__b
protectedinherited

Definition at line 1118 of file JQuaternion3D.hh.

double JGEOMETRY3D::JQuaternion3D::__c
protectedinherited

Definition at line 1119 of file JQuaternion3D.hh.

double JGEOMETRY3D::JQuaternion3D::__d
protectedinherited

Definition at line 1120 of file JQuaternion3D.hh.


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