jagua_rs/util/config.rs
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
use serde::{Deserialize, Serialize};
use crate::fsize;
///Configuration of the Collision Detection Engine
#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq)]
pub struct CDEConfig {
///Maximum depth of the quadtree
pub quadtree_depth: u8,
///Target number of cells in the Hazard Proximity Grid (set to 0 to disable)
pub hpg_n_cells: usize,
///Configuration of the surrogate generation for items
pub item_surrogate_config: SPSurrogateConfig,
}
/// maximum number of definable pole limits, increase if needed
const N_POLE_LIMITS: usize = 3;
#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq)]
pub struct SPSurrogateConfig {
///Limits on the number of poles to be generated at different coverage levels.
///For example: [(100, 0.0), (20, 0.75), (10, 0.90)]:
///While the coverage is below 75% the generation will stop at 100 poles.
///If 75% coverage with 20 or more poles the generation will stop.
///If 90% coverage with 10 or more poles the generation will stop.
pub n_pole_limits: [(usize, fsize); N_POLE_LIMITS],
///Number of poles to test during fail-fast (additional poles are exclusively used in the hazard proximity grid)
pub n_ff_poles: usize,
///number of piers to test during fail-fast
pub n_ff_piers: usize,
}
impl SPSurrogateConfig {
pub fn none() -> Self {
Self {
n_pole_limits: [(0, 0.0); N_POLE_LIMITS],
n_ff_poles: 0,
n_ff_piers: 0,
}
}
}