Simplify function parameters

This commit is contained in:
Hanno Braun 2025-01-23 21:51:34 +01:00
parent 6c29384c8c
commit 36e472c771
2 changed files with 10 additions and 7 deletions

View File

@ -24,9 +24,11 @@ pub fn model() -> AnyOp {
sketch.to_face(surface, &mut stores.vertices)
};
let bottom = top
.flip(&mut stores.surfaces)
.translate([0., 0., -1.], &mut stores);
let bottom = top.flip(&mut stores.surfaces).translate(
[0., 0., -1.],
&mut stores.surfaces,
&mut stores.vertices,
);
let [a, b, c, d] = bottom.vertices().collect_array().unwrap();
let [e, f, g, h] = top.vertices().collect_array().unwrap();

View File

@ -3,7 +3,7 @@ use spade::Triangulation;
use crate::{
geometry::{AnyOp, Handle, Operation, TriMesh, Triangle},
math::{Plane, Point, Vector},
storage::{Store, Stores},
storage::Store,
};
use super::Vertex;
@ -39,16 +39,17 @@ impl Face {
pub fn translate(
&self,
offset: impl Into<Vector<3>>,
stores: &mut Stores,
surfaces: &mut Store<Plane>,
vertices: &mut Store<Vertex>,
) -> Self {
let offset = offset.into();
Self {
surface: stores.surfaces.insert(self.surface.translate(offset)),
surface: surfaces.insert(self.surface.translate(offset)),
vertices: self
.vertices
.iter()
.map(|vertex| stores.vertices.insert(vertex.translate(offset)))
.map(|vertex| vertices.insert(vertex.translate(offset)))
.collect(),
}
}