mirror of
https://github.com/hannobraun/Fornjot
synced 2025-11-26 17:32:03 +00:00
Add Face::translate
This commit is contained in:
parent
e92296a1f0
commit
467b66750f
@ -2,8 +2,8 @@ use spade::Triangulation;
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
geometry::{AnyOp, Handle, Operation, Sketch, TriMesh, Triangle},
|
geometry::{AnyOp, Handle, Operation, Sketch, TriMesh, Triangle},
|
||||||
math::{Plane, Point},
|
math::{Plane, Point, Vector},
|
||||||
storage::Store,
|
storage::{Store, Stores},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::Vertex;
|
use super::Vertex;
|
||||||
@ -45,6 +45,24 @@ impl Face {
|
|||||||
vertices: self.vertices.clone(),
|
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 {
|
impl Operation for Face {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user