From 1b77875cc3825939ae14ee34f4d03307d9f05eb9 Mon Sep 17 00:00:00 2001 From: Andrew Dudney Date: Tue, 26 Jul 2016 17:53:16 -0700 Subject: [PATCH] Fixed tests, now most use deg, and none use deg(x).into() --- tests/matrix.rs | 28 ++++++++++++++-------------- tests/quaternion.rs | 28 ++++++++++++++-------------- tests/rotation.rs | 4 ++-- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/tests/matrix.rs b/tests/matrix.rs index 3af48f0..9d7674f 100644 --- a/tests/matrix.rs +++ b/tests/matrix.rs @@ -406,10 +406,10 @@ pub mod matrix3 { fn test_x() { let vec = vec3(0.0, 0.0, 1.0); - let rot = Matrix3::from(Euler::new(deg(90.0).into(), rad(0.0), rad(0.0))); + let rot = Matrix3::from(Euler::new(deg(90.0), deg(0.0), deg(0.0))); assert_approx_eq!(vec3(0.0, -1.0, 0.0), rot * vec); - let rot = Matrix3::from(Euler::new(deg(-90.0).into(), rad(0.0), rad(0.0))); + let rot = Matrix3::from(Euler::new(deg(-90.0), deg(0.0), deg(0.0))); assert_approx_eq!(vec3(0.0, 1.0, 0.0), rot * vec); } @@ -417,10 +417,10 @@ pub mod matrix3 { fn test_y() { let vec = vec3(0.0, 0.0, 1.0); - let rot = Matrix3::from(Euler::new(rad(0.0), deg(90.0).into(), rad(0.0))); + let rot = Matrix3::from(Euler::new(deg(0.0), deg(90.0), deg(0.0))); assert_approx_eq!(vec3(1.0, 0.0, 0.0), rot * vec); - let rot = Matrix3::from(Euler::new(rad(0.0), deg(-90.0).into(), rad(0.0))); + let rot = Matrix3::from(Euler::new(deg(0.0), deg(-90.0), deg(0.0))); assert_approx_eq!(vec3(-1.0, 0.0, 0.0), rot * vec); } @@ -428,10 +428,10 @@ pub mod matrix3 { fn test_z() { let vec = vec3(1.0, 0.0, 0.0); - let rot = Matrix3::from(Euler::new(rad(0.0), rad(0.0), deg(90.0).into())); + let rot = Matrix3::from(Euler::new(deg(0.0), deg(0.0), deg(90.0))); assert_approx_eq!(vec3(0.0, 1.0, 0.0), rot * vec); - let rot = Matrix3::from(Euler::new(rad(0.0), rad(0.0), deg(-90.0).into())); + let rot = Matrix3::from(Euler::new(deg(0.0), deg(0.0), deg(-90.0))); assert_approx_eq!(vec3(0.0, -1.0, 0.0), rot * vec); } @@ -441,7 +441,7 @@ pub mod matrix3 { fn test_x_then_y() { let vec = vec3(0.0, 1.0, 0.0); - let rot = Matrix3::from(Euler::new(deg(90.0).into(), deg(90.0).into(), rad(0.0))); + let rot = Matrix3::from(Euler::new(deg(90.0), deg(90.0), deg(0.0))); assert_approx_eq!(vec3(0.0, 0.0, 1.0), rot * vec); } @@ -450,7 +450,7 @@ pub mod matrix3 { fn test_y_then_z() { let vec = vec3(0.0, 0.0, 1.0); - let rot = Matrix3::from(Euler::new(rad(0.0), deg(90.0).into(), deg(90.0).into())); + let rot = Matrix3::from(Euler::new(deg(0.0), deg(90.0), deg(90.0))); assert_approx_eq!(vec3(1.0, 0.0, 0.0), rot * vec); } } @@ -462,7 +462,7 @@ pub mod matrix3 { fn test_x() { let vec = vec3(0.0, 0.0, 1.0); - let rot = Matrix3::from_angle_x(deg(90.0).into()); + let rot = Matrix3::from_angle_x(deg(90.0)); println!("x mat: {:?}", rot); assert_approx_eq!(vec3(0.0, -1.0, 0.0), rot * vec); } @@ -471,7 +471,7 @@ pub mod matrix3 { fn test_y() { let vec = vec3(0.0, 0.0, 1.0); - let rot = Matrix3::from_angle_y(deg(90.0).into()); + let rot = Matrix3::from_angle_y(deg(90.0)); assert_approx_eq!(vec3(1.0, 0.0, 0.0), rot * vec); } @@ -479,7 +479,7 @@ pub mod matrix3 { fn test_z() { let vec = vec3(1.0, 0.0, 0.0); - let rot = Matrix3::from_angle_z(deg(90.0).into()); + let rot = Matrix3::from_angle_z(deg(90.0)); assert_approx_eq!(vec3(0.0, 1.0, 0.0), rot * vec); } @@ -487,7 +487,7 @@ pub mod matrix3 { fn test_xy() { let vec = vec3(0.0, 0.0, 1.0); - let rot = Matrix3::from_axis_angle(vec3(1.0, 1.0, 0.0).normalize(), deg(90.0).into()); + let rot = Matrix3::from_axis_angle(vec3(1.0, 1.0, 0.0).normalize(), deg(90.0)); assert_approx_eq!(vec3(2.0f32.sqrt() / 2.0, -2.0f32.sqrt() / 2.0, 0.0), rot * vec); } @@ -495,7 +495,7 @@ pub mod matrix3 { fn test_yz() { let vec = vec3(1.0, 0.0, 0.0); - let rot = Matrix3::from_axis_angle(vec3(0.0, 1.0, 1.0).normalize(), deg(-90.0).into()); + let rot = Matrix3::from_axis_angle(vec3(0.0, 1.0, 1.0).normalize(), deg(-90.0)); assert_approx_eq!(vec3(0.0, -2.0f32.sqrt() / 2.0, 2.0f32.sqrt() / 2.0), rot * vec); } @@ -503,7 +503,7 @@ pub mod matrix3 { fn test_xz() { let vec = vec3(0.0, 1.0, 0.0); - let rot = Matrix3::from_axis_angle(vec3(1.0, 0.0, 1.0).normalize(), deg(90.0).into()); + let rot = Matrix3::from_axis_angle(vec3(1.0, 0.0, 1.0).normalize(), deg(90.0)); assert_approx_eq!(vec3(-2.0f32.sqrt() / 2.0, 0.0, 2.0f32.sqrt() / 2.0), rot * vec); } } diff --git a/tests/quaternion.rs b/tests/quaternion.rs index bfa9cee..c73ad07 100644 --- a/tests/quaternion.rs +++ b/tests/quaternion.rs @@ -156,10 +156,10 @@ mod rotate_from_euler { fn test_x() { let vec = vec3(0.0, 0.0, 1.0); - let rot = Quaternion::from(Euler::new(deg(90.0).into(), rad(0.0), rad(0.0))); + let rot = Quaternion::from(Euler::new(deg(90.0), deg(0.0), deg(0.0))); assert_approx_eq!(vec3(0.0, -1.0, 0.0), rot * vec); - let rot = Quaternion::from(Euler::new(deg(-90.0).into(), rad(0.0), rad(0.0))); + let rot = Quaternion::from(Euler::new(deg(-90.0), deg(0.0), deg(0.0))); assert_approx_eq!(vec3(0.0, 1.0, 0.0), rot * vec); } @@ -167,10 +167,10 @@ mod rotate_from_euler { fn test_y() { let vec = vec3(0.0, 0.0, 1.0); - let rot = Quaternion::from(Euler::new(rad(0.0), deg(90.0).into(), rad(0.0))); + let rot = Quaternion::from(Euler::new(deg(0.0), deg(90.0), deg(0.0))); assert_approx_eq!(vec3(1.0, 0.0, 0.0), rot * vec); - let rot = Quaternion::from(Euler::new(rad(0.0), deg(-90.0).into(), rad(0.0))); + let rot = Quaternion::from(Euler::new(deg(0.0), deg(-90.0), deg(0.0))); assert_approx_eq!(vec3(-1.0, 0.0, 0.0), rot * vec); } @@ -178,10 +178,10 @@ mod rotate_from_euler { fn test_z() { let vec = vec3(1.0, 0.0, 0.0); - let rot = Quaternion::from(Euler::new(rad(0.0), rad(0.0), deg(90.0).into())); + let rot = Quaternion::from(Euler::new(deg(0.0), deg(0.0), deg(90.0))); assert_approx_eq!(vec3(0.0, 1.0, 0.0), rot * vec); - let rot = Quaternion::from(Euler::new(rad(0.0), rad(0.0), deg(-90.0).into())); + let rot = Quaternion::from(Euler::new(deg(0.0), deg(0.0), deg(-90.0))); assert_approx_eq!(vec3(0.0, -1.0, 0.0), rot * vec); } @@ -191,7 +191,7 @@ mod rotate_from_euler { fn test_x_then_y() { let vec = vec3(0.0, 1.0, 0.0); - let rot = Quaternion::from(Euler::new(deg(90.0).into(), deg(90.0).into(), rad(0.0))); + let rot = Quaternion::from(Euler::new(deg(90.0), deg(90.0), deg(0.0))); assert_approx_eq!(vec3(0.0, 0.0, 1.0), rot * vec); } @@ -200,7 +200,7 @@ mod rotate_from_euler { fn test_y_then_z() { let vec = vec3(0.0, 0.0, 1.0); - let rot = Quaternion::from(Euler::new(rad(0.0), deg(90.0).into(), deg(90.0).into())); + let rot = Quaternion::from(Euler::new(deg(0.0), deg(90.0), deg(90.0))); assert_approx_eq!(vec3(1.0, 0.0, 0.0), rot * vec); } } @@ -212,7 +212,7 @@ mod rotate_from_axis_angle { fn test_x() { let vec = vec3(0.0, 0.0, 1.0); - let rot = Quaternion::from_angle_x(deg(90.0).into()); + let rot = Quaternion::from_angle_x(deg(90.0)); assert_approx_eq!(vec3(0.0, -1.0, 0.0), rot * vec); } @@ -220,7 +220,7 @@ mod rotate_from_axis_angle { fn test_y() { let vec = vec3(0.0, 0.0, 1.0); - let rot = Quaternion::from_angle_y(deg(90.0).into()); + let rot = Quaternion::from_angle_y(deg(90.0)); assert_approx_eq!(vec3(1.0, 0.0, 0.0), rot * vec); } @@ -228,7 +228,7 @@ mod rotate_from_axis_angle { fn test_z() { let vec = vec3(1.0, 0.0, 0.0); - let rot = Quaternion::from_angle_z(deg(90.0).into()); + let rot = Quaternion::from_angle_z(deg(90.0)); assert_approx_eq!(vec3(0.0, 1.0, 0.0), rot * vec); } @@ -236,7 +236,7 @@ mod rotate_from_axis_angle { fn test_xy() { let vec = vec3(0.0, 0.0, 1.0); - let rot = Quaternion::from_axis_angle(vec3(1.0, 1.0, 0.0).normalize(), deg(90.0).into()); + let rot = Quaternion::from_axis_angle(vec3(1.0, 1.0, 0.0).normalize(), deg(90.0)); assert_approx_eq!(vec3(2.0f32.sqrt() / 2.0, -2.0f32.sqrt() / 2.0, 0.0), rot * vec); } @@ -244,7 +244,7 @@ mod rotate_from_axis_angle { fn test_yz() { let vec = vec3(1.0, 0.0, 0.0); - let rot = Quaternion::from_axis_angle(vec3(0.0, 1.0, 1.0).normalize(), deg(-90.0).into()); + let rot = Quaternion::from_axis_angle(vec3(0.0, 1.0, 1.0).normalize(), deg(-90.0)); assert_approx_eq!(vec3(0.0, -2.0f32.sqrt() / 2.0, 2.0f32.sqrt() / 2.0), rot * vec); } @@ -252,7 +252,7 @@ mod rotate_from_axis_angle { fn test_xz() { let vec = vec3(0.0, 1.0, 0.0); - let rot = Quaternion::from_axis_angle(vec3(1.0, 0.0, 1.0).normalize(), deg(90.0).into()); + let rot = Quaternion::from_axis_angle(vec3(1.0, 0.0, 1.0).normalize(), deg(90.0)); assert_approx_eq!(vec3(-2.0f32.sqrt() / 2.0, 0.0, 2.0f32.sqrt() / 2.0), rot * vec); } } diff --git a/tests/rotation.rs b/tests/rotation.rs index 0f41611..97d3169 100644 --- a/tests/rotation.rs +++ b/tests/rotation.rs @@ -21,12 +21,12 @@ mod rotation { use super::cgmath::*; pub fn a2>() -> R { - Rotation2::from_angle(deg(30.0).into()) + Rotation2::from_angle(deg(30.0)) } pub fn a3>() -> R { let axis = Vector3::new(1.0, 1.0, 0.0).normalize(); - Rotation3::from_axis_angle(axis, deg(30.0).into()) + Rotation3::from_axis_angle(axis, deg(30.0)) } }