From 6165ac8dbf06dd20a9076e6f8ff7b6e0c033b358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Sun, 8 Aug 2021 13:05:13 +0200 Subject: [PATCH] Fix nalgebra-glm tests. --- nalgebra-glm/src/common.rs | 2 +- nalgebra-glm/src/gtx/transform2.rs | 5 +++-- nalgebra-glm/src/traits.rs | 6 ++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/nalgebra-glm/src/common.rs b/nalgebra-glm/src/common.rs index 6a7aa8bf..6ab20371 100644 --- a/nalgebra-glm/src/common.rs +++ b/nalgebra-glm/src/common.rs @@ -507,7 +507,7 @@ pub fn sign(x: &TVec) -> TVec { /// /// This is useful in cases where you would want a threshold function with a smooth transition. /// This is equivalent to: `let result = clamp((x - edge0) / (edge1 - edge0), 0, 1); return t * t * (3 - 2 * t);` Results are undefined if `edge0 >= edge1`. -pub fn smoothstep(edge0: T, edge1: T, x: T) -> T { +pub fn smoothstep(edge0: T, edge1: T, x: T) -> T { let _3 = T::from_subset(&3.0f64); let _2 = T::from_subset(&2.0f64); let t = na::clamp((x - edge0) / (edge1 - edge0), T::zero(), T::one()); diff --git a/nalgebra-glm/src/gtx/transform2.rs b/nalgebra-glm/src/gtx/transform2.rs index 36d6fc73..f389e4b1 100644 --- a/nalgebra-glm/src/gtx/transform2.rs +++ b/nalgebra-glm/src/gtx/transform2.rs @@ -1,5 +1,6 @@ use crate::aliases::{TMat3, TMat4, TVec2, TVec3}; use crate::traits::Number; +use crate::RealNumber; /// Build planar projection matrix along normal axis and right-multiply it to `m`. pub fn proj2d(m: &TMat3, normal: &TVec2) -> TMat3 { @@ -26,7 +27,7 @@ pub fn proj(m: &TMat4, normal: &TVec3) -> TMat4 { } /// Builds a reflection matrix and right-multiply it to `m`. -pub fn reflect2d(m: &TMat3, normal: &TVec2) -> TMat3 { +pub fn reflect2d(m: &TMat3, normal: &TVec2) -> TMat3 { let mut res = TMat3::identity(); { @@ -38,7 +39,7 @@ pub fn reflect2d(m: &TMat3, normal: &TVec2) -> TMat3 { } /// Builds a reflection matrix, and right-multiply it to `m`. -pub fn reflect(m: &TMat4, normal: &TVec3) -> TMat4 { +pub fn reflect(m: &TMat4, normal: &TVec3) -> TMat4 { let mut res = TMat4::identity(); { diff --git a/nalgebra-glm/src/traits.rs b/nalgebra-glm/src/traits.rs index 3d33fd1e..a09a95f2 100644 --- a/nalgebra-glm/src/traits.rs +++ b/nalgebra-glm/src/traits.rs @@ -2,7 +2,7 @@ use approx::AbsDiffEq; use num::{Bounded, Signed}; use na::Scalar; -use simba::scalar::{ClosedAdd, ClosedMul, ClosedSub, RealField, SupersetOf}; +use simba::scalar::{ClosedAdd, ClosedMul, ClosedSub, RealField}; use std::cmp::PartialOrd; /// A number that can either be an integer or a float. @@ -16,7 +16,6 @@ pub trait Number: + AbsDiffEq + Signed + Bounded - + SupersetOf { } @@ -29,8 +28,7 @@ impl< + ClosedMul + AbsDiffEq + Signed - + Bounded - + SupersetOf, + + Bounded, > Number for T { }