use PartialOrd with SimdRealField implementation of `rem` function
instead of num::Euclid
This commit is contained in:
parent
a1f34d5926
commit
1dcb9d649b
|
@ -2111,7 +2111,7 @@ impl<T: Scalar + ClosedAdd + ClosedSub + ClosedMul, R: Dim, C: Dim, S: RawStorag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: crate::SimdRealField + num::Euclid + ClosedMul, R: Dim, C: Dim, S: RawStorage<T, R, C>>
|
impl<T: crate::SimdRealField + PartialOrd + ClosedMul, R: Dim, C: Dim, S: RawStorage<T, R, C>>
|
||||||
Matrix<T, R, C, S>
|
Matrix<T, R, C, S>
|
||||||
{
|
{
|
||||||
/// Calculate the right-handed angle between two vectors in radians.
|
/// Calculate the right-handed angle between two vectors in radians.
|
||||||
|
@ -2154,11 +2154,16 @@ impl<T: crate::SimdRealField + num::Euclid + ClosedMul, R: Dim, C: Dim, S: RawSt
|
||||||
shape
|
shape
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let two_pi =
|
||||||
|
(T::SimdRealField::one() + T::SimdRealField::one()) * T::SimdRealField::simd_pi();
|
||||||
let perp = -self.perp(other);
|
let perp = -self.perp(other);
|
||||||
let dot = self.dot(other);
|
let dot = self.dot(other);
|
||||||
T::SimdRealField::simd_atan2(perp, dot).rem_euclid(
|
let res: T::SimdRealField = T::SimdRealField::simd_atan2(perp, dot) % two_pi.clone();
|
||||||
&((T::SimdRealField::one() + T::SimdRealField::one()) * T::SimdRealField::simd_pi()),
|
if res < T::SimdRealField::zero() {
|
||||||
)
|
res + two_pi
|
||||||
|
} else {
|
||||||
|
res
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue