points

Macro points 

Source
macro_rules! points {
    ($(($($values:expr),+)),*) => { ... };
}
Expand description

Creates a Point array, where the dimension is determined by the length of the tuples in the array, and the values all must implement ExtendedNumOps and be of the same type. Point tuples must all be the same length.

ยงExample

use simplify_polyline::*;

// 2d array
let points2d: [Point<2, f64>; 3] = points![(1.0, 1.0), (2.0, 2.0), (3.0, 3.0)];
assert_eq!(points2d.len(), 3);
assert_eq!(points2d[0].vec.len(), 2);

// 4d array
let points4d: [Point<4, f64>; 2] = points![(1.0, 2.0, 3.0, 4.0), (5.0, 6.0, 7.0, 8.0)];
assert_eq!(points4d.len(), 2);
assert_eq!(points4d[0].vec.len(), 4);