CGPdocs

affine_rt

Rigid transform: rotation + translation.

module 09_geometric_transformationsource: affine_rt.hpp
T * p scales, rotates and then translates: affine_rt gives R p + t, affine_rts gives R s p + t, and affine gives R s S p + t, where S = diag(scaling_xyz) stretches the local axes of the shape before the rotation.
T * p scales, rotates and then translates: affine_rt gives R p + t, affine_rts gives R s p + t, and affine gives R s S p + t, where S = diag(scaling_xyz) stretches the local axes of the shape before the rotation. Tap to enlarge.

Fields and methods

Members of the struct affine_rt. Most of what you do with a CGP type goes through the free functions listed below.

Fields

rotation_transform rotationRotation part of the rigid transform.
vec3 translationTranslation part of the rigid transform, applied after the rotation.

Methods

affine_rt()Builds the identity transform (identity rotation, zero translation).3 overloads src
affine_rt(rotation_transform const& rotation)Builds a pure rotation with zero translation (explicit). src
affine_rt(rotation_transform const& rotation, vec3 const& translation)Builds the rigid transform p -> rotation*p + translation (explicit). src
Returns the 4x4 matrix ((R, t), (0, 1)) of the transform. src
Returns the rigid transform of a mat4, with the translation of its last column and the rotation of its 3x3 block divided by the norm of the first row (a uniform scaling is thus dropped; identity rotation if that norm is below 1e-5). src
Sets the translation and returns a reference to the transform. src
Sets the rotation and returns a reference to the transform. src

Functions taking a affine_rt

Transform 1

affine_rt inverse(affine_rt const& T)

Inverse rigid transform (rotation + translation).

Convert 2

std::string str(affine_rt const& T)

String listing the rotation (quaternion) and translation of the rigid transform.

std::string type_str(affine_rt const&)

Type name "affine_rt".

Functions returning a affine_rt

Compute 1

Documented on another page

  • rotation_around_centerRigid transform that applies the rotation R around center instead of the origin, mapping p to R(p - center) + center.on rotation_transform

Operators

Show the 20 operators (+, -, *, ==, ...)

operator*

11 overloads
affine operator*(affine_rt const& T1, affine const& T2)
source

Composition T1 o T2 of a rigid transform (parent) with an affine transform (child), exact for any scaling_xyz.

vec3 operator*(affine_rt const& T, vec3 const& p)
source

Apply the rigid transform to a point: rotation * p + translation.

vec4 operator*(affine_rt const& T, vec4 const& p)
source

Apply the rigid transform to a homogeneous vector, the translation being weighted by w.

affine_rt operator*(affine_rt const& T1, affine_rt const& T2)
source

Composition T1 o T2 of two rigid transforms.

affine_rt operator*(affine_rt const& T, rotation_transform const& R)
source

Rigid transform T o R: the rotation is applied before T.

mat4 operator*(affine_rt const& T1, mat4 const& T2)
source

Product of the 4x4 matrix of the rigid transform with a mat4.

mat4 operator*(affine_rt const& T1, mat3 const& T2)
source

Product of the 4x4 matrix of the rigid transform with a mat3 extended to a mat4.

affine_rts operator*(float s, affine_rt const& T)
source

Uniform scaling by s applied after the rigid transform (rotation kept, translation and scaling multiplied by s).

affine_rts operator*(affine_rt const& T, float s)
source

Uniform scaling by s applied after the rigid transform (rotation kept, translation and scaling multiplied by s).

affine_rts operator*(affine_rt const& T1, affine_rts const& T2)
source

Composition T1 o T2 of a rigid transform with a rotation-translation-scaling.

frame operator*(affine_rt const& T, frame const& f)
source

Frame transformed by the rigid transform: orientation and position are rotated, then the position is translated.

affine_rt operator+(affine_rt const& T, vec3 const& tr)

Copy of the rigid transform with tr added to its translation.

affine_rt operator-(affine_rt const& T, vec3 const& tr)

Copy of the rigid transform with tr subtracted from its translation.

std::ostream& operator<<(std::ostream& s, affine_rt const& T)

Write str(T) of the rigid transform to the stream.

Documented on another page

  • operator*Composition T1 o T2 of an affine transform with a rigid transform, returned as an affine; asserts that T1.scaling_xyz is uniform (use T1.matrix()*T2.matrix() otherwise).on affine
  • operator*Rigid transform R o T: the rotation is applied after T, rotating its translation as well.on rotation_transform
  • operator*Product of a mat4 with the 4x4 matrix of the rigid transform.on mat4
  • operator*Product of a mat3 extended to a mat4 with the 4x4 matrix of the rigid transform.on mat3
  • operator*Composition T1 o T2 of a rotation-translation-scaling with a rigid transform.on affine_rts
  • operator+Copy of the rigid transform with tr added to its translation.on vec3
CGP - Computer Graphics Programming.