Add from array impl for points.
This commit is contained in:
parent
c2d597e744
commit
2814e09d31
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue