7 个版本 (4 个重大更新)

0.5.0 2024 年 7 月 14 日
0.4.0 2024 年 7 月 13 日
0.3.2 2024 年 7 月 10 日
0.2.0 2024 年 7 月 8 日
0.1.0 2024 年 7 月 8 日

#101 in 无标准库


marg-orientation 中使用

EUPL-1.2 OR Apache-2.0 OR MIT

27KB
490

简单的坐标框架转换

Crates.io Docs Build Status Safety Dance MSRV EUPL 1.2 licensed Apache 2.0 licensed MIT licensed

该 crate 旨在支持不同标准和非标准坐标框架之间的简单转换。一个潜在用例是在原型设计 IMU 传感器数据时,可能需要将多个惯性或场传感器安装在不同的方向上。这些可以表示为坐标框架,例如 EastNorthUp,然后可以轻松转换为任何您喜欢的基,例如 NorthEastDown

示例

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);
}

行为准则

我们遵守 贡献者契约 并要求您也这样做。

许可证

版权所有 © 2024 Markus Mayer

根据您选择的三重许可证中的任何一个

依赖项

~0.3–1.5MB
~32K SLoC