Use newtypes for collider, rigid-body and joint handles.

This commit is contained in:
Crozet Sébastien
2021-01-20 16:33:42 +01:00
parent 28b7866aee
commit 0ade350b5f
11 changed files with 224 additions and 175 deletions

View File

@@ -1,6 +1,5 @@
//! Miscellaneous utilities.
use crate::dynamics::RigidBodyHandle;
use na::{Matrix3, Point2, Point3, Scalar, SimdRealField, Vector2, Vector3};
use num::Zero;
use simba::simd::SimdValue;
@@ -658,11 +657,8 @@ impl Drop for FlushToZeroDenormalsAreZeroFlags {
}
}
pub(crate) fn other_handle(
pair: (RigidBodyHandle, RigidBodyHandle),
handle: RigidBodyHandle,
) -> RigidBodyHandle {
if pair.0 == handle {
pub(crate) fn select_other<T: PartialEq>(pair: (T, T), elt: T) -> T {
if pair.0 == elt {
pair.1
} else {
pair.0