associate const

This commit is contained in:
Quaternions 2024-09-18 15:15:16 -07:00
parent 9ae1c3505d
commit 7d89eb6d0c

View File

@ -374,6 +374,7 @@ impl std::ops::Mul<i64> for Ratio64Vec2{
#[derive(Clone,Copy,Hash)] #[derive(Clone,Copy,Hash)]
pub struct Angle32(i32); pub struct Angle32(i32);
impl Angle32{ impl Angle32{
const ANGLE32_TO_FLOAT64_RADIANS:f64=std::f64::consts::PI/((1i64<<31) as f64);
pub const FRAC_PI_2:Self=Self(1<<30); pub const FRAC_PI_2:Self=Self(1<<30);
pub const NEG_FRAC_PI_2:Self=Self(-1<<30); pub const NEG_FRAC_PI_2:Self=Self(-1<<30);
pub const PI:Self=Self(-1<<31); pub const PI:Self=Self(-1<<31);
@ -425,11 +426,10 @@ impl Angle32{
} }
*/ */
} }
const ANGLE32_TO_FLOAT64_RADIANS:f64=std::f64::consts::PI/((1i64<<31) as f64);
impl Into<f32> for Angle32{ impl Into<f32> for Angle32{
#[inline] #[inline]
fn into(self)->f32{ fn into(self)->f32{
(self.0 as f64*ANGLE32_TO_FLOAT64_RADIANS) as f32 (self.0 as f64*Self::ANGLE32_TO_FLOAT64_RADIANS) as f32
} }
} }
impl std::ops::Neg for Angle32{ impl std::ops::Neg for Angle32{