macro_rules! coordinate {
($x:tt = $xx:expr, $y:tt = $yy:expr, $z:tt = $zz:expr $(,)?) => { ... };
(n = $n:expr, e = $e:expr, d = $d:expr; in $in:ty) => { ... };
(e = $e:expr, n = $n:expr, u = $u:expr; in $in:ty) => { ... };
(f = $f:expr, r = $r:expr, d = $d:expr; in $in:ty) => { ... };
(x = $x:expr, y = $y:expr, z = $z:expr; in $in:ty) => { ... };
}Expand description
Quickly construct a Coordinate using named components.
This macro allows constructing Coordinates for a coordinate system by naming the arguments
according to its CoordinateSystem::Convention. Using the wrong named arguments (eg, trying
to make a NedLike Coordinate using f = ) will produce an error at compile-time.
For NedLike, use:
coordinate! {
n = Length::new::<meter>(1.),
e = Length::new::<meter>(2.),
d = Length::new::<meter>(3.),
}For FrdLike, use:
coordinate! {
f = Length::new::<meter>(1.),
r = Length::new::<meter>(2.),
d = Length::new::<meter>(3.),
}For RightHandedXyzLike, use:
coordinate! {
x = Length::new::<meter>(1.),
y = Length::new::<meter>(2.),
z = Length::new::<meter>(3.),
}The macro also allows explicitly specifying the coordinate system In for the returned
Coordinate (which is otherwise inferred) by suffixing the component list with ; in System, like so:
system!(struct Frd using FRD);
coordinate! {
f = Length::new::<meter>(1.),
r = Length::new::<meter>(2.),
d = Length::new::<meter>(3.);
in Frd
}