# SE(3)¶

## Overview¶

4x4 matrices for transforming homogeneous coordinates are commonly used to describe general rigid body displacements .

$\begin{split}\Phi \in SE(3) = \begin{bmatrix}R & \underline{r}\\ 0 & 1 \end{bmatrix}\end{split}$

Here $$R$$ is an orthonormal rotation matrix that is a member of the Special Orthogonal Group ($$\in SO(3)$$) with the property:

$R^{-1} = R^T$

and $$\underline{r}$$ is a translation vector. In group theory, this set of 4x4 matrices is identified as the Special Euclidian group, SE(3).

SE(3) matrices have the property that:

$\begin{split}\Phi^{-1} = \begin{bmatrix}R^T & -R^T \underline{r} \\ 0 & 1 \end{bmatrix}\end{split}$

Consider how the vector $$\underline{v}_b$$ is transformed from frame $$b$$ to frame $$a$$ using 4x4 transformation matrices. To transform a 3D vector using 4x4 transformation matrices, a homogeneous coordinate is appended to $$\underline{v}_b$$ and the transformation is performed as:

$\begin{split}\begin{Bmatrix} \underline{v}_a \\ 1 \end{Bmatrix} = \begin{Bmatrix} R^{ab} \underline{v}_b + \underline{r}_{ab}^a \\ 1 \end{Bmatrix} = \begin{bmatrix} R^{ab} & \underline{r}_{ab}^a \\ 0 & 1 \end{bmatrix} \begin{Bmatrix} \underline{v}_b \\ 1 \end{Bmatrix}\end{split}$

The notation provided by the SE(3) group is convenient for its compact notation in that it encapsulates general rigid body rotation and translation in one symbol. However, this example demonstrates that when composing rigid body transformations, there is no need to perform the full 4x4 matrix multiplication or store the 0s and 1s. KSL has a special datastructure for rigid body transformations called ksl_SE3_t and a collection of functions that perform only the minimum number of operations for composing rigid body transformations and transforming vectors.

## Double precision¶

union ksl_SE3_t
#include <matrix.h>

Double precision member of 3 Dimensional Special Euclidian group (SE3) consisting of a double precision SO3 (othonormalized 3x3 rotation matrix) and double precision translation vector pair.

This union allows accessing double precision SE3 quantities by field name, as a singly dimensioned array, as a doubly dimensioned array, or by accessing a specific column. If using the at or as_array operators, quantities are accessed in column major order.

The following examples illustrate how to access row 2, column 1 (using 0 based indexing) of SE3 matrix D. The following access methods are equivalent.

D.as_array[2 + 1 * 3];
D.at;
D.m21;
D.v1.z;
D.v1.at;
D.v.z;
D.v.at;
D.R.m21;
D.R.v1.z;
D.R.v1.at;
D.R.v.z;
D.R.v.at;


The following examples illustrate how to access row 1, column 3 (using 0 based indexing) of SE3 matrix D. The following access methods are equivalent.

D.as_array[1 + 3 * 3];
D.at;
D.m13;
D.v3.y;
D.v3.at;
D.v.y;
D.v.at;
D.t.y;
D.t.at;


See also the ksl_SE3_get and ksl_SE3_set functions.

Public Members

double as_array
struct ksl_SE3_t::[anonymous] [anonymous]

anonymous union allows accessing quantities at specified index in linear array, where entities are specified in column major order

double at
struct ksl_SE3_t::[anonymous] [anonymous]

anonymous union allows accessing SE3 quantities at specified index in a doubly dimensioned array, where entities are specified in column major order

ksl_mat3x3_t R

rotation component of SE3 transformation

ksl_vec3_t t

translation component of SE3 transformation

struct ksl_SE3_t::[anonymous] [anonymous]

anonymous union allows accessing rotation matrix and translation vector quantities by field name

double m00
double m10
double m20
double m01
double m11
double m21
double m02
double m12
double m22
double m03
double m13
double m23
struct ksl_SE3_t::[anonymous] [anonymous]

anonymous union allows accessing rotation matrix quantities by field name

ksl_vec3_t v0
ksl_vec3_t v1
ksl_vec3_t v2
ksl_vec3_t v3
struct ksl_SE3_t::[anonymous] [anonymous]

anonymous union allows accessing columns of rotation matrix quantities by field name

ksl_vec3_t v
struct ksl_SE3_t::[anonymous] [anonymous]

anonymous union allows accessing columns of rotation matrix quantities at specified index

ksl_SE3_t ksl_SE3(const double m00, const double m01, const double m02, const double m03, const double m10, const double m11, const double m12, const double m13, const double m20, const double m21, const double m22, const double m23)

ksl_SE3_t constructor.

Note that in the constructor, fields are specified in row major order. Internally, ksl_SE3_t datastructures are stored in column major order.

ksl_SE3_t ksl_SE3_cmo(const double m00, const double m10, const double m20, const double m01, const double m11, const double m21, const double m02, const double m12, const double m22, const double m03, const double m13, const double m23)

alternative ksl_SE3_t constructor.

In this alternate constructor, fields are specified in column major order to match the internal layout of ksl_SE3_t datastructures.

ksl_SE3_t ksl_SE3_fromRt(const ksl_mat3x3_t R, const ksl_vec3_t t)

alternative ksl_SE3_t constructor that allows creating a ksl_SE3_t datastructure from a rotation matrix and translation vector.

ksl_SE3_t *ksl_SE3_alloc(int n)

allocates n ksl_SE3_t datastructures on the heap. Must be freed by the user.

void ksl_SE3_toMat4x4(const ksl_SE3_t *d, ksl_mat4x4_t *m)

convert a ksl_SE3_t datastructure to a ksl_mat4x4_t datastructure

Parameters
• d: [in] input SE3 datastructure
• m: [out] output mat4x4 matrix

void ksl_SE3_toMat4x4f(const ksl_SE3_t *d, ksl_mat4x4f_t *m)

convert a ksl_SE3_t datastructure to a ksl_mat4x4f_t datastructure

Parameters
• d: [in] input SE3 datastructure
• m: [out] output mat4x4f matrix

void ksl_SE3_setIdentity(ksl_SE3_t *d)

Set a double precision SE3 matrix to identity.

$$\begin{bmatrix}I & 0\\0 & 1\end{bmatrix} \rightarrow \Phi$$

Parameters
• d: [in/out] input SE3 matrix

void ksl_SE3_set(ksl_SE3_t *D, const int row, const int column, const double value)

Set a value in a double precision SE3 matrix at specified row and column index.

Bounds checking are performed in debug mode. Bounds checking can be disabled by compiling in release mode using the compiler flag -DNDEBUG.

The ksl_SE3_t data structure is designed specifically for rigid body transformations and is a subset of more general 4x4 matrices. As the fourth row of an SE(3) matrix always contains 0s and 1s, no memory is allocated for these quantities and it is not permitted to set values in these locations. If it is desired to set quantities in the last row, it is recommended to use the more general ksl_mat4x4_t data structure.

Parameters
• D: [in/out]
• row: [in] row index, $$0 \le row \lt 3$$
• column: [in] column index, $$0 \le column \lt 4$$
• value: [in] value to set

double ksl_SE3_get(const ksl_SE3_t *D, const int row, const int column)

TODO document this function.

void ksl_SE3_getTranslation(const ksl_SE3_t *D, ksl_vec3_t *t)

TODO document this function.

void ksl_SE3_invert(ksl_SE3_t *D)

TODO document this function.

void ksl_SE3_inverted(const ksl_SE3_t *Di, ksl_SE3_t *Do)

TODO document this function.

void ksl_SE3_copy(const ksl_SE3_t *Di, ksl_SE3_t *Do)

TODO document this function.

## Single precision¶

union ksl_SE3f_t
#include <matrix.h>

Single precision member of 3 Dimensional Special Euclidian group (SE3) consisting of a single precision SO3 (othonormalized 3x3 rotation matrix) and single precision translation vector pair.

This union allows accessing single precision SE3 quantities by field name, as a singly dimensioned array, as a doubly dimensioned array, or by accessing a specific column. If using the at or as_array operators, quantities are accessed in column major order.

The following examples illustrate how to access row 2, column 1 (using 0 based indexing) of SE3 matrix D. The following access methods are equivalent.

D.as_array[2 + 1 * 3];
D.at;
D.m21;
D.v1.z;
D.v1.at;
D.v.z;
D.v.at;
D.R.m21;
D.R.v1.z;
D.R.v1.at;
D.R.v.z;
D.R.v.at;


The following examples illustrate how to access row 1, column 3 (using 0 based indexing) of SE3 matrix D. The following access methods are equivalent.

D.as_array[1 + 3 * 3];
D.at;
D.m13;
D.v3.y;
D.v3.at;
D.v.y;
D.v.at;
D.t.y;
D.t.at;


See also the ksl_SE3f_get and ksl_SE3f_set functions.

Public Members

float as_array
struct ksl_SE3f_t::[anonymous] [anonymous]

anonymous union allows accessing quantities at specified index in linear array, with entities specified in column major order

float at
struct ksl_SE3f_t::[anonymous] [anonymous]

anonymous union allows accessing SE3 quantities at specified index in a doubly dimensioned array, with entities specified in column major order

ksl_mat3x3f_t R

rotation component of SE3 transformation

ksl_vec3f_t t

translation component of SE3 transformation

struct ksl_SE3f_t::[anonymous] [anonymous]

anonymous union allows accessing rotation matrix and translation vector quantities by field name

float m00
float m10
float m20
float m01
float m11
float m21
float m02
float m12
float m22
float m03
float m13
float m23
struct ksl_SE3f_t::[anonymous] [anonymous]

anonymous union allows accessing rotation matrix quantities by field name

ksl_vec3f_t v0
ksl_vec3f_t v1
ksl_vec3f_t v2
ksl_vec3f_t v3
struct ksl_SE3f_t::[anonymous] [anonymous]

anonymous union allows accessing columns of rotation matrix quantities by field name

ksl_vec3f_t v
struct ksl_SE3f_t::[anonymous] [anonymous]

anonymous union allows accessing columns of rotation matrix quantities at specified index

ksl_SE3f_t ksl_SE3f(const float m00, const float m01, const float m02, const float m03, const float m10, const float m11, const float m12, const float m13, const float m20, const float m21, const float m22, const float m23)

ksl_SE3f_t constructor.

Note that in the constructor, fields are specified in row major order. Internally, ksl_SE3f_t datastructures are stored in column major order.

ksl_SE3f_t ksl_SE3f_cmo(const float m00, const float m10, const float m20, const float m01, const float m11, const float m21, const float m02, const float m12, const float m22, const float m03, const float m13, const float m23)

alternative ksl_SE3f_t constructor.

In this alternate constructor, fields are specified in column major order to match the internal layout of ksl_SE3f_t datastructures.

ksl_SE3f_t ksl_SE3f_fromRt(const ksl_mat3x3f_t R, const ksl_vec3f_t t)

alternative ksl_SE3f_t constructor that allows creating a ksl_SE3_t datastructure from a rotation matrix and translation vector.

ksl_SE3f_t *ksl_SE3f_alloc(int n)

allocates n ksl_SE3f_t datastructures on the heap. Must be freed by the user.

void ksl_SE3f_toMat4x4f(const ksl_SE3f_t *d, ksl_mat4x4f_t *m)

convert a ksl_SE3f_t datastructure to a ksl_mat4x4f_t datastructure

Parameters
• d: [in] input SE3f datastructure
• m: [out] output mat4x4f matrix

void ksl_SE3f_setIdentity(ksl_SE3f_t *d)

Set a single precision SE3 matrix to identity.

$$\begin{bmatrix}I & 0\\0 & 1\end{bmatrix} \rightarrow \Phi$$

Parameters
• d: [in/out] input SE3 matrix

void ksl_SE3f_set(ksl_SE3f_t *D, const int row, const int column, const float value)

Set a value in a single precision SE3 matrix at specified row and column index.

Bounds checking are performed in debug mode. Bounds checking can be disabled by compiling in release mode using the compiler flag -DNDEBUG.

The ksl_SE3_t data structure is designed specifically for rigid body transformations and is a subset of more general 4x4 matrices. As the fourth row of an SE(3) matrix always contains 0s and 1s, no memory is allocated for these quantities and it is not permitted to set values in these locations. If it is desired to set quantities in the last row, it is recommended to use the more general ksl_mat4x4_t data structure.

Parameters
• D: [in/out]
• row: [in] row index, $$0 \le row \lt 3$$
• column: [in] column index, $$0 \le column \lt 4$$
• value: [in] value to set

float ksl_SE3f_get(const ksl_SE3f_t *D, const int row, const int column)

TODO document this function.

void ksl_SE3f_getTranslation(const ksl_SE3f_t *D, ksl_vec3f_t *t)

TODO document this function.

void ksl_SE3f_invert(ksl_SE3f_t *D)

TODO document this function.

void ksl_SE3f_inverted(const ksl_SE3f_t *Di, ksl_SE3f_t *Do)

TODO document this function.

void ksl_SE3f_copy(const ksl_SE3f_t *Di, ksl_SE3f_t *Do)

TODO document this function.