Add Face::translate

This commit is contained in:
Hanno Braun 2025-01-20 19:32:09 +01:00
parent e92296a1f0
commit 467b66750f

View File

@ -2,8 +2,8 @@ use spade::Triangulation;
use crate::{
geometry::{AnyOp, Handle, Operation, Sketch, TriMesh, Triangle},
math::{Plane, Point},
storage::Store,
math::{Plane, Point, Vector},
storage::{Store, Stores},
};
use super::Vertex;
@ -45,6 +45,24 @@ impl Face {
vertices: self.vertices.clone(),
}
}
#[allow(unused)] // code that uses it is being worked on
pub fn translate(
&self,
offset: impl Into<Vector<3>>,
stores: &mut Stores,
) -> Self {
let offset = offset.into();
Self {
surface: stores.get().insert(self.surface.translate(offset)),
vertices: self
.vertices
.iter()
.map(|vertex| stores.get().insert(vertex.translate(offset)))
.collect(),
}
}
}
impl Operation for Face {