ncollide3d/transformation/to_trimesh/
cone_to_trimesh.rs

1use super::ToTriMesh;
2use crate::procedural;
3use crate::procedural::TriMesh;
4use crate::shape::Cone;
5use na;
6use simba::scalar::RealField;
7
8impl<N: RealField + Copy> ToTriMesh<N> for Cone<N> {
9    type DiscretizationParameter = u32;
10
11    fn to_trimesh(&self, nsubdiv: u32) -> TriMesh<N> {
12        // FIXME, inconsistancy we should be able to work directly with the radius.
13        // FIXME, inconsistancy we should be able to work directly with the half height.
14        let diameter = self.radius * na::convert(2.0f64);
15        let height = self.half_height * na::convert(2.0f64);
16
17        procedural::cone(diameter, height, nsubdiv)
18    }
19}