From 930432aefe1479fe359c3971613f09b063d48c71 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Thu, 1 Apr 2021 11:25:05 -0400 Subject: [PATCH] remove unused math.rs --- src/lib.rs | 1 - src/math.rs | 40 ---------------------------------------- 2 files changed, 41 deletions(-) delete mode 100644 src/math.rs diff --git a/src/lib.rs b/src/lib.rs index fee30ca..e08bdad 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,6 @@ mod blur; mod grid; mod imgdata; // for storing image data -mod math; pub mod model; mod palette; mod util; // for math things diff --git a/src/math.rs b/src/math.rs deleted file mode 100644 index fc37981..0000000 --- a/src/math.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Previously from trig.rs -// From https://bits.stephan-brumme.com/absFloat.html -#[allow(dead_code)] -#[inline] -fn abs(x: f32) -> f32 { - f32::from_bits(x.to_bits() & 0x7FFF_FFFF) -} - -// Previously from trig.rs -// Branchless floor implementation -#[allow(dead_code)] -#[inline] -fn floor(x: f32) -> f32 { - let mut x_trunc = (x as i32) as f32; - x_trunc -= (x < x_trunc) as i32 as f32; - x_trunc -} - -// Previously from trig.rs -// Approximates `cos(x)` in radians with the maximum error of `0.002` -// https://stackoverflow.com/posts/28050328/revisions -#[allow(dead_code)] -#[inline] -pub fn cos(mut x: f32) -> f32 { - const ALPHA: f32 = 0.5 * std::f32::consts::FRAC_1_PI; - x *= ALPHA; - x -= 0.25_f32 + floor(x + 0.25_f32); - x *= 16.0_f32 * (abs(x) - 0.5_f32); - x += 0.225_f32 * x * (abs(x) - 1.0_f32); - x -} - -// Previously from trig.rs -// Approximates `sin(x)` in radians with the maximum error of `0.002` -#[allow(dead_code)] -#[inline] -pub fn sin(x: f32) -> f32 { - cos(x - std::f32::consts::FRAC_PI_2) -} -