Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
QuaternionXaxial.cxx
Go to the documentation of this file.
1// @(#)root/mathcore:$Id$
2// Authors: W. Brown, M. Fischler, L. Moneta 2005
3
4 /**********************************************************************
5 * *
6 * Copyright (c) 2005 , LCG ROOT FNAL MathLib Team *
7 * *
8 * *
9 **********************************************************************/
10
11// Implementation file for quaternion times other non-axial rotations.
12// Decoupled from main Quaternion implementations.
13//
14// Created by: Mark Fischler Tues July 19, 2005
15//
16// Last update: $Id$
17//
19
20namespace ROOT {
21
22namespace Math {
23
24
25// Although the same technique would work with axial rotations,
26// we know that two of the four quaternion components will be zero,
27// and we exploit that knowledge:
28
30 // combination with a RotationX
31 Quaternion q(rx);
32 return Quaternion (
33 U()*q.U() - I()*q.I()
34 , I()*q.U() + U()*q.I()
35 , J()*q.U() + K()*q.I()
36 , K()*q.U() - J()*q.I()
37 );
38}
39
41 // combination with a RotationY
42 Quaternion q(ry);
43 return Quaternion (
44 U()*q.U() - J()*q.J()
45 , I()*q.U() - K()*q.J()
46 , J()*q.U() + U()*q.J()
47 , K()*q.U() + I()*q.J()
48 );
49}
50
52 // combination with a RotationZ
53 Quaternion q(rz);
54 return Quaternion (
55 U()*q.U() - K()*q.K()
56 , I()*q.U() + J()*q.K()
57 , J()*q.U() - I()*q.K()
58 , K()*q.U() + U()*q.K()
59 );
60}
61
63operator * ( RotationX const & r, Quaternion const & q ) {
64 return Quaternion(r) * q; // TODO: improve performance
65}
66
67Quaternion
68operator * ( RotationY const & r, Quaternion const & q ) {
69 return Quaternion(r) * q; // TODO: improve performance
70}
71
72Quaternion
73operator * ( RotationZ const & r, Quaternion const & q ) {
74 return Quaternion(r) * q; // TODO: improve performance
75}
76
77
78} //namespace Math
79} //namespace ROOT
ROOT::R::TRInterface & r
Definition Object.C:4
float * q
Rotation class with the (3D) rotation represented by a unit quaternion (u, i, j, k).
Definition Quaternion.h:47
Quaternion()
Default constructor (identity rotation)
Definition Quaternion.h:58
Scalar U() const
Access to the four quaternion components: U() is the coefficient of the identity Pauli matrix,...
Definition Quaternion.h:165
AVector operator*(const AVector &v) const
Overload operator * for rotation on a vector.
Definition Quaternion.h:240
Rotation class representing a 3D rotation about the X axis by the angle of rotation.
Definition RotationX.h:43
Rotation class representing a 3D rotation about the Y axis by the angle of rotation.
Definition RotationY.h:43
Rotation class representing a 3D rotation about the Z axis by the angle of rotation.
Definition RotationZ.h:43
#define I(x, y, z)
Namespace for new Math classes and functions.
AxisAngle operator*(RotationX const &r1, AxisAngle const &r2)
Multiplication of an axial rotation by an AxisAngle.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...