Fixed tests, now most use deg, and none use deg(x).into()
This commit is contained in:
parent
17d98af64f
commit
1b77875cc3
3 changed files with 30 additions and 30 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,12 +21,12 @@ mod rotation {
|
|||
use super::cgmath::*;
|
||||
|
||||
pub fn a2<R: Rotation2<f64>>() -> R {
|
||||
Rotation2::from_angle(deg(30.0).into())
|
||||
Rotation2::from_angle(deg(30.0))
|
||||
}
|
||||
|
||||
pub fn a3<R: Rotation3<f64>>() -> 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))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue