ncollide3d/shape/deformable_shape.rs
1use crate::query::LocalShapeApproximation;
2use na::RealField;
3
4/// The type of elements used to describe a deformation on a collision object.
5#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
6pub enum DeformationsType {
7 /// Deformations described as scalars.
8 Scalars,
9 /// Deformations described as vectors.
10 Vectors,
11 /// Deformations described as isometries.
12 Isometries,
13}
14
15/// Trait implemented by deformable shapes.
16pub trait DeformableShape<N: RealField + Copy> {
17 /// The type of degrees of freedom this shape has.
18 fn deformations_type(&self) -> DeformationsType;
19
20 // /// Applies a deformation to all the degrees of freedom of this shape.
21 // fn deform_all(&mut self, coords: &[N], indices: &[usize]);
22
23 /// Updates some the degrees of freedom of this shape.
24 // fn set_partial_deformations(&mut self, coords: &[N], indices: &[DeformationIndex]);
25
26 /// Updates all the degrees of freedom of this shape.
27 fn set_deformations(&mut self, coords: &[N]);
28
29 /// Updates the given local approximation of this shape.
30 fn update_local_approximation(&self, coords: &[N], approx: &mut LocalShapeApproximation<N>);
31}