Crate liealg

source ·
Expand description

§Lie group and Lie algebra in rust

liealg is a library for computing Lie algebra and Lie group in 3D space(SO3 and SE3). It 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.

§Traits

liealg provides a set of mathematical entity traits for Lie group and Lie algebra. these are Adjoint, Algebra, Group, Vector. liealg provides a standard implementation of these traits, but users can also implement their own types.

liealg also provides a trait Real for using more types of real numbers, except f32, f64, it can support most real number types, such as rational and decimal, users can also define their own real number types.

§Implementations

liealg provides two implementations of Lie group and Lie algebra, SO3 and SE3, which correspond to rotation and rigid body motion in 3D space.

groupalgebravector
SO3so3Vec3
SE3se3Vec6

§Usage

add liealg to your dependencies

[dependencies]
liealg = "0.1"

import prelude module

use liealg::prelude::*;

Rotation

Vec3 ---> so3 ---> SO3 -------> AdjSO3
     hat      exp      adjoint

Vec3 <--- so3 <--- SO3
      vee      log

Rigid body motion

Vec6 ---> se3 ---> SE3 -------> AdjSE3
     hat      exp      adjoint

Vec6 <--- se3 <--- SE3
      vee      log

§Example

§Rotation

use std::f32::consts::FRAC_PI_2;
use liealg::prelude::*;
use liealg::Vec3;
let vec = Vec3::new(0., 0., FRAC_PI_2);
println!("vec: {}", vec);
let so3 = vec.hat();
println!("so3: {}", so3);
let rot = so3.exp();
println!("rot: {:.2}", rot);
let so3_ = rot.log();
let vec_ = so3_.vee();
println!("vec_: {}", vec_);

§Rigid body motion

use std::f32::consts::FRAC_PI_2;
use liealg::prelude::*;
use liealg::Vec6;
let vec = Vec6::new([0., 0., 1.], [0., -1., 0.]) * FRAC_PI_2;
println!("vec: {}", vec);
let se3 = vec.hat();
println!("se3: {}", se3);
let rigid = se3.exp();
println!("rigid: {:.2}", rigid);
let se3_ = rigid.log();
let vec_ = se3_.vee();
println!("vec_: {}", vec_);

Re-exports§

Modules§

  • prelude module
  • Rigid body transformations in 3D space
  • Rotation in 3D space

Structs§

Traits§