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) sketch.to_face(surface, &mut stores.vertices)
}; };
let bottom = top let bottom = top.flip(&mut stores.surfaces).translate(
.flip(&mut stores.surfaces) [0., 0., -1.],
.translate([0., 0., -1.], &mut stores); &mut stores.surfaces,
&mut stores.vertices,
);
let [a, b, c, d] = bottom.vertices().collect_array().unwrap(); let [a, b, c, d] = bottom.vertices().collect_array().unwrap();
let [e, f, g, h] = top.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::{ use crate::{
geometry::{AnyOp, Handle, Operation, TriMesh, Triangle}, geometry::{AnyOp, Handle, Operation, TriMesh, Triangle},
math::{Plane, Point, Vector}, math::{Plane, Point, Vector},
storage::{Store, Stores}, storage::Store,
}; };
use super::Vertex; use super::Vertex;
@ -39,16 +39,17 @@ impl Face {
pub fn translate( pub fn translate(
&self, &self,
offset: impl Into<Vector<3>>, offset: impl Into<Vector<3>>,
stores: &mut Stores, surfaces: &mut Store<Plane>,
vertices: &mut Store<Vertex>,
) -> Self { ) -> Self {
let offset = offset.into(); let offset = offset.into();
Self { Self {
surface: stores.surfaces.insert(self.surface.translate(offset)), surface: surfaces.insert(self.surface.translate(offset)),
vertices: self vertices: self
.vertices .vertices
.iter() .iter()
.map(|vertex| stores.vertices.insert(vertex.translate(offset))) .map(|vertex| vertices.insert(vertex.translate(offset)))
.collect(), .collect(),
} }
} }