diff options
| author | Crozet Sébastien <developer@crozet.re> | 2020-10-27 09:20:40 +0100 |
|---|---|---|
| committer | Crozet Sébastien <developer@crozet.re> | 2020-10-27 09:20:44 +0100 |
| commit | 8c872dc0af9ece127a87b4adb112b0e1ed6ab249 (patch) | |
| tree | 309c79a7cf538e47218c92a90784bd1a2c3c04d7 /src/geometry/shape.rs | |
| parent | dbdd797d5934ee76b0358b6cf845575ce0ef29af (diff) | |
| download | rapier-8c872dc0af9ece127a87b4adb112b0e1ed6ab249.tar.gz rapier-8c872dc0af9ece127a87b4adb112b0e1ed6ab249.tar.bz2 rapier-8c872dc0af9ece127a87b4adb112b0e1ed6ab249.zip | |
Replace the Rounded<S> type by a non-generic RoundCylinder type.
Diffstat (limited to 'src/geometry/shape.rs')
| -rw-r--r-- | src/geometry/shape.rs | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/geometry/shape.rs b/src/geometry/shape.rs index 8f40fd4..982e484 100644 --- a/src/geometry/shape.rs +++ b/src/geometry/shape.rs @@ -1,6 +1,6 @@ use crate::dynamics::MassProperties; use crate::geometry::{ - Ball, Capsule, Cuboid, HeightField, Roundable, Rounded, Segment, Triangle, Trimesh, + Ball, Capsule, Cuboid, HeightField, RoundCylinder, Segment, Triangle, Trimesh, }; use crate::math::Isometry; use downcast_rs::{impl_downcast, DowncastSync}; @@ -132,11 +132,8 @@ impl dyn Shape { } /// Converts this abstract shape to a cone, if it is one. - pub fn as_rounded<S>(&self) -> Option<&Rounded<S>> - where - S: Roundable, - Rounded<S>: Shape, - { + #[cfg(feature = "dim3")] + pub fn as_round_cylinder(&self) -> Option<&RoundCylinder> { self.downcast_ref() } } @@ -364,19 +361,21 @@ impl Shape for Cone { } #[cfg(feature = "dim3")] -impl Shape for Rounded<Cylinder> { +impl Shape for RoundCylinder { #[cfg(feature = "serde-serialize")] fn as_serialize(&self) -> Option<&dyn Serialize> { Some(self as &dyn Serialize) } fn compute_aabb(&self, position: &Isometry<f32>) -> AABB<f32> { - self.shape.compute_aabb(position).loosened(self.radius) + self.cylinder + .compute_aabb(position) + .loosened(self.border_radius) } fn mass_properties(&self, density: f32) -> MassProperties { // We ignore the margin here. - self.shape.mass_properties(density) + self.cylinder.mass_properties(density) } fn shape_type(&self) -> ShapeType { @@ -385,6 +384,9 @@ impl Shape for Rounded<Cylinder> { #[cfg(feature = "dim3")] fn as_polygonal_feature_map(&self) -> Option<(&dyn PolygonalFeatureMap, f32)> { - Some((&self.shape as &dyn PolygonalFeatureMap, self.radius)) + Some(( + &self.cylinder as &dyn PolygonalFeatureMap, + self.border_radius, + )) } } |
