Provides SE(3) rigid transformations, quaternion operations, and 3D/4D vector arithmetic as DuckDB scalar functions.
Maintainer(s):
jokasimr
Compatibility Matrix
This table covers all DuckDB releases that have not reached end-of-life, including LTS releases, and shows the 2 most recent patch releases of each. Older patch releases are not listed, but the extension may be available for them as well.
| Platform | 1.4.4 | 1.4.5 | 1.5.5 | 1.5.6 | 2.0.0 |
|---|---|---|---|---|---|
| Linux AMD64 | |||||
| Linux ARM64 | |||||
| macOS AMD64 | |||||
| macOS ARM64 | |||||
| Windows AMD64 | |||||
| Windows ARM64 | |||||
| WebAssembly |
Installing and Loading
INSTALL se3 FROM community;
LOAD se3;
Example
SELECT se3_apply(
se3_from_axis_angle(
struct_pack(x:=1.0, y:=0.0, z:=0.0), -- translation
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
); -- {x: 0.0, y: 2.0, z: 0.0}
About se3
This extension provides SE(3) rigid transformations, quaternion operations, and 3D/4D vector arithmetic, implemented as DuckDB scalar functions.
Features:
- Sequences of rotations and translations can be combined into a single rigid transformation with 6 degrees of freedom, stored as a 7-scalar struct: 3 translation components and a 4-component unit quaternion.
- Transformations translate then rotate.
se3_compose(W2, W1)appliesW1first, thenW2. - Transformations can be efficiently applied to points in 3D without calling trigonometric functions. See
se3_apply(). - Quaternion construction from axis-angle, multiplication, conjugation, and squared norms.
- 3D/4D vector arithmetic, norms, normalization, dot products, angles and their trigonometric ratios, projection, and rejection; 3D cross products.
For types, functions, and composition semantics, see the API reference.
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))] |
| vcot_angle | scalar | Returns the cotangent of the angle between a and b. | NULL | [vcot_angle(vvec(1.0, 0.0, 0.0), vvec(1.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)] |
| vsin_angle | scalar | Returns the sine of the angle between a and b. | NULL | [vsin_angle(vvec(1.0, 0.0, 0.0), vvec(0.0, 1.0, 0.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))] |
| vtan_angle | scalar | Returns the tangent of the angle between a and b. | NULL | [vtan_angle(vvec(1.0, 0.0, 0.0), vvec(1.0, 1.0, 0.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
| name | description | input_type | scope | aliases | typed_value |
|---|---|---|---|---|---|
| temp_directory | Set the directory to which temporary files are written. | VARCHAR | GLOBAL | [] | post.db.tmp |
© 2026 DuckDB Foundation, Amsterdam NL