use fj_math::Vector;
use crate::{
objects::{Face, Shell},
operations::{insert::Insert, presentation::GetColor},
storage::Handle,
Core,
};
use super::{SweepCache, SweepRegion};
pub trait SweepFace {
fn sweep_face(
&self,
path: impl Into<Vector<3>>,
cache: &mut SweepCache,
core: &mut Core,
) -> Shell;
}
impl SweepFace for Handle<Face> {
fn sweep_face(
&self,
path: impl Into<Vector<3>>,
cache: &mut SweepCache,
core: &mut Core,
) -> Shell {
let path = path.into();
let bottom_face = self;
let other_faces = bottom_face
.region()
.sweep_region(
bottom_face.surface(),
bottom_face.region().get_color(core),
path,
cache,
core,
)
.all_faces()
.map(|side_face| side_face.insert(core));
let mut faces = Vec::new();
faces.push(bottom_face.clone());
faces.extend(other_faces);
Shell::new(faces)
}
}