cartesian_tree/
lib.rs

1//! Cartesian Tree Library
2//!
3//! This crate provides a tree-based coordinate system where each frame has a position
4//! and orientation relative to its parent. You can create hierarchical transformations
5//! and convert poses between frames.
6
7pub mod errors;
8pub mod frame;
9pub mod lazy_access;
10pub mod pose;
11pub mod rotation;
12
13pub mod tree;
14pub use errors::CartesianTreeError;
15pub use frame::Frame;
16pub use pose::Pose;
17
18// The bindings module and the PyO3 initialization are only compiled when the
19// "bindings" feature is enabled.
20#[cfg(feature = "bindings")]
21pub mod bindings;
22#[cfg(feature = "bindings")]
23use pyo3::prelude::*;
24
25#[cfg(feature = "bindings")]
26#[pymodule]
27#[pyo3(name = "_cartesian_tree")]
28fn cartesian_tree(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
29    m.add_class::<bindings::frame::PyFrame>()?;
30    m.add_class::<bindings::pose::PyPose>()?;
31    m.add_class::<bindings::utils::PyVector3>()?;
32    m.add_class::<bindings::utils::PyRotation>()?;
33    m.add_class::<bindings::utils::PyIsometry>()?;
34    m.add_class::<bindings::lazy_access::PyLazyTranslation>()?;
35    m.add_class::<bindings::lazy_access::PyLazyRotation>()?;
36    m.add_function(wrap_pyfunction!(bindings::lazy_access::x, m)?)?;
37    m.add_function(wrap_pyfunction!(bindings::lazy_access::y, m)?)?;
38    m.add_function(wrap_pyfunction!(bindings::lazy_access::z, m)?)?;
39    m.add_function(wrap_pyfunction!(bindings::lazy_access::rx, m)?)?;
40    m.add_function(wrap_pyfunction!(bindings::lazy_access::ry, m)?)?;
41    m.add_function(wrap_pyfunction!(bindings::lazy_access::rz, m)?)?;
42    Ok(())
43}