Skip to content

Commit

Permalink
Fix edge vertices not being transformed with edge
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Feb 10, 2022
1 parent 0b4ea9a commit d300dd8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/kernel/topology/edges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ impl Edge {
#[must_use]
pub fn transform(mut self, transform: &Isometry<f64>) -> Self {
self.curve = self.curve.transform(transform);
self.vertices = self
.vertices
.map(|vertices| vertices.map(|vertex| vertex.transform(transform)));

self
}
}
12 changes: 12 additions & 0 deletions src/kernel/topology/vertices.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use parry3d_f64::math::Isometry;

use crate::{kernel::geometry::Curve, math::Point};

/// The vertices of a shape
Expand Down Expand Up @@ -71,4 +73,14 @@ impl<const D: usize> Vertex<D> {
pub fn location(&self) -> &Point<D> {
&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<f64>) -> Self {
self.canonical = transform.transform_point(&self.canonical);
self
}
}

0 comments on commit d300dd8

Please sign in to comment.