diff --git a/crates/fj-kernel/src/algorithms/transform/mod.rs b/crates/fj-kernel/src/algorithms/transform/mod.rs index c8d831468..f262a2750 100644 --- a/crates/fj-kernel/src/algorithms/transform/mod.rs +++ b/crates/fj-kernel/src/algorithms/transform/mod.rs @@ -4,7 +4,6 @@ mod curve; mod cycle; mod edge; mod face; -mod path; mod shell; mod sketch; mod solid; diff --git a/crates/fj-kernel/src/algorithms/transform/path.rs b/crates/fj-kernel/src/algorithms/transform/path.rs deleted file mode 100644 index 1f15d3321..000000000 --- a/crates/fj-kernel/src/algorithms/transform/path.rs +++ /dev/null @@ -1,22 +0,0 @@ -use fj_math::Transform; - -use crate::{objects::Objects, path::GlobalPath, validate::ValidationError}; - -use super::TransformObject; - -impl TransformObject for GlobalPath { - fn transform( - self, - transform: &Transform, - _: &Objects, - ) -> Result { - match self { - Self::Circle(curve) => { - Ok(Self::Circle(transform.transform_circle(&curve))) - } - Self::Line(curve) => { - Ok(Self::Line(transform.transform_line(&curve))) - } - } - } -} diff --git a/crates/fj-kernel/src/algorithms/transform/surface.rs b/crates/fj-kernel/src/algorithms/transform/surface.rs index 61edf94fd..f05007520 100644 --- a/crates/fj-kernel/src/algorithms/transform/surface.rs +++ b/crates/fj-kernel/src/algorithms/transform/surface.rs @@ -15,7 +15,7 @@ impl TransformObject for Handle { objects: &Objects, ) -> Result { Ok(objects.surfaces.insert(Surface::new( - self.u().transform(transform, objects)?, + self.u().transform(transform), transform.transform_vector(&self.v()), ))?) } diff --git a/crates/fj-kernel/src/path.rs b/crates/fj-kernel/src/path.rs index 16e01a6b4..a4b7a528b 100644 --- a/crates/fj-kernel/src/path.rs +++ b/crates/fj-kernel/src/path.rs @@ -22,7 +22,7 @@ //! [`Surface`]: crate::objects::Surface //! [#1021]: https://github.com/hannobraun/Fornjot/issues/1021 -use fj_math::{Circle, Line, Point, Scalar, Vector}; +use fj_math::{Circle, Line, Point, Scalar, Transform, Vector}; /// A path through surface (2D) space #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] @@ -141,4 +141,15 @@ impl GlobalPath { Self::Line(line) => line.vector_from_line_coords(vector), } } + + /// Transform the path + #[must_use] + pub fn transform(self, transform: &Transform) -> Self { + match self { + Self::Circle(curve) => { + Self::Circle(transform.transform_circle(&curve)) + } + Self::Line(curve) => Self::Line(transform.transform_line(&curve)), + } + } }