diff --git a/src/kernel/topology/edges.rs b/src/kernel/topology/edges.rs index 1e99a7e0a..8238e9c02 100644 --- a/src/kernel/topology/edges.rs +++ b/src/kernel/topology/edges.rs @@ -155,6 +155,10 @@ impl Edge { #[must_use] pub fn transform(mut self, transform: &Isometry) -> Self { self.curve = self.curve.transform(transform); + self.vertices = self + .vertices + .map(|vertices| vertices.map(|vertex| vertex.transform(transform))); + self } } diff --git a/src/kernel/topology/vertices.rs b/src/kernel/topology/vertices.rs index c966f0401..d9f648ffe 100644 --- a/src/kernel/topology/vertices.rs +++ b/src/kernel/topology/vertices.rs @@ -1,3 +1,5 @@ +use parry3d_f64::math::Isometry; + use crate::{kernel::geometry::Curve, math::Point}; /// The vertices of a shape @@ -71,4 +73,14 @@ impl Vertex { pub fn location(&self) -> &Point { &self.location } + + /// Create a transformed vertex + /// + /// The transformed vertex has its canonical form transformed by the + /// transformation provided, but is otherwise identical. + #[must_use] + pub fn transform(mut self, transform: &Isometry) -> Self { + self.canonical = transform.transform_point(&self.canonical); + self + } }