1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use crate::{any::Difficulty, catch::difficulty::DifficultyValues};

use super::convert::CatchBeatmap;

/// The result of calculating the strains on a osu!catch map.
///
/// Suitable to plot the difficulty of a map over time.
#[derive(Clone, Debug, PartialEq)]
pub struct CatchStrains {
    /// Strain peaks of the movement skill.
    pub movement: Vec<f64>,
}

impl CatchStrains {
    /// Time between two strains in ms.
    pub const SECTION_LEN: f64 = 750.0;
}

pub fn strains(difficulty: &Difficulty, converted: &CatchBeatmap<'_>) -> CatchStrains {
    let DifficultyValues { movement, .. } = DifficultyValues::calculate(difficulty, converted);

    CatchStrains {
        movement: movement.get_curr_strain_peaks().into_vec(),
    }
}