Library of Assembled Shared Sources
|
a linear 2D transformation More...
#include <transformation_2d.h>
Public Member Functions | |
Transformation2D () | |
construct an identity transformation. | |
template<typename InputIterator> | |
Transformation2D (InputIterator first, InputIterator last) | |
construct a transformation from a 3x3 tranformation matrix. | |
const Transformation2D< T > | inverse () const |
return the inverse transformation. | |
const TValue * | matrix () const |
Return pointer to row major matrix representation of transformation. | |
Static Public Member Functions | |
static const TSelf | identity () |
make a 2D identity transformation | |
static const TSelf | translation (const Vector2D< T > &offset) |
make a 2D transformation representing a translation | |
static const TSelf | scaler (const T &scale) |
make a 3D transformation representing a uniform scaling | |
static const TSelf | scaler (const Vector2D< T > &scale) |
make a 3D transformation representing a scaling with different factors per axis | |
static const TSelf | rotation (TParam radians) |
make a 3D transformation representing a counterclockwise rotation | |
Related Symbols | |
(Note that these are not member symbols.) | |
template<typename T> | |
Transformation2D< T > | concatenate (const Transformation2D< T > &first, const Transformation2D< T > &second) |
concatenate two transformations first and second in one. | |
template<typename T> | |
Vector2D< T > | transform (const Vector2D< T > &subject, const Transformation2D< T > &transformation) |
apply transformation to a vector | |
template<typename T> | |
Point2D< T > | transform (const Point2D< T > &subject, const Transformation2D< T > &transformation) |
apply transformation to a point | |
template<typename T> | |
Vector2D< T > | normalTransform (const Vector2D< T > &subject, const Transformation2D< T > &transformation) |
apply transformation to a normal vector. | |
template<typename T> | |
std::pair< Vector2D< T >, T > | normalTransform (const std::pair< Vector2D< T >, T > &subject, const Transformation2D< T > &transformation) |
apply transformation to a 3D normal vector. | |
a linear 2D transformation
Definition at line 83 of file transformation_2d.h.
lass::prim::Transformation2D< T >::Transformation2D | ( | ) |
construct an identity transformation.
An identity transformation transforms every point to itself.
Definition at line 65 of file transformation_2d.inl.
Referenced by identity(), rotation(), scaler(), scaler(), and translation().
lass::prim::Transformation2D< T >::Transformation2D | ( | InputIterator | first, |
InputIterator | last ) |
construct a transformation from a 3x3 tranformation matrix.
The elements of the 3x3 matrix will represented in a row major way by an iterator range [first, last) of 9 elements.
Definition at line 106 of file transformation_2d.inl.
const Transformation2D< T > lass::prim::Transformation2D< T >::inverse | ( | ) | const |
return the inverse transformation.
The inverse is calculated on the first call, and then cached for later use. For the transformation, we've use the C version of Cramer's rule as described in the Intel (R) article "Streaming SIMD Extensions -Inverse of 4x4 Matrix" which can be found here: http://www.intel.com/design/pentiumiii/sml/245043.htm
Definition at line 124 of file transformation_2d.inl.
References inv(), and lass::num::inv().
Referenced by lass::prim::Transformation2D< U >::normalTransform(), and lass::prim::Transformation2D< U >::normalTransform().
|
inline |
Return pointer to row major matrix representation of transformation.
This is for immediate use only, like std::basic_string::data()
.
Definition at line 172 of file transformation_2d.inl.
Referenced by lass::prim::Transformation2D< U >::concatenate(), lass::prim::Transformation2D< U >::transform(), and lass::prim::Transformation2D< U >::transform().
|
concatenate two transformations first and second in one.
The result is one transformation that performs the same actions as first performing first and then second. Hence, the following lines of code are equivalent (ignoring numerical imprecions):
Definition at line 322 of file transformation_2d.inl.
|
apply transformation to a normal vector.
Vectors that represent a normal vector should transform differentely than ordinary vectors. Use this transformation function for normals.
Definition at line 379 of file transformation_2d.inl.
|
apply transformation to a 3D normal vector.
Vectors that represent a normal vector should transform differentely than ordinary vectors. Use this transformation function for normals.
Cartesian lines have a 3D normal vector that must be transformed in 2D. Use this function to do it:
Definition at line 403 of file transformation_2d.inl.