Skip to content

Commit

Permalink
Add CyclesInFace::as_handle
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed May 16, 2022
1 parent 8d70529 commit 35fe5cc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
6 changes: 2 additions & 4 deletions crates/fj-kernel/src/algorithms/sweep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,7 @@ impl Relation {
};

exteriors
.0
.iter()
.as_handle()
.map(|cycle| self.cycles.get(cycle).unwrap().clone())
.collect()
}
Expand All @@ -283,8 +282,7 @@ impl Relation {
};

interiors
.0
.iter()
.as_handle()
.map(|cycle| self.cycles.get(cycle).unwrap().clone())
.collect()
}
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-kernel/src/shape/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl Validate for Face {
if !stores.surfaces.contains(surface) {
missing_surface = Some(surface.clone());
}
for cycle in exteriors.0.iter().chain(&interiors.0) {
for cycle in exteriors.as_handle().chain(interiors.as_handle()) {
if !stores.cycles.contains(cycle) {
missing_cycles.insert(cycle.clone());
}
Expand Down
7 changes: 6 additions & 1 deletion crates/fj-kernel/src/topology/faces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ impl CyclesInFace {
}

fn as_canonical(&self) -> impl Iterator<Item = Cycle<3>> + '_ {
self.0.iter().map(|edge| edge.get())
self.as_handle().map(|edge| edge.get())
}

/// Access an iterator over handles to the cycles
pub fn as_handle(&self) -> impl Iterator<Item = &'_ Handle<Cycle<3>>> + '_ {
self.0.iter()
}
}
8 changes: 6 additions & 2 deletions crates/fj-operations/src/group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,12 @@ fn copy_shape(orig: Shape, target: &mut Shape) {
target
.insert(Face::new(
surfaces[&surface].clone(),
exteriors.0.iter().map(|cycle| cycles[cycle].clone()),
interiors.0.iter().map(|cycle| cycles[cycle].clone()),
exteriors
.as_handle()
.map(|cycle| cycles[cycle].clone()),
interiors
.as_handle()
.map(|cycle| cycles[cycle].clone()),
color,
))
.unwrap();
Expand Down

0 comments on commit 35fe5cc

Please sign in to comment.