wedged/subspace/
constructors.rs1
2use super::*;
3
4macro_rules! impl_specific_constructors {
5 ($($ty:ident::new($($arg:ident),*);)*) => {
6 $(
7 impl<T> $ty<T> {
8 #[doc = new_docs!($ty::new($($arg),*);)]
9 pub const fn new($($arg: T),*) -> $ty<T> {
10 $ty { data: <Self as Deref>::Target::new($($arg),*) }
11 }
12 }
13 )*
14 }
15}
16
17impl_specific_constructors!{
18
19 SimpleVec1::new(x);
20 SimpleVec2::new(x,y);
21 SimpleVec3::new(x,y,z);
22 SimpleVec4::new(x,y,z,w);
23 SimpleVec5::new(x,y,z,w,a);
24 SimpleVec6::new(x,y,z,w,a,b);
25
26 SimpleBiVec3::new(x,y,z);
27 SimpleTriVec4::new(x,y,z,w);
28 SimpleQuadVec5::new(x,y,z,w,a);
29 SimplePentVec6::new(x,y,z,w,a,b);
30
31 SimpleBiVec2::new(x);
32 SimpleTriVec3::new(x);
33 SimpleQuadVec4::new(x);
34 SimplePentVec5::new(x);
35 SimpleHexVec6::new(x);
36
37}
38
39impl<T:AllocBlade<N,U0>, N:DimName> SimpleScalar<T,N> {
40
41 pub fn new(x:T) -> Self {
54 Self::from_inner_unchecked(Scalar::new(x))
55 }
56
57}
58
59impl<T:AllocBlade<N,N>, N:DimName> SimplePsuedoScalar<T,N> {
60
61 pub fn new_psuedoscalar(x:T) -> Self {
75 Self::from_inner_unchecked(PsuedoScalar::new_psuedoscalar(x))
76 }
77
78 pub fn unit_psuedoscalar() -> Self where T:One {
80 Self::from_inner_unchecked(PsuedoScalar::unit_psuedoscalar())
81 }
82
83}
84
85impl<T:AllocBlade<N,N>, N:DimName> UnitPsuedoScalar<T,N> {
86
87 pub fn unit_psuedoscalar() -> Self where T:One {
89 Self::from_inner_unchecked(PsuedoScalar::unit_psuedoscalar())
90 }
91
92}