1use nalgebra::Vector3;
2
3use crate::shape::Shape;
4
5#[derive(PartialEq, Debug, Clone, Copy)]
9pub struct Cuboid {
10 pub half_extents: Vector3<f32>,
12}
13
14impl Cuboid {
15 pub fn new(half_extents: Vector3<f32>) -> Self {
21 Cuboid { half_extents }
22 }
23}
24
25impl Shape for Cuboid {
26 fn is_convex(&self) -> bool {
27 true
28 }
29
30 fn clone_box(&self) -> Box<dyn Shape + Send + Sync> {
31 Box::new(*self)
32 }
33
34 fn get_shape_type(&self) -> crate::shape::ShapeType {
35 crate::shape::ShapeType::Cuboid
36 }
37
38 fn get_half_extents(&self) -> Option<Vector3<f32>> {
39 Some(self.half_extents)
40 }
41}