klampt.math.se3 module

Operations for rigid transformations in Klamp’t. All rigid transformations are specified in the form T=(R,t), where R is a 9-list specifying the entries of the rotation matrix in column major form, and t is a 3-list specifying the translation vector.

Primarily, this form was chosen for interfacing with C++ code. C++ methods on objects of the form T = X.getTransform() will return se3 element proper. Conversely, X.setTransform(*T) will set the rotation and translation of some transform.

Extracting the so3 portion of the transform is simply T[0]. Extracting the translation vector is simply T[1].

Applying an se3 element to a point p is apply(T,p). Applying it to a directional quantity d is either apply_rotation(T,d) or so3.apply(T[0],d).

To flatten into a single array, use klampt.model.getConfig(T), which is equivalent to T[0] + T[1]. To read and write to disk in a way that is compatible with other Klamp’t IO routines, use klampt.io.loader.writeSe3() and klampt.io.loader.readSe3().

klampt.math.se3.apply(T, point)[source]

Applies the transform T to the given point

klampt.math.se3.apply_rotation(T, point)[source]

Applies only the rotation part of T

klampt.math.se3.distance(T1, T2, Rweight=1.0, tweight=1.0)[source]

Returns a distance metric between the two transformations. The rotation distance is weighted by Rweight and the translation distance is weighted by tweight

klampt.math.se3.error(T1, T2)[source]

Returns a 6D “difference vector” that describes how far T1 is from T2. More precisely, this is the Lie derivative (w,v).

klampt.math.se3.from_homogeneous(mat)[source]

Returns a T corresponding to the 4x4 homogeneous transform mat

klampt.math.se3.from_rotation(mat)[source]

Returns a transformation T corresponding to the 3x3 rotation matrix mat

klampt.math.se3.from_translation(t)[source]

Returns a transformation T that translates points by t

klampt.math.se3.homogeneous(T)[source]

Returns the 4x4 homogeneous transform corresponding to T

klampt.math.se3.identity()[source]

Returns the identity transformation.

klampt.math.se3.interpolate(T1, T2, u)[source]

Interpolate linearly between the two transformations T1 and T2.

klampt.math.se3.inv(T)[source]

Returns the inverse of the transformation.

klampt.math.se3.mul(T1, T2)[source]

Composes two transformations.

klampt.math.se3.rotation(T)[source]

Returns the 3x3 rotation matrix corresponding to T’s rotation

klampt.math.se3.translation(T)[source]

Returns the translation vector corresponding to T’s translation