removed math_util module

This commit is contained in:
MaxOhn
2021-11-13 17:20:26 +01:00
parent 8beabd4e11
commit d39d9ae426
6 changed files with 15 additions and 26 deletions
+4
View File
@@ -541,6 +541,10 @@ fn difficulty_range_ar(ar: f64) -> f64 {
crate::difficulty_range(ar, 450.0, 1200.0, 1800.0)
}
fn lerp(start: f64, end: f64, percent: f64) -> f64 {
start + (end - start) * percent
}
/// The result of a difficulty calculation on an osu!standard map.
#[derive(Clone, Debug, Default)]
pub struct OsuDifficultyAttributes {
+3 -5
View File
@@ -1,6 +1,4 @@
use crate::math_util;
use super::{skill_kind::calculate_speed_rhythm_bonus, DifficultyObject, SkillKind};
use super::{lerp, skill_kind::calculate_speed_rhythm_bonus, DifficultyObject, SkillKind};
use std::cmp::Ordering;
@@ -86,8 +84,8 @@ impl Skill {
for (i, strain) in peaks.take(reduced_section_count).enumerate() {
let clamped = (i as f64 / reduced_section_count_f64).clamp(0.0, 1.0);
let scale = (math_util::lerp(1.0, 10.0, clamped)).log10();
*strain *= math_util::lerp(REDUCED_STRAIN_BASELINE, 1.0, scale);
let scale = (lerp(1.0, 10.0, clamped)).log10();
*strain *= lerp(REDUCED_STRAIN_BASELINE, 1.0, scale);
}
self.strain_peaks
+3 -4
View File
@@ -4,9 +4,9 @@ use std::{
iter,
};
use crate::{math_util, parse::Pos2};
use crate::parse::Pos2;
use super::DifficultyObject;
use super::{lerp, DifficultyObject};
const SINGLE_SPACING_TRESHOLD: f64 = 125.0;
@@ -380,8 +380,7 @@ impl SkillKind {
if let Some(prev) =
prev.filter(|p| strain_time < hit_window_full && p.strain_time > strain_time)
{
strain_time =
math_util::lerp(prev.strain_time, strain_time, speed_window_ratio);
strain_time = lerp(prev.strain_time, strain_time, speed_window_ratio);
}
// * Cap delta time to the OD 300 hit window