diff --git a/experiments/2024-12-09/src/geometry/sketch.rs b/experiments/2024-12-09/src/geometry/sketch.rs index 604f561b2..cb78b3cdc 100644 --- a/experiments/2024-12-09/src/geometry/sketch.rs +++ b/experiments/2024-12-09/src/geometry/sketch.rs @@ -14,7 +14,7 @@ impl Sketch { pub fn to_face( &self, surface: Handle, - vertices: &mut Store, + _: &mut Store, ) -> Face { let vertices = self .points @@ -23,7 +23,7 @@ impl Sketch { .map(|point| { let point = surface.point_from_local(point); let vertex = Vertex::from(point); - vertices.insert(vertex) + Handle::new(vertex) }) .collect::>(); diff --git a/experiments/2024-12-09/src/model.rs b/experiments/2024-12-09/src/model.rs index 56a14e51f..01d71a655 100644 --- a/experiments/2024-12-09/src/model.rs +++ b/experiments/2024-12-09/src/model.rs @@ -1,5 +1,5 @@ use crate::{ - geometry::{AnyOp, Sketch}, + geometry::{AnyOp, Handle, Sketch}, math::{Bivector, Plane, Point, Vector}, storage::Stores, topology::sweep::SweepExt, @@ -12,7 +12,7 @@ pub fn model() -> AnyOp { let sketch = Sketch::from([[-0.5, -0.5], [0.5, -0.5], [0.5, 0.5], [-0.5, 0.5]]); - let surface = stores.surfaces.insert(Plane { + let surface = Handle::new(Plane { origin: Point::from([0., 0., 0.5]), coords: Bivector { a: Vector::from([1., 0., 0.]), @@ -23,7 +23,7 @@ pub fn model() -> AnyOp { sketch.to_face(surface, &mut stores.vertices) }; - let top = stores.faces.insert(top); + let top = Handle::new(top); let solid = top.sweep( [0., 0., -1.], diff --git a/experiments/2024-12-09/src/storage.rs b/experiments/2024-12-09/src/storage.rs index 8a9189b1f..e729968f5 100644 --- a/experiments/2024-12-09/src/storage.rs +++ b/experiments/2024-12-09/src/storage.rs @@ -1,7 +1,6 @@ use std::marker::PhantomData; use crate::{ - geometry::Handle, math::Plane, topology::{face::Face, vertex::Vertex}, }; @@ -27,10 +26,6 @@ impl Store { pub fn new() -> Self { Self { _t: PhantomData } } - - pub fn insert(&mut self, op: T) -> Handle { - Handle::new(op) - } } impl Default for Store { diff --git a/experiments/2024-12-09/src/topology/face.rs b/experiments/2024-12-09/src/topology/face.rs index 85f7d483c..e2fc99390 100644 --- a/experiments/2024-12-09/src/topology/face.rs +++ b/experiments/2024-12-09/src/topology/face.rs @@ -40,9 +40,9 @@ impl Face { .map(|(a, b)| [a, b]) } - pub fn flip(&self, surfaces: &mut Store) -> Self { + pub fn flip(&self, _: &mut Store) -> Self { Self { - surface: surfaces.insert(self.surface.flip()), + surface: Handle::new(self.surface.flip()), vertices: self.vertices.clone(), } } @@ -50,17 +50,17 @@ impl Face { pub fn translate( &self, offset: impl Into>, - surfaces: &mut Store, - vertices: &mut Store, + _: &mut Store, + _: &mut Store, ) -> Self { let offset = offset.into(); Self { - surface: surfaces.insert(self.surface.translate(offset)), + surface: Handle::new(self.surface.translate(offset)), vertices: self .vertices .iter() - .map(|vertex| vertices.insert(vertex.translate(offset))) + .map(|vertex| Handle::new(vertex.translate(offset))) .collect(), } } diff --git a/experiments/2024-12-09/src/topology/solid.rs b/experiments/2024-12-09/src/topology/solid.rs index 691637269..5be227829 100644 --- a/experiments/2024-12-09/src/topology/solid.rs +++ b/experiments/2024-12-09/src/topology/solid.rs @@ -37,8 +37,8 @@ impl Solid { /// this operation. pub fn connect_faces( [a, b]: [Handle; 2], - faces: &mut Store, - surfaces: &mut Store, + _: &mut Store, + _: &mut Store, ) -> Self { assert_eq!( a.vertices().count(), @@ -50,14 +50,14 @@ impl Solid { .half_edges() .zip(b.half_edges()) .map(|([q, r], [t, s])| { - let surface = surfaces.insert(Plane::from_points( + let surface = Handle::new(Plane::from_points( [q, r, s].map(|vertex| vertex.point), )); let face = Face::new( surface, [q, r, s, t].map(|vertex| vertex.clone()), ); - faces.insert(face) + Handle::new(face) }) .collect::>(); diff --git a/experiments/2024-12-09/src/topology/sweep.rs b/experiments/2024-12-09/src/topology/sweep.rs index 75028c7f7..70d5fac33 100644 --- a/experiments/2024-12-09/src/topology/sweep.rs +++ b/experiments/2024-12-09/src/topology/sweep.rs @@ -38,8 +38,9 @@ impl SweepExt for Handle { vertices: &mut Store, ) -> Sweep { let bottom = self; - let top = faces - .insert(bottom.flip(surfaces).translate(path, surfaces, vertices)); + let top = Handle::new( + bottom.flip(surfaces).translate(path, surfaces, vertices), + ); let solid = Solid::connect_faces([top, bottom], faces, surfaces);