macro_rules! point {
(($x:expr, $y:expr)) => { ... };
(($x:expr, $y:expr, $z:expr)) => { ... };
}Expand description
Construct a crate::Point2D or crate::Point3D
from a tuple literal.
The (x, y) form expands to Point2D::new(x, y); the (x, y, z)
form expands to Point3D::new(x, y, z). The coordinate type and
coordinate system are inferred from context, so a binding annotated
Point2D<f64, Cartesian> will pick up f64 for the expressions.
§Examples
use geometry_cs::Cartesian;
use geometry_model::{point, Point2D, Point3D};
use geometry_trait::Point as _;
let p: Point2D<f64, Cartesian> = point!((1.0, 2.0));
assert_eq!(p.get::<0>(), 1.0);
let q: Point3D<f64, Cartesian> = point!((1.0, 2.0, 3.0));
assert_eq!(q.get::<2>(), 3.0);