From 332394ba43440eb9021b0304815567b0a9bf4194 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Wed, 5 Oct 2022 13:44:28 +0200 Subject: [PATCH] Don't duplicate surface when transforming `Face` --- .../src/algorithms/transform/face.rs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/transform/face.rs b/crates/fj-kernel/src/algorithms/transform/face.rs index 608dbd9b9..79c18d542 100644 --- a/crates/fj-kernel/src/algorithms/transform/face.rs +++ b/crates/fj-kernel/src/algorithms/transform/face.rs @@ -2,6 +2,7 @@ use fj_math::Transform; use crate::{ objects::{Face, Faces}, + partial::HasPartial, stores::Stores, }; @@ -9,10 +10,20 @@ use super::TransformObject; impl TransformObject for Face { fn transform(self, transform: &Transform, stores: &Stores) -> Self { - let exterior = self.exterior().clone().transform(transform, stores); - let interiors = self - .interiors() - .map(|cycle| cycle.clone().transform(transform, stores)); + let surface = self.surface().clone().transform(transform, stores); + let exterior = self + .exterior() + .to_partial() + .transform(transform, stores) + .with_surface(surface.clone()) + .build(stores); + let interiors = self.interiors().map(|cycle| { + cycle + .to_partial() + .transform(transform, stores) + .with_surface(surface.clone()) + .build(stores) + }); let color = self.color();