pub mod oracle;
pub mod state;
pub mod scheduler;
pub mod cpu;

use crate::mesh::Vec3;

/// Surface sample collected by a crawler.
#[derive(Debug, Clone, Copy)]
pub struct SurfaceHit {
    pub position: Vec3,
    pub normal: Vec3,
    pub face_id: u32,
}

/// Configuration for the crawler-based decompiler.
#[derive(Debug, Clone)]
pub struct CrawlerConfig {
    /// Number of initial probes deployed around the bounding sphere.
    pub initial_probes: usize,
    /// Number of crawlers deployed per contact point in patrol phase.
    pub crawlers_per_contact: usize,
    /// Step size as fraction of bounding sphere radius.
    pub step_fraction: f64,
    /// Distance threshold for surface detection.
    pub surface_epsilon: f64,
    /// Angle tolerance (radians) for face boundary detection.
    pub edge_angle_threshold: f64,
    /// Maximum steps before a crawler gives up.
    pub max_steps: u32,
    /// Scan row spacing as fraction of bounding radius.
    pub scan_spacing: f64,
}

impl Default for CrawlerConfig {
    fn default() -> Self {
        Self {
            initial_probes: 128,
            crawlers_per_contact: 4,
            step_fraction: 0.005,
            surface_epsilon: 1e-4,
            edge_angle_threshold: 0.3,
            max_steps: 10000,
            scan_spacing: 0.01,
        }
    }
}
