diff options
| author | Crozet Sébastien <developer@crozet.re> | 2020-10-26 16:36:07 +0100 |
|---|---|---|
| committer | Crozet Sébastien <developer@crozet.re> | 2020-10-26 16:36:07 +0100 |
| commit | 08930b1238c90bec16db84c50ac4ea7c9a1e0a5b (patch) | |
| tree | dd3baf539e8eabd46dcfcee956d86c0e52a2c10b /src/utils.rs | |
| parent | ba6655be8e4b781bfaac06282e1c7d53a56111f5 (diff) | |
| download | rapier-08930b1238c90bec16db84c50ac4ea7c9a1e0a5b.tar.gz rapier-08930b1238c90bec16db84c50ac4ea7c9a1e0a5b.tar.bz2 rapier-08930b1238c90bec16db84c50ac4ea7c9a1e0a5b.zip | |
Fix multiple warnings.
Diffstat (limited to 'src/utils.rs')
| -rw-r--r-- | src/utils.rs | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/src/utils.rs b/src/utils.rs index 0bc9e17..a398a02 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,7 +1,6 @@ //! Miscellaneous utilities. use crate::dynamics::RigidBodyHandle; -use crate::math::{Isometry, Point, Rotation, Vector}; #[cfg(all(feature = "enhanced-determinism", feature = "serde-serialize"))] use indexmap::IndexMap as HashMap; use na::{Matrix2, Matrix3, Matrix3x2, Point2, Point3, Scalar, SimdRealField, Vector2, Vector3}; @@ -1334,28 +1333,3 @@ pub(crate) fn other_handle( pair.0 } } - -/// Returns the rotation that aligns the y axis to the segment direction. -pub(crate) fn rotation_wrt_y(a: &Point<f32>, b: &Point<f32>) -> Rotation<f32> { - let mut dir = b - a; - - if dir.y < 0.0 { - dir = -dir; - } - - #[cfg(feature = "dim2")] - return Rotation::rotation_between(&Vector::y(), &dir); - - #[cfg(feature = "dim3")] - return Rotation::rotation_between(&Vector::y(), &dir).unwrap_or(Rotation::identity()); -} - -// Return the transform that aligns the y axis to the segment and move the origin to the segment middle, -// and the capsule's half-height. -pub(crate) fn segment_to_capsule(a: &Point<f32>, b: &Point<f32>) -> (Isometry<f32>, f32) { - let rot = rotation_wrt_y(a, b); - let half_height = (b - a).norm() / 2.0; - let center = na::center(a, b); - let pos = Isometry::from_parts(center.coords.into(), rot); - (pos, half_height) -} |
