Skip to main content

vvcm_rs/
lib.rs

1#![deny(unsafe_code)]
2#![warn(missing_docs)]
3
4//! Forward kinematics and simulation utilities for the Virtual Variable Cables
5//! Model (VVCM).
6//!
7//! The crate exposes `nalgebra` point and vector types directly. Length values
8//! are unitless to the type system and must be consistent across each solve.
9//! The FK engine normalizes coordinates internally for numerical stability and
10//! maps results back to the caller's coordinate frames.
11//!
12//! # Basic usage
13//!
14//! ```rust
15//! use vvcm_rs::{point2, Point2, VvcmFk};
16//!
17//! let formation: Vec<Point2> = vec![
18//!     point2((213.7, 122.7)),
19//!     point2((804.6, 37.2)),
20//!     point2((904.0, 550.0)),
21//!     point2((439.3, 715.9)),
22//! ];
23//!
24//! let sheet: Vec<Point2> = vec![
25//!     point2((-316.1, -421.9)),
26//!     point2((803.4, -384.1)),
27//!     point2((746.1, 712.8)),
28//!     point2((-367.3, 664.2)),
29//! ];
30//!
31//! let mut fk = VvcmFk::new(1000.0, sheet)?;
32//! let solutions = fk.update_stable_solutions(&formation)?;
33//!
34//! assert!(solutions.stable_count() > 0);
35//! # Ok::<(), vvcm_rs::VvcmError>(())
36//! ```
37
38pub mod error;
39#[doc(hidden)]
40#[cfg(not(all(feature = "wasm", target_arch = "wasm32")))]
41#[allow(unsafe_code)]
42pub mod ffi;
43pub mod fk;
44pub mod manual_simulation;
45pub mod simulation;
46pub mod types;
47
48mod math;
49#[cfg(feature = "python-extension")]
50mod python;
51#[cfg(all(feature = "wasm", target_arch = "wasm32"))]
52pub mod wasm;
53
54pub use error::VvcmError;
55pub use fk::VvcmFk;
56pub use manual_simulation::VvcmManualSimulation;
57pub use simulation::VvcmSimulation;
58pub use types::{
59    FkSolution, FkSolutions, IntoPoint2, IntoPoint3, Point2, Point3, Scalar, Vector2, Vector3,
60    distance2, distance3, point2, point2_zero, point3, point3_zero, relative_xy_to,
61    translated_xy_by,
62};