Fix operator overloads
This commit is contained in:
parent
13fef22fc9
commit
c3e43b9b9b
1 changed files with 13 additions and 13 deletions
26
src/angle.rs
26
src/angle.rs
|
@ -18,12 +18,12 @@ pub impl<T:Copy Num NumCast> Radians<T>: Angle<T> {
|
|||
#[inline(always)] pure fn to_radians() -> Radians<T> { self }
|
||||
#[inline(always)] pure fn to_degrees() -> Degrees<T> { Degrees(*self * cast(180.0 / pi)) }
|
||||
|
||||
#[inline(always)] pure fn add(rhs: &Radians<T>) -> Radians<T> { self + *rhs }
|
||||
#[inline(always)] pure fn sub(rhs: &Radians<T>) -> Radians<T> { self - *rhs }
|
||||
#[inline(always)] pure fn mul(rhs: &T) -> Radians<T> { self * *rhs }
|
||||
#[inline(always)] pure fn div(rhs: &T) -> Radians<T> { self / *rhs }
|
||||
#[inline(always)] pure fn modulo(rhs: &T) -> Radians<T> { self % *rhs }
|
||||
#[inline(always)] pure fn neg() -> Radians<T> {-self }
|
||||
#[inline(always)] pure fn add(rhs: &Radians<T>) -> Radians<T> { Radians(*self + **rhs) }
|
||||
#[inline(always)] pure fn sub(rhs: &Radians<T>) -> Radians<T> { Radians(*self - **rhs) }
|
||||
#[inline(always)] pure fn mul(rhs: &T) -> Radians<T> { Radians(*self * *rhs) }
|
||||
#[inline(always)] pure fn div(rhs: &T) -> Radians<T> { Radians(*self / *rhs) }
|
||||
#[inline(always)] pure fn modulo(rhs: &T) -> Radians<T> { Radians(*self % *rhs) }
|
||||
#[inline(always)] pure fn neg() -> Radians<T> { Radians(-*self) }
|
||||
}
|
||||
|
||||
pub enum Degrees<T> = T;
|
||||
|
@ -32,15 +32,15 @@ pub impl<T:Copy Num NumCast> Degrees<T>: Angle<T> {
|
|||
#[inline(always)] pure fn to_radians() -> Radians<T> { Radians(*self * cast(pi / 180.0)) }
|
||||
#[inline(always)] pure fn to_degrees() -> Degrees<T> { self }
|
||||
|
||||
#[inline(always)] pure fn add(rhs: &Degrees<T>) -> Degrees<T> { self + *rhs }
|
||||
#[inline(always)] pure fn sub(rhs: &Degrees<T>) -> Degrees<T> { self - *rhs }
|
||||
#[inline(always)] pure fn mul(rhs: &T) -> Degrees<T> { self * *rhs }
|
||||
#[inline(always)] pure fn div(rhs: &T) -> Degrees<T> { self / *rhs }
|
||||
#[inline(always)] pure fn modulo(rhs: &T) -> Degrees<T> { self % *rhs }
|
||||
#[inline(always)] pure fn neg() -> Degrees<T> {-self }
|
||||
#[inline(always)] pure fn add(rhs: &Degrees<T>) -> Degrees<T> { Degrees(*self + **rhs) }
|
||||
#[inline(always)] pure fn sub(rhs: &Degrees<T>) -> Degrees<T> { Degrees(*self - **rhs) }
|
||||
#[inline(always)] pure fn mul(rhs: &T) -> Degrees<T> { Degrees(*self * *rhs) }
|
||||
#[inline(always)] pure fn div(rhs: &T) -> Degrees<T> { Degrees(*self / *rhs) }
|
||||
#[inline(always)] pure fn modulo(rhs: &T) -> Degrees<T> { Degrees(*self % *rhs) }
|
||||
#[inline(always)] pure fn neg() -> Degrees<T> { Degrees(-*self) }
|
||||
}
|
||||
|
||||
pub struct AxisRotation<T> {
|
||||
pub struct AxialRotation<T> {
|
||||
axis: Vec3<T>,
|
||||
theta: Radians<T>,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue