|
geomc 1.0
A c++ linear algebra template library
|
A similarity transform, which is a rotation, scaling, and translation. More...
#include <geomc/linalg/Similarity.h>
Public Types | |
| using | elem_t |
| The coordinate type of this object. | |
| using | point_t |
| The type of a point in this object's space. | |
Public Member Functions | |
| Similarity (const Isometry< T, N > &s, T sx=1) | |
| Similarity (const Rotation< T, N > &rx) | |
| Similarity (const Vec< T, N > &tx) | |
| Similarity (T sx) | |
| Similarity (T sx, const Rotation< T, N > &rx) | |
| Similarity (T sx, const Rotation< T, N > &rx, const Vec< T, N > &tx) | |
| Vec< T, N > | apply_direction (const Vec< T, N > &v) const |
| Transform a direction vector. | |
| Vec< T, N > | apply_inverse_direction (const Vec< T, N > &v) const |
| Inverse-transform a direction vector. | |
| Similarity< T, N > | inverse () const |
| Compute the inverse of the similarity. | |
| operator AffineTransform< T, N > () const | |
| Represent this similarity as an affine transform. | |
|
template<index_t M> requires (M > N) | |
| operator Similarity< T, M > () const | |
| Extend the dimensionality of this similarity. | |
|
template<typename U, index_t M> requires (M > N) | |
| operator Similarity< U, M > () const | |
| Extend the dimensionality of this similarity and change the coordinate type. | |
| template<typename U> | |
| operator Similarity< U, N > () const | |
| Cast the underlying coordinate type. | |
| Similarity< T, N > | operator* (const Similarity< T, N > &other) const |
| Compose two similarity transforms. | |
| Vec< T, N > | operator* (const Vec< T, N > &p) const |
| Transform a point. | |
| Similarity< T, N > & | operator*= (const Similarity< T, N > &other) |
| Compose in-place. | |
| Similarity< T, N > | operator+= (const Vec< T, N > &v) |
| Similarity< T, N > | operator/ (const Similarity< T, N > &other) const |
| Compose with the inverse of a similarity. | |
| Similarity< T, N > & | operator/= (const Similarity< T, N > &other) |
| In-place apply inverse. | |
| Similarity< T, N > | scaled (T s) const |
Public Attributes | |
| Rotation< T, N > | rx |
| Rotation component. | |
| T | sx = 1 |
| Scale component. | |
| Vec< T, N > | tx |
| Translation component. | |
Static Public Attributes | |
| static constexpr index_t | N |
| The dimension of this object. | |
Related Symbols | |
(Note that these are not member symbols.) | |
| template<typename T, index_t N> | |
| Capsule< T, N > | operator* (const Similarity< T, N > &xf, const Capsule< T, N > &c) |
| Transform a capsule by a similarity transform. | |
| template<typename T, index_t N> | |
| Cylinder< T, N > | operator* (const Similarity< T, N > &xf, const Cylinder< T, N > &c) |
| Transform a cylinder by a similarity transform. | |
| template<typename T, index_t N, typename Shape> | |
| Dilated< Shape > | operator* (const Similarity< T, N > &xf, const Dilated< Shape > &s) |
| Transform a dilated shape by a similarity transform. | |
| template<typename T, index_t N> | |
| Simplex< T, N > | operator* (const Similarity< T, N > &xf, const Simplex< T, N > &s) |
| Transform a simplex by a similarity transform. | |
| template<typename T, index_t N> | |
| Sphere< T, N > | operator* (const Similarity< T, N > &xf, const Sphere< T, N > &s) |
| Transform a sphere by a similarity transform. | |
| template<typename T, index_t N> | |
| Similarity< T, N > | operator+ (const Similarity< T, N > &i, const Vec< T, N > &v) |
| Apply a translation to a similarity. | |
| template<typename T, index_t N> | |
| Similarity< T, N > | operator+ (const Vec< T, N > &v, const Similarity< T, N > &i) |
| Apply a translation to a similarity. | |
| template<typename T, index_t N> | |
| Capsule< T, N > | operator/ (const Capsule< T, N > &c, const Similarity< T, N > &xf) |
| Inverse-transform a capsule by a similarity transform. | |
| template<typename T, index_t N> | |
| Cylinder< T, N > | operator/ (const Cylinder< T, N > &c, const Similarity< T, N > &xf) |
| Inverse-transform a cylinder by a similarity transform. | |
| template<typename T, index_t N, typename Shape> | |
| Dilated< Shape > | operator/ (const Dilated< Shape > &s, const Similarity< T, N > &xf) |
| Inverse-transform a dilated shape by a similarity transform. | |
| template<typename T, index_t N> | |
| Simplex< T, N > | operator/ (const Simplex< T, N > &s, const Similarity< T, N > &xf) |
| Inverse-transform a simplex by a similarity transform. | |
| template<typename T, index_t N> | |
| Sphere< T, N > | operator/ (const Sphere< T, N > &s, const Similarity< T, N > &xf) |
| Inverse-transform a sphere by a similarity transform. | |
| template<typename T, index_t N> | |
| Vec< T, N > | operator/ (const Vec< T, N > &v, const Similarity< T, N > &i) |
| Transform a point. | |
A similarity transform, which is a rotation, scaling, and translation.
Similar transforms do not have any skew or nonuniform scales; they preserve shapes, angles, and relative distances.
Similarities meet the Transform concept. For transforms which do not include a scaling, see Isometry. For nonuniform scaling or skew transforms, see AffineTransform.
Similarity transforms compose like transforms, with multiplication on the left:
Similarity<T,N> s1, s2; Similarity<T,N> s3 = s2 * s1; // similarity which applies s1, then s2 Vec<T,N> v = s3 * s1 * v0; // apply s1 to v0, then s3 to the result Sphere<T,N> s = s1 * sphere; // apply s1 to a sphere
Similarity transforms can be inverted with the / operator:
Similarity<T,N> s1, s2; Similarity<T,N> s3 = s2 / s1; // similarity which takes s1 to s2 Vec<T,N> v = v0 / s3; // apply the inverse of s3 to v0
Compose with rotations and translations:
Similarity<T,3> s; Rotation<T,3> r; Similarity<T,3> s2 = r * s; // s2 is s with r applied Similarity<T,3> s3 = s + Vec<T,3>(1,2,3); // s3 is s translated by (1,2,3)
Scaling is done explicitly with .scaled() or the .sx member:
Similarity<T,3> s; Similarity<T,3> s2 = s.scaled(2); // s2 is s with double the scale Similarity<T,3> s3 = s * 2; // s3 is s with double the scale
|
inherited |
The type of a point in this object's space.
An N-vector of T if N > 1, otherwise a T.