removed math_util module
This commit is contained in:
@@ -127,7 +127,6 @@ mod pp;
|
||||
pub use pp::{AnyPP, AttributeProvider};
|
||||
|
||||
mod curve;
|
||||
mod math_util;
|
||||
mod mods;
|
||||
|
||||
#[cfg(any(feature = "osu", feature = "fruits"))]
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
#[cfg(feature = "sliders")]
|
||||
#[inline]
|
||||
pub(crate) fn is_linear(
|
||||
p0: crate::parse::Pos2,
|
||||
p1: crate::parse::Pos2,
|
||||
p2: crate::parse::Pos2,
|
||||
) -> bool {
|
||||
((p1.x - p0.x) * (p2.y - p0.y) - (p1.y - p0.y) * (p2.x - p0.x)).abs() <= f32::EPSILON
|
||||
}
|
||||
|
||||
#[cfg(feature = "osu")]
|
||||
#[inline]
|
||||
pub(crate) fn lerp(start: f64, end: f64, percent: f64) -> f64 {
|
||||
start + (end - start) * percent
|
||||
}
|
||||
@@ -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
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+5
-1
@@ -765,7 +765,7 @@ impl Beatmap {
|
||||
|
||||
#[cfg(feature = "sliders")]
|
||||
mod osu_fruits {
|
||||
use crate::{math_util::is_linear, ParseError};
|
||||
use crate::ParseError;
|
||||
|
||||
use super::Pos2;
|
||||
|
||||
@@ -869,6 +869,10 @@ mod osu_fruits {
|
||||
}
|
||||
}
|
||||
|
||||
fn is_linear(p0: Pos2, p1: Pos2, p2: Pos2) -> bool {
|
||||
((p1.x - p0.x) * (p2.y - p0.y) - (p1.y - p0.y) * (p2.x - p0.x)).abs() <= f32::EPSILON
|
||||
}
|
||||
|
||||
/// Control point for slider curve calculation
|
||||
#[derive(Copy, Clone, Debug, Default, PartialEq)]
|
||||
pub struct PathControlPoint {
|
||||
|
||||
Reference in New Issue
Block a user