Add from array impl for points.

This commit is contained in:
Shane Pearman 2018-03-31 12:42:22 -07:00 committed by Sébastien Crozet
parent c2d597e744
commit 2814e09d31
1 changed files with 12 additions and 0 deletions

View File

@ -125,3 +125,15 @@ componentwise_constructors_impl!(
U5, x:0, y:1, z:2, w:3, a:4; U5, x:0, y:1, z:2, w:3, a:4;
U6, x:0, y:1, z:2, w:3, a:4, b:5; U6, x:0, y:1, z:2, w:3, a:4, b:5;
); );
macro_rules! from_array_impl(
($($D: ty, $len: expr);*) => {$(
impl <N: Scalar> From <[N; $len]> for Point <N, $D> {
fn from (coords : [N; $len]) -> Self {
Point::from_coordinates(coords.into())
}
}
)*}
);
from_array_impl!(U1,1; U2,2; U3,3; U4,4; U5,5; U6,6);