Crates.io | liealg |
lib.rs | liealg |
version | 0.4.0 |
source | src |
created_at | 2024-03-10 18:00:05.618097 |
updated_at | 2024-11-23 10:19:48.3742 |
description | lie group and lie algebra in rust |
homepage | |
repository | https://github.com/geshengpsn/liealg |
max_upload_size | |
id | 1168837 |
size | 56,219 |
liealg is a library for computing Lie algebra and Lie group in 3D space(SO3 and SE3).
liealg is mainly used in robot kinematics and other related area. If you want to do some general Lie group and Lie algebra calculations, it is better not to use this library.
add dependency in your Cargo.toml
:
[dependencies]
liealg = "0.1.1"
or use cargo add
:
cargo add liealg
entities in liealg are related as follows:
graph TD;
A[Vec3]-->|hat|B[so3];
B-->|vee|A;
B-->|exp|C[SO3];
C-->|log|B;
C-->|adjoint|D[AdjSO3];
E[Vec6]-->|hat|F[se3];
F-->|vee|E;
F-->|exp|J[SE3];
J-->|log|F;
J-->|adjoint|K[AdjSE3];
and SO3 and SE3 can multiply matrices, take inverse and 3D point.
use liealg::prelude::*;
use liealg::{Vec3, Point};
// construct Vec3
let v = Vec3::new(0., 0., 1.) * FRAC_PI_2;
// hat convert Vec3 to so3
let so3 = v.hat();
// exp convert so3 to SO3
let rot = so3.exp();
// SO3 mat_mul
let _ = rot.mat_mul(&other);
// SO3 inverse
let rot_inv = rot.inv();
// SO3 act on 3D point
let point = Point::new(1., 2., 3.);
let _ = rot.act(&point);
use liealg::prelude::*;
use liealg::{Vec3, Point};
// construct Vec6
let v = Vec6::new([0., 0., 1], [0., -1., 0.]) * FRAC_PI_2;
// hat convert Vec6 to se3
let se3 = v.hat();
// exp convert se3 to SE3
let t = se3.exp();
// SE3 mat_mul
let _ = t.mat_mul(&other);
// SE3 inverse
let inv = rot.inv();
// SE3 act on 3D point
let point = Point::new(1., 2., 3.);
let _ = rot.act(&point);