diff --git a/src/angle.rs b/src/angle.rs index fd79fdc..31dddb8 100644 --- a/src/angle.rs +++ b/src/angle.rs @@ -17,10 +17,11 @@ pub trait Angle: Add , Modulo , Neg , Eq, Ord { - static pure fn full_rotation() -> self; - static pure fn half_rotation() -> self; - static pure fn quarter_rotation() -> self; - static pure fn eighth_rotation() -> self; + static pure fn full_turn() -> self; + static pure fn half_turn() -> self; + static pure fn quadrant() -> self; + static pure fn sextant() -> self; + static pure fn octant() -> self; pure fn to_radians() -> Radians; pure fn to_degrees() -> Degrees; @@ -34,10 +35,11 @@ pub trait Angle: Add pub enum Radians = T; pub impl Radians: Angle { - #[inline(always)] static pure fn full_rotation() -> Radians { Radians(move cast(2.0 * pi)) } - #[inline(always)] static pure fn half_rotation() -> Radians { Radians(move cast(pi)) } - #[inline(always)] static pure fn quarter_rotation() -> Radians { Radians(move cast(pi / 2.0)) } - #[inline(always)] static pure fn eighth_rotation() -> Radians { Radians(move cast(pi / 4.0)) } + #[inline(always)] static pure fn full_turn() -> Radians { Radians(move cast(2.0 * pi)) } // TODO: calculate absolute values + #[inline(always)] static pure fn half_turn() -> Radians { Radians(move cast(pi)) } + #[inline(always)] static pure fn quadrant() -> Radians { Radians(move cast(pi / 2.0)) } + #[inline(always)] static pure fn sextant() -> Radians { Radians(move cast(pi / 3.0)) } + #[inline(always)] static pure fn octant() -> Radians { Radians(move cast(pi / 4.0)) } #[inline(always)] pure fn to_radians() -> Radians { self } #[inline(always)] pure fn to_degrees() -> Degrees { Degrees(*self * cast(180.0 / pi)) } @@ -112,10 +114,11 @@ pub impl Radians: ToStr { pub enum Degrees = T; pub impl Degrees: Angle { - #[inline(always)] static pure fn full_rotation() -> Degrees { Degrees(move cast(360.0)) } - #[inline(always)] static pure fn half_rotation() -> Degrees { Degrees(move cast(180.0)) } - #[inline(always)] static pure fn quarter_rotation() -> Degrees { Degrees(move cast(90.0)) } - #[inline(always)] static pure fn eighth_rotation() -> Degrees { Degrees(move cast(45.0)) } + #[inline(always)] static pure fn full_turn() -> Degrees { Degrees(move cast(360.0)) } + #[inline(always)] static pure fn half_turn() -> Degrees { Degrees(move cast(180.0)) } + #[inline(always)] static pure fn quadrant() -> Degrees { Degrees(move cast(90.0)) } + #[inline(always)] static pure fn sextant() -> Degrees { Degrees(move cast(60.0)) } + #[inline(always)] static pure fn octant() -> Degrees { Degrees(move cast(45.0)) } #[inline(always)] pure fn to_radians() -> Radians { Radians(*self * cast(pi / 180.0)) } #[inline(always)] pure fn to_degrees() -> Degrees { self } diff --git a/src/gltypes.rs b/src/gltypes.rs index e11bbd7..acd641d 100644 --- a/src/gltypes.rs +++ b/src/gltypes.rs @@ -439,31 +439,35 @@ pub fn degrees(theta: f32) -> degrees { Degrees(theta) } pub fn ddegrees(theta: f64) -> ddegrees { Degrees(theta) } pub impl radians { - #[inline(always)] static pure fn full_rotation() -> radians { Angle::full_rotation() } - #[inline(always)] static pure fn half_rotation() -> radians { Angle::half_rotation() } - #[inline(always)] static pure fn quarter_rotation() -> radians { Angle::quarter_rotation() } - #[inline(always)] static pure fn eighth_rotation() -> radians { Angle::eighth_rotation() } + #[inline(always)] static pure fn full_turn() -> radians { Angle::full_turn() } + #[inline(always)] static pure fn half_turn() -> radians { Angle::half_turn() } + #[inline(always)] static pure fn quadrant() -> radians { Angle::quadrant() } + #[inline(always)] static pure fn sextant() -> radians { Angle::sextant() } + #[inline(always)] static pure fn octant() -> radians { Angle::octant() } } pub impl dradians { - #[inline(always)] static pure fn full_rotation() -> dradians { Angle::full_rotation() } - #[inline(always)] static pure fn half_rotation() -> dradians { Angle::half_rotation() } - #[inline(always)] static pure fn quarter_rotation() -> dradians { Angle::quarter_rotation() } - #[inline(always)] static pure fn eighth_rotation() -> dradians { Angle::eighth_rotation() } + #[inline(always)] static pure fn full_turn() -> dradians { Angle::full_turn() } + #[inline(always)] static pure fn half_turn() -> dradians { Angle::half_turn() } + #[inline(always)] static pure fn quadrant() -> dradians { Angle::quadrant() } + #[inline(always)] static pure fn sextant() -> dradians { Angle::sextant() } + #[inline(always)] static pure fn octant() -> dradians { Angle::octant() } } pub impl degrees { - #[inline(always)] static pure fn full_rotation() -> degrees { Angle::full_rotation() } - #[inline(always)] static pure fn half_rotation() -> degrees { Angle::half_rotation() } - #[inline(always)] static pure fn quarter_rotation() -> degrees { Angle::quarter_rotation() } - #[inline(always)] static pure fn eighth_rotation() -> degrees { Angle::eighth_rotation() } + #[inline(always)] static pure fn full_turn() -> degrees { Angle::full_turn() } + #[inline(always)] static pure fn half_turn() -> degrees { Angle::half_turn() } + #[inline(always)] static pure fn quadrant() -> degrees { Angle::quadrant() } + #[inline(always)] static pure fn sextant() -> degrees { Angle::sextant() } + #[inline(always)] static pure fn octant() -> degrees { Angle::octant() } } pub impl ddegrees { - #[inline(always)] static pure fn full_rotation() -> ddegrees { Angle::full_rotation() } - #[inline(always)] static pure fn half_rotation() -> ddegrees { Angle::half_rotation() } - #[inline(always)] static pure fn quarter_rotation() -> ddegrees { Angle::quarter_rotation() } - #[inline(always)] static pure fn eighth_rotation() -> ddegrees { Angle::eighth_rotation() } + #[inline(always)] static pure fn full_turn() -> ddegrees { Angle::full_turn() } + #[inline(always)] static pure fn half_turn() -> ddegrees { Angle::half_turn() } + #[inline(always)] static pure fn quadrant() -> ddegrees { Angle::quadrant() } + #[inline(always)] static pure fn sextant() -> ddegrees { Angle::sextant() } + #[inline(always)] static pure fn octant() -> ddegrees { Angle::octant() } }