Thea
RigidTransform3.hpp
1 //============================================================================
2 //
3 // This file is part of the Thea toolkit.
4 //
5 // This software is distributed under the BSD license, as detailed in the
6 // accompanying LICENSE.txt file. Portions are derived from other works:
7 // their respective licenses and copyright information are reproduced in
8 // LICENSE.txt and/or in the relevant source files.
9 //
10 // Author: Siddhartha Chaudhuri
11 // First version: 2009
12 //
13 //============================================================================
14 
15 #ifndef __Thea_RigidTransform3_hpp__
16 #define __Thea_RigidTransform3_hpp__
17 
18 #include "Common.hpp"
19 #include "AffineTransform3.hpp"
20 #include "RigidTransformN.hpp"
21 
22 namespace Thea {
23 
30 template <typename T>
31 class /* THEA_API */ RigidTransformN<3, T> : public Internal::RigidTransformNBase<3, T>
32 {
33  private:
35 
36  public:
37  typedef typename BaseT::AffineTransformT AffineTransformT;
38  typedef typename BaseT::VectorT VectorT;
39  typedef typename BaseT::MatrixT MatrixT;
40 
43 
44  using BaseT::translation;
45 
47  static RigidTransformN translation(T const & tx, T const & ty, T const & tz)
48  {
49  return BaseT::translation(VectorT(tx, ty, tz));
50  }
51 
53  static RigidTransformN rotationAxisAngle(VectorT const & axis, Real radians)
54  {
55  return BaseT::_fromAffine(AffineTransformT::rotationAxisAngle(axis, radians));
56  }
57 
61  static RigidTransformN rotationEulerAnglesXYZ(Real yaw_radians, Real pitch_radians, Real roll_radians)
62  {
63  return BaseT::_fromAffine(AffineTransformT::rotationEulerAnglesXYZ(yaw_radians, pitch_radians, roll_radians));
64  }
65 
69  static RigidTransformN rotationEulerAnglesXZY(Real yaw_radians, Real pitch_radians, Real roll_radians)
70  {
71  return BaseT::_fromAffine(AffineTransformT::rotationEulerAnglesXZY(yaw_radians, pitch_radians, roll_radians));
72  }
73 
77  static RigidTransformN rotationEulerAnglesYXZ(Real yaw_radians, Real pitch_radians, Real roll_radians)
78  {
79  return BaseT::_fromAffine(AffineTransformT::rotationEulerAnglesYXZ(yaw_radians, pitch_radians, roll_radians));
80  }
81 
85  static RigidTransformN rotationEulerAnglesYZX(Real yaw_radians, Real pitch_radians, Real roll_radians)
86  {
87  return BaseT::_fromAffine(AffineTransformT::rotationEulerAnglesYZX(yaw_radians, pitch_radians, roll_radians));
88  }
89 
93  static RigidTransformN rotationEulerAnglesZXY(Real yaw_radians, Real pitch_radians, Real roll_radians)
94  {
95  return BaseT::_fromAffine(AffineTransformT::rotationEulerAnglesZXY(yaw_radians, pitch_radians, roll_radians));
96  }
97 
101  static RigidTransformN rotationEulerAnglesZYX(Real yaw_radians, Real pitch_radians, Real roll_radians)
102  {
103  return BaseT::_fromAffine(AffineTransformT::rotationEulerAnglesZYX(yaw_radians, pitch_radians, roll_radians));
104  }
105 
114  static RigidTransformN rotationArc(VectorT const & start_dir, VectorT const & end_dir, bool normalize_dirs = true)
115  {
116  return BaseT::_fromAffine(AffineTransformT::rotationArc(start_dir, end_dir, normalize_dirs));
117  }
118 
119 }; // class RigidTransformN<3, T>
120 
121 #ifdef THEA_EXPORT_INSTANTIATION
122  template class THEA_API RigidTransformN<3, Real>;
123 #endif
124 
126 typedef RigidTransformN<3, Real> RigidTransform3;
127 
128 } // namespace Thea
129 
130 #endif
static RigidTransformN rotationEulerAnglesZXY(Real yaw_radians, Real pitch_radians, Real roll_radians)
Rotate about the Y axis by the roll angle, then the X axis by the pitch angle, and finally the Z axis...
static RigidTransformN rotationArc(VectorT const &start_dir, VectorT const &end_dir, bool normalize_dirs=true)
Return the transformation corresponding to the rotation from one direction vector to another...
static RigidTransformN rotationEulerAnglesZYX(Real yaw_radians, Real pitch_radians, Real roll_radians)
Rotate about the X axis by the roll angle, then the Y axis by the pitch angle, and finally the Z axis...
static RigidTransformN rotationAxisAngle(VectorT const &axis, Real radians)
Construct a rotation specified by an angle (in radians) around an axis.
RigidTransformN()
Default constructor.
Root namespace for the Thea library.
static RigidTransformN translation(T const &tx, T const &ty, T const &tz)
Construct a translation.
static RigidTransformN rotationEulerAnglesYXZ(Real yaw_radians, Real pitch_radians, Real roll_radians)
Rotate about the Z axis by the roll angle, then the X axis by the pitch angle, and finally the Y axis...
AffineTransformN< N, T > AffineTransformT
N-dimensional affine transform type.
static RigidTransformT translation(VectorT const &translation_)
Construct a translation.
Vector< N, T > VectorT
N-dimensional vector.
static RigidTransformT _fromAffine(AffineTransformT const &aff_)
Construct from an affine transform, assuming it is rigid (use with caution since it can break the rig...
A rigid transformation in N-space, consisting of a rotation followed by a translation.
RigidTransformN< 3, Real > RigidTransform3
The default affine transform class in real 3-space.
[Internal] Base class for a rigid transformation in N-space, consisting of a rotation followed by a t...
static RigidTransformN rotationEulerAnglesXZY(Real yaw_radians, Real pitch_radians, Real roll_radians)
Rotate about the Y axis by the roll angle, then the Z axis by the pitch angle, and finally the X axis...
static RigidTransformN rotationEulerAnglesYZX(Real yaw_radians, Real pitch_radians, Real roll_radians)
Rotate about the X axis by the roll angle, then the Z axis by the pitch angle, and finally the Y axis...
static RigidTransformN rotationEulerAnglesXYZ(Real yaw_radians, Real pitch_radians, Real roll_radians)
Rotate about the Z axis by the roll angle, then the Y axis by the pitch angle, and finally the X axis...