Provide surface to JoinCycle::add_joined_edges

This commit is contained in:
Hanno Braun 2024-05-03 13:57:56 +02:00
parent ce326893a4
commit 9ad7934b22
3 changed files with 19 additions and 5 deletions

View File

@ -75,6 +75,7 @@ impl AddHole for Shell {
entry.clone(), entry.clone(),
*core.layers.geometry.of_half_edge(&entry), *core.layers.geometry.of_half_edge(&entry),
)], )],
location.face.surface().clone(),
core, core,
)], )],
core, core,
@ -150,6 +151,7 @@ impl AddHole for Shell {
entry.clone(), entry.clone(),
*core.layers.geometry.of_half_edge(&entry), *core.layers.geometry.of_half_edge(&entry),
)], )],
entry_location.face.surface().clone(),
core, core,
)], )],
core, core,
@ -171,6 +173,7 @@ impl AddHole for Shell {
exit.clone(), exit.clone(),
*core.layers.geometry.of_half_edge(exit), *core.layers.geometry.of_half_edge(exit),
)], )],
exit_location.face.surface().clone(),
core, core,
)], )],
core, core,

View File

@ -11,7 +11,7 @@ use crate::{
update::{UpdateCycle, UpdateHalfEdge}, update::{UpdateCycle, UpdateHalfEdge},
}, },
storage::Handle, storage::Handle,
topology::{Cycle, HalfEdge}, topology::{Cycle, HalfEdge, Surface},
Core, Core,
}; };
@ -25,7 +25,12 @@ pub trait JoinCycle {
/// ///
/// The geometry for each new half-edge needs to be provided as well. /// The geometry for each new half-edge needs to be provided as well.
#[must_use] #[must_use]
fn add_joined_edges<Es>(&self, edges: Es, core: &mut Core) -> Self fn add_joined_edges<Es>(
&self,
edges: Es,
surface: Handle<Surface>,
core: &mut Core,
) -> Self
where where
Es: IntoIterator<Item = (Handle<HalfEdge>, HalfEdgeGeom)>, Es: IntoIterator<Item = (Handle<HalfEdge>, HalfEdgeGeom)>,
Es::IntoIter: Clone + ExactSizeIterator; Es::IntoIter: Clone + ExactSizeIterator;
@ -82,7 +87,12 @@ pub trait JoinCycle {
} }
impl JoinCycle for Cycle { impl JoinCycle for Cycle {
fn add_joined_edges<Es>(&self, edges: Es, core: &mut Core) -> Self fn add_joined_edges<Es>(
&self,
edges: Es,
_: Handle<Surface>,
core: &mut Core,
) -> Self
where where
Es: IntoIterator<Item = (Handle<HalfEdge>, HalfEdgeGeom)>, Es: IntoIterator<Item = (Handle<HalfEdge>, HalfEdgeGeom)>,
Es::IntoIter: Clone + ExactSizeIterator, Es::IntoIter: Clone + ExactSizeIterator,

View File

@ -51,7 +51,7 @@ impl SweepCycle for Cycle {
fn sweep_cycle( fn sweep_cycle(
&self, &self,
surface: Handle<Surface>, surface: Handle<Surface>,
_top_surface: Handle<Surface>, top_surface: Handle<Surface>,
color: Option<Color>, color: Option<Color>,
path: impl Into<Vector<3>>, path: impl Into<Vector<3>>,
cache: &mut SweepCache, cache: &mut SweepCache,
@ -83,7 +83,8 @@ impl SweepCycle for Cycle {
)); ));
} }
let top_cycle = Cycle::empty().add_joined_edges(top_edges, core); let top_cycle =
Cycle::empty().add_joined_edges(top_edges, top_surface, core);
SweptCycle { faces, top_cycle } SweptCycle { faces, top_cycle }
} }