geomc 1.0
A c++ linear algebra template library
|
Affine transformation class. More...
#include <geomc/linalg/AffineTransform.h>
Public Member Functions | |
AffineTransform () | |
Construct a new identity transform. | |
AffineTransform< T, N > & | operator*= (const AffineTransform< T, N > &xf) |
AffineTransform< T, N > & | operator/= (const AffineTransform< T, N > &xf) |
template<typename U > | |
operator AffineTransform< U, N > () const | |
Cast elements to a different type. | |
const Vec< T, N > | apply (const Vec< T, N > &p) const |
const Vec< T, N > | apply_vector (const Vec< T, N > &v) const |
const Vec< T, N > | apply_normal (const Vec< T, N > &n) const |
const Vec< T, N > | apply_inverse (const Vec< T, N > &p) const |
const Vec< T, N > | apply_inverse_vector (const Vec< T, N > &v) const |
const Vec< T, N > | apply_inverse_normal (const Vec< T, N > &n) const |
const AffineTransform< T, N > | apply (const AffineTransform< T, N > &xf) const |
const AffineTransform< T, N > | apply_inverse (const AffineTransform< T, N > &xf) const |
const AffineTransform< T, N > | inverse () const |
Public Attributes | |
SimpleMatrix< T, N+1, N+1 > | mat |
Matrix representing this transformation. | |
SimpleMatrix< T, N+1, N+1 > | inv |
Matrix representing the inverse of this transformation. | |
Friends | |
Ray< T, N > | operator* (const AffineTransform< T, N > &xf, Ray< T, N > r) |
Ray< T, N > | operator/ (Ray< T, N > r, const AffineTransform< T, N > &xf) |
Vec< T, N > | operator* (const AffineTransform< T, N > &xf, Vec< T, N > p) |
Vec< T, N > | operator/ (Vec< T, N > p, const AffineTransform< T, N > &xf) |
AffineTransform< T, N > | operator* (const AffineTransform< T, N > &xf1, const AffineTransform< T, N > &xf2) |
AffineTransform< T, N > | operator/ (const AffineTransform< T, N > &xf1, const AffineTransform< T, N > &xf2) |
Related Functions | |
(Note that these are not member functions.) | |
template<typename T > | |
AffineTransform< T, 3 > | rotation (Vec< T, 3 > axis, T radians) |
template<typename T > | |
AffineTransform< T, 3 > | rotation (Vec< T, 3 > axis, const Vec< T, 3 > ¢er, T radians) |
template<typename T > | |
AffineTransform< T, 3 > | rotation (Quat< T > q) |
template<typename T > | |
AffineTransform< T, 2 > | rotation (T radians) |
template<typename T > | |
AffineTransform< T, 3 > | direction_align (const Vec< T, 3 > &dir, const Vec< T, 3 > &align_with) |
template<typename T , index_t N> | |
AffineTransform< T, N > | translation (const Vec< T, N > &tx) |
template<typename T , index_t N> | |
AffineTransform< T, N > | scale (const Vec< T, N > &sx) |
template<typename T , index_t N, MatrixLayout Lyt, StoragePolicy P> | |
AffineTransform< T, N > | transformation (const SimpleMatrix< T, N, N, Lyt, P > &mat) |
template<typename T > | |
AffineTransform< T, 3 > | scale (T sx, T sy, T sz) |
template<typename T > | |
AffineTransform< T, 2 > | scale (T sx, T sy) |
template<typename T > | |
AffineTransform< T, 3 > | translation (T tx, T ty, T tz) |
template<typename T > | |
AffineTransform< T, 2 > | translation (T tx, T ty) |
Affine transformation class.
Vectors are assumed to be columns; therefore a transformation is ordered like:
T * v
and so:
A * B * v
applies B to v, then A to the result.
The transform which "undoes" a transform can be obtained with xf.inverse()
. Because an AffineTransform internally stores both itself and its inverse, this construction is fairly inexpensive, as are all inverse-application functions.
Transforms are best constructed using the provided methods:
Vec<double,3> v = ... ; AffineTransform<double,3> xf = rotation(axis, angle); xf *= translation(v); xf *= scale(v); xf *= transformation(mat3x3);
These methods will generally be most efficient and robust, especially when constructing the internal inverse transformation matrix needed by AffineTransform objects.
|
inline |
Concatenation of transforms.
this
followed by a transform by xf
.
|
inline |
Application of inverse.
this
followed by the inverse of xf
. Inverse transformation of a point.
Inverse transformation of a normal.
Inverse transformation of a direction vector; ignores any translation.
Transformation of a normal. Preserves surface direction of geometry transformed by this
.
Transformation of a direction vector; ignores any translation.
|
inline |
this
.
|
inline |
Concatenation of transforms.
Assign a transform representing an application of this
followed by xf
.
|
inline |
Apply inverse transform.
Assign a transform representing an application of this
followed by the inverse of xf
.
|
related |
Rotation to align one vector with another.
dir | Unit direction to be realigned. |
align_with | Unit direction to align with. |
dir
with align_with
.
|
friend |
Transformation of a ray.
|
friend |
Transformation of a point.
|
friend |
Concatenation of transforms.
xf2
followed by xf1
.
|
friend |
Inverse transform application.
xf1
followed by the inverse of xf2
.
|
friend |
Inverse transformation of a ray (xf
-1
* ray
)
|
friend |
Inverse transformation of a point (xf
-1
* pt
)
|
related |
Rotation from a quaternion.
q | Rotation quaternion. |
|
related |
2D rotation about the origin by angle radians
.
radians | Angle of rotation in the counterclockwise direction |
|
related |
Rotation about a point.
This transformation will not be a pure rotation; it will include a translation component.
axis | Axis of rotation. |
center | Center of rotation. |
radians | Angle of rotation. |
center
by angle radians
and axis axis
.
|
related |
Rotation about an axis.
axis | Axis of rotation. |
radians | Angle of rotation. |
axis
by angle radians
.
|
related |
Scale transform.
sx | Vector whose elements describe a scaling along each axis. |
|
related |
Per-axis 2D scale
|
related |
Per-axis 3D scale
|
related |
Arbitrary transformation.
mat | N x N matrix representing an arbitrary transformation. |
mat
|
related |
Translation transform
|
related |
2D translation
|
related |
3D translation