Skip to content

Commit

Permalink
Simplify interface of transform_shape
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Jun 29, 2022
1 parent e598881 commit eedb67f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
9 changes: 2 additions & 7 deletions crates/fj-kernel/src/algorithms/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,10 @@ use crate::{
};

/// Transform a shape
pub fn transform_shape(faces: &[Face], transform: &Transform) -> Vec<Face> {
let mut target = Vec::new();

pub fn transform_shape(faces: &mut Vec<Face>, transform: &Transform) {
for face in faces {
let face = transform_face(face, transform);
target.push(face);
*face = transform_face(face, transform);
}

target
}

pub fn transform_face(face: &Face, transform: &Transform) -> Face {
Expand Down
4 changes: 2 additions & 2 deletions crates/fj-operations/src/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ impl ToShape for fj::Transform {
tolerance: Tolerance,
debug_info: &mut DebugInfo,
) -> Result<Validated<Vec<Face>>, ValidationError> {
let shape = self
let mut shape = self
.shape
.to_shape(config, tolerance, debug_info)?
.into_inner();

let shape = transform_shape(&shape, &make_transform(self));
transform_shape(&mut shape, &make_transform(self));

validate(shape, config)
}
Expand Down

0 comments on commit eedb67f

Please sign in to comment.