15 #ifndef __Thea_AffineTransformN_hpp__ 16 #define __Thea_AffineTransformN_hpp__ 35 template <
int N,
typename T>
43 THEA_DECL_SMART_POINTERS(AffineTransformT)
49 AffineTransformNBase(MatrixT
const & linear_, VectorT
const & translation_) : linear(linear_), trans(translation_) {}
58 static AffineTransformT
scaling(VectorT
const & s)
64 static AffineTransformT
scaling(T
const & s)
79 MatrixT
const &
getLinear()
const {
return linear; }
85 void setLinear(MatrixT
const & linear_) { linear = linear_; }
100 for (
intx i = 0; i < N; ++i)
102 for (
intx j = 0; j < N; ++j)
103 m(i, j) = linear(i, j);
115 for (
intx i = 0; i < N; ++i)
117 for (
intx j = 0; j < N; ++j)
118 m(i, j) = linear(i, j);
129 MatrixT inv = linear.inverse();
136 debugAssertM(i >= 0 && i < N && j >= 0 && j <= N,
"AffineTransformT: Index out of bounds");
137 return j == N ? trans[i] : linear(i, j);
143 debugAssertM(i >= 0 && i < N && j >= 0 && j <= N,
"AffineTransformT: Index out of bounds");
144 return j == N ? trans[i] : linear(i, j);
148 AffineTransformT
operator*(AffineTransformT
const & rhs)
const 154 VectorT
operator*(VectorT
const & v)
const {
return linear * v + trans; }
159 std::ostringstream oss;
167 static AffineTransformT
const idty(MatrixT::Identity(), VectorT::Zero());
180 template <
int N,
typename T = Real>
187 typedef typename BaseT::VectorT
VectorT;
188 typedef typename BaseT::MatrixT
MatrixT;
194 AffineTransformN(MatrixT
const & linear_, VectorT
const & translation_ = VectorT::Zero()) : BaseT(linear_, translation_) {}
202 template <
int N,
typename T>
204 operator<<(std::ostream & os, AffineTransformN<N, T>
const & tr)
206 return os << tr.toString();
211 #include "AffineTransform2.hpp" 212 #include "AffineTransform3.hpp" Eigen::Matrix< T, Size, 1, Options|((Options &Eigen::DontAlign)==0 &&Size==Eigen::Dynamic?Eigen::AutoAlign:Eigen::DontAlign), MaxRowsAtCompileTime, 1 > Vector
General 1D dense column vector template, alias for Eigen::Matrix<T, Size, 1,...>, with a custom align...
std::ptrdiff_t intx
A signed integer suitable for indexing a structure held in memory.
std::string toString(char const *s)
Convert a C-string to a std::string object, returning an empty string if the input is a null pointer...
Root namespace for the Thea library.
Matrix< N, N, T > scaling(Vector< N, T > const &s)
Matrix to scale a point by the corresponding scaling parameter along each dimension.
Eigen::Matrix< T, Rows, Cols, Options|((Options &Eigen::DontAlign)==0 &&(Rows==Eigen::Dynamic||Cols==Eigen::Dynamic)?Eigen::AutoAlign:Eigen::DontAlign), MaxRowsAtCompileTime, MaxColsAtCompileTime > Matrix
General 2D dense matrix template, alias for Eigen::Matrix with a custom default layout (row or column...
void debugAssertM(CondT const &test, MessageT const &msg)
Check if a test condition is true, and immediately abort the program with an error code if not...