1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use crate::{
    element::{Element, InnerElement},
    Num,
};

pub fn cube(x: impl Num, y: impl Num, z: impl Num) -> Element {
    Element(InnerElement::Cube {
        x: x.f32(),
        y: y.f32(),
        z: z.f32(),
        centered: false,
    })
}

pub fn cylinder(h: i32, r: i32) -> Element {
    Element(InnerElement::Cylinder {
        h: h.f32(),
        r: r.f32(),
        centered: false,
    })
}

impl Element {
    pub fn rotate_extrude(self, angle: i32) -> Self {
        Element(InnerElement::RotateExtrude {
            angle: angle.f32(),
            child: Box::new(self.0),
        })
    }
}