Search Shortcut cmd + k | ctrl + k

Provides SE(3) rigid transformations (combinations of rotations and translations in 3D) as DuckDB scalar functions.

Maintainer(s): jokasimr

Installing and Loading

INSTALL se3 FROM community;
LOAD se3;

Example

SELECT se3_apply(
    quat_from_axis_angle(
        struct_pack(x:=0.0, y:=0.0, z:=1.0), -- rotation axis (Z)
        pi()/2.0                             -- 90 degrees
    ),
    struct_pack(x:=1.0, y:=0.0, z:=0.0)      -- point
);                                           -- returns (0., 1., 0.)

About se3

This extension provides SE(3) rigid transformations, implemented as DuckDB scalar functions.

Features:

  • Sequences of rotations and translations can be combined to a 7 DOF struct that represents one combined translation then rotation. See se3_compose.
  • Transformations can be efficiently applied to points in 3D without calling trigonometric functions. See se3_apply().

For full documentation see: https://github.com/jokasimr/se3.

Added Functions

function_name function_type description comment examples
qconj scalar Returns the quaternion conjugate of q. NULL [qconj(vvec(1.0, 2.0, 3.0, 4.0))]
qmul scalar Multiplies quaternions qA and qB. NULL [qmul(quat_from_axis_angle(vvec(0.0, 0.0, 1.0), pi()/2.0), quat_from_axis_angle(vvec(0.0, 1.0, 0.0), pi()/2.0))]
qnorm2 scalar Returns the squared norm of quaternion q. NULL [qnorm2(quat_from_axis_angle(vvec(0.0, 0.0, 1.0), pi()/2.0))]
quat_from_axis_angle scalar Constructs a unit quaternion from axis and angle in radians. Returns NULL for a zero-length axis. NULL [quat_from_axis_angle(vvec(0.0, 0.0, 1.0), pi()/2.0)]
se3_apply scalar Applies transformation W to point p. W can be a full transformation struct, a vec3 representing only the translation part, or a quat representing only the rotation part. NULL [se3_apply(se3_identity(), vvec(1.0, 2.0, 3.0))]
se3_compose scalar Composes two transformations, applying W1 first and then W2. W1 and W2 can each be a full transformation struct, a vec3 representing only the translation part, or a quat representing only the rotation part. NULL [se3_compose(se3_identity(), se3_identity())]
se3_from_axis_angle scalar Constructs a transform from translation t and an axis-angle rotation. Returns NULL for a zero-length axis. NULL [se3_from_axis_angle(vvec(1.0, 0.0, 0.0), vvec(0.0, 0.0, 1.0), pi()/2.0)]
se3_identity scalar Returns the identity transform. NULL [se3_identity()]
se3_inv scalar Returns the inverse transformation of W. W can be a full transformation struct, a vec3 representing only the translation part, or a quat representing only the rotation part. NULL [se3_inv(se3_identity())]
se3_make scalar Constructs a transform from translation t and quaternion q. NULL [se3_make(vvec(1.0, 2.0, 3.0), quat_from_axis_angle(vvec(0.0, 0.0, 1.0), pi()/2.0))]
vadd scalar Returns the element-wise sum of a and b. NULL [vadd(vvec(1.0, 2.0, 3.0), vvec(4.0, 5.0, 6.0))]
vangle scalar Returns the angle in radians between a and b. NULL [vangle(vvec(1.0, 0.0, 0.0), vvec(0.0, 1.0, 0.0))]
vcos_angle scalar Returns vdot(a, b) / (vnorm(a) * vnorm(b)) without clamping. NULL [vcos_angle(vvec(1.0, 0.0, 0.0), vvec(0.0, 1.0, 0.0))]
vcross scalar Returns the 3D cross product of a and b. NULL [vcross(vvec(1.0, 0.0, 0.0), vvec(0.0, 1.0, 0.0))]
vdot scalar Returns the dot product of a and b. NULL [vdot(vvec(1.0, 2.0, 3.0), vvec(4.0, 5.0, 6.0))]
vnorm scalar Returns the Euclidean norm of v. NULL [vnorm(vvec(1.0, 2.0, 3.0))]
vnorm2 scalar Returns the squared Euclidean norm of v. NULL [vnorm2(vvec(1.0, 2.0, 3.0))]
vnormalize scalar Returns v divided by its Euclidean norm. NULL [vnormalize(vvec(1.0, 2.0, 3.0))]
vproj scalar Returns the projection of a onto b. NULL [vproj(vvec(2.0, 2.0, 0.0), vvec(1.0, 0.0, 0.0))]
vrej scalar Returns the rejection of a from b. NULL [vrej(vvec(2.0, 2.0, 0.0), vvec(1.0, 0.0, 0.0))]
vscale scalar Scales vector v by scalar s. NULL [vscale(vvec(1.0, 2.0, 3.0), 2.0)]
vsub scalar Returns the element-wise difference a - b. NULL [vsub(vvec(4.0, 5.0, 6.0), vvec(1.0, 2.0, 3.0))]
vvec scalar Creates a vec3 from x, y, and z components. NULL [vvec(1.0, 2.0, 3.0)]
vvec scalar Creates a vec4 from w, x, y, and z components. NULL [vvec(1.0, 2.0, 3.0, 4.0)]

Overloaded Functions

This extension does not add any function overloads.

Added Types

This extension does not add any types.

Added Settings

This extension does not add any settings.