convex_try_new3d/
convex_try_new3d.rs

1use parry3d::math::Vector;
2use parry3d::shape::ConvexPolyhedron;
3
4fn main() {
5    let points = vec![
6        Vector::new(0.0f32, 0.0, 1.0),
7        Vector::new(0.0, 0.0, -1.0),
8        Vector::new(0.0, 1.0, 0.0),
9        Vector::new(0.0, -1.0, 0.0),
10        Vector::new(1.0, 0.0, 0.0),
11        Vector::new(-1.0, 0.0, 0.0),
12    ];
13
14    let indices = vec![
15        [0, 4, 2],
16        [0, 3, 4],
17        [5, 0, 2],
18        [5, 3, 0],
19        [1, 5, 2],
20        [1, 3, 5],
21        [4, 1, 2],
22        [4, 3, 1],
23    ];
24
25    let convex =
26        ConvexPolyhedron::from_convex_mesh(points, &indices).expect("Invalid convex shape.");
27    convex.check_geometry();
28}