fj_kernel/algorithms/approx/
solid.rs

1//! Solid approximation
2
3use std::collections::BTreeSet;
4
5use crate::objects::Solid;
6
7use super::{edge::EdgeCache, face::FaceApprox, Approx, Tolerance};
8
9impl Approx for &Solid {
10    type Approximation = BTreeSet<FaceApprox>;
11    type Cache = EdgeCache;
12
13    fn approx_with_cache(
14        self,
15        tolerance: impl Into<Tolerance>,
16        cache: &mut Self::Cache,
17    ) -> Self::Approximation {
18        let tolerance = tolerance.into();
19
20        self.shells()
21            .flat_map(|shell| shell.approx_with_cache(tolerance, cache))
22            .collect()
23    }
24}