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
//! Oct-tree construction settings.

use serde::Deserialize;

use crate::dom::{Surface, Tree};

/// Tree construction settings.
#[derive(Deserialize)]
pub struct TreeBuilder {
    /// Target maximum number of triangles per cell.
    pub tar_tris: usize,
    /// Maximum mesh depth.
    pub max_depth: u32,
    /// Collision detection expansion parameter.
    pub padding: f64,
}

impl TreeBuilder {
    /// Build a Tree instance.
    #[inline]
    #[must_use]
    pub fn build<'a, T>(&self, surfs: &'a [Surface<T>]) -> Tree<'a, T> {
        Tree::new(self, surfs)
    }
}