kittycad_modeling_cmds/shared/point/
uniform.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use super::{Point2d, Point3d, Point4d};

macro_rules! impl_uniform {
    ($typ:ident, $($i:ident),*) => {
        impl<T> $typ<T>
        where
            T: Copy,
        {
            /// Set all components to the same value.
            pub const fn uniform(value: T) -> Self {
                Self {
                    $(
                        $i: value,
                    )*
                }
            }
        }
    };
}

impl_uniform!(Point2d, x, y);
impl_uniform!(Point3d, x, y, z);
impl_uniform!(Point4d, x, y, z, w);