Skip to main content

rscad_core/objects/three_dimensional/
cylinder.rs

1use crate::prelude_::*;
2
3#[derive(Clone, Copy, Debug, Default)]
4#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
5#[cfg_attr(feature = "reflect", derive(bevy_reflect::Reflect))]
6pub struct Cylinder {
7    pub height: f64,
8    pub radius: f64,
9    pub fn_: usize,
10}
11
12impl Cylinder {
13    pub fn new<H: Number, R: Number>(height: H, radius: R, fn_: impl Into<Option<usize>>) -> Self {
14        Self {
15            height: height.to_f64(),
16            radius: radius.to_f64(),
17            fn_: fn_.into().unwrap_or(32),
18        }
19    }
20}
21
22impl Object for Cylinder {}