Remove Angle::equiv
Thus relied on the == operator, which doesn't make sense for floats. It seems better to leave this up to clients to decide if they want to normalize.
This commit is contained in:
parent
0de8942748
commit
40232ec063
2 changed files with 1 additions and 17 deletions
|
@ -107,11 +107,6 @@ pub trait Angle where
|
||||||
fn turn_div_4() -> Self;
|
fn turn_div_4() -> Self;
|
||||||
fn turn_div_6() -> Self;
|
fn turn_div_6() -> Self;
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn equiv(&self, other: &Self) -> bool {
|
|
||||||
self.normalize() == other.normalize()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn sin(self) -> Self::Unitless;
|
fn sin(self) -> Self::Unitless;
|
||||||
fn cos(self) -> Self::Unitless;
|
fn cos(self) -> Self::Unitless;
|
||||||
fn tan(self) -> Self::Unitless;
|
fn tan(self) -> Self::Unitless;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
extern crate cgmath;
|
extern crate cgmath;
|
||||||
|
|
||||||
use cgmath::{Angle, Rad, Deg, rad, deg};
|
use cgmath::{Rad, Deg, rad, deg};
|
||||||
use cgmath::ApproxEq;
|
use cgmath::ApproxEq;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -36,14 +36,3 @@ fn conv() {
|
||||||
let angle: Rad<_> = angle.into();
|
let angle: Rad<_> = angle.into();
|
||||||
assert!(angle.approx_eq(&rad(30.0f64)));
|
assert!(angle.approx_eq(&rad(30.0f64)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn equiv() {
|
|
||||||
assert!(Deg::<f32>::full_turn().equiv(&-Deg::<f32>::full_turn()));
|
|
||||||
assert!(Deg::<f32>::turn_div_2().equiv(&-Deg::<f32>::turn_div_2()));
|
|
||||||
assert!((Deg::<f32>::turn_div_3() - Deg::<f32>::full_turn()).equiv(&Deg::<f32>::turn_div_3()));
|
|
||||||
|
|
||||||
assert!(Rad::<f32>::full_turn().equiv(&-Rad::<f32>::full_turn()));
|
|
||||||
assert!(Rad::<f32>::turn_div_2().equiv(&-Rad::<f32>::turn_div_2()));
|
|
||||||
assert!((Rad::<f32>::turn_div_3() - Rad::<f32>::full_turn()).equiv(&Rad::<f32>::turn_div_3()));
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue