diff --git a/src/angle.rs b/src/angle.rs index 514be8a..986a7f5 100644 --- a/src/angle.rs +++ b/src/angle.rs @@ -36,12 +36,30 @@ pub impl Radians: Angle { #[inline(always)] pure fn to_radians() -> Radians { self } #[inline(always)] pure fn to_degrees() -> Degrees { Degrees(*self * cast(180.0 / pi)) } +} + +pub impl Radians: Add, Radians> { #[inline(always)] pure fn add(rhs: &Radians) -> Radians { Radians(*self + **rhs) } +} + +pub impl Radians: Sub, Radians> { #[inline(always)] pure fn sub(rhs: &Radians) -> Radians { Radians(*self - **rhs) } - #[inline(always)] pure fn mul(rhs: &T) -> Radians { Radians(*self * *rhs) } - #[inline(always)] pure fn div(rhs: &T) -> Radians { Radians(*self / *rhs) } - #[inline(always)] pure fn modulo(rhs: &T) -> Radians { Radians(*self % *rhs) } - #[inline(always)] pure fn neg() -> Radians { Radians(-*self) } +} + +pub impl Radians: Mul> { + #[inline(always)] pure fn mul(rhs: &T) -> Radians { Radians(*self * *rhs) } +} + +pub impl Radians: Div> { + #[inline(always)] pure fn div(rhs: &T) -> Radians { Radians(*self / *rhs) } +} + +pub impl Radians: Modulo> { + #[inline(always)] pure fn modulo(rhs: &T) -> Radians { Radians(*self % *rhs) } +} + +pub impl Radians: Neg> { + #[inline(always)] pure fn neg() -> Radians { Radians(-*self) } } pub impl Radians: Eq { @@ -67,12 +85,30 @@ pub impl Degrees: Angle { #[inline(always)] pure fn to_radians() -> Radians { Radians(*self * cast(pi / 180.0)) } #[inline(always)] pure fn to_degrees() -> Degrees { self } +} + +pub impl Degrees: Add, Degrees> { #[inline(always)] pure fn add(rhs: &Degrees) -> Degrees { Degrees(*self + **rhs) } +} + +pub impl Degrees: Sub, Degrees> { #[inline(always)] pure fn sub(rhs: &Degrees) -> Degrees { Degrees(*self - **rhs) } - #[inline(always)] pure fn mul(rhs: &T) -> Degrees { Degrees(*self * *rhs) } - #[inline(always)] pure fn div(rhs: &T) -> Degrees { Degrees(*self / *rhs) } - #[inline(always)] pure fn modulo(rhs: &T) -> Degrees { Degrees(*self % *rhs) } - #[inline(always)] pure fn neg() -> Degrees { Degrees(-*self) } +} + +pub impl Degrees: Mul> { + #[inline(always)] pure fn mul(rhs: &T) -> Degrees { Degrees(*self * *rhs) } +} + +pub impl Degrees: Div> { + #[inline(always)] pure fn div(rhs: &T) -> Degrees { Degrees(*self / *rhs) } +} + +pub impl Degrees: Modulo> { + #[inline(always)] pure fn modulo(rhs: &T) -> Degrees { Degrees(*self % *rhs) } +} + +pub impl Degrees: Neg> { + #[inline(always)] pure fn neg() -> Degrees { Degrees(-*self) } } pub impl Degrees: Eq {