Fix compilation when targetting no-std.

This commit is contained in:
Crozet Sébastien 2021-02-25 15:01:53 +01:00
parent bf0f3163ce
commit a32f41bd41
2 changed files with 18 additions and 6 deletions

View File

@ -1,6 +1,6 @@
use crate::{ use crate::{
Isometry3, Matrix4, Normed, Point3, Quaternion, Scalar, SimdRealField, Translation3, Unit, Isometry3, Matrix4, Normed, Point3, Quaternion, Scalar, SimdRealField, Translation3, Unit,
UnitQuaternion, Vector3, VectorN, U8, UnitQuaternion, Vector3, VectorN, Zero, U8,
}; };
use approx::{AbsDiffEq, RelativeEq, UlpsEq}; use approx::{AbsDiffEq, RelativeEq, UlpsEq};
#[cfg(feature = "serde-serialize")] #[cfg(feature = "serde-serialize")]
@ -35,14 +35,23 @@ use simba::scalar::{ClosedNeg, RealField};
/// If a feature that you need is missing, feel free to open an issue or a PR. /// If a feature that you need is missing, feel free to open an issue or a PR.
/// See https://github.com/dimforge/nalgebra/issues/487 /// See https://github.com/dimforge/nalgebra/issues/487
#[repr(C)] #[repr(C)]
#[derive(Debug, Default, Eq, PartialEq, Copy, Clone)] #[derive(Debug, Eq, PartialEq, Copy, Clone)]
pub struct DualQuaternion<N: SimdRealField> { pub struct DualQuaternion<N: Scalar> {
/// The real component of the quaternion /// The real component of the quaternion
pub real: Quaternion<N>, pub real: Quaternion<N>,
/// The dual component of the quaternion /// The dual component of the quaternion
pub dual: Quaternion<N>, pub dual: Quaternion<N>,
} }
impl<N: Scalar + Zero> Default for DualQuaternion<N> {
fn default() -> Self {
Self {
real: Quaternion::default(),
dual: Quaternion::default(),
}
}
}
impl<N: SimdRealField> DualQuaternion<N> impl<N: SimdRealField> DualQuaternion<N>
where where
N::Element: SimdRealField, N::Element: SimdRealField,

View File

@ -1,12 +1,12 @@
use crate::{ use crate::{
DualQuaternion, Isometry3, Quaternion, SimdRealField, Translation3, UnitDualQuaternion, DualQuaternion, Isometry3, Quaternion, Scalar, SimdRealField, Translation3, UnitDualQuaternion,
UnitQuaternion, UnitQuaternion,
}; };
use num::{One, Zero}; use num::{One, Zero};
#[cfg(feature = "arbitrary")] #[cfg(feature = "arbitrary")]
use quickcheck::{Arbitrary, Gen}; use quickcheck::{Arbitrary, Gen};
impl<N: SimdRealField> DualQuaternion<N> { impl<N: Scalar> DualQuaternion<N> {
/// Creates a dual quaternion from its rotation and translation components. /// Creates a dual quaternion from its rotation and translation components.
/// ///
/// # Example /// # Example
@ -40,7 +40,10 @@ impl<N: SimdRealField> DualQuaternion<N> {
/// assert_eq!(dq2 * dq1, dq2); /// assert_eq!(dq2 * dq1, dq2);
/// ``` /// ```
#[inline] #[inline]
pub fn identity() -> Self { pub fn identity() -> Self
where
N: SimdRealField,
{
Self::from_real_and_dual( Self::from_real_and_dual(
Quaternion::from_real(N::one()), Quaternion::from_real(N::one()),
Quaternion::from_real(N::zero()), Quaternion::from_real(N::zero()),