7 releases (4 breaking)
0.5.0 | Jul 14, 2024 |
---|---|
0.4.0 | Jul 13, 2024 |
0.3.2 | Jul 10, 2024 |
0.2.0 | Jul 8, 2024 |
0.1.0 | Jul 8, 2024 |
#101 in No standard library
Used in marg-orientation
27KB
490 lines
Simple coordinate frame conversions
This crate aims at supporting simple conversions between different standard and non-standard
coordinate frames. One potential use-case is in prototyping IMU sensor data where multiple
inertial or field sensors may be mounted in different orientations. These can then be expressed
in terms of coordinate frames such as EastNorthUp
and trivially converted
to whatever basis you prefer, for example NorthEastDown
.
Example
use coordinate_frame::{NorthEastDown, NorthEastUp};
fn example() {
// Construct a coordinate in one reference frame.
let neu = NorthEastUp::new(1.0, 2.0, 3.0);
assert_eq!(neu.north(), 1.0);
assert_eq!(neu.east(), 2.0);
assert_eq!(neu.up(), 3.0);
// Note that "non-native" axes are also available.
assert_eq!(neu.down(), -3.0);
// You can transform it into a different frame.
let ned: NorthEastDown<_> = neu.into();
assert_eq!(ned.north(), 1.0);
assert_eq!(ned.east(), 2.0);
assert_eq!(ned.down(), -3.0);
// Information is available as you'd expect.
assert_eq!(ned, &[1.0, 2.0, -3.0]);
assert_eq!(ned.x(), 1.0);
assert_eq!(ned.z(), -3.0);
}
Code of Conduct
We abide by the Contributor Covenant and ask that you do as well.
License
Copyright © 2024 Markus Mayer
Triple licensed under your choice of either of:
- European Union Public Licence, Version 1.2, (LICENSE-EUPL or https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12)
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
Dependencies
~0.2–1.4MB
~31K SLoC