Thea
RigidTransform2.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_RigidTransform2_hpp__
16 #define __Thea_RigidTransform2_hpp__
17 
18 #include "Common.hpp"
19 #include "AffineTransform2.hpp"
20 #include "RigidTransformN.hpp"
21 
22 namespace Thea {
23 
30 template <typename T>
31 class /* THEA_API */ RigidTransformN<2, T> : public Internal::RigidTransformNBase<2, 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)
48  {
49  return BaseT::translation(VectorT(tx, ty));
50  }
51 
53  static RigidTransformN rotation(Real radians)
54  {
55  return BaseT::_fromAffine(AffineTransformT::rotation(radians));
56  }
57 
58 }; // class RigidTransformN<2, T>
59 
60 #ifdef THEA_EXPORT_INSTANTIATION
61  template class THEA_API RigidTransformN<2, Real>;
62 #endif
63 
65 typedef RigidTransformN<2, Real> RigidTransform2;
66 
67 } // namespace Thea
68 
69 #endif
RigidTransformN()
Default constructor.
Root namespace for the Thea library.
static RigidTransformN translation(T const &tx, T const &ty)
Construct a translation.
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.
static RigidTransformN rotation(Real radians)
Construct a rotation specified by an angle (in radians) around the origin.
[Internal] Base class for a rigid transformation in N-space, consisting of a rotation followed by a t...
RigidTransformN< 2, Real > RigidTransform2
The default rigid transform class in real 2-space.