1use crate::shape::Shape;
2
3#[derive(PartialEq, Debug, Copy, Clone)]
7pub struct Cone {
8 pub radius: f32,
10 pub half_length: f32,
12}
13impl Cone {
14 pub fn new(radius: f32, half_length: f32) -> Self {
21 Cone {
22 radius,
23 half_length,
24 }
25 }
26}
27
28impl Shape for Cone {
29 fn is_convex(&self) -> bool {
30 true
31 }
32
33 fn clone_box(&self) -> Box<dyn Shape + Send + Sync> {
34 Box::new(*self)
35 }
36
37 fn get_shape_type(&self) -> crate::shape::ShapeType {
38 crate::shape::ShapeType::Cone
39 }
40
41 fn get_radius(&self) -> Option<f32> {
42 Some(self.radius)
43 }
44
45 fn get_half_length(&self) -> Option<f32> {
46 Some(self.half_length)
47 }
48}