1 #ifndef Geom_newTkRotation_H 2 #define Geom_newTkRotation_H 17 std::ostream & operator<<( std::ostream& s, const TkRotation<T>&
r);
19 std::ostream & operator<<( std::ostream& s, const TkRotation2D<T>&
r);
42 rot(xx,xy,xz, yx,yy,yz, zx, zy,zz){}
49 TkRotation(
const GlobalVector & aX,
const GlobalVector & aY) {
51 GlobalVector uX = aX.
unit();
52 GlobalVector uY = aY.
unit();
53 GlobalVector uZ(uX.
cross(uY));
57 rot.axis[2]= uZ.basicVector().v;
61 TkRotation(
const BasicVector & aX,
const BasicVector & aY) {
63 BasicVector uX = aX.
unit();
64 BasicVector uY = aY.
unit();
65 BasicVector uZ(uX.
cross(uY));
78 TkRotation(
const GlobalVector & uX,
const GlobalVector & uY,
79 const GlobalVector & uZ) {
85 TkRotation(
const BasicVector & uX,
const BasicVector & uY,
86 const BasicVector & uZ) {
119 *
this = (tmpRoty*tmpRotz).multiplyInverse(*
this);
155 template <
typename U>
158 a.yx(), a.
yy(), a.
yz(),
159 a.zx(), a.zy(), a.
zz()) {}
162 return rot.transpose();
166 return rot.rotate(v.
v);
170 return rot.rotateBack(v.
v);
175 return rot.rotate(v.
v);
179 return rot.rotateBack(v.
v);
182 template <
class Scalar>
185 xy()*v.
x() +
yy()*v.
y() + zy()*v.
z(),
191 yx()*v.
x() +
yy()*v.
y(),
192 zx()*v.
x() + zy()*v.
y());
206 return rot.transpose()*b.
rot;
215 return *
this = b.operator * (*this);
231 fabs(newX.
mag2()-1.) > del ||
232 fabs(newY.
mag2()-1.) > del ||
233 fabs(newZ.
mag2()-1.) > del ||
234 fabs(newX.
dot(newY)) > del ||
235 fabs(newY.
dot(newZ)) > del ||
236 fabs(newZ.
dot(newX)) > del) {
241 newX.
y(), newY.
y(), newZ.
y(),
242 newX.
z(), newY.
z(), newZ.
z()));
275 template <
class T,
class U>
278 r.
yx()*v.
x() + r.
yy()*v.
y() + r.
yz()*v.
z(),
279 r.
zx()*v.
x() + r.
zy()*v.
y() + r.
zz()*v.
z());
282 template <
class T,
class U>
286 return RT( a.
xx()*b.
xx() + a.
xy()*b.
yx() + a.
xz()*b.
zx(),
316 BasicVector uX = aX.
unit();
317 BasicVector uY(-uX.
y(),uX.
x());
330 BasicVector
x()
const {
return rot.axis[0];}
331 BasicVector
y()
const {
return rot.axis[1];}
335 return rot.transpose();
338 BasicVector
rotate(
const BasicVector&
v)
const {
339 return rot.rotate(v.
v);
343 return rot.rotateBack(v.
v);
Basic3DVector< T > BasicVector
Basic3DVector< T > z() const
Basic3DVector< T > operator*(const Basic3DVector< T > &v) const
TkRotation(const GlobalVector &aX, const GlobalVector &aY)
T y() const
Cartesian y coordinate.
T x() const
Cartesian x coordinate.
TkRotation2D(const BasicVector &uX, const BasicVector &uY)
Basic3DVector< T > y() const
TkRotation(const Basic3DVector< T > &axis, T phi)
std::ostream & operator<< < float >(std::ostream &s, const TkRotation< float > &r)
TkRotation & transform(const TkRotation &b)
Sin< T >::type sin(const T &t)
Geom::Theta< T > theta() const
Basic3DVector unit() const
TkRotation operator*(const TkRotation &b) const
Basic3DVector cross(const Basic3DVector &lh) const
Vector product, or "cross" product, with a vector of same type.
Basic3DVector< Scalar > multiplyInverse(const Basic3DVector< Scalar > &v) const
TkRotation2D(Rot2< T > const &irot)
Basic3DVector< U > operator*(const TkRotation< T > &r, const Basic3DVector< U > &v)
Vector3DBase< T, GlobalTag > GlobalVector
TkRotation2D transposed() const
TkRotation multiplyInverse(const TkRotation &b) const
Geom::Phi< T > phi() const
TkRotation(const TkRotation< U > &a)
TkRotation & rotateAxes(const Basic3DVector< T > &newX, const Basic3DVector< T > &newY, const Basic3DVector< T > &newZ)
Basic3DVector< T > x() const
Basic2DVector unit() const
Basic3DVector< T > rotate(const Basic3DVector< T > &v) const
T z() const
Cartesian z coordinate.
TkRotation(T xx, T xy, T xz, T yx, T yy, T yz, T zx, T zy, T zz)
Basic3DVector< T > operator*(const Basic2DVector< T > &v) const
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > cross(const Vector3DBase< U, FrameTag > &v) const
Cos< T >::type cos(const T &t)
Basic3DVector< T > multiplyInverse(const Basic2DVector< T > &v) const
TkRotation(Rot3< T > const &irot)
TkRotation(const BasicVector &aX, const BasicVector &aY)
T y() const
Cartesian y coordinate.
Vector3DBase unit() const
TkRotation & operator*=(const TkRotation &b)
std::ostream & operator<< < double >(std::ostream &s, const TkRotation< double > &r)
TkRotation(const GlobalVector &uX, const GlobalVector &uY, const GlobalVector &uZ)
Basic3DVector< T > rotateBack(const Basic3DVector< T > &v) const
TkRotation2D(const BasicVector &aX)
TkRotation transposed() const
BasicVector rotateBack(const BasicVector &v) const
TkRotation2D(T xx, T xy, T yx, T yy)
Basic3DVector< T > multiplyInverse(const Basic3DVector< T > &v) const
Basic2DVector< T > BasicVector
const BasicVectorType & basicVector() const
T x() const
Cartesian x coordinate.
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
T dot(const Basic3DVector &rh) const
Scalar product, or "dot" product, with a vector of same type.
TkRotation(const BasicVector &uX, const BasicVector &uY, const BasicVector &uZ)
BasicVector rotate(const BasicVector &v) const