From 34a34e52b58e6f566be45a1174b1c6f6c157394f Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 28 Jun 2022 16:42:27 +0200 Subject: [PATCH] Accept `Vec` in `transform` --- crates/fj-kernel/src/algorithms/transform.rs | 7 +++---- crates/fj-operations/src/transform.rs | 2 ++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/transform.rs b/crates/fj-kernel/src/algorithms/transform.rs index 4d48ba39a..31e08dd27 100644 --- a/crates/fj-kernel/src/algorithms/transform.rs +++ b/crates/fj-kernel/src/algorithms/transform.rs @@ -1,16 +1,15 @@ use fj_math::Transform; use crate::{ - iter::ObjectIters, objects::{Cycle, CyclesInFace, Edge, Face, FaceBRep, Vertex}, shape::{LocalForm, Shape}, }; /// Transform a shape -pub fn transform(shape: &Shape, transform: &Transform) -> Vec { +pub fn transform(shape: &[Face], transform: &Transform) -> Vec { let mut target = Vec::new(); - for face in shape.face_iter() { + for face in shape { let face = match face { Face::Face(face) => { let mut tmp = Shape::new(); @@ -32,7 +31,7 @@ pub fn transform(shape: &Shape, transform: &Transform) -> Vec { Face::Triangles(triangles) => { let mut target = Vec::new(); - for (triangle, color) in triangles { + for &(triangle, color) in triangles { let triangle = transform.transform_triangle(&triangle); target.push((triangle, color)); } diff --git a/crates/fj-operations/src/transform.rs b/crates/fj-operations/src/transform.rs index b44acb58b..39eb98380 100644 --- a/crates/fj-operations/src/transform.rs +++ b/crates/fj-operations/src/transform.rs @@ -1,6 +1,7 @@ use fj_interop::debug::DebugInfo; use fj_kernel::{ algorithms::{transform, Tolerance}, + iter::ObjectIters, shape::Shape, validation::{validate, Validated, ValidationConfig, ValidationError}, }; @@ -18,6 +19,7 @@ impl ToShape for fj::Transform { let shape = self.shape.to_shape(config, tolerance, debug_info)?; let shape = shape.into_inner(); + let shape = shape.face_iter().collect::>(); let faces = transform(&shape, &make_transform(self)); let mut target = Shape::new();