kittycad_modeling_cmds/shared/point/
uniform.rs

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