Crate coordinate_frame

Source
Expand description

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

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

// Base vectors are also provided.
let axis = NorthEastDown::<f64>::z_axis();
assert_eq!(axis, [0.0, 0.0, 1.0]);

Structs§

DownEastNorth
A down, east and north frame (left-handed)
DownEastSouth
A down, east and south frame (right-handed)
DownNorthEast
A down, north and east frame (right-handed)
DownNorthWest
A down, north and west frame (left-handed)
DownSouthEast
A down, south and east frame (left-handed)
DownSouthWest
A down, south and west frame (right-handed)
DownWestNorth
A down, west and north frame (right-handed)
DownWestSouth
A down, west and south frame (left-handed)
EastDownNorth
A east, down and north frame (right-handed)
EastDownSouth
A east, down and south frame (left-handed)
EastNorthDown
A east, north and down frame (left-handed)
EastNorthUp
A east, north and up frame (right-handed, geography)
EastSouthDown
A east, south and down frame (right-handed)
EastSouthUp
A east, south and up frame (left-handed)
EastUpNorth
A east, up and north frame (left-handed)
EastUpSouth
A east, up and south frame (right-handed)
NorthDownEast
A north, down and east frame (left-handed)
NorthDownWest
A north, down and west frame (right-handed)
NorthEastDown
A north, east and down frame (right-handed, aeronautics)
NorthEastUp
A north, east and up frame (left-handed)
NorthUpEast
A north, up and east frame (right-handed)
NorthUpWest
A north, up and west frame (left-handed)
NorthWestDown
A north, west and down frame (left-handed)
NorthWestUp
A north, west and up frame (right-handed)
SouthDownEast
A south, down and east frame (right-handed)
SouthDownWest
A south, down and west frame (left-handed)
SouthEastDown
A south, east and down frame (left-handed)
SouthEastUp
A south, east and up frame (right-handed)
SouthUpEast
A south, up and east frame (left-handed)
SouthUpWest
A south, up and west frame (right-handed)
SouthWestDown
A south, west and down frame (right-handed)
SouthWestUp
A south, west and up frame (left-handed)
UpEastNorth
A up, east and north frame (right-handed)
UpEastSouth
A up, east and south frame (left-handed)
UpNorthEast
A up, north and east frame (left-handed)
UpNorthWest
A up, north and west frame (right-handed)
UpSouthEast
A up, south and east frame (right-handed)
UpSouthWest
A up, south and west frame (left-handed)
UpWestNorth
A up, west and north frame (left-handed)
UpWestSouth
A up, west and south frame (right-handed)
WestDownNorth
A west, down and north frame (left-handed)
WestDownSouth
A west, down and south frame (right-handed)
WestNorthDown
A west, north and down frame (right-handed)
WestNorthUp
A west, north and up frame (left-handed)
WestSouthDown
A west, south and down frame (left-handed)
WestSouthUp
A west, south and up frame (right-handed)
WestUpNorth
A west, up and north frame (right-handed)
WestUpSouth
A west, up and south frame (left-handed)

Enums§

CoordinateFrameType
A coordinate frame type.
ParseCoordinateFrameError

Traits§

CoordinateFrame
A coordinate frame.
LeftHanded
Marks a left-handed coordinate system.
RightHanded
Marks a right-handed coordinate system.
SaturatingNeg
Performs a saturating negation.
ZeroOne
Provides the values zero and one.