kcl_api/point/uniform.rs
1use super::Point2d;
2use super::Point3d;
3use super::Point4d;
4
5macro_rules! impl_uniform {
6 ($typ:ident, $($i:ident),*) => {
7 impl<T> $typ<T>
8 where
9 T: Copy,
10 {
11 /// Set all components to the same value.
12 pub const fn uniform(value: T) -> Self {
13 Self {
14 $(
15 $i: value,
16 )*
17 }
18 }
19 }
20 };
21}
22
23impl_uniform!(Point2d, x, y);
24impl_uniform!(Point3d, x, y, z);
25impl_uniform!(Point4d, x, y, z, w);