From 3eee6a227c3037516916f0a10033733f99c09e8c Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:02:30 +0200 Subject: [PATCH 01/57] Move `Stores` to `objects` `Stores` isn't really part of the infrastructure in `stores`, it just uses it. Moving it to `objects` removes the weird dependency cycle between `stores` and `objects`. --- .../fj-kernel/src/algorithms/approx/curve.rs | 4 +-- .../src/algorithms/intersect/curve_edge.rs | 4 +-- .../src/algorithms/intersect/curve_face.rs | 4 +-- .../src/algorithms/intersect/face_face.rs | 8 ++--- .../src/algorithms/intersect/face_point.rs | 3 +- .../src/algorithms/intersect/ray_face.rs | 3 +- .../algorithms/intersect/surface_surface.rs | 8 ++--- .../fj-kernel/src/algorithms/sweep/curve.rs | 4 +-- crates/fj-kernel/src/algorithms/sweep/edge.rs | 6 ++-- crates/fj-kernel/src/algorithms/sweep/face.rs | 6 ++-- crates/fj-kernel/src/algorithms/sweep/mod.rs | 2 +- .../fj-kernel/src/algorithms/sweep/sketch.rs | 5 +-- .../fj-kernel/src/algorithms/sweep/vertex.rs | 10 +++--- .../src/algorithms/transform/curve.rs | 4 +-- .../src/algorithms/transform/cycle.rs | 2 +- .../src/algorithms/transform/edge.rs | 4 +-- .../src/algorithms/transform/face.rs | 3 +- .../fj-kernel/src/algorithms/transform/mod.rs | 2 +- .../src/algorithms/transform/path.rs | 2 +- .../src/algorithms/transform/shell.rs | 2 +- .../src/algorithms/transform/sketch.rs | 2 +- .../src/algorithms/transform/solid.rs | 2 +- .../src/algorithms/transform/surface.rs | 4 +-- .../src/algorithms/transform/vertex.rs | 2 +- .../src/algorithms/triangulate/mod.rs | 3 +- .../fj-kernel/src/algorithms/validate/mod.rs | 11 +++---- crates/fj-kernel/src/builder/face.rs | 4 +-- crates/fj-kernel/src/builder/shell.rs | 5 +-- crates/fj-kernel/src/builder/sketch.rs | 4 +-- crates/fj-kernel/src/builder/solid.rs | 5 +-- crates/fj-kernel/src/iter.rs | 4 +-- crates/fj-kernel/src/objects/curve.rs | 4 +-- crates/fj-kernel/src/objects/edge.rs | 5 ++- crates/fj-kernel/src/objects/face.rs | 7 ++-- crates/fj-kernel/src/objects/mod.rs | 33 ++++++++++++++++++- crates/fj-kernel/src/objects/shell.rs | 4 +-- crates/fj-kernel/src/objects/sketch.rs | 7 ++-- crates/fj-kernel/src/objects/solid.rs | 4 +-- crates/fj-kernel/src/objects/vertex.rs | 4 +-- crates/fj-kernel/src/partial/maybe_partial.rs | 6 ++-- crates/fj-kernel/src/partial/objects/curve.rs | 4 +-- crates/fj-kernel/src/partial/objects/cycle.rs | 4 +-- crates/fj-kernel/src/partial/objects/edge.rs | 6 ++-- crates/fj-kernel/src/partial/objects/mod.rs | 5 +-- .../fj-kernel/src/partial/objects/vertex.rs | 4 +-- crates/fj-kernel/src/partial/traits.rs | 2 +- crates/fj-kernel/src/stores/mod.rs | 32 ------------------ crates/fj-operations/src/difference_2d.rs | 3 +- crates/fj-operations/src/group.rs | 3 +- crates/fj-operations/src/lib.rs | 3 +- crates/fj-operations/src/planes.rs | 4 +-- crates/fj-operations/src/shape_processor.rs | 2 +- crates/fj-operations/src/sketch.rs | 3 +- crates/fj-operations/src/sweep.rs | 3 +- crates/fj-operations/src/transform.rs | 3 +- 55 files changed, 131 insertions(+), 156 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/approx/curve.rs b/crates/fj-kernel/src/algorithms/approx/curve.rs index 4e2bbc354..a33ae87b5 100644 --- a/crates/fj-kernel/src/algorithms/approx/curve.rs +++ b/crates/fj-kernel/src/algorithms/approx/curve.rs @@ -197,10 +197,10 @@ mod tests { use crate::{ algorithms::approx::{path::RangeOnPath, Approx, ApproxPoint}, - objects::{Curve, Surface}, + objects::{Curve, Stores, Surface}, partial::HasPartial, path::GlobalPath, - stores::{Handle, Stores}, + stores::Handle, }; use super::CurveApprox; diff --git a/crates/fj-kernel/src/algorithms/intersect/curve_edge.rs b/crates/fj-kernel/src/algorithms/intersect/curve_edge.rs index 9fb5bad74..1e809523a 100644 --- a/crates/fj-kernel/src/algorithms/intersect/curve_edge.rs +++ b/crates/fj-kernel/src/algorithms/intersect/curve_edge.rs @@ -75,9 +75,9 @@ mod tests { use fj_math::Point; use crate::{ - objects::{Curve, HalfEdge, Surface}, + objects::{Curve, HalfEdge, Stores, Surface}, partial::HasPartial, - stores::{Handle, Stores}, + stores::Handle, }; use super::CurveEdgeIntersection; diff --git a/crates/fj-kernel/src/algorithms/intersect/curve_face.rs b/crates/fj-kernel/src/algorithms/intersect/curve_face.rs index 1f069af73..7013eb00c 100644 --- a/crates/fj-kernel/src/algorithms/intersect/curve_face.rs +++ b/crates/fj-kernel/src/algorithms/intersect/curve_face.rs @@ -156,9 +156,9 @@ where #[cfg(test)] mod tests { use crate::{ - objects::{Curve, Face, Surface}, + objects::{Curve, Face, Stores, Surface}, partial::HasPartial, - stores::{Handle, Stores}, + stores::Handle, }; use super::CurveFaceIntersection; diff --git a/crates/fj-kernel/src/algorithms/intersect/face_face.rs b/crates/fj-kernel/src/algorithms/intersect/face_face.rs index 35376bf22..fd6e5a3c8 100644 --- a/crates/fj-kernel/src/algorithms/intersect/face_face.rs +++ b/crates/fj-kernel/src/algorithms/intersect/face_face.rs @@ -1,6 +1,6 @@ use crate::{ - objects::{Curve, Face}, - stores::{Handle, Stores}, + objects::{Curve, Face, Stores}, + stores::Handle, }; use super::{CurveFaceIntersection, SurfaceSurfaceIntersection}; @@ -64,9 +64,9 @@ mod tests { use crate::{ algorithms::intersect::CurveFaceIntersection, - objects::{Curve, Face, Surface}, + objects::{Curve, Face, Stores, Surface}, partial::HasPartial, - stores::{Handle, Stores}, + stores::Handle, }; use super::FaceFaceIntersection; diff --git a/crates/fj-kernel/src/algorithms/intersect/face_point.rs b/crates/fj-kernel/src/algorithms/intersect/face_point.rs index 21721708d..671723119 100644 --- a/crates/fj-kernel/src/algorithms/intersect/face_point.rs +++ b/crates/fj-kernel/src/algorithms/intersect/face_point.rs @@ -134,8 +134,7 @@ mod tests { use crate::{ algorithms::intersect::{face_point::FacePointIntersection, Intersect}, iter::ObjectIters, - objects::{Face, Surface}, - stores::Stores, + objects::{Face, Stores, Surface}, }; #[test] diff --git a/crates/fj-kernel/src/algorithms/intersect/ray_face.rs b/crates/fj-kernel/src/algorithms/intersect/ray_face.rs index ebe6997da..b13cfa167 100644 --- a/crates/fj-kernel/src/algorithms/intersect/ray_face.rs +++ b/crates/fj-kernel/src/algorithms/intersect/ray_face.rs @@ -152,8 +152,7 @@ mod tests { transform::TransformObject, }, iter::ObjectIters, - objects::{Face, Surface}, - stores::Stores, + objects::{Face, Stores, Surface}, }; #[test] diff --git a/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs b/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs index a7350c56c..dccc41e34 100644 --- a/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs +++ b/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs @@ -1,9 +1,9 @@ use fj_math::{Line, Plane, Point, Scalar}; use crate::{ - objects::{Curve, GlobalCurve, Surface}, + objects::{Curve, GlobalCurve, Stores, Surface}, path::{GlobalPath, SurfacePath}, - stores::{Handle, Stores}, + stores::Handle, }; /// The intersection between two surfaces @@ -88,9 +88,9 @@ mod tests { use crate::{ algorithms::transform::TransformObject, - objects::{Curve, Surface}, + objects::{Curve, Stores, Surface}, partial::HasPartial, - stores::{Handle, Stores}, + stores::Handle, }; use super::SurfaceSurfaceIntersection; diff --git a/crates/fj-kernel/src/algorithms/sweep/curve.rs b/crates/fj-kernel/src/algorithms/sweep/curve.rs index a712c28c0..2d27c1754 100644 --- a/crates/fj-kernel/src/algorithms/sweep/curve.rs +++ b/crates/fj-kernel/src/algorithms/sweep/curve.rs @@ -1,9 +1,9 @@ use fj_math::{Circle, Line, Vector}; use crate::{ - objects::{Curve, Surface}, + objects::{Curve, Stores, Surface}, path::{GlobalPath, SurfacePath}, - stores::{Handle, Stores}, + stores::Handle, }; use super::Sweep; diff --git a/crates/fj-kernel/src/algorithms/sweep/edge.rs b/crates/fj-kernel/src/algorithms/sweep/edge.rs index 268f5793b..9a7635966 100644 --- a/crates/fj-kernel/src/algorithms/sweep/edge.rs +++ b/crates/fj-kernel/src/algorithms/sweep/edge.rs @@ -4,10 +4,9 @@ use fj_math::{Line, Scalar, Vector}; use crate::{ algorithms::{reverse::Reverse, transform::TransformObject}, objects::{ - Curve, Cycle, Face, GlobalEdge, HalfEdge, SurfaceVertex, Vertex, + Curve, Cycle, Face, GlobalEdge, HalfEdge, Stores, SurfaceVertex, Vertex, }, path::SurfacePath, - stores::Stores, }; use super::Sweep; @@ -184,9 +183,8 @@ mod tests { use crate::{ algorithms::{reverse::Reverse, sweep::Sweep}, - objects::{Cycle, Face, HalfEdge, Surface}, + objects::{Cycle, Face, HalfEdge, Stores, Surface}, partial::HasPartial, - stores::Stores, }; #[test] diff --git a/crates/fj-kernel/src/algorithms/sweep/face.rs b/crates/fj-kernel/src/algorithms/sweep/face.rs index 1aa8122ff..98ce31e7d 100644 --- a/crates/fj-kernel/src/algorithms/sweep/face.rs +++ b/crates/fj-kernel/src/algorithms/sweep/face.rs @@ -2,9 +2,8 @@ use fj_math::{Scalar, Vector}; use crate::{ algorithms::{reverse::Reverse, transform::TransformObject}, - objects::{Face, Shell}, + objects::{Face, Shell, Stores}, path::GlobalPath, - stores::Stores, }; use super::Sweep; @@ -77,9 +76,8 @@ mod tests { use crate::{ algorithms::{reverse::Reverse, transform::TransformObject}, - objects::{Face, HalfEdge, Sketch, Surface}, + objects::{Face, HalfEdge, Sketch, Stores, Surface}, partial::HasPartial, - stores::Stores, }; use super::Sweep; diff --git a/crates/fj-kernel/src/algorithms/sweep/mod.rs b/crates/fj-kernel/src/algorithms/sweep/mod.rs index bf898cf1e..7eb4d4a14 100644 --- a/crates/fj-kernel/src/algorithms/sweep/mod.rs +++ b/crates/fj-kernel/src/algorithms/sweep/mod.rs @@ -8,7 +8,7 @@ mod vertex; use fj_math::Vector; -use crate::stores::Stores; +use crate::objects::Stores; /// Sweep an object along a path to create another object pub trait Sweep { diff --git a/crates/fj-kernel/src/algorithms/sweep/sketch.rs b/crates/fj-kernel/src/algorithms/sweep/sketch.rs index 43bf8a54b..8506f5054 100644 --- a/crates/fj-kernel/src/algorithms/sweep/sketch.rs +++ b/crates/fj-kernel/src/algorithms/sweep/sketch.rs @@ -1,9 +1,6 @@ use fj_math::Vector; -use crate::{ - objects::{Sketch, Solid}, - stores::Stores, -}; +use crate::objects::{Sketch, Solid, Stores}; use super::Sweep; diff --git a/crates/fj-kernel/src/algorithms/sweep/vertex.rs b/crates/fj-kernel/src/algorithms/sweep/vertex.rs index 15c1a7c30..716aa301d 100644 --- a/crates/fj-kernel/src/algorithms/sweep/vertex.rs +++ b/crates/fj-kernel/src/algorithms/sweep/vertex.rs @@ -2,11 +2,11 @@ use fj_math::{Line, Point, Scalar, Vector}; use crate::{ objects::{ - Curve, GlobalCurve, GlobalEdge, GlobalVertex, HalfEdge, Surface, - SurfaceVertex, Vertex, + Curve, GlobalCurve, GlobalEdge, GlobalVertex, HalfEdge, Stores, + Surface, SurfaceVertex, Vertex, }, path::SurfacePath, - stores::{Handle, Stores}, + stores::Handle, }; use super::Sweep; @@ -146,9 +146,9 @@ mod tests { use crate::{ algorithms::sweep::Sweep, - objects::{Curve, HalfEdge, Surface, Vertex}, + objects::{Curve, HalfEdge, Stores, Surface, Vertex}, partial::HasPartial, - stores::{Handle, Stores}, + stores::Handle, }; #[test] diff --git a/crates/fj-kernel/src/algorithms/transform/curve.rs b/crates/fj-kernel/src/algorithms/transform/curve.rs index 8f91ec78a..80f9120ba 100644 --- a/crates/fj-kernel/src/algorithms/transform/curve.rs +++ b/crates/fj-kernel/src/algorithms/transform/curve.rs @@ -1,9 +1,9 @@ use fj_math::Transform; use crate::{ - objects::GlobalCurve, + objects::{GlobalCurve, Stores}, partial::PartialCurve, - stores::{Handle, Stores}, + stores::Handle, }; use super::TransformObject; diff --git a/crates/fj-kernel/src/algorithms/transform/cycle.rs b/crates/fj-kernel/src/algorithms/transform/cycle.rs index b59b312e0..46a4b9e5c 100644 --- a/crates/fj-kernel/src/algorithms/transform/cycle.rs +++ b/crates/fj-kernel/src/algorithms/transform/cycle.rs @@ -1,6 +1,6 @@ use fj_math::Transform; -use crate::{partial::PartialCycle, stores::Stores}; +use crate::{objects::Stores, partial::PartialCycle}; use super::TransformObject; diff --git a/crates/fj-kernel/src/algorithms/transform/edge.rs b/crates/fj-kernel/src/algorithms/transform/edge.rs index ba661a16d..3e590c6f8 100644 --- a/crates/fj-kernel/src/algorithms/transform/edge.rs +++ b/crates/fj-kernel/src/algorithms/transform/edge.rs @@ -1,9 +1,9 @@ use fj_math::Transform; use crate::{ - objects::Curve, + objects::{Curve, Stores}, partial::{MaybePartial, PartialGlobalEdge, PartialHalfEdge}, - stores::{Handle, Stores}, + stores::Handle, }; use super::TransformObject; diff --git a/crates/fj-kernel/src/algorithms/transform/face.rs b/crates/fj-kernel/src/algorithms/transform/face.rs index 50716afe7..e7a258d50 100644 --- a/crates/fj-kernel/src/algorithms/transform/face.rs +++ b/crates/fj-kernel/src/algorithms/transform/face.rs @@ -1,9 +1,8 @@ use fj_math::Transform; use crate::{ - objects::{Face, Faces}, + objects::{Face, Faces, Stores}, partial::HasPartial, - stores::Stores, }; use super::TransformObject; diff --git a/crates/fj-kernel/src/algorithms/transform/mod.rs b/crates/fj-kernel/src/algorithms/transform/mod.rs index bae1a1524..4851b63a5 100644 --- a/crates/fj-kernel/src/algorithms/transform/mod.rs +++ b/crates/fj-kernel/src/algorithms/transform/mod.rs @@ -14,8 +14,8 @@ mod vertex; use fj_math::{Transform, Vector}; use crate::{ + objects::Stores, partial::{HasPartial, MaybePartial, Partial}, - stores::Stores, }; /// Transform an object diff --git a/crates/fj-kernel/src/algorithms/transform/path.rs b/crates/fj-kernel/src/algorithms/transform/path.rs index b4c998654..dd30962b1 100644 --- a/crates/fj-kernel/src/algorithms/transform/path.rs +++ b/crates/fj-kernel/src/algorithms/transform/path.rs @@ -1,6 +1,6 @@ use fj_math::Transform; -use crate::{path::GlobalPath, stores::Stores}; +use crate::{objects::Stores, path::GlobalPath}; use super::TransformObject; diff --git a/crates/fj-kernel/src/algorithms/transform/shell.rs b/crates/fj-kernel/src/algorithms/transform/shell.rs index d2ebadad9..9d3cf5fec 100644 --- a/crates/fj-kernel/src/algorithms/transform/shell.rs +++ b/crates/fj-kernel/src/algorithms/transform/shell.rs @@ -1,6 +1,6 @@ use fj_math::Transform; -use crate::{objects::Shell, stores::Stores}; +use crate::objects::{Shell, Stores}; use super::TransformObject; diff --git a/crates/fj-kernel/src/algorithms/transform/sketch.rs b/crates/fj-kernel/src/algorithms/transform/sketch.rs index 4a48bb23d..e7eade654 100644 --- a/crates/fj-kernel/src/algorithms/transform/sketch.rs +++ b/crates/fj-kernel/src/algorithms/transform/sketch.rs @@ -1,6 +1,6 @@ use fj_math::Transform; -use crate::{objects::Sketch, stores::Stores}; +use crate::objects::{Sketch, Stores}; use super::TransformObject; diff --git a/crates/fj-kernel/src/algorithms/transform/solid.rs b/crates/fj-kernel/src/algorithms/transform/solid.rs index 558e3a1e0..1bfe44071 100644 --- a/crates/fj-kernel/src/algorithms/transform/solid.rs +++ b/crates/fj-kernel/src/algorithms/transform/solid.rs @@ -1,6 +1,6 @@ use fj_math::Transform; -use crate::{objects::Solid, stores::Stores}; +use crate::objects::{Solid, Stores}; use super::TransformObject; diff --git a/crates/fj-kernel/src/algorithms/transform/surface.rs b/crates/fj-kernel/src/algorithms/transform/surface.rs index 02e35c1e1..e14e33c1c 100644 --- a/crates/fj-kernel/src/algorithms/transform/surface.rs +++ b/crates/fj-kernel/src/algorithms/transform/surface.rs @@ -1,8 +1,8 @@ use fj_math::Transform; use crate::{ - objects::Surface, - stores::{Handle, Stores}, + objects::{Stores, Surface}, + stores::Handle, }; use super::TransformObject; diff --git a/crates/fj-kernel/src/algorithms/transform/vertex.rs b/crates/fj-kernel/src/algorithms/transform/vertex.rs index e451426dc..81004f9d3 100644 --- a/crates/fj-kernel/src/algorithms/transform/vertex.rs +++ b/crates/fj-kernel/src/algorithms/transform/vertex.rs @@ -1,8 +1,8 @@ use fj_math::Transform; use crate::{ + objects::Stores, partial::{PartialGlobalVertex, PartialSurfaceVertex, PartialVertex}, - stores::Stores, }; use super::TransformObject; diff --git a/crates/fj-kernel/src/algorithms/triangulate/mod.rs b/crates/fj-kernel/src/algorithms/triangulate/mod.rs index a756c3cab..6b0ecb813 100644 --- a/crates/fj-kernel/src/algorithms/triangulate/mod.rs +++ b/crates/fj-kernel/src/algorithms/triangulate/mod.rs @@ -84,8 +84,7 @@ mod tests { use crate::{ algorithms::approx::{Approx, Tolerance}, - objects::{Face, Surface}, - stores::Stores, + objects::{Face, Stores, Surface}, }; use super::Triangulate; diff --git a/crates/fj-kernel/src/algorithms/validate/mod.rs b/crates/fj-kernel/src/algorithms/validate/mod.rs index e10e5f1c9..163fac920 100644 --- a/crates/fj-kernel/src/algorithms/validate/mod.rs +++ b/crates/fj-kernel/src/algorithms/validate/mod.rs @@ -36,8 +36,7 @@ pub trait Validate: Sized { /// ``` rust /// # use fj_kernel::{ /// # algorithms::validate::{Validate, ValidationConfig}, - /// # objects::GlobalVertex, - /// # stores::Stores, + /// # objects::{GlobalVertex, Stores}, /// # }; /// # let stores = Stores::new(); /// # let object = GlobalVertex::from_position([0., 0., 0.], &stores); @@ -46,8 +45,7 @@ pub trait Validate: Sized { /// ``` rust /// # use fj_kernel::{ /// # algorithms::validate::{Validate, ValidationConfig}, - /// # objects::GlobalVertex, - /// # stores::Stores, + /// # objects::{GlobalVertex, Stores}, /// # }; /// # let stores = Stores::new(); /// # let object = GlobalVertex::from_position([0., 0., 0.], &stores); @@ -168,12 +166,11 @@ mod tests { use crate::{ algorithms::validate::{Validate, ValidationConfig, ValidationError}, objects::{ - Curve, GlobalCurve, GlobalEdge, GlobalVertex, HalfEdge, Surface, - SurfaceVertex, Vertex, + Curve, GlobalCurve, GlobalEdge, GlobalVertex, HalfEdge, Stores, + Surface, SurfaceVertex, Vertex, }, partial::HasPartial, path::SurfacePath, - stores::Stores, }; #[test] diff --git a/crates/fj-kernel/src/builder/face.rs b/crates/fj-kernel/src/builder/face.rs index cc56be7a7..146035813 100644 --- a/crates/fj-kernel/src/builder/face.rs +++ b/crates/fj-kernel/src/builder/face.rs @@ -1,9 +1,9 @@ use fj_math::Point; use crate::{ - objects::{Cycle, Face, Surface}, + objects::{Cycle, Face, Stores, Surface}, partial::HasPartial, - stores::{Handle, Stores}, + stores::Handle, }; /// API for building a [`Face`] diff --git a/crates/fj-kernel/src/builder/shell.rs b/crates/fj-kernel/src/builder/shell.rs index 2a0707d12..40d7a0117 100644 --- a/crates/fj-kernel/src/builder/shell.rs +++ b/crates/fj-kernel/src/builder/shell.rs @@ -3,10 +3,11 @@ use fj_math::Scalar; use crate::{ algorithms::transform::TransformObject, objects::{ - Curve, Cycle, Face, HalfEdge, Shell, Surface, SurfaceVertex, Vertex, + Curve, Cycle, Face, HalfEdge, Shell, Stores, Surface, SurfaceVertex, + Vertex, }, partial::HasPartial, - stores::{Handle, Stores}, + stores::Handle, }; /// API for building a [`Shell`] diff --git a/crates/fj-kernel/src/builder/sketch.rs b/crates/fj-kernel/src/builder/sketch.rs index dcd7f9bdd..1caa526a2 100644 --- a/crates/fj-kernel/src/builder/sketch.rs +++ b/crates/fj-kernel/src/builder/sketch.rs @@ -1,8 +1,8 @@ use fj_math::Point; use crate::{ - objects::{Face, Sketch, Surface}, - stores::{Handle, Stores}, + objects::{Face, Sketch, Stores, Surface}, + stores::Handle, }; /// API for building a [`Sketch`] diff --git a/crates/fj-kernel/src/builder/solid.rs b/crates/fj-kernel/src/builder/solid.rs index 335a051d7..dadf330b1 100644 --- a/crates/fj-kernel/src/builder/solid.rs +++ b/crates/fj-kernel/src/builder/solid.rs @@ -1,9 +1,6 @@ use fj_math::Scalar; -use crate::{ - objects::{Shell, Solid}, - stores::Stores, -}; +use crate::objects::{Shell, Solid, Stores}; /// API for building a [`Solid`] /// diff --git a/crates/fj-kernel/src/iter.rs b/crates/fj-kernel/src/iter.rs index 52896b4b3..b6ba204c3 100644 --- a/crates/fj-kernel/src/iter.rs +++ b/crates/fj-kernel/src/iter.rs @@ -362,10 +362,10 @@ mod tests { use crate::{ objects::{ Curve, Cycle, Face, GlobalCurve, GlobalVertex, HalfEdge, Shell, - Sketch, Solid, Surface, SurfaceVertex, Vertex, + Sketch, Solid, Stores, Surface, SurfaceVertex, Vertex, }, partial::HasPartial, - stores::{Handle, Stores}, + stores::Handle, }; use super::ObjectIters as _; diff --git a/crates/fj-kernel/src/objects/curve.rs b/crates/fj-kernel/src/objects/curve.rs index 8280b8abf..faaf185a3 100644 --- a/crates/fj-kernel/src/objects/curve.rs +++ b/crates/fj-kernel/src/objects/curve.rs @@ -1,9 +1,9 @@ use crate::{ path::SurfacePath, - stores::{Handle, HandleWrapper, Stores}, + stores::{Handle, HandleWrapper}, }; -use super::Surface; +use super::{Stores, Surface}; /// A curve, defined in local surface coordinates #[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] diff --git a/crates/fj-kernel/src/objects/edge.rs b/crates/fj-kernel/src/objects/edge.rs index a472c577a..0c6284fcf 100644 --- a/crates/fj-kernel/src/objects/edge.rs +++ b/crates/fj-kernel/src/objects/edge.rs @@ -172,7 +172,10 @@ impl VerticesInNormalizedOrder { mod tests { use pretty_assertions::assert_eq; - use crate::{objects::Surface, partial::HasPartial, stores::Stores}; + use crate::{ + objects::{Stores, Surface}, + partial::HasPartial, + }; use super::HalfEdge; diff --git a/crates/fj-kernel/src/objects/face.rs b/crates/fj-kernel/src/objects/face.rs index 3b1ce1267..9cb4d14bd 100644 --- a/crates/fj-kernel/src/objects/face.rs +++ b/crates/fj-kernel/src/objects/face.rs @@ -3,12 +3,9 @@ use std::collections::{btree_set, BTreeSet}; use fj_interop::mesh::Color; use fj_math::Winding; -use crate::{ - builder::FaceBuilder, - stores::{Handle, Stores}, -}; +use crate::{builder::FaceBuilder, stores::Handle}; -use super::{Cycle, Surface}; +use super::{Cycle, Stores, Surface}; /// A face of a shape /// diff --git a/crates/fj-kernel/src/objects/mod.rs b/crates/fj-kernel/src/objects/mod.rs index 8f137b1ff..535698f3b 100644 --- a/crates/fj-kernel/src/objects/mod.rs +++ b/crates/fj-kernel/src/objects/mod.rs @@ -70,7 +70,6 @@ //! As of this writing, most objects are not managed in the centralized object //! storage. Changing this is an ongoing effort ([#1021]). //! -//! [`Stores`]: crate::stores::Stores //! [`Handle`]: crate::stores::Handle //! [#1021]: https://github.com/hannobraun/Fornjot/issues/1021 @@ -84,6 +83,8 @@ mod solid; mod surface; mod vertex; +use crate::stores::Store; + pub use self::{ curve::{Curve, GlobalCurve}, cycle::Cycle, @@ -95,3 +96,33 @@ pub use self::{ surface::Surface, vertex::{GlobalVertex, SurfaceVertex, Vertex}, }; + +/// The available object stores +/// +/// # Implementation Note +/// +/// The intention is to eventually manage all objects in here. Making this +/// happen is simply a case of putting in the required work. See [#1021]. +/// +/// [#1021]: https://github.com/hannobraun/Fornjot/issues/1021 +#[derive(Debug, Default)] +pub struct Stores { + /// Store for curves + pub curves: Store, + + /// Store for global curves + pub global_curves: Store, + + /// Store for global vertices + pub global_vertices: Store, + + /// Store for surfaces + pub surfaces: Store, +} + +impl Stores { + /// Construct a new instance of `Stores` + pub fn new() -> Self { + Self::default() + } +} diff --git a/crates/fj-kernel/src/objects/shell.rs b/crates/fj-kernel/src/objects/shell.rs index f0ed38f60..b8a336a7d 100644 --- a/crates/fj-kernel/src/objects/shell.rs +++ b/crates/fj-kernel/src/objects/shell.rs @@ -1,6 +1,6 @@ -use crate::{builder::ShellBuilder, stores::Stores}; +use crate::builder::ShellBuilder; -use super::{face::Faces, Face}; +use super::{face::Faces, Face, Stores}; /// A 3-dimensional closed shell /// diff --git a/crates/fj-kernel/src/objects/sketch.rs b/crates/fj-kernel/src/objects/sketch.rs index d6dc7b655..0e1d5ce28 100644 --- a/crates/fj-kernel/src/objects/sketch.rs +++ b/crates/fj-kernel/src/objects/sketch.rs @@ -1,9 +1,6 @@ -use crate::{ - builder::SketchBuilder, - stores::{Handle, Stores}, -}; +use crate::{builder::SketchBuilder, stores::Handle}; -use super::{face::Faces, Face, Surface}; +use super::{face::Faces, Face, Stores, Surface}; /// A 2-dimensional shape /// diff --git a/crates/fj-kernel/src/objects/solid.rs b/crates/fj-kernel/src/objects/solid.rs index d0a4c2e8c..4430b0ac6 100644 --- a/crates/fj-kernel/src/objects/solid.rs +++ b/crates/fj-kernel/src/objects/solid.rs @@ -1,8 +1,8 @@ use std::collections::BTreeSet; -use crate::{builder::SolidBuilder, stores::Stores}; +use crate::builder::SolidBuilder; -use super::{Face, Shell}; +use super::{Face, Shell, Stores}; /// A 3-dimensional shape /// diff --git a/crates/fj-kernel/src/objects/vertex.rs b/crates/fj-kernel/src/objects/vertex.rs index 501489482..115f59336 100644 --- a/crates/fj-kernel/src/objects/vertex.rs +++ b/crates/fj-kernel/src/objects/vertex.rs @@ -1,9 +1,9 @@ use fj_math::Point; use pretty_assertions::assert_eq; -use crate::stores::{Handle, Stores}; +use crate::stores::Handle; -use super::{Curve, Surface}; +use super::{Curve, Stores, Surface}; /// A vertex /// diff --git a/crates/fj-kernel/src/partial/maybe_partial.rs b/crates/fj-kernel/src/partial/maybe_partial.rs index 4ca4f7b9c..b6824b965 100644 --- a/crates/fj-kernel/src/partial/maybe_partial.rs +++ b/crates/fj-kernel/src/partial/maybe_partial.rs @@ -2,10 +2,10 @@ use fj_math::Point; use crate::{ objects::{ - Curve, GlobalCurve, GlobalEdge, HalfEdge, Surface, SurfaceVertex, - Vertex, + Curve, GlobalCurve, GlobalEdge, HalfEdge, Stores, Surface, + SurfaceVertex, Vertex, }, - stores::{Handle, Stores}, + stores::Handle, }; use super::{HasPartial, Partial}; diff --git a/crates/fj-kernel/src/partial/objects/curve.rs b/crates/fj-kernel/src/partial/objects/curve.rs index 75acbe30a..ae29324b4 100644 --- a/crates/fj-kernel/src/partial/objects/curve.rs +++ b/crates/fj-kernel/src/partial/objects/curve.rs @@ -1,9 +1,9 @@ use fj_math::{Point, Scalar, Vector}; use crate::{ - objects::{Curve, GlobalCurve, Surface}, + objects::{Curve, GlobalCurve, Stores, Surface}, path::SurfacePath, - stores::{Handle, HandleWrapper, Stores}, + stores::{Handle, HandleWrapper}, }; /// A partial [`Curve`] diff --git a/crates/fj-kernel/src/partial/objects/cycle.rs b/crates/fj-kernel/src/partial/objects/cycle.rs index fca7d660c..3104ec934 100644 --- a/crates/fj-kernel/src/partial/objects/cycle.rs +++ b/crates/fj-kernel/src/partial/objects/cycle.rs @@ -1,9 +1,9 @@ use fj_math::Point; use crate::{ - objects::{Curve, Cycle, HalfEdge, Surface, SurfaceVertex, Vertex}, + objects::{Curve, Cycle, HalfEdge, Stores, Surface, SurfaceVertex, Vertex}, partial::{HasPartial, MaybePartial}, - stores::{Handle, Stores}, + stores::Handle, }; /// A partial [`Cycle`] diff --git a/crates/fj-kernel/src/partial/objects/edge.rs b/crates/fj-kernel/src/partial/objects/edge.rs index 3036720fb..caf5f6849 100644 --- a/crates/fj-kernel/src/partial/objects/edge.rs +++ b/crates/fj-kernel/src/partial/objects/edge.rs @@ -2,11 +2,11 @@ use fj_math::{Point, Scalar}; use crate::{ objects::{ - Curve, GlobalCurve, GlobalEdge, GlobalVertex, HalfEdge, Surface, - SurfaceVertex, Vertex, + Curve, GlobalCurve, GlobalEdge, GlobalVertex, HalfEdge, Stores, + Surface, SurfaceVertex, Vertex, }, partial::{HasPartial, MaybePartial, PartialCurve}, - stores::{Handle, HandleWrapper, Stores}, + stores::{Handle, HandleWrapper}, }; /// A partial [`HalfEdge`] diff --git a/crates/fj-kernel/src/partial/objects/mod.rs b/crates/fj-kernel/src/partial/objects/mod.rs index 15f17bdc7..7262610db 100644 --- a/crates/fj-kernel/src/partial/objects/mod.rs +++ b/crates/fj-kernel/src/partial/objects/mod.rs @@ -5,9 +5,10 @@ pub mod vertex; use crate::{ objects::{ - Curve, Cycle, GlobalEdge, GlobalVertex, HalfEdge, SurfaceVertex, Vertex, + Curve, Cycle, GlobalEdge, GlobalVertex, HalfEdge, Stores, + SurfaceVertex, Vertex, }, - stores::{Handle, Stores}, + stores::Handle, }; use super::{ diff --git a/crates/fj-kernel/src/partial/objects/vertex.rs b/crates/fj-kernel/src/partial/objects/vertex.rs index c15126d2b..7fc7221a1 100644 --- a/crates/fj-kernel/src/partial/objects/vertex.rs +++ b/crates/fj-kernel/src/partial/objects/vertex.rs @@ -1,9 +1,9 @@ use fj_math::Point; use crate::{ - objects::{Curve, GlobalVertex, Surface, SurfaceVertex, Vertex}, + objects::{Curve, GlobalVertex, Stores, Surface, SurfaceVertex, Vertex}, partial::{HasPartial, MaybePartial}, - stores::{Handle, Stores}, + stores::Handle, }; /// A partial [`Vertex`] diff --git a/crates/fj-kernel/src/partial/traits.rs b/crates/fj-kernel/src/partial/traits.rs index 6726cd042..6a91b6215 100644 --- a/crates/fj-kernel/src/partial/traits.rs +++ b/crates/fj-kernel/src/partial/traits.rs @@ -1,4 +1,4 @@ -use crate::stores::Stores; +use crate::objects::Stores; /// Implemented for objects that a partial object type exists for /// diff --git a/crates/fj-kernel/src/stores/mod.rs b/crates/fj-kernel/src/stores/mod.rs index 0e42ea5ea..a19bd1b44 100644 --- a/crates/fj-kernel/src/stores/mod.rs +++ b/crates/fj-kernel/src/stores/mod.rs @@ -4,39 +4,7 @@ mod blocks; mod handle; mod store; -use crate::objects::{Curve, GlobalCurve, GlobalVertex, Surface}; - pub use self::{ handle::{Handle, HandleWrapper, ObjectId}, store::{Iter, Reservation, Store}, }; - -/// The available object stores -/// -/// # Implementation Note -/// -/// The intention is to eventually manage all objects in here. Making this -/// happen is simply a case of putting in the required work. See [#1021]. -/// -/// [#1021]: https://github.com/hannobraun/Fornjot/issues/1021 -#[derive(Debug, Default)] -pub struct Stores { - /// Store for curves - pub curves: Store, - - /// Store for global curves - pub global_curves: Store, - - /// Store for global vertices - pub global_vertices: Store, - - /// Store for surfaces - pub surfaces: Store, -} - -impl Stores { - /// Construct a new instance of `Stores` - pub fn new() -> Self { - Self::default() - } -} diff --git a/crates/fj-operations/src/difference_2d.rs b/crates/fj-operations/src/difference_2d.rs index 9c24fbe67..7e82cb205 100644 --- a/crates/fj-operations/src/difference_2d.rs +++ b/crates/fj-operations/src/difference_2d.rs @@ -5,8 +5,7 @@ use fj_kernel::{ validate::{Validate, Validated, ValidationConfig, ValidationError}, }, iter::ObjectIters, - objects::{Face, Sketch}, - stores::Stores, + objects::{Face, Sketch, Stores}, }; use fj_math::Aabb; diff --git a/crates/fj-operations/src/group.rs b/crates/fj-operations/src/group.rs index bf4670fd6..9093ad4b3 100644 --- a/crates/fj-operations/src/group.rs +++ b/crates/fj-operations/src/group.rs @@ -3,8 +3,7 @@ use fj_kernel::{ algorithms::validate::{ Validate, Validated, ValidationConfig, ValidationError, }, - objects::Faces, - stores::Stores, + objects::{Faces, Stores}, }; use fj_math::Aabb; diff --git a/crates/fj-operations/src/lib.rs b/crates/fj-operations/src/lib.rs index c87387787..91cd5708f 100644 --- a/crates/fj-operations/src/lib.rs +++ b/crates/fj-operations/src/lib.rs @@ -32,8 +32,7 @@ use fj_kernel::{ algorithms::validate::{ Validate, Validated, ValidationConfig, ValidationError, }, - objects::{Faces, Sketch}, - stores::Stores, + objects::{Faces, Sketch, Stores}, }; use fj_math::Aabb; diff --git a/crates/fj-operations/src/planes.rs b/crates/fj-operations/src/planes.rs index 584e2b1ec..c3eddd1f4 100644 --- a/crates/fj-operations/src/planes.rs +++ b/crates/fj-operations/src/planes.rs @@ -1,6 +1,6 @@ use fj_kernel::{ - objects::Surface, - stores::{Handle, Stores}, + objects::{Stores, Surface}, + stores::Handle, }; /// The static planes diff --git a/crates/fj-operations/src/shape_processor.rs b/crates/fj-operations/src/shape_processor.rs index 0800fcbfd..392613935 100644 --- a/crates/fj-operations/src/shape_processor.rs +++ b/crates/fj-operations/src/shape_processor.rs @@ -7,7 +7,7 @@ use fj_kernel::{ triangulate::Triangulate, validate::{ValidationConfig, ValidationError}, }, - stores::Stores, + objects::Stores, }; use fj_math::Scalar; diff --git a/crates/fj-operations/src/sketch.rs b/crates/fj-operations/src/sketch.rs index 5b651322c..9e00ec20a 100644 --- a/crates/fj-operations/src/sketch.rs +++ b/crates/fj-operations/src/sketch.rs @@ -3,9 +3,8 @@ use fj_kernel::{ algorithms::validate::{ Validate, Validated, ValidationConfig, ValidationError, }, - objects::{Cycle, Face, HalfEdge, Sketch}, + objects::{Cycle, Face, HalfEdge, Sketch, Stores}, partial::HasPartial, - stores::Stores, }; use fj_math::{Aabb, Point}; diff --git a/crates/fj-operations/src/sweep.rs b/crates/fj-operations/src/sweep.rs index 15438e4a3..59821b63d 100644 --- a/crates/fj-operations/src/sweep.rs +++ b/crates/fj-operations/src/sweep.rs @@ -4,8 +4,7 @@ use fj_kernel::{ sweep::Sweep, validate::{Validate, Validated, ValidationConfig, ValidationError}, }, - objects::Solid, - stores::Stores, + objects::{Solid, Stores}, }; use fj_math::{Aabb, Vector}; diff --git a/crates/fj-operations/src/transform.rs b/crates/fj-operations/src/transform.rs index 959993883..c13134ca2 100644 --- a/crates/fj-operations/src/transform.rs +++ b/crates/fj-operations/src/transform.rs @@ -4,8 +4,7 @@ use fj_kernel::{ transform::TransformObject, validate::{Validate, Validated, ValidationConfig, ValidationError}, }, - objects::Faces, - stores::Stores, + objects::{Faces, Stores}, }; use fj_math::{Aabb, Transform, Vector}; From 5e8773c264cd0560cad79b25e8d68a65b8705817 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:05:01 +0200 Subject: [PATCH 02/57] Rename `stores` to `storage` Without `Stores` in there, the old name no longer really fit. --- crates/fj-kernel/src/algorithms/approx/curve.rs | 4 ++-- crates/fj-kernel/src/algorithms/approx/mod.rs | 2 +- crates/fj-kernel/src/algorithms/intersect/curve_edge.rs | 2 +- crates/fj-kernel/src/algorithms/intersect/curve_face.rs | 2 +- crates/fj-kernel/src/algorithms/intersect/face_face.rs | 4 ++-- crates/fj-kernel/src/algorithms/intersect/surface_surface.rs | 4 ++-- crates/fj-kernel/src/algorithms/sweep/curve.rs | 2 +- crates/fj-kernel/src/algorithms/sweep/vertex.rs | 4 ++-- crates/fj-kernel/src/algorithms/transform/curve.rs | 2 +- crates/fj-kernel/src/algorithms/transform/edge.rs | 2 +- crates/fj-kernel/src/algorithms/transform/surface.rs | 2 +- crates/fj-kernel/src/builder/face.rs | 2 +- crates/fj-kernel/src/builder/shell.rs | 2 +- crates/fj-kernel/src/builder/sketch.rs | 2 +- crates/fj-kernel/src/iter.rs | 4 ++-- crates/fj-kernel/src/lib.rs | 2 +- crates/fj-kernel/src/objects/curve.rs | 2 +- crates/fj-kernel/src/objects/cycle.rs | 2 +- crates/fj-kernel/src/objects/edge.rs | 2 +- crates/fj-kernel/src/objects/face.rs | 2 +- crates/fj-kernel/src/objects/mod.rs | 4 ++-- crates/fj-kernel/src/objects/sketch.rs | 2 +- crates/fj-kernel/src/objects/vertex.rs | 2 +- crates/fj-kernel/src/partial/maybe_partial.rs | 2 +- crates/fj-kernel/src/partial/objects/curve.rs | 2 +- crates/fj-kernel/src/partial/objects/cycle.rs | 2 +- crates/fj-kernel/src/partial/objects/edge.rs | 2 +- crates/fj-kernel/src/partial/objects/mod.rs | 2 +- crates/fj-kernel/src/partial/objects/vertex.rs | 2 +- crates/fj-kernel/src/{stores => storage}/blocks.rs | 0 crates/fj-kernel/src/{stores => storage}/handle.rs | 0 crates/fj-kernel/src/{stores => storage}/mod.rs | 0 crates/fj-kernel/src/{stores => storage}/store.rs | 0 crates/fj-operations/src/planes.rs | 2 +- 34 files changed, 36 insertions(+), 36 deletions(-) rename crates/fj-kernel/src/{stores => storage}/blocks.rs (100%) rename crates/fj-kernel/src/{stores => storage}/handle.rs (100%) rename crates/fj-kernel/src/{stores => storage}/mod.rs (100%) rename crates/fj-kernel/src/{stores => storage}/store.rs (100%) diff --git a/crates/fj-kernel/src/algorithms/approx/curve.rs b/crates/fj-kernel/src/algorithms/approx/curve.rs index a33ae87b5..462c8b760 100644 --- a/crates/fj-kernel/src/algorithms/approx/curve.rs +++ b/crates/fj-kernel/src/algorithms/approx/curve.rs @@ -14,7 +14,7 @@ use std::collections::BTreeMap; use crate::{ objects::{Curve, GlobalCurve}, path::{GlobalPath, SurfacePath}, - stores::{Handle, ObjectId}, + storage::{Handle, ObjectId}, }; use super::{path::RangeOnPath, Approx, ApproxPoint, Tolerance}; @@ -200,7 +200,7 @@ mod tests { objects::{Curve, Stores, Surface}, partial::HasPartial, path::GlobalPath, - stores::Handle, + storage::Handle, }; use super::CurveApprox; diff --git a/crates/fj-kernel/src/algorithms/approx/mod.rs b/crates/fj-kernel/src/algorithms/approx/mod.rs index eeec9c47a..acedb5665 100644 --- a/crates/fj-kernel/src/algorithms/approx/mod.rs +++ b/crates/fj-kernel/src/algorithms/approx/mod.rs @@ -20,7 +20,7 @@ use std::{ use fj_math::Point; -use crate::{objects::Curve, stores::Handle}; +use crate::{objects::Curve, storage::Handle}; pub use self::tolerance::{InvalidTolerance, Tolerance}; diff --git a/crates/fj-kernel/src/algorithms/intersect/curve_edge.rs b/crates/fj-kernel/src/algorithms/intersect/curve_edge.rs index 1e809523a..1caa83872 100644 --- a/crates/fj-kernel/src/algorithms/intersect/curve_edge.rs +++ b/crates/fj-kernel/src/algorithms/intersect/curve_edge.rs @@ -77,7 +77,7 @@ mod tests { use crate::{ objects::{Curve, HalfEdge, Stores, Surface}, partial::HasPartial, - stores::Handle, + storage::Handle, }; use super::CurveEdgeIntersection; diff --git a/crates/fj-kernel/src/algorithms/intersect/curve_face.rs b/crates/fj-kernel/src/algorithms/intersect/curve_face.rs index 7013eb00c..d38483e14 100644 --- a/crates/fj-kernel/src/algorithms/intersect/curve_face.rs +++ b/crates/fj-kernel/src/algorithms/intersect/curve_face.rs @@ -158,7 +158,7 @@ mod tests { use crate::{ objects::{Curve, Face, Stores, Surface}, partial::HasPartial, - stores::Handle, + storage::Handle, }; use super::CurveFaceIntersection; diff --git a/crates/fj-kernel/src/algorithms/intersect/face_face.rs b/crates/fj-kernel/src/algorithms/intersect/face_face.rs index fd6e5a3c8..e974c1ec2 100644 --- a/crates/fj-kernel/src/algorithms/intersect/face_face.rs +++ b/crates/fj-kernel/src/algorithms/intersect/face_face.rs @@ -1,6 +1,6 @@ use crate::{ objects::{Curve, Face, Stores}, - stores::Handle, + storage::Handle, }; use super::{CurveFaceIntersection, SurfaceSurfaceIntersection}; @@ -66,7 +66,7 @@ mod tests { algorithms::intersect::CurveFaceIntersection, objects::{Curve, Face, Stores, Surface}, partial::HasPartial, - stores::Handle, + storage::Handle, }; use super::FaceFaceIntersection; diff --git a/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs b/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs index dccc41e34..1865e6161 100644 --- a/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs +++ b/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs @@ -3,7 +3,7 @@ use fj_math::{Line, Plane, Point, Scalar}; use crate::{ objects::{Curve, GlobalCurve, Stores, Surface}, path::{GlobalPath, SurfacePath}, - stores::Handle, + storage::Handle, }; /// The intersection between two surfaces @@ -90,7 +90,7 @@ mod tests { algorithms::transform::TransformObject, objects::{Curve, Stores, Surface}, partial::HasPartial, - stores::Handle, + storage::Handle, }; use super::SurfaceSurfaceIntersection; diff --git a/crates/fj-kernel/src/algorithms/sweep/curve.rs b/crates/fj-kernel/src/algorithms/sweep/curve.rs index 2d27c1754..c11a394da 100644 --- a/crates/fj-kernel/src/algorithms/sweep/curve.rs +++ b/crates/fj-kernel/src/algorithms/sweep/curve.rs @@ -3,7 +3,7 @@ use fj_math::{Circle, Line, Vector}; use crate::{ objects::{Curve, Stores, Surface}, path::{GlobalPath, SurfacePath}, - stores::Handle, + storage::Handle, }; use super::Sweep; diff --git a/crates/fj-kernel/src/algorithms/sweep/vertex.rs b/crates/fj-kernel/src/algorithms/sweep/vertex.rs index 716aa301d..be85b72a9 100644 --- a/crates/fj-kernel/src/algorithms/sweep/vertex.rs +++ b/crates/fj-kernel/src/algorithms/sweep/vertex.rs @@ -6,7 +6,7 @@ use crate::{ Surface, SurfaceVertex, Vertex, }, path::SurfacePath, - stores::Handle, + storage::Handle, }; use super::Sweep; @@ -148,7 +148,7 @@ mod tests { algorithms::sweep::Sweep, objects::{Curve, HalfEdge, Stores, Surface, Vertex}, partial::HasPartial, - stores::Handle, + storage::Handle, }; #[test] diff --git a/crates/fj-kernel/src/algorithms/transform/curve.rs b/crates/fj-kernel/src/algorithms/transform/curve.rs index 80f9120ba..e6f207177 100644 --- a/crates/fj-kernel/src/algorithms/transform/curve.rs +++ b/crates/fj-kernel/src/algorithms/transform/curve.rs @@ -3,7 +3,7 @@ use fj_math::Transform; use crate::{ objects::{GlobalCurve, Stores}, partial::PartialCurve, - stores::Handle, + storage::Handle, }; use super::TransformObject; diff --git a/crates/fj-kernel/src/algorithms/transform/edge.rs b/crates/fj-kernel/src/algorithms/transform/edge.rs index 3e590c6f8..b8107bc71 100644 --- a/crates/fj-kernel/src/algorithms/transform/edge.rs +++ b/crates/fj-kernel/src/algorithms/transform/edge.rs @@ -3,7 +3,7 @@ use fj_math::Transform; use crate::{ objects::{Curve, Stores}, partial::{MaybePartial, PartialGlobalEdge, PartialHalfEdge}, - stores::Handle, + storage::Handle, }; use super::TransformObject; diff --git a/crates/fj-kernel/src/algorithms/transform/surface.rs b/crates/fj-kernel/src/algorithms/transform/surface.rs index e14e33c1c..2b91f96c2 100644 --- a/crates/fj-kernel/src/algorithms/transform/surface.rs +++ b/crates/fj-kernel/src/algorithms/transform/surface.rs @@ -2,7 +2,7 @@ use fj_math::Transform; use crate::{ objects::{Stores, Surface}, - stores::Handle, + storage::Handle, }; use super::TransformObject; diff --git a/crates/fj-kernel/src/builder/face.rs b/crates/fj-kernel/src/builder/face.rs index 146035813..cd04efa3d 100644 --- a/crates/fj-kernel/src/builder/face.rs +++ b/crates/fj-kernel/src/builder/face.rs @@ -3,7 +3,7 @@ use fj_math::Point; use crate::{ objects::{Cycle, Face, Stores, Surface}, partial::HasPartial, - stores::Handle, + storage::Handle, }; /// API for building a [`Face`] diff --git a/crates/fj-kernel/src/builder/shell.rs b/crates/fj-kernel/src/builder/shell.rs index 40d7a0117..3bb5a74b6 100644 --- a/crates/fj-kernel/src/builder/shell.rs +++ b/crates/fj-kernel/src/builder/shell.rs @@ -7,7 +7,7 @@ use crate::{ Vertex, }, partial::HasPartial, - stores::Handle, + storage::Handle, }; /// API for building a [`Shell`] diff --git a/crates/fj-kernel/src/builder/sketch.rs b/crates/fj-kernel/src/builder/sketch.rs index 1caa526a2..dea3dc2aa 100644 --- a/crates/fj-kernel/src/builder/sketch.rs +++ b/crates/fj-kernel/src/builder/sketch.rs @@ -2,7 +2,7 @@ use fj_math::Point; use crate::{ objects::{Face, Sketch, Stores, Surface}, - stores::Handle, + storage::Handle, }; /// API for building a [`Sketch`] diff --git a/crates/fj-kernel/src/iter.rs b/crates/fj-kernel/src/iter.rs index b6ba204c3..8cec30db1 100644 --- a/crates/fj-kernel/src/iter.rs +++ b/crates/fj-kernel/src/iter.rs @@ -7,7 +7,7 @@ use crate::{ Curve, Cycle, Face, GlobalCurve, GlobalVertex, HalfEdge, Shell, Sketch, Solid, Surface, Vertex, }, - stores::Handle, + storage::Handle, }; /// Access iterators over all objects of a shape, or part of it @@ -365,7 +365,7 @@ mod tests { Sketch, Solid, Stores, Surface, SurfaceVertex, Vertex, }, partial::HasPartial, - stores::Handle, + storage::Handle, }; use super::ObjectIters as _; diff --git a/crates/fj-kernel/src/lib.rs b/crates/fj-kernel/src/lib.rs index da162ba61..803ec7317 100644 --- a/crates/fj-kernel/src/lib.rs +++ b/crates/fj-kernel/src/lib.rs @@ -93,4 +93,4 @@ pub mod iter; pub mod objects; pub mod partial; pub mod path; -pub mod stores; +pub mod storage; diff --git a/crates/fj-kernel/src/objects/curve.rs b/crates/fj-kernel/src/objects/curve.rs index faaf185a3..3bc00d8be 100644 --- a/crates/fj-kernel/src/objects/curve.rs +++ b/crates/fj-kernel/src/objects/curve.rs @@ -1,6 +1,6 @@ use crate::{ path::SurfacePath, - stores::{Handle, HandleWrapper}, + storage::{Handle, HandleWrapper}, }; use super::{Stores, Surface}; diff --git a/crates/fj-kernel/src/objects/cycle.rs b/crates/fj-kernel/src/objects/cycle.rs index 5c82a5459..cfddc5fa9 100644 --- a/crates/fj-kernel/src/objects/cycle.rs +++ b/crates/fj-kernel/src/objects/cycle.rs @@ -1,7 +1,7 @@ use fj_math::{Scalar, Winding}; use pretty_assertions::assert_eq; -use crate::{path::SurfacePath, stores::Handle}; +use crate::{path::SurfacePath, storage::Handle}; use super::{HalfEdge, Surface}; diff --git a/crates/fj-kernel/src/objects/edge.rs b/crates/fj-kernel/src/objects/edge.rs index 0c6284fcf..ca7a05f09 100644 --- a/crates/fj-kernel/src/objects/edge.rs +++ b/crates/fj-kernel/src/objects/edge.rs @@ -2,7 +2,7 @@ use std::fmt; use pretty_assertions::{assert_eq, assert_ne}; -use crate::stores::{Handle, HandleWrapper}; +use crate::storage::{Handle, HandleWrapper}; use super::{Curve, GlobalCurve, GlobalVertex, Vertex}; diff --git a/crates/fj-kernel/src/objects/face.rs b/crates/fj-kernel/src/objects/face.rs index 9cb4d14bd..269762cfe 100644 --- a/crates/fj-kernel/src/objects/face.rs +++ b/crates/fj-kernel/src/objects/face.rs @@ -3,7 +3,7 @@ use std::collections::{btree_set, BTreeSet}; use fj_interop::mesh::Color; use fj_math::Winding; -use crate::{builder::FaceBuilder, stores::Handle}; +use crate::{builder::FaceBuilder, storage::Handle}; use super::{Cycle, Stores, Surface}; diff --git a/crates/fj-kernel/src/objects/mod.rs b/crates/fj-kernel/src/objects/mod.rs index 535698f3b..e8e6883c0 100644 --- a/crates/fj-kernel/src/objects/mod.rs +++ b/crates/fj-kernel/src/objects/mod.rs @@ -70,7 +70,7 @@ //! As of this writing, most objects are not managed in the centralized object //! storage. Changing this is an ongoing effort ([#1021]). //! -//! [`Handle`]: crate::stores::Handle +//! [`Handle`]: crate::storage::Handle //! [#1021]: https://github.com/hannobraun/Fornjot/issues/1021 mod curve; @@ -83,7 +83,7 @@ mod solid; mod surface; mod vertex; -use crate::stores::Store; +use crate::storage::Store; pub use self::{ curve::{Curve, GlobalCurve}, diff --git a/crates/fj-kernel/src/objects/sketch.rs b/crates/fj-kernel/src/objects/sketch.rs index 0e1d5ce28..c39d51c71 100644 --- a/crates/fj-kernel/src/objects/sketch.rs +++ b/crates/fj-kernel/src/objects/sketch.rs @@ -1,4 +1,4 @@ -use crate::{builder::SketchBuilder, stores::Handle}; +use crate::{builder::SketchBuilder, storage::Handle}; use super::{face::Faces, Face, Stores, Surface}; diff --git a/crates/fj-kernel/src/objects/vertex.rs b/crates/fj-kernel/src/objects/vertex.rs index 115f59336..b07c76c82 100644 --- a/crates/fj-kernel/src/objects/vertex.rs +++ b/crates/fj-kernel/src/objects/vertex.rs @@ -1,7 +1,7 @@ use fj_math::Point; use pretty_assertions::assert_eq; -use crate::stores::Handle; +use crate::storage::Handle; use super::{Curve, Stores, Surface}; diff --git a/crates/fj-kernel/src/partial/maybe_partial.rs b/crates/fj-kernel/src/partial/maybe_partial.rs index b6824b965..fdc01fcf9 100644 --- a/crates/fj-kernel/src/partial/maybe_partial.rs +++ b/crates/fj-kernel/src/partial/maybe_partial.rs @@ -5,7 +5,7 @@ use crate::{ Curve, GlobalCurve, GlobalEdge, HalfEdge, Stores, Surface, SurfaceVertex, Vertex, }, - stores::Handle, + storage::Handle, }; use super::{HasPartial, Partial}; diff --git a/crates/fj-kernel/src/partial/objects/curve.rs b/crates/fj-kernel/src/partial/objects/curve.rs index ae29324b4..49999ac51 100644 --- a/crates/fj-kernel/src/partial/objects/curve.rs +++ b/crates/fj-kernel/src/partial/objects/curve.rs @@ -3,7 +3,7 @@ use fj_math::{Point, Scalar, Vector}; use crate::{ objects::{Curve, GlobalCurve, Stores, Surface}, path::SurfacePath, - stores::{Handle, HandleWrapper}, + storage::{Handle, HandleWrapper}, }; /// A partial [`Curve`] diff --git a/crates/fj-kernel/src/partial/objects/cycle.rs b/crates/fj-kernel/src/partial/objects/cycle.rs index 3104ec934..ea6f2025a 100644 --- a/crates/fj-kernel/src/partial/objects/cycle.rs +++ b/crates/fj-kernel/src/partial/objects/cycle.rs @@ -3,7 +3,7 @@ use fj_math::Point; use crate::{ objects::{Curve, Cycle, HalfEdge, Stores, Surface, SurfaceVertex, Vertex}, partial::{HasPartial, MaybePartial}, - stores::Handle, + storage::Handle, }; /// A partial [`Cycle`] diff --git a/crates/fj-kernel/src/partial/objects/edge.rs b/crates/fj-kernel/src/partial/objects/edge.rs index caf5f6849..47dd55860 100644 --- a/crates/fj-kernel/src/partial/objects/edge.rs +++ b/crates/fj-kernel/src/partial/objects/edge.rs @@ -6,7 +6,7 @@ use crate::{ Surface, SurfaceVertex, Vertex, }, partial::{HasPartial, MaybePartial, PartialCurve}, - stores::{Handle, HandleWrapper}, + storage::{Handle, HandleWrapper}, }; /// A partial [`HalfEdge`] diff --git a/crates/fj-kernel/src/partial/objects/mod.rs b/crates/fj-kernel/src/partial/objects/mod.rs index 7262610db..7d92bb245 100644 --- a/crates/fj-kernel/src/partial/objects/mod.rs +++ b/crates/fj-kernel/src/partial/objects/mod.rs @@ -8,7 +8,7 @@ use crate::{ Curve, Cycle, GlobalEdge, GlobalVertex, HalfEdge, Stores, SurfaceVertex, Vertex, }, - stores::Handle, + storage::Handle, }; use super::{ diff --git a/crates/fj-kernel/src/partial/objects/vertex.rs b/crates/fj-kernel/src/partial/objects/vertex.rs index 7fc7221a1..c0f194ec3 100644 --- a/crates/fj-kernel/src/partial/objects/vertex.rs +++ b/crates/fj-kernel/src/partial/objects/vertex.rs @@ -3,7 +3,7 @@ use fj_math::Point; use crate::{ objects::{Curve, GlobalVertex, Stores, Surface, SurfaceVertex, Vertex}, partial::{HasPartial, MaybePartial}, - stores::Handle, + storage::Handle, }; /// A partial [`Vertex`] diff --git a/crates/fj-kernel/src/stores/blocks.rs b/crates/fj-kernel/src/storage/blocks.rs similarity index 100% rename from crates/fj-kernel/src/stores/blocks.rs rename to crates/fj-kernel/src/storage/blocks.rs diff --git a/crates/fj-kernel/src/stores/handle.rs b/crates/fj-kernel/src/storage/handle.rs similarity index 100% rename from crates/fj-kernel/src/stores/handle.rs rename to crates/fj-kernel/src/storage/handle.rs diff --git a/crates/fj-kernel/src/stores/mod.rs b/crates/fj-kernel/src/storage/mod.rs similarity index 100% rename from crates/fj-kernel/src/stores/mod.rs rename to crates/fj-kernel/src/storage/mod.rs diff --git a/crates/fj-kernel/src/stores/store.rs b/crates/fj-kernel/src/storage/store.rs similarity index 100% rename from crates/fj-kernel/src/stores/store.rs rename to crates/fj-kernel/src/storage/store.rs diff --git a/crates/fj-operations/src/planes.rs b/crates/fj-operations/src/planes.rs index c3eddd1f4..bca5a28b7 100644 --- a/crates/fj-operations/src/planes.rs +++ b/crates/fj-operations/src/planes.rs @@ -1,6 +1,6 @@ use fj_kernel::{ objects::{Stores, Surface}, - stores::Handle, + storage::Handle, }; /// The static planes From 71157adfbf3cb47f8dce0de00dda18cc095f1ab5 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:25:54 +0200 Subject: [PATCH 03/57] Rename `Stores` to `Objects` The new name is less technical. It focuses on what the trait *is*, instead of how it is implemented. --- .../fj-kernel/src/algorithms/approx/curve.rs | 10 +++---- .../src/algorithms/intersect/curve_edge.rs | 10 +++---- .../src/algorithms/intersect/curve_face.rs | 4 +-- .../src/algorithms/intersect/face_face.rs | 10 +++---- .../src/algorithms/intersect/face_point.rs | 18 ++++++------- .../src/algorithms/intersect/ray_face.rs | 16 ++++++------ .../algorithms/intersect/surface_surface.rs | 8 +++--- .../fj-kernel/src/algorithms/sweep/curve.rs | 8 ++++-- crates/fj-kernel/src/algorithms/sweep/edge.rs | 13 +++++++--- crates/fj-kernel/src/algorithms/sweep/face.rs | 14 ++++++---- crates/fj-kernel/src/algorithms/sweep/mod.rs | 4 +-- .../fj-kernel/src/algorithms/sweep/sketch.rs | 8 ++++-- .../fj-kernel/src/algorithms/sweep/vertex.rs | 18 +++++++++---- .../src/algorithms/transform/curve.rs | 6 ++--- .../src/algorithms/transform/cycle.rs | 4 +-- .../src/algorithms/transform/edge.rs | 6 ++--- .../src/algorithms/transform/face.rs | 6 ++--- .../fj-kernel/src/algorithms/transform/mod.rs | 16 +++++++----- .../src/algorithms/transform/path.rs | 4 +-- .../src/algorithms/transform/shell.rs | 4 +-- .../src/algorithms/transform/sketch.rs | 4 +-- .../src/algorithms/transform/solid.rs | 4 +-- .../src/algorithms/transform/surface.rs | 4 +-- .../src/algorithms/transform/vertex.rs | 8 +++--- .../src/algorithms/triangulate/mod.rs | 8 +++--- .../fj-kernel/src/algorithms/validate/mod.rs | 14 +++++----- crates/fj-kernel/src/builder/face.rs | 4 +-- crates/fj-kernel/src/builder/shell.rs | 4 +-- crates/fj-kernel/src/builder/sketch.rs | 4 +-- crates/fj-kernel/src/builder/solid.rs | 4 +-- crates/fj-kernel/src/iter.rs | 26 +++++++++---------- crates/fj-kernel/src/objects/curve.rs | 6 ++--- crates/fj-kernel/src/objects/edge.rs | 4 +-- crates/fj-kernel/src/objects/face.rs | 4 +-- crates/fj-kernel/src/objects/mod.rs | 6 ++--- crates/fj-kernel/src/objects/shell.rs | 4 +-- crates/fj-kernel/src/objects/sketch.rs | 7 +++-- crates/fj-kernel/src/objects/solid.rs | 4 +-- crates/fj-kernel/src/objects/vertex.rs | 4 +-- crates/fj-kernel/src/partial/maybe_partial.rs | 4 +-- crates/fj-kernel/src/partial/objects/curve.rs | 4 +-- crates/fj-kernel/src/partial/objects/cycle.rs | 6 +++-- crates/fj-kernel/src/partial/objects/edge.rs | 6 ++--- crates/fj-kernel/src/partial/objects/mod.rs | 4 +-- .../fj-kernel/src/partial/objects/vertex.rs | 8 +++--- crates/fj-kernel/src/partial/traits.rs | 4 +-- crates/fj-operations/src/difference_2d.rs | 4 +-- crates/fj-operations/src/group.rs | 4 +-- crates/fj-operations/src/lib.rs | 8 +++--- crates/fj-operations/src/planes.rs | 4 +-- crates/fj-operations/src/shape_processor.rs | 4 +-- crates/fj-operations/src/sketch.rs | 4 +-- crates/fj-operations/src/sweep.rs | 4 +-- crates/fj-operations/src/transform.rs | 4 +-- 54 files changed, 208 insertions(+), 174 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/approx/curve.rs b/crates/fj-kernel/src/algorithms/approx/curve.rs index 462c8b760..5a7585d5d 100644 --- a/crates/fj-kernel/src/algorithms/approx/curve.rs +++ b/crates/fj-kernel/src/algorithms/approx/curve.rs @@ -197,7 +197,7 @@ mod tests { use crate::{ algorithms::approx::{path::RangeOnPath, Approx, ApproxPoint}, - objects::{Curve, Stores, Surface}, + objects::{Curve, Objects, Surface}, partial::HasPartial, path::GlobalPath, storage::Handle, @@ -207,7 +207,7 @@ mod tests { #[test] fn approx_line_on_flat_surface() { - let stores = Stores::new(); + let stores = Objects::new(); let surface = stores .surfaces @@ -225,7 +225,7 @@ mod tests { #[test] fn approx_line_on_curved_surface_but_not_along_curve() { - let stores = Stores::new(); + let stores = Objects::new(); let surface = stores.surfaces.insert(Surface::new( GlobalPath::circle_from_radius(1.), @@ -244,7 +244,7 @@ mod tests { #[test] fn approx_line_on_curved_surface_along_curve() { - let stores = Stores::new(); + let stores = Objects::new(); let path = GlobalPath::circle_from_radius(1.); let surface = stores.surfaces.insert(Surface::new(path, [0., 0., 1.])); @@ -274,7 +274,7 @@ mod tests { #[test] fn approx_circle_on_flat_surface() { - let stores = Stores::new(); + let stores = Objects::new(); let surface = stores .surfaces diff --git a/crates/fj-kernel/src/algorithms/intersect/curve_edge.rs b/crates/fj-kernel/src/algorithms/intersect/curve_edge.rs index 1caa83872..c914fab9d 100644 --- a/crates/fj-kernel/src/algorithms/intersect/curve_edge.rs +++ b/crates/fj-kernel/src/algorithms/intersect/curve_edge.rs @@ -75,7 +75,7 @@ mod tests { use fj_math::Point; use crate::{ - objects::{Curve, HalfEdge, Stores, Surface}, + objects::{Curve, HalfEdge, Objects, Surface}, partial::HasPartial, storage::Handle, }; @@ -84,7 +84,7 @@ mod tests { #[test] fn compute_edge_in_front_of_curve_origin() { - let stores = Stores::new(); + let stores = Objects::new(); let surface = stores.surfaces.insert(Surface::xy_plane()); let curve = Handle::::partial() @@ -108,7 +108,7 @@ mod tests { #[test] fn compute_edge_behind_curve_origin() { - let stores = Stores::new(); + let stores = Objects::new(); let surface = stores.surfaces.insert(Surface::xy_plane()); let curve = Handle::::partial() @@ -132,7 +132,7 @@ mod tests { #[test] fn compute_edge_parallel_to_curve() { - let stores = Stores::new(); + let stores = Objects::new(); let surface = stores.surfaces.insert(Surface::xy_plane()); let curve = Handle::::partial() @@ -151,7 +151,7 @@ mod tests { #[test] fn compute_edge_on_curve() { - let stores = Stores::new(); + let stores = Objects::new(); let surface = stores.surfaces.insert(Surface::xy_plane()); let curve = Handle::::partial() diff --git a/crates/fj-kernel/src/algorithms/intersect/curve_face.rs b/crates/fj-kernel/src/algorithms/intersect/curve_face.rs index d38483e14..d2c77bfdd 100644 --- a/crates/fj-kernel/src/algorithms/intersect/curve_face.rs +++ b/crates/fj-kernel/src/algorithms/intersect/curve_face.rs @@ -156,7 +156,7 @@ where #[cfg(test)] mod tests { use crate::{ - objects::{Curve, Face, Stores, Surface}, + objects::{Curve, Face, Objects, Surface}, partial::HasPartial, storage::Handle, }; @@ -165,7 +165,7 @@ mod tests { #[test] fn compute() { - let stores = Stores::new(); + let stores = Objects::new(); let surface = stores.surfaces.insert(Surface::xy_plane()); diff --git a/crates/fj-kernel/src/algorithms/intersect/face_face.rs b/crates/fj-kernel/src/algorithms/intersect/face_face.rs index e974c1ec2..22154a68c 100644 --- a/crates/fj-kernel/src/algorithms/intersect/face_face.rs +++ b/crates/fj-kernel/src/algorithms/intersect/face_face.rs @@ -1,5 +1,5 @@ use crate::{ - objects::{Curve, Face, Stores}, + objects::{Curve, Face, Objects}, storage::Handle, }; @@ -24,7 +24,7 @@ pub struct FaceFaceIntersection { impl FaceFaceIntersection { /// Compute the intersections between two faces - pub fn compute(faces: [&Face; 2], stores: &Stores) -> Option { + pub fn compute(faces: [&Face; 2], stores: &Objects) -> Option { let surfaces = faces.map(|face| face.surface().clone()); let intersection_curves = @@ -64,7 +64,7 @@ mod tests { use crate::{ algorithms::intersect::CurveFaceIntersection, - objects::{Curve, Face, Stores, Surface}, + objects::{Curve, Face, Objects, Surface}, partial::HasPartial, storage::Handle, }; @@ -73,7 +73,7 @@ mod tests { #[test] fn compute_no_intersection() { - let stores = Stores::new(); + let stores = Objects::new(); #[rustfmt::skip] let points = [ @@ -97,7 +97,7 @@ mod tests { #[test] fn compute_one_intersection() { - let stores = Stores::new(); + let stores = Objects::new(); #[rustfmt::skip] let points = [ diff --git a/crates/fj-kernel/src/algorithms/intersect/face_point.rs b/crates/fj-kernel/src/algorithms/intersect/face_point.rs index 671723119..6c0403d6f 100644 --- a/crates/fj-kernel/src/algorithms/intersect/face_point.rs +++ b/crates/fj-kernel/src/algorithms/intersect/face_point.rs @@ -134,12 +134,12 @@ mod tests { use crate::{ algorithms::intersect::{face_point::FacePointIntersection, Intersect}, iter::ObjectIters, - objects::{Face, Stores, Surface}, + objects::{Face, Objects, Surface}, }; #[test] fn point_is_outside_face() { - let stores = Stores::new(); + let stores = Objects::new(); let surface = stores.surfaces.insert(Surface::xy_plane()); let face = Face::builder(&stores, surface) @@ -153,7 +153,7 @@ mod tests { #[test] fn ray_hits_vertex_while_passing_outside() { - let stores = Stores::new(); + let stores = Objects::new(); let surface = stores.surfaces.insert(Surface::xy_plane()); let face = Face::builder(&stores, surface) @@ -170,7 +170,7 @@ mod tests { #[test] fn ray_hits_vertex_at_cycle_seam() { - let stores = Stores::new(); + let stores = Objects::new(); let surface = stores.surfaces.insert(Surface::xy_plane()); let face = Face::builder(&stores, surface) @@ -187,7 +187,7 @@ mod tests { #[test] fn ray_hits_vertex_while_staying_inside() { - let stores = Stores::new(); + let stores = Objects::new(); let surface = stores.surfaces.insert(Surface::xy_plane()); let face = Face::builder(&stores, surface) @@ -209,7 +209,7 @@ mod tests { #[test] fn ray_hits_parallel_edge_and_leaves_face_at_vertex() { - let stores = Stores::new(); + let stores = Objects::new(); let surface = stores.surfaces.insert(Surface::xy_plane()); let face = Face::builder(&stores, surface) @@ -231,7 +231,7 @@ mod tests { #[test] fn ray_hits_parallel_edge_and_does_not_leave_face_there() { - let stores = Stores::new(); + let stores = Objects::new(); let surface = stores.surfaces.insert(Surface::xy_plane()); let face = Face::builder(&stores, surface) @@ -254,7 +254,7 @@ mod tests { #[test] fn point_is_coincident_with_edge() { - let stores = Stores::new(); + let stores = Objects::new(); let surface = stores.surfaces.insert(Surface::xy_plane()); let face = Face::builder(&stores, surface) @@ -280,7 +280,7 @@ mod tests { #[test] fn point_is_coincident_with_vertex() { - let stores = Stores::new(); + let stores = Objects::new(); let surface = stores.surfaces.insert(Surface::xy_plane()); let face = Face::builder(&stores, surface) diff --git a/crates/fj-kernel/src/algorithms/intersect/ray_face.rs b/crates/fj-kernel/src/algorithms/intersect/ray_face.rs index b13cfa167..ed3553d99 100644 --- a/crates/fj-kernel/src/algorithms/intersect/ray_face.rs +++ b/crates/fj-kernel/src/algorithms/intersect/ray_face.rs @@ -152,12 +152,12 @@ mod tests { transform::TransformObject, }, iter::ObjectIters, - objects::{Face, Stores, Surface}, + objects::{Face, Objects, Surface}, }; #[test] fn ray_misses_whole_surface() { - let stores = Stores::new(); + let stores = Objects::new(); let ray = HorizontalRayToTheRight::from([0., 0., 0.]); @@ -177,7 +177,7 @@ mod tests { #[test] fn ray_hits_face() { - let stores = Stores::new(); + let stores = Objects::new(); let ray = HorizontalRayToTheRight::from([0., 0., 0.]); @@ -200,7 +200,7 @@ mod tests { #[test] fn ray_hits_surface_but_misses_face() { - let stores = Stores::new(); + let stores = Objects::new(); let ray = HorizontalRayToTheRight::from([0., 0., 0.]); @@ -220,7 +220,7 @@ mod tests { #[test] fn ray_hits_edge() { - let stores = Stores::new(); + let stores = Objects::new(); let ray = HorizontalRayToTheRight::from([0., 0., 0.]); @@ -251,7 +251,7 @@ mod tests { #[test] fn ray_hits_vertex() { - let stores = Stores::new(); + let stores = Objects::new(); let ray = HorizontalRayToTheRight::from([0., 0., 0.]); @@ -280,7 +280,7 @@ mod tests { #[test] fn ray_is_parallel_to_surface_and_hits() { - let stores = Stores::new(); + let stores = Objects::new(); let ray = HorizontalRayToTheRight::from([0., 0., 0.]); @@ -302,7 +302,7 @@ mod tests { #[test] fn ray_is_parallel_to_surface_and_misses() { - let stores = Stores::new(); + let stores = Objects::new(); let ray = HorizontalRayToTheRight::from([0., 0., 0.]); diff --git a/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs b/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs index 1865e6161..8f8ee0a9e 100644 --- a/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs +++ b/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs @@ -1,7 +1,7 @@ use fj_math::{Line, Plane, Point, Scalar}; use crate::{ - objects::{Curve, GlobalCurve, Stores, Surface}, + objects::{Curve, GlobalCurve, Objects, Surface}, path::{GlobalPath, SurfacePath}, storage::Handle, }; @@ -17,7 +17,7 @@ impl SurfaceSurfaceIntersection { /// Compute the intersection between two surfaces pub fn compute( surfaces: [Handle; 2], - stores: &Stores, + stores: &Objects, ) -> Option { // Algorithm from Real-Time Collision Detection by Christer Ericson. See // section 5.4.4, Intersection of Two Planes. @@ -88,7 +88,7 @@ mod tests { use crate::{ algorithms::transform::TransformObject, - objects::{Curve, Stores, Surface}, + objects::{Curve, Objects, Surface}, partial::HasPartial, storage::Handle, }; @@ -97,7 +97,7 @@ mod tests { #[test] fn plane_plane() { - let stores = Stores::new(); + let stores = Objects::new(); let xy = stores.surfaces.insert(Surface::xy_plane()); let xz = stores.surfaces.insert(Surface::xz_plane()); diff --git a/crates/fj-kernel/src/algorithms/sweep/curve.rs b/crates/fj-kernel/src/algorithms/sweep/curve.rs index c11a394da..3a545131c 100644 --- a/crates/fj-kernel/src/algorithms/sweep/curve.rs +++ b/crates/fj-kernel/src/algorithms/sweep/curve.rs @@ -1,7 +1,7 @@ use fj_math::{Circle, Line, Vector}; use crate::{ - objects::{Curve, Stores, Surface}, + objects::{Curve, Objects, Surface}, path::{GlobalPath, SurfacePath}, storage::Handle, }; @@ -11,7 +11,11 @@ use super::Sweep; impl Sweep for Handle { type Swept = Handle; - fn sweep(self, path: impl Into>, stores: &Stores) -> Self::Swept { + fn sweep( + self, + path: impl Into>, + stores: &Objects, + ) -> Self::Swept { match self.surface().u() { GlobalPath::Circle(_) => { // Sweeping a `Curve` creates a `Surface`. The u-axis of that diff --git a/crates/fj-kernel/src/algorithms/sweep/edge.rs b/crates/fj-kernel/src/algorithms/sweep/edge.rs index 9a7635966..346367545 100644 --- a/crates/fj-kernel/src/algorithms/sweep/edge.rs +++ b/crates/fj-kernel/src/algorithms/sweep/edge.rs @@ -4,7 +4,8 @@ use fj_math::{Line, Scalar, Vector}; use crate::{ algorithms::{reverse::Reverse, transform::TransformObject}, objects::{ - Curve, Cycle, Face, GlobalEdge, HalfEdge, Stores, SurfaceVertex, Vertex, + Curve, Cycle, Face, GlobalEdge, HalfEdge, Objects, SurfaceVertex, + Vertex, }, path::SurfacePath, }; @@ -14,7 +15,11 @@ use super::Sweep; impl Sweep for (HalfEdge, Color) { type Swept = Face; - fn sweep(self, path: impl Into>, stores: &Stores) -> Self::Swept { + fn sweep( + self, + path: impl Into>, + stores: &Objects, + ) -> Self::Swept { let (edge, color) = self; let path = path.into(); @@ -183,13 +188,13 @@ mod tests { use crate::{ algorithms::{reverse::Reverse, sweep::Sweep}, - objects::{Cycle, Face, HalfEdge, Stores, Surface}, + objects::{Cycle, Face, HalfEdge, Objects, Surface}, partial::HasPartial, }; #[test] fn sweep() { - let stores = Stores::new(); + let stores = Objects::new(); let half_edge = HalfEdge::partial() .with_surface(Some(stores.surfaces.insert(Surface::xy_plane()))) diff --git a/crates/fj-kernel/src/algorithms/sweep/face.rs b/crates/fj-kernel/src/algorithms/sweep/face.rs index 98ce31e7d..22ac7532f 100644 --- a/crates/fj-kernel/src/algorithms/sweep/face.rs +++ b/crates/fj-kernel/src/algorithms/sweep/face.rs @@ -2,7 +2,7 @@ use fj_math::{Scalar, Vector}; use crate::{ algorithms::{reverse::Reverse, transform::TransformObject}, - objects::{Face, Shell, Stores}, + objects::{Face, Objects, Shell}, path::GlobalPath, }; @@ -11,7 +11,11 @@ use super::Sweep; impl Sweep for Face { type Swept = Shell; - fn sweep(self, path: impl Into>, stores: &Stores) -> Self::Swept { + fn sweep( + self, + path: impl Into>, + stores: &Objects, + ) -> Self::Swept { let path = path.into(); let mut faces = Vec::new(); @@ -76,7 +80,7 @@ mod tests { use crate::{ algorithms::{reverse::Reverse, transform::TransformObject}, - objects::{Face, HalfEdge, Sketch, Stores, Surface}, + objects::{Face, HalfEdge, Objects, Sketch, Surface}, partial::HasPartial, }; @@ -89,7 +93,7 @@ mod tests { #[test] fn sweep_up() { - let stores = Stores::new(); + let stores = Objects::new(); let surface = stores.surfaces.insert(Surface::xy_plane()); let solid = Sketch::builder(&stores, surface.clone()) @@ -126,7 +130,7 @@ mod tests { #[test] fn sweep_down() { - let stores = Stores::new(); + let stores = Objects::new(); let surface = stores.surfaces.insert(Surface::xy_plane()); let solid = Sketch::builder(&stores, surface.clone()) diff --git a/crates/fj-kernel/src/algorithms/sweep/mod.rs b/crates/fj-kernel/src/algorithms/sweep/mod.rs index 7eb4d4a14..e89f27c3d 100644 --- a/crates/fj-kernel/src/algorithms/sweep/mod.rs +++ b/crates/fj-kernel/src/algorithms/sweep/mod.rs @@ -8,7 +8,7 @@ mod vertex; use fj_math::Vector; -use crate::objects::Stores; +use crate::objects::Objects; /// Sweep an object along a path to create another object pub trait Sweep { @@ -16,5 +16,5 @@ pub trait Sweep { type Swept; /// Sweep the object along the given path - fn sweep(self, path: impl Into>, store: &Stores) -> Self::Swept; + fn sweep(self, path: impl Into>, store: &Objects) -> Self::Swept; } diff --git a/crates/fj-kernel/src/algorithms/sweep/sketch.rs b/crates/fj-kernel/src/algorithms/sweep/sketch.rs index 8506f5054..89c85a7e8 100644 --- a/crates/fj-kernel/src/algorithms/sweep/sketch.rs +++ b/crates/fj-kernel/src/algorithms/sweep/sketch.rs @@ -1,13 +1,17 @@ use fj_math::Vector; -use crate::objects::{Sketch, Solid, Stores}; +use crate::objects::{Objects, Sketch, Solid}; use super::Sweep; impl Sweep for Sketch { type Swept = Solid; - fn sweep(self, path: impl Into>, stores: &Stores) -> Self::Swept { + fn sweep( + self, + path: impl Into>, + stores: &Objects, + ) -> Self::Swept { let path = path.into(); let mut shells = Vec::new(); diff --git a/crates/fj-kernel/src/algorithms/sweep/vertex.rs b/crates/fj-kernel/src/algorithms/sweep/vertex.rs index be85b72a9..1e02bcd09 100644 --- a/crates/fj-kernel/src/algorithms/sweep/vertex.rs +++ b/crates/fj-kernel/src/algorithms/sweep/vertex.rs @@ -2,7 +2,7 @@ use fj_math::{Line, Point, Scalar, Vector}; use crate::{ objects::{ - Curve, GlobalCurve, GlobalEdge, GlobalVertex, HalfEdge, Stores, + Curve, GlobalCurve, GlobalEdge, GlobalVertex, HalfEdge, Objects, Surface, SurfaceVertex, Vertex, }, path::SurfacePath, @@ -14,7 +14,11 @@ use super::Sweep; impl Sweep for (Vertex, Handle) { type Swept = HalfEdge; - fn sweep(self, path: impl Into>, stores: &Stores) -> Self::Swept { + fn sweep( + self, + path: impl Into>, + stores: &Objects, + ) -> Self::Swept { let (vertex, surface) = self; let path = path.into(); @@ -123,7 +127,11 @@ impl Sweep for (Vertex, Handle) { impl Sweep for Handle { type Swept = (GlobalEdge, [Handle; 2]); - fn sweep(self, path: impl Into>, stores: &Stores) -> Self::Swept { + fn sweep( + self, + path: impl Into>, + stores: &Objects, + ) -> Self::Swept { let curve = GlobalCurve::new(stores); let a = self.clone(); @@ -146,14 +154,14 @@ mod tests { use crate::{ algorithms::sweep::Sweep, - objects::{Curve, HalfEdge, Stores, Surface, Vertex}, + objects::{Curve, HalfEdge, Objects, Surface, Vertex}, partial::HasPartial, storage::Handle, }; #[test] fn vertex_surface() { - let stores = Stores::new(); + let stores = Objects::new(); let surface = stores.surfaces.insert(Surface::xz_plane()); let curve = Handle::::partial() diff --git a/crates/fj-kernel/src/algorithms/transform/curve.rs b/crates/fj-kernel/src/algorithms/transform/curve.rs index e6f207177..1d9148b4a 100644 --- a/crates/fj-kernel/src/algorithms/transform/curve.rs +++ b/crates/fj-kernel/src/algorithms/transform/curve.rs @@ -1,7 +1,7 @@ use fj_math::Transform; use crate::{ - objects::{GlobalCurve, Stores}, + objects::{GlobalCurve, Objects}, partial::PartialCurve, storage::Handle, }; @@ -9,7 +9,7 @@ use crate::{ use super::TransformObject; impl TransformObject for Handle { - fn transform(self, _: &Transform, stores: &Stores) -> Self { + fn transform(self, _: &Transform, stores: &Objects) -> Self { // `GlobalCurve` doesn't contain any internal geometry. If it did, that // would just be redundant with the geometry of other objects, and this // other geometry is already being transformed by other implementations @@ -23,7 +23,7 @@ impl TransformObject for Handle { } impl TransformObject for PartialCurve { - fn transform(self, transform: &Transform, stores: &Stores) -> Self { + fn transform(self, transform: &Transform, stores: &Objects) -> Self { let surface = self .surface .map(|surface| surface.transform(transform, stores)); diff --git a/crates/fj-kernel/src/algorithms/transform/cycle.rs b/crates/fj-kernel/src/algorithms/transform/cycle.rs index 46a4b9e5c..1f5ef536c 100644 --- a/crates/fj-kernel/src/algorithms/transform/cycle.rs +++ b/crates/fj-kernel/src/algorithms/transform/cycle.rs @@ -1,11 +1,11 @@ use fj_math::Transform; -use crate::{objects::Stores, partial::PartialCycle}; +use crate::{objects::Objects, partial::PartialCycle}; use super::TransformObject; impl TransformObject for PartialCycle { - fn transform(self, transform: &Transform, stores: &Stores) -> Self { + fn transform(self, transform: &Transform, stores: &Objects) -> Self { let surface = self .surface .clone() diff --git a/crates/fj-kernel/src/algorithms/transform/edge.rs b/crates/fj-kernel/src/algorithms/transform/edge.rs index b8107bc71..856a3cb8e 100644 --- a/crates/fj-kernel/src/algorithms/transform/edge.rs +++ b/crates/fj-kernel/src/algorithms/transform/edge.rs @@ -1,7 +1,7 @@ use fj_math::Transform; use crate::{ - objects::{Curve, Stores}, + objects::{Curve, Objects}, partial::{MaybePartial, PartialGlobalEdge, PartialHalfEdge}, storage::Handle, }; @@ -9,7 +9,7 @@ use crate::{ use super::TransformObject; impl TransformObject for PartialHalfEdge { - fn transform(self, transform: &Transform, stores: &Stores) -> Self { + fn transform(self, transform: &Transform, stores: &Objects) -> Self { let surface = self .surface .map(|surface| surface.transform(transform, stores)); @@ -49,7 +49,7 @@ impl TransformObject for PartialHalfEdge { } impl TransformObject for PartialGlobalEdge { - fn transform(self, transform: &Transform, stores: &Stores) -> Self { + fn transform(self, transform: &Transform, stores: &Objects) -> Self { let curve = self.curve.map(|curve| curve.0.transform(transform, stores)); let vertices = self.vertices.map(|vertices| { diff --git a/crates/fj-kernel/src/algorithms/transform/face.rs b/crates/fj-kernel/src/algorithms/transform/face.rs index e7a258d50..a12349857 100644 --- a/crates/fj-kernel/src/algorithms/transform/face.rs +++ b/crates/fj-kernel/src/algorithms/transform/face.rs @@ -1,14 +1,14 @@ use fj_math::Transform; use crate::{ - objects::{Face, Faces, Stores}, + objects::{Face, Faces, Objects}, partial::HasPartial, }; use super::TransformObject; impl TransformObject for Face { - fn transform(self, transform: &Transform, stores: &Stores) -> Self { + fn transform(self, transform: &Transform, stores: &Objects) -> Self { let surface = self.surface().clone().transform(transform, stores); let exterior = self .exterior() @@ -33,7 +33,7 @@ impl TransformObject for Face { } impl TransformObject for Faces { - fn transform(self, transform: &Transform, stores: &Stores) -> Self { + fn transform(self, transform: &Transform, stores: &Objects) -> Self { let mut faces = Faces::new(); faces.extend( self.into_iter() diff --git a/crates/fj-kernel/src/algorithms/transform/mod.rs b/crates/fj-kernel/src/algorithms/transform/mod.rs index 4851b63a5..4ba663f9a 100644 --- a/crates/fj-kernel/src/algorithms/transform/mod.rs +++ b/crates/fj-kernel/src/algorithms/transform/mod.rs @@ -14,7 +14,7 @@ mod vertex; use fj_math::{Transform, Vector}; use crate::{ - objects::Stores, + objects::Objects, partial::{HasPartial, MaybePartial, Partial}, }; @@ -30,13 +30,13 @@ use crate::{ pub trait TransformObject: Sized { /// Transform the object #[must_use] - fn transform(self, transform: &Transform, stores: &Stores) -> Self; + fn transform(self, transform: &Transform, stores: &Objects) -> Self; /// Translate the object /// /// Convenience wrapper around [`TransformObject::transform`]. #[must_use] - fn translate(self, offset: impl Into>, stores: &Stores) -> Self { + fn translate(self, offset: impl Into>, stores: &Objects) -> Self { self.transform(&Transform::translation(offset), stores) } @@ -44,7 +44,11 @@ pub trait TransformObject: Sized { /// /// Convenience wrapper around [`TransformObject::transform`]. #[must_use] - fn rotate(self, axis_angle: impl Into>, stores: &Stores) -> Self { + fn rotate( + self, + axis_angle: impl Into>, + stores: &Objects, + ) -> Self { self.transform(&Transform::rotation(axis_angle), stores) } } @@ -54,7 +58,7 @@ where T: HasPartial, T::Partial: TransformObject, { - fn transform(self, transform: &Transform, stores: &Stores) -> Self { + fn transform(self, transform: &Transform, stores: &Objects) -> Self { self.to_partial().transform(transform, stores).build(stores) } } @@ -64,7 +68,7 @@ where T: HasPartial + TransformObject, T::Partial: TransformObject, { - fn transform(self, transform: &Transform, stores: &Stores) -> Self { + fn transform(self, transform: &Transform, stores: &Objects) -> Self { match self { Self::Full(full) => Self::Full(full.transform(transform, stores)), Self::Partial(partial) => { diff --git a/crates/fj-kernel/src/algorithms/transform/path.rs b/crates/fj-kernel/src/algorithms/transform/path.rs index dd30962b1..3cec75e9d 100644 --- a/crates/fj-kernel/src/algorithms/transform/path.rs +++ b/crates/fj-kernel/src/algorithms/transform/path.rs @@ -1,11 +1,11 @@ use fj_math::Transform; -use crate::{objects::Stores, path::GlobalPath}; +use crate::{objects::Objects, path::GlobalPath}; use super::TransformObject; impl TransformObject for GlobalPath { - fn transform(self, transform: &Transform, _: &Stores) -> Self { + fn transform(self, transform: &Transform, _: &Objects) -> Self { match self { Self::Circle(curve) => { Self::Circle(transform.transform_circle(&curve)) diff --git a/crates/fj-kernel/src/algorithms/transform/shell.rs b/crates/fj-kernel/src/algorithms/transform/shell.rs index 9d3cf5fec..94c1fdd33 100644 --- a/crates/fj-kernel/src/algorithms/transform/shell.rs +++ b/crates/fj-kernel/src/algorithms/transform/shell.rs @@ -1,11 +1,11 @@ use fj_math::Transform; -use crate::objects::{Shell, Stores}; +use crate::objects::{Objects, Shell}; use super::TransformObject; impl TransformObject for Shell { - fn transform(self, transform: &Transform, stores: &Stores) -> Self { + fn transform(self, transform: &Transform, stores: &Objects) -> Self { let faces = self .into_faces() .into_iter() diff --git a/crates/fj-kernel/src/algorithms/transform/sketch.rs b/crates/fj-kernel/src/algorithms/transform/sketch.rs index e7eade654..5382388ca 100644 --- a/crates/fj-kernel/src/algorithms/transform/sketch.rs +++ b/crates/fj-kernel/src/algorithms/transform/sketch.rs @@ -1,11 +1,11 @@ use fj_math::Transform; -use crate::objects::{Sketch, Stores}; +use crate::objects::{Objects, Sketch}; use super::TransformObject; impl TransformObject for Sketch { - fn transform(self, transform: &Transform, stores: &Stores) -> Self { + fn transform(self, transform: &Transform, stores: &Objects) -> Self { let faces = self .into_faces() .into_iter() diff --git a/crates/fj-kernel/src/algorithms/transform/solid.rs b/crates/fj-kernel/src/algorithms/transform/solid.rs index 1bfe44071..e5aae6e07 100644 --- a/crates/fj-kernel/src/algorithms/transform/solid.rs +++ b/crates/fj-kernel/src/algorithms/transform/solid.rs @@ -1,11 +1,11 @@ use fj_math::Transform; -use crate::objects::{Solid, Stores}; +use crate::objects::{Objects, Solid}; use super::TransformObject; impl TransformObject for Solid { - fn transform(self, transform: &Transform, stores: &Stores) -> Self { + fn transform(self, transform: &Transform, stores: &Objects) -> Self { let faces = self .into_shells() .map(|shell| shell.transform(transform, stores)); diff --git a/crates/fj-kernel/src/algorithms/transform/surface.rs b/crates/fj-kernel/src/algorithms/transform/surface.rs index 2b91f96c2..56232fc6d 100644 --- a/crates/fj-kernel/src/algorithms/transform/surface.rs +++ b/crates/fj-kernel/src/algorithms/transform/surface.rs @@ -1,14 +1,14 @@ use fj_math::Transform; use crate::{ - objects::{Stores, Surface}, + objects::{Objects, Surface}, storage::Handle, }; use super::TransformObject; impl TransformObject for Handle { - fn transform(self, transform: &Transform, stores: &Stores) -> Self { + fn transform(self, transform: &Transform, stores: &Objects) -> Self { stores.surfaces.insert(Surface::new( self.u().transform(transform, stores), transform.transform_vector(&self.v()), diff --git a/crates/fj-kernel/src/algorithms/transform/vertex.rs b/crates/fj-kernel/src/algorithms/transform/vertex.rs index 81004f9d3..c038edfa6 100644 --- a/crates/fj-kernel/src/algorithms/transform/vertex.rs +++ b/crates/fj-kernel/src/algorithms/transform/vertex.rs @@ -1,14 +1,14 @@ use fj_math::Transform; use crate::{ - objects::Stores, + objects::Objects, partial::{PartialGlobalVertex, PartialSurfaceVertex, PartialVertex}, }; use super::TransformObject; impl TransformObject for PartialVertex { - fn transform(self, transform: &Transform, stores: &Stores) -> Self { + fn transform(self, transform: &Transform, stores: &Objects) -> Self { let curve = self.curve.map(|curve| curve.transform(transform, stores)); let surface_form = self.surface_form.map(|surface_form| { surface_form @@ -32,7 +32,7 @@ impl TransformObject for PartialVertex { } impl TransformObject for PartialSurfaceVertex { - fn transform(self, transform: &Transform, stores: &Stores) -> Self { + fn transform(self, transform: &Transform, stores: &Objects) -> Self { let surface = self .surface .map(|surface| surface.transform(transform, stores)); @@ -51,7 +51,7 @@ impl TransformObject for PartialSurfaceVertex { } impl TransformObject for PartialGlobalVertex { - fn transform(self, transform: &Transform, _: &Stores) -> Self { + fn transform(self, transform: &Transform, _: &Objects) -> Self { let position = self .position .map(|position| transform.transform_point(&position)); diff --git a/crates/fj-kernel/src/algorithms/triangulate/mod.rs b/crates/fj-kernel/src/algorithms/triangulate/mod.rs index 6b0ecb813..2c6721709 100644 --- a/crates/fj-kernel/src/algorithms/triangulate/mod.rs +++ b/crates/fj-kernel/src/algorithms/triangulate/mod.rs @@ -84,14 +84,14 @@ mod tests { use crate::{ algorithms::approx::{Approx, Tolerance}, - objects::{Face, Stores, Surface}, + objects::{Face, Objects, Surface}, }; use super::Triangulate; #[test] fn simple() -> anyhow::Result<()> { - let stores = Stores::new(); + let stores = Objects::new(); let a = [0., 0.]; let b = [2., 0.]; @@ -120,7 +120,7 @@ mod tests { #[test] fn simple_hole() -> anyhow::Result<()> { - let stores = Stores::new(); + let stores = Objects::new(); let a = [0., 0.]; let b = [4., 0.]; @@ -171,7 +171,7 @@ mod tests { #[ignore] #[test] fn sharp_concave_shape() -> anyhow::Result<()> { - let stores = Stores::new(); + let stores = Objects::new(); // // c diff --git a/crates/fj-kernel/src/algorithms/validate/mod.rs b/crates/fj-kernel/src/algorithms/validate/mod.rs index 163fac920..37f1c5512 100644 --- a/crates/fj-kernel/src/algorithms/validate/mod.rs +++ b/crates/fj-kernel/src/algorithms/validate/mod.rs @@ -36,18 +36,18 @@ pub trait Validate: Sized { /// ``` rust /// # use fj_kernel::{ /// # algorithms::validate::{Validate, ValidationConfig}, - /// # objects::{GlobalVertex, Stores}, + /// # objects::{GlobalVertex, Objects}, /// # }; - /// # let stores = Stores::new(); + /// # let stores = Objects::new(); /// # let object = GlobalVertex::from_position([0., 0., 0.], &stores); /// object.validate(); /// ``` /// ``` rust /// # use fj_kernel::{ /// # algorithms::validate::{Validate, ValidationConfig}, - /// # objects::{GlobalVertex, Stores}, + /// # objects::{GlobalVertex, Objects}, /// # }; - /// # let stores = Stores::new(); + /// # let stores = Objects::new(); /// # let object = GlobalVertex::from_position([0., 0., 0.], &stores); /// object.validate_with_config(&ValidationConfig::default()); /// ``` @@ -166,7 +166,7 @@ mod tests { use crate::{ algorithms::validate::{Validate, ValidationConfig, ValidationError}, objects::{ - Curve, GlobalCurve, GlobalEdge, GlobalVertex, HalfEdge, Stores, + Curve, GlobalCurve, GlobalEdge, GlobalVertex, HalfEdge, Objects, Surface, SurfaceVertex, Vertex, }, partial::HasPartial, @@ -175,7 +175,7 @@ mod tests { #[test] fn coherence_edge() { - let stores = Stores::new(); + let stores = Objects::new(); let surface = stores.surfaces.insert(Surface::xy_plane()); @@ -239,7 +239,7 @@ mod tests { #[test] fn uniqueness_vertex() -> anyhow::Result<()> { - let stores = Stores::new(); + let stores = Objects::new(); let mut shape = Vec::new(); let deviation = Scalar::from_f64(0.25); diff --git a/crates/fj-kernel/src/builder/face.rs b/crates/fj-kernel/src/builder/face.rs index cd04efa3d..b93f2bc75 100644 --- a/crates/fj-kernel/src/builder/face.rs +++ b/crates/fj-kernel/src/builder/face.rs @@ -1,7 +1,7 @@ use fj_math::Point; use crate::{ - objects::{Cycle, Face, Stores, Surface}, + objects::{Cycle, Face, Objects, Surface}, partial::HasPartial, storage::Handle, }; @@ -11,7 +11,7 @@ use crate::{ /// Also see [`Face::builder`]. pub struct FaceBuilder<'a> { /// The stores that the created objects are put in - pub stores: &'a Stores, + pub stores: &'a Objects, /// The surface that the [`Face`] is defined in pub surface: Handle, diff --git a/crates/fj-kernel/src/builder/shell.rs b/crates/fj-kernel/src/builder/shell.rs index 3bb5a74b6..c609cdc1b 100644 --- a/crates/fj-kernel/src/builder/shell.rs +++ b/crates/fj-kernel/src/builder/shell.rs @@ -3,7 +3,7 @@ use fj_math::Scalar; use crate::{ algorithms::transform::TransformObject, objects::{ - Curve, Cycle, Face, HalfEdge, Shell, Stores, Surface, SurfaceVertex, + Curve, Cycle, Face, HalfEdge, Objects, Shell, Surface, SurfaceVertex, Vertex, }, partial::HasPartial, @@ -15,7 +15,7 @@ use crate::{ /// Also see [`Shell::builder`]. pub struct ShellBuilder<'a> { /// The stores that the created objects are put in - pub stores: &'a Stores, + pub stores: &'a Objects, } impl<'a> ShellBuilder<'a> { diff --git a/crates/fj-kernel/src/builder/sketch.rs b/crates/fj-kernel/src/builder/sketch.rs index dea3dc2aa..963e9e92a 100644 --- a/crates/fj-kernel/src/builder/sketch.rs +++ b/crates/fj-kernel/src/builder/sketch.rs @@ -1,7 +1,7 @@ use fj_math::Point; use crate::{ - objects::{Face, Sketch, Stores, Surface}, + objects::{Face, Objects, Sketch, Surface}, storage::Handle, }; @@ -10,7 +10,7 @@ use crate::{ /// Also see [`Sketch::builder`]. pub struct SketchBuilder<'a> { /// The stores that the created objects are put in - pub stores: &'a Stores, + pub stores: &'a Objects, /// The surface that the [`Sketch`] is defined in pub surface: Handle, diff --git a/crates/fj-kernel/src/builder/solid.rs b/crates/fj-kernel/src/builder/solid.rs index dadf330b1..fb6318f51 100644 --- a/crates/fj-kernel/src/builder/solid.rs +++ b/crates/fj-kernel/src/builder/solid.rs @@ -1,13 +1,13 @@ use fj_math::Scalar; -use crate::objects::{Shell, Solid, Stores}; +use crate::objects::{Objects, Shell, Solid}; /// API for building a [`Solid`] /// /// Also see [`Solid::builder`]. pub struct SolidBuilder<'a> { /// The stores that the created objects are put in - pub stores: &'a Stores, + pub stores: &'a Objects, } impl<'a> SolidBuilder<'a> { diff --git a/crates/fj-kernel/src/iter.rs b/crates/fj-kernel/src/iter.rs index 8cec30db1..446614fa7 100644 --- a/crates/fj-kernel/src/iter.rs +++ b/crates/fj-kernel/src/iter.rs @@ -361,8 +361,8 @@ impl Iterator for Iter { mod tests { use crate::{ objects::{ - Curve, Cycle, Face, GlobalCurve, GlobalVertex, HalfEdge, Shell, - Sketch, Solid, Stores, Surface, SurfaceVertex, Vertex, + Curve, Cycle, Face, GlobalCurve, GlobalVertex, HalfEdge, Objects, + Shell, Sketch, Solid, Surface, SurfaceVertex, Vertex, }, partial::HasPartial, storage::Handle, @@ -372,7 +372,7 @@ mod tests { #[test] fn curve() { - let stores = Stores::new(); + let stores = Objects::new(); let surface = stores.surfaces.insert(Surface::xy_plane()); let object = Handle::::partial() @@ -395,7 +395,7 @@ mod tests { #[test] fn cycle() { - let stores = Stores::new(); + let stores = Objects::new(); let surface = stores.surfaces.insert(Surface::xy_plane()); let object = Cycle::partial() @@ -419,7 +419,7 @@ mod tests { #[test] fn face() { - let stores = Stores::new(); + let stores = Objects::new(); let surface = stores.surfaces.insert(Surface::xy_plane()); let object = Face::builder(&stores, surface) @@ -441,7 +441,7 @@ mod tests { #[test] fn global_curve() { - let stores = Stores::new(); + let stores = Objects::new(); let object = GlobalCurve::new(&stores); @@ -460,7 +460,7 @@ mod tests { #[test] fn global_vertex() { - let stores = Stores::new(); + let stores = Objects::new(); let object = GlobalVertex::from_position([0., 0., 0.], &stores); @@ -479,7 +479,7 @@ mod tests { #[test] fn half_edge() { - let stores = Stores::new(); + let stores = Objects::new(); let object = HalfEdge::partial() .with_surface(Some(stores.surfaces.insert(Surface::xy_plane()))) @@ -501,7 +501,7 @@ mod tests { #[test] fn shell() { - let stores = Stores::new(); + let stores = Objects::new(); let object = Shell::builder(&stores).build_cube_from_edge_length(1.); @@ -520,7 +520,7 @@ mod tests { #[test] fn sketch() { - let stores = Stores::new(); + let stores = Objects::new(); let surface = stores.surfaces.insert(Surface::xy_plane()); let face = Face::builder(&stores, surface) @@ -543,7 +543,7 @@ mod tests { #[test] fn solid() { - let stores = Stores::new(); + let stores = Objects::new(); let object = Solid::builder(&stores).build_cube_from_edge_length(1.); @@ -562,7 +562,7 @@ mod tests { #[test] fn surface() { - let stores = Stores::new(); + let stores = Objects::new(); let object = stores.surfaces.insert(Surface::xy_plane()); @@ -581,7 +581,7 @@ mod tests { #[test] fn vertex() { - let stores = Stores::new(); + let stores = Objects::new(); let surface = stores.surfaces.insert(Surface::xy_plane()); let curve = Handle::::partial() diff --git a/crates/fj-kernel/src/objects/curve.rs b/crates/fj-kernel/src/objects/curve.rs index 3bc00d8be..2d153aa18 100644 --- a/crates/fj-kernel/src/objects/curve.rs +++ b/crates/fj-kernel/src/objects/curve.rs @@ -3,7 +3,7 @@ use crate::{ storage::{Handle, HandleWrapper}, }; -use super::{Stores, Surface}; +use super::{Objects, Surface}; /// A curve, defined in local surface coordinates #[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] @@ -19,7 +19,7 @@ impl Curve { surface: Handle, path: SurfacePath, global_form: impl Into>, - stores: &Stores, + stores: &Objects, ) -> Handle { stores.curves.insert(Self { surface, @@ -50,7 +50,7 @@ pub struct GlobalCurve; impl GlobalCurve { /// Construct a new instance of `Handle` and add it to the store - pub fn new(stores: &Stores) -> Handle { + pub fn new(stores: &Objects) -> Handle { stores.global_curves.insert(GlobalCurve) } } diff --git a/crates/fj-kernel/src/objects/edge.rs b/crates/fj-kernel/src/objects/edge.rs index ca7a05f09..079502eee 100644 --- a/crates/fj-kernel/src/objects/edge.rs +++ b/crates/fj-kernel/src/objects/edge.rs @@ -173,7 +173,7 @@ mod tests { use pretty_assertions::assert_eq; use crate::{ - objects::{Stores, Surface}, + objects::{Objects, Surface}, partial::HasPartial, }; @@ -181,7 +181,7 @@ mod tests { #[test] fn global_edge_equality() { - let stores = Stores::new(); + let stores = Objects::new(); let surface = stores.surfaces.insert(Surface::xy_plane()); diff --git a/crates/fj-kernel/src/objects/face.rs b/crates/fj-kernel/src/objects/face.rs index 269762cfe..1bb2aec4d 100644 --- a/crates/fj-kernel/src/objects/face.rs +++ b/crates/fj-kernel/src/objects/face.rs @@ -5,7 +5,7 @@ use fj_math::Winding; use crate::{builder::FaceBuilder, storage::Handle}; -use super::{Cycle, Stores, Surface}; +use super::{Cycle, Objects, Surface}; /// A face of a shape /// @@ -41,7 +41,7 @@ pub struct Face { impl Face { /// Build a `Face` using [`FaceBuilder`] - pub fn builder(stores: &Stores, surface: Handle) -> FaceBuilder { + pub fn builder(stores: &Objects, surface: Handle) -> FaceBuilder { FaceBuilder { stores, surface, diff --git a/crates/fj-kernel/src/objects/mod.rs b/crates/fj-kernel/src/objects/mod.rs index e8e6883c0..8f43d1cb9 100644 --- a/crates/fj-kernel/src/objects/mod.rs +++ b/crates/fj-kernel/src/objects/mod.rs @@ -58,7 +58,7 @@ //! ## How Identity Works //! //! We can exactly determine the identity of an object, thanks to [centralized -//! object storage][`Stores`]. If objects are created at different times, +//! object storage][`Objects`]. If objects are created at different times, //! potentially by different code, they end up being stored at different memory //! locations, regardless of their (non-)equality. //! @@ -106,7 +106,7 @@ pub use self::{ /// /// [#1021]: https://github.com/hannobraun/Fornjot/issues/1021 #[derive(Debug, Default)] -pub struct Stores { +pub struct Objects { /// Store for curves pub curves: Store, @@ -120,7 +120,7 @@ pub struct Stores { pub surfaces: Store, } -impl Stores { +impl Objects { /// Construct a new instance of `Stores` pub fn new() -> Self { Self::default() diff --git a/crates/fj-kernel/src/objects/shell.rs b/crates/fj-kernel/src/objects/shell.rs index b8a336a7d..9df04c8c5 100644 --- a/crates/fj-kernel/src/objects/shell.rs +++ b/crates/fj-kernel/src/objects/shell.rs @@ -1,6 +1,6 @@ use crate::builder::ShellBuilder; -use super::{face::Faces, Face, Stores}; +use super::{face::Faces, Face, Objects}; /// A 3-dimensional closed shell /// @@ -15,7 +15,7 @@ pub struct Shell { impl Shell { /// Build a `Shell` using [`ShellBuilder`] - pub fn builder(stores: &Stores) -> ShellBuilder { + pub fn builder(stores: &Objects) -> ShellBuilder { ShellBuilder { stores } } diff --git a/crates/fj-kernel/src/objects/sketch.rs b/crates/fj-kernel/src/objects/sketch.rs index c39d51c71..aadd97e4a 100644 --- a/crates/fj-kernel/src/objects/sketch.rs +++ b/crates/fj-kernel/src/objects/sketch.rs @@ -1,6 +1,6 @@ use crate::{builder::SketchBuilder, storage::Handle}; -use super::{face::Faces, Face, Stores, Surface}; +use super::{face::Faces, Face, Objects, Surface}; /// A 2-dimensional shape /// @@ -15,7 +15,10 @@ pub struct Sketch { impl Sketch { /// Build a `Sketch` using [`SketchBuilder`] - pub fn builder(stores: &Stores, surface: Handle) -> SketchBuilder { + pub fn builder( + stores: &Objects, + surface: Handle, + ) -> SketchBuilder { SketchBuilder { stores, surface } } diff --git a/crates/fj-kernel/src/objects/solid.rs b/crates/fj-kernel/src/objects/solid.rs index 4430b0ac6..8f49117da 100644 --- a/crates/fj-kernel/src/objects/solid.rs +++ b/crates/fj-kernel/src/objects/solid.rs @@ -2,7 +2,7 @@ use std::collections::BTreeSet; use crate::builder::SolidBuilder; -use super::{Face, Shell, Stores}; +use super::{Face, Objects, Shell}; /// A 3-dimensional shape /// @@ -17,7 +17,7 @@ pub struct Solid { impl Solid { /// Build a `Solid` using [`SolidBuilder`] - pub fn builder(stores: &Stores) -> SolidBuilder { + pub fn builder(stores: &Objects) -> SolidBuilder { SolidBuilder { stores } } diff --git a/crates/fj-kernel/src/objects/vertex.rs b/crates/fj-kernel/src/objects/vertex.rs index b07c76c82..0bf3d51ea 100644 --- a/crates/fj-kernel/src/objects/vertex.rs +++ b/crates/fj-kernel/src/objects/vertex.rs @@ -3,7 +3,7 @@ use pretty_assertions::assert_eq; use crate::storage::Handle; -use super::{Curve, Stores, Surface}; +use super::{Curve, Objects, Surface}; /// A vertex /// @@ -129,7 +129,7 @@ impl GlobalVertex { /// Construct a `GlobalVertex` from a position pub fn from_position( position: impl Into>, - stores: &Stores, + stores: &Objects, ) -> Handle { let position = position.into(); stores.global_vertices.insert(Self { position }) diff --git a/crates/fj-kernel/src/partial/maybe_partial.rs b/crates/fj-kernel/src/partial/maybe_partial.rs index fdc01fcf9..f69afd854 100644 --- a/crates/fj-kernel/src/partial/maybe_partial.rs +++ b/crates/fj-kernel/src/partial/maybe_partial.rs @@ -2,7 +2,7 @@ use fj_math::Point; use crate::{ objects::{ - Curve, GlobalCurve, GlobalEdge, HalfEdge, Stores, Surface, + Curve, GlobalCurve, GlobalEdge, HalfEdge, Objects, Surface, SurfaceVertex, Vertex, }, storage::Handle, @@ -48,7 +48,7 @@ impl MaybePartial { /// /// If this already is a full object, it is returned. If this is a partial /// object, the full object is built from it, using [`Partial::build`]. - pub fn into_full(self, stores: &Stores) -> T { + pub fn into_full(self, stores: &Objects) -> T { match self { Self::Partial(partial) => partial.build(stores), Self::Full(full) => full, diff --git a/crates/fj-kernel/src/partial/objects/curve.rs b/crates/fj-kernel/src/partial/objects/curve.rs index 49999ac51..a517f3567 100644 --- a/crates/fj-kernel/src/partial/objects/curve.rs +++ b/crates/fj-kernel/src/partial/objects/curve.rs @@ -1,7 +1,7 @@ use fj_math::{Point, Scalar, Vector}; use crate::{ - objects::{Curve, GlobalCurve, Stores, Surface}, + objects::{Curve, GlobalCurve, Objects, Surface}, path::SurfacePath, storage::{Handle, HandleWrapper}, }; @@ -83,7 +83,7 @@ impl PartialCurve { } /// Build a full [`Curve`] from the partial curve - pub fn build(self, stores: &Stores) -> Handle { + pub fn build(self, stores: &Objects) -> Handle { let path = self.path.expect("Can't build `Curve` without path"); let surface = self.surface.expect("Can't build `Curve` without surface"); diff --git a/crates/fj-kernel/src/partial/objects/cycle.rs b/crates/fj-kernel/src/partial/objects/cycle.rs index ea6f2025a..4fc9fd9d6 100644 --- a/crates/fj-kernel/src/partial/objects/cycle.rs +++ b/crates/fj-kernel/src/partial/objects/cycle.rs @@ -1,7 +1,9 @@ use fj_math::Point; use crate::{ - objects::{Curve, Cycle, HalfEdge, Stores, Surface, SurfaceVertex, Vertex}, + objects::{ + Curve, Cycle, HalfEdge, Objects, Surface, SurfaceVertex, Vertex, + }, partial::{HasPartial, MaybePartial}, storage::Handle, }; @@ -154,7 +156,7 @@ impl PartialCycle { } /// Build a full [`Cycle`] from the partial cycle - pub fn build(self, stores: &Stores) -> Cycle { + pub fn build(self, stores: &Objects) -> Cycle { let surface = self.surface.expect("Need surface to build `Cycle`"); let surface_for_edges = surface.clone(); let half_edges = self.half_edges.into_iter().map(|half_edge| { diff --git a/crates/fj-kernel/src/partial/objects/edge.rs b/crates/fj-kernel/src/partial/objects/edge.rs index 47dd55860..d7be68ff0 100644 --- a/crates/fj-kernel/src/partial/objects/edge.rs +++ b/crates/fj-kernel/src/partial/objects/edge.rs @@ -2,7 +2,7 @@ use fj_math::{Point, Scalar}; use crate::{ objects::{ - Curve, GlobalCurve, GlobalEdge, GlobalVertex, HalfEdge, Stores, + Curve, GlobalCurve, GlobalEdge, GlobalVertex, HalfEdge, Objects, Surface, SurfaceVertex, Vertex, }, partial::{HasPartial, MaybePartial, PartialCurve}, @@ -181,7 +181,7 @@ impl PartialHalfEdge { } /// Build a full [`HalfEdge`] from the partial half-edge - pub fn build(self, stores: &Stores) -> HalfEdge { + pub fn build(self, stores: &Objects) -> HalfEdge { let surface = self.surface; let curve = self .curve @@ -272,7 +272,7 @@ impl PartialGlobalEdge { } /// Build a full [`GlobalEdge`] from the partial global edge - pub fn build(self, _: &Stores) -> GlobalEdge { + pub fn build(self, _: &Objects) -> GlobalEdge { let curve = self .curve .expect("Can't build `GlobalEdge` without `GlobalCurve`"); diff --git a/crates/fj-kernel/src/partial/objects/mod.rs b/crates/fj-kernel/src/partial/objects/mod.rs index 7d92bb245..f8eb5de1b 100644 --- a/crates/fj-kernel/src/partial/objects/mod.rs +++ b/crates/fj-kernel/src/partial/objects/mod.rs @@ -5,7 +5,7 @@ pub mod vertex; use crate::{ objects::{ - Curve, Cycle, GlobalEdge, GlobalVertex, HalfEdge, Stores, + Curve, Cycle, GlobalEdge, GlobalVertex, HalfEdge, Objects, SurfaceVertex, Vertex, }, storage::Handle, @@ -27,7 +27,7 @@ macro_rules! impl_traits { impl Partial for $partial { type Full = $full; - fn build(self, stores: &Stores) -> Self::Full { + fn build(self, stores: &Objects) -> Self::Full { self.build(stores) } } diff --git a/crates/fj-kernel/src/partial/objects/vertex.rs b/crates/fj-kernel/src/partial/objects/vertex.rs index c0f194ec3..18ca23ab7 100644 --- a/crates/fj-kernel/src/partial/objects/vertex.rs +++ b/crates/fj-kernel/src/partial/objects/vertex.rs @@ -1,7 +1,7 @@ use fj_math::Point; use crate::{ - objects::{Curve, GlobalVertex, Stores, Surface, SurfaceVertex, Vertex}, + objects::{Curve, GlobalVertex, Objects, Surface, SurfaceVertex, Vertex}, partial::{HasPartial, MaybePartial}, storage::Handle, }; @@ -86,7 +86,7 @@ impl PartialVertex { /// Panics, if no position has been provided. /// /// Panics, if no curve has been provided. - pub fn build(self, stores: &Stores) -> Vertex { + pub fn build(self, stores: &Objects) -> Vertex { let position = self .position .expect("Cant' build `Vertex` without position"); @@ -185,7 +185,7 @@ impl PartialSurfaceVertex { /// Panics, if no position has been provided. /// /// Panics, if no surface has been provided. - pub fn build(self, stores: &Stores) -> SurfaceVertex { + pub fn build(self, stores: &Objects) -> SurfaceVertex { let position = self .position .expect("Can't build `SurfaceVertex` without position"); @@ -269,7 +269,7 @@ impl PartialGlobalVertex { } /// Build a full [`GlobalVertex`] from the partial global vertex - pub fn build(self, stores: &Stores) -> Handle { + pub fn build(self, stores: &Objects) -> Handle { let position = self .position .expect("Can't build a `GlobalVertex` without a position"); diff --git a/crates/fj-kernel/src/partial/traits.rs b/crates/fj-kernel/src/partial/traits.rs index 6a91b6215..e76cced11 100644 --- a/crates/fj-kernel/src/partial/traits.rs +++ b/crates/fj-kernel/src/partial/traits.rs @@ -1,4 +1,4 @@ -use crate::objects::Stores; +use crate::objects::Objects; /// Implemented for objects that a partial object type exists for /// @@ -77,5 +77,5 @@ pub trait Partial: Default + for<'a> From<&'a Self::Full> { /// Calling `build` on a partial object that can't infer its missing parts /// is considered a programmer error, hence why this method doesn't return a /// [`Result`]. - fn build(self, stores: &Stores) -> Self::Full; + fn build(self, stores: &Objects) -> Self::Full; } diff --git a/crates/fj-operations/src/difference_2d.rs b/crates/fj-operations/src/difference_2d.rs index 7e82cb205..8d5e880f9 100644 --- a/crates/fj-operations/src/difference_2d.rs +++ b/crates/fj-operations/src/difference_2d.rs @@ -5,7 +5,7 @@ use fj_kernel::{ validate::{Validate, Validated, ValidationConfig, ValidationError}, }, iter::ObjectIters, - objects::{Face, Sketch, Stores}, + objects::{Face, Objects, Sketch}, }; use fj_math::Aabb; @@ -19,7 +19,7 @@ impl Shape for fj::Difference2d { fn compute_brep( &self, config: &ValidationConfig, - stores: &Stores, + stores: &Objects, planes: &Planes, debug_info: &mut DebugInfo, ) -> Result, ValidationError> { diff --git a/crates/fj-operations/src/group.rs b/crates/fj-operations/src/group.rs index 9093ad4b3..7e3229f35 100644 --- a/crates/fj-operations/src/group.rs +++ b/crates/fj-operations/src/group.rs @@ -3,7 +3,7 @@ use fj_kernel::{ algorithms::validate::{ Validate, Validated, ValidationConfig, ValidationError, }, - objects::{Faces, Stores}, + objects::{Faces, Objects}, }; use fj_math::Aabb; @@ -17,7 +17,7 @@ impl Shape for fj::Group { fn compute_brep( &self, config: &ValidationConfig, - stores: &Stores, + stores: &Objects, planes: &Planes, debug_info: &mut DebugInfo, ) -> Result, ValidationError> { diff --git a/crates/fj-operations/src/lib.rs b/crates/fj-operations/src/lib.rs index 91cd5708f..a8c9cbb52 100644 --- a/crates/fj-operations/src/lib.rs +++ b/crates/fj-operations/src/lib.rs @@ -32,7 +32,7 @@ use fj_kernel::{ algorithms::validate::{ Validate, Validated, ValidationConfig, ValidationError, }, - objects::{Faces, Sketch, Stores}, + objects::{Faces, Objects, Sketch}, }; use fj_math::Aabb; @@ -45,7 +45,7 @@ pub trait Shape { fn compute_brep( &self, config: &ValidationConfig, - stores: &Stores, + stores: &Objects, planes: &Planes, debug_info: &mut DebugInfo, ) -> Result, ValidationError>; @@ -63,7 +63,7 @@ impl Shape for fj::Shape { fn compute_brep( &self, config: &ValidationConfig, - stores: &Stores, + stores: &Objects, planes: &Planes, debug_info: &mut DebugInfo, ) -> Result, ValidationError> { @@ -109,7 +109,7 @@ impl Shape for fj::Shape2d { fn compute_brep( &self, config: &ValidationConfig, - stores: &Stores, + stores: &Objects, planes: &Planes, debug_info: &mut DebugInfo, ) -> Result, ValidationError> { diff --git a/crates/fj-operations/src/planes.rs b/crates/fj-operations/src/planes.rs index bca5a28b7..9b351ecd6 100644 --- a/crates/fj-operations/src/planes.rs +++ b/crates/fj-operations/src/planes.rs @@ -1,5 +1,5 @@ use fj_kernel::{ - objects::{Stores, Surface}, + objects::{Objects, Surface}, storage::Handle, }; @@ -25,7 +25,7 @@ impl Planes { /// /// Create one instance of this struct, then share it everywhere it's /// needed. - pub fn new(stores: &Stores) -> Self { + pub fn new(stores: &Objects) -> Self { let xy = stores.surfaces.insert(Surface::xy_plane()); let xz = stores.surfaces.insert(Surface::xz_plane()); let yz = stores.surfaces.insert(Surface::yz_plane()); diff --git a/crates/fj-operations/src/shape_processor.rs b/crates/fj-operations/src/shape_processor.rs index 392613935..b446bfb89 100644 --- a/crates/fj-operations/src/shape_processor.rs +++ b/crates/fj-operations/src/shape_processor.rs @@ -7,7 +7,7 @@ use fj_kernel::{ triangulate::Triangulate, validate::{ValidationConfig, ValidationError}, }, - objects::Stores, + objects::Objects, }; use fj_math::Scalar; @@ -43,7 +43,7 @@ impl ShapeProcessor { }; let config = ValidationConfig::default(); - let stores = Stores::new(); + let stores = Objects::new(); let planes = Planes::new(&stores); let mut debug_info = DebugInfo::new(); let shape = diff --git a/crates/fj-operations/src/sketch.rs b/crates/fj-operations/src/sketch.rs index 9e00ec20a..9dafad662 100644 --- a/crates/fj-operations/src/sketch.rs +++ b/crates/fj-operations/src/sketch.rs @@ -3,7 +3,7 @@ use fj_kernel::{ algorithms::validate::{ Validate, Validated, ValidationConfig, ValidationError, }, - objects::{Cycle, Face, HalfEdge, Sketch, Stores}, + objects::{Cycle, Face, HalfEdge, Objects, Sketch}, partial::HasPartial, }; use fj_math::{Aabb, Point}; @@ -18,7 +18,7 @@ impl Shape for fj::Sketch { fn compute_brep( &self, config: &ValidationConfig, - stores: &Stores, + stores: &Objects, planes: &Planes, _: &mut DebugInfo, ) -> Result, ValidationError> { diff --git a/crates/fj-operations/src/sweep.rs b/crates/fj-operations/src/sweep.rs index 59821b63d..850221a73 100644 --- a/crates/fj-operations/src/sweep.rs +++ b/crates/fj-operations/src/sweep.rs @@ -4,7 +4,7 @@ use fj_kernel::{ sweep::Sweep, validate::{Validate, Validated, ValidationConfig, ValidationError}, }, - objects::{Solid, Stores}, + objects::{Objects, Solid}, }; use fj_math::{Aabb, Vector}; @@ -18,7 +18,7 @@ impl Shape for fj::Sweep { fn compute_brep( &self, config: &ValidationConfig, - stores: &Stores, + stores: &Objects, planes: &Planes, debug_info: &mut DebugInfo, ) -> Result, ValidationError> { diff --git a/crates/fj-operations/src/transform.rs b/crates/fj-operations/src/transform.rs index c13134ca2..f90b01eec 100644 --- a/crates/fj-operations/src/transform.rs +++ b/crates/fj-operations/src/transform.rs @@ -4,7 +4,7 @@ use fj_kernel::{ transform::TransformObject, validate::{Validate, Validated, ValidationConfig, ValidationError}, }, - objects::{Faces, Stores}, + objects::{Faces, Objects}, }; use fj_math::{Aabb, Transform, Vector}; @@ -18,7 +18,7 @@ impl Shape for fj::Transform { fn compute_brep( &self, config: &ValidationConfig, - stores: &Stores, + stores: &Objects, planes: &Planes, debug_info: &mut DebugInfo, ) -> Result, ValidationError> { From 279128f0790024fef4fb225140c270b7fa55f1dc Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:27:17 +0200 Subject: [PATCH 04/57] Rename variables --- .../fj-kernel/src/algorithms/approx/curve.rs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/approx/curve.rs b/crates/fj-kernel/src/algorithms/approx/curve.rs index 5a7585d5d..82d771176 100644 --- a/crates/fj-kernel/src/algorithms/approx/curve.rs +++ b/crates/fj-kernel/src/algorithms/approx/curve.rs @@ -207,15 +207,15 @@ mod tests { #[test] fn approx_line_on_flat_surface() { - let stores = Objects::new(); + let objects = Objects::new(); - let surface = stores + let surface = objects .surfaces .insert(Surface::new(GlobalPath::x_axis(), [0., 0., 1.])); let curve = Handle::::partial() .with_surface(Some(surface)) .as_line_from_points([[1., 1.], [2., 1.]]) - .build(&stores); + .build(&objects); let range = RangeOnPath::from([[0.], [1.]]); let approx = (&curve, range).approx(1.); @@ -225,16 +225,16 @@ mod tests { #[test] fn approx_line_on_curved_surface_but_not_along_curve() { - let stores = Objects::new(); + let objects = Objects::new(); - let surface = stores.surfaces.insert(Surface::new( + let surface = objects.surfaces.insert(Surface::new( GlobalPath::circle_from_radius(1.), [0., 0., 1.], )); let curve = Handle::::partial() .with_surface(Some(surface)) .as_line_from_points([[1., 1.], [1., 2.]]) - .build(&stores); + .build(&objects); let range = RangeOnPath::from([[0.], [1.]]); let approx = (&curve, range).approx(1.); @@ -244,14 +244,14 @@ mod tests { #[test] fn approx_line_on_curved_surface_along_curve() { - let stores = Objects::new(); + let objects = Objects::new(); let path = GlobalPath::circle_from_radius(1.); - let surface = stores.surfaces.insert(Surface::new(path, [0., 0., 1.])); + let surface = objects.surfaces.insert(Surface::new(path, [0., 0., 1.])); let curve = Handle::::partial() .with_surface(Some(surface.clone())) .as_line_from_points([[0., 1.], [1., 1.]]) - .build(&stores); + .build(&objects); let range = RangeOnPath::from([[0.], [TAU]]); let tolerance = 1.; @@ -274,15 +274,15 @@ mod tests { #[test] fn approx_circle_on_flat_surface() { - let stores = Objects::new(); + let objects = Objects::new(); - let surface = stores + let surface = objects .surfaces .insert(Surface::new(GlobalPath::x_axis(), [0., 0., 1.])); let curve = Handle::::partial() .with_surface(Some(surface)) .as_circle_from_radius(1.) - .build(&stores); + .build(&objects); let range = RangeOnPath::from([[0.], [TAU]]); let tolerance = 1.; From 48e1d8987a598ca106610b923a327545fe88d595 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:29:02 +0200 Subject: [PATCH 05/57] Rename variables --- .../src/algorithms/intersect/curve_edge.rs | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/intersect/curve_edge.rs b/crates/fj-kernel/src/algorithms/intersect/curve_edge.rs index c914fab9d..87828ed74 100644 --- a/crates/fj-kernel/src/algorithms/intersect/curve_edge.rs +++ b/crates/fj-kernel/src/algorithms/intersect/curve_edge.rs @@ -84,17 +84,17 @@ mod tests { #[test] fn compute_edge_in_front_of_curve_origin() { - let stores = Objects::new(); + let objects = Objects::new(); - let surface = stores.surfaces.insert(Surface::xy_plane()); + let surface = objects.surfaces.insert(Surface::xy_plane()); let curve = Handle::::partial() .with_surface(Some(surface.clone())) .as_u_axis() - .build(&stores); + .build(&objects); let half_edge = HalfEdge::partial() .with_surface(Some(surface)) .as_line_segment_from_points([[1., -1.], [1., 1.]]) - .build(&stores); + .build(&objects); let intersection = CurveEdgeIntersection::compute(&curve, &half_edge); @@ -108,17 +108,17 @@ mod tests { #[test] fn compute_edge_behind_curve_origin() { - let stores = Objects::new(); + let objects = Objects::new(); - let surface = stores.surfaces.insert(Surface::xy_plane()); + let surface = objects.surfaces.insert(Surface::xy_plane()); let curve = Handle::::partial() .with_surface(Some(surface.clone())) .as_u_axis() - .build(&stores); + .build(&objects); let half_edge = HalfEdge::partial() .with_surface(Some(surface)) .as_line_segment_from_points([[-1., -1.], [-1., 1.]]) - .build(&stores); + .build(&objects); let intersection = CurveEdgeIntersection::compute(&curve, &half_edge); @@ -132,17 +132,17 @@ mod tests { #[test] fn compute_edge_parallel_to_curve() { - let stores = Objects::new(); + let objects = Objects::new(); - let surface = stores.surfaces.insert(Surface::xy_plane()); + let surface = objects.surfaces.insert(Surface::xy_plane()); let curve = Handle::::partial() .with_surface(Some(surface.clone())) .as_u_axis() - .build(&stores); + .build(&objects); let half_edge = HalfEdge::partial() .with_surface(Some(surface)) .as_line_segment_from_points([[-1., -1.], [1., -1.]]) - .build(&stores); + .build(&objects); let intersection = CurveEdgeIntersection::compute(&curve, &half_edge); @@ -151,17 +151,17 @@ mod tests { #[test] fn compute_edge_on_curve() { - let stores = Objects::new(); + let objects = Objects::new(); - let surface = stores.surfaces.insert(Surface::xy_plane()); + let surface = objects.surfaces.insert(Surface::xy_plane()); let curve = Handle::::partial() .with_surface(Some(surface.clone())) .as_u_axis() - .build(&stores); + .build(&objects); let half_edge = HalfEdge::partial() .with_surface(Some(surface)) .as_line_segment_from_points([[-1., 0.], [1., 0.]]) - .build(&stores); + .build(&objects); let intersection = CurveEdgeIntersection::compute(&curve, &half_edge); From e8062c1cdec11eba02b72330adf708df86f29748 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:29:36 +0200 Subject: [PATCH 06/57] Rename variable --- crates/fj-kernel/src/algorithms/intersect/curve_face.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/intersect/curve_face.rs b/crates/fj-kernel/src/algorithms/intersect/curve_face.rs index d2c77bfdd..e445d6c5f 100644 --- a/crates/fj-kernel/src/algorithms/intersect/curve_face.rs +++ b/crates/fj-kernel/src/algorithms/intersect/curve_face.rs @@ -165,14 +165,14 @@ mod tests { #[test] fn compute() { - let stores = Objects::new(); + let objects = Objects::new(); - let surface = stores.surfaces.insert(Surface::xy_plane()); + let surface = objects.surfaces.insert(Surface::xy_plane()); let curve = Handle::::partial() .with_surface(Some(surface.clone())) .as_line_from_points([[-3., 0.], [-2., 0.]]) - .build(&stores); + .build(&objects); #[rustfmt::skip] let exterior = [ @@ -189,7 +189,7 @@ mod tests { [ 1., -1.], ]; - let face = Face::builder(&stores, surface) + let face = Face::builder(&objects, surface) .with_exterior_polygon_from_points(exterior) .with_interior_polygon_from_points(interior) .build(); From 17ca861937a7cce91a9f488bd867fb7f50090ce9 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:30:04 +0200 Subject: [PATCH 07/57] Rename argument --- crates/fj-kernel/src/algorithms/intersect/face_face.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/intersect/face_face.rs b/crates/fj-kernel/src/algorithms/intersect/face_face.rs index 22154a68c..987e5d74e 100644 --- a/crates/fj-kernel/src/algorithms/intersect/face_face.rs +++ b/crates/fj-kernel/src/algorithms/intersect/face_face.rs @@ -24,11 +24,11 @@ pub struct FaceFaceIntersection { impl FaceFaceIntersection { /// Compute the intersections between two faces - pub fn compute(faces: [&Face; 2], stores: &Objects) -> Option { + pub fn compute(faces: [&Face; 2], objects: &Objects) -> Option { let surfaces = faces.map(|face| face.surface().clone()); let intersection_curves = - SurfaceSurfaceIntersection::compute(surfaces, stores)? + SurfaceSurfaceIntersection::compute(surfaces, objects)? .intersection_curves; // Can be cleaned up, once `zip` is stable: From 123bfe73c3bfb41e7dafc5663ac9ba0b95081006 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:30:36 +0200 Subject: [PATCH 08/57] Rename variables --- .../src/algorithms/intersect/face_face.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/intersect/face_face.rs b/crates/fj-kernel/src/algorithms/intersect/face_face.rs index 987e5d74e..640e7d325 100644 --- a/crates/fj-kernel/src/algorithms/intersect/face_face.rs +++ b/crates/fj-kernel/src/algorithms/intersect/face_face.rs @@ -73,7 +73,7 @@ mod tests { #[test] fn compute_no_intersection() { - let stores = Objects::new(); + let objects = Objects::new(); #[rustfmt::skip] let points = [ @@ -84,20 +84,20 @@ mod tests { ]; let [a, b] = [Surface::xy_plane(), Surface::xz_plane()].map(|surface| { - let surface = stores.surfaces.insert(surface); - Face::builder(&stores, surface) + let surface = objects.surfaces.insert(surface); + Face::builder(&objects, surface) .with_exterior_polygon_from_points(points) .build() }); - let intersection = FaceFaceIntersection::compute([&a, &b], &stores); + let intersection = FaceFaceIntersection::compute([&a, &b], &objects); assert!(intersection.is_none()); } #[test] fn compute_one_intersection() { - let stores = Objects::new(); + let objects = Objects::new(); #[rustfmt::skip] let points = [ @@ -107,20 +107,20 @@ mod tests { [-1., 1.], ]; let surfaces = [Surface::xy_plane(), Surface::xz_plane()] - .map(|surface| stores.surfaces.insert(surface)); + .map(|surface| objects.surfaces.insert(surface)); let [a, b] = surfaces.clone().map(|surface| { - Face::builder(&stores, surface) + Face::builder(&objects, surface) .with_exterior_polygon_from_points(points) .build() }); - let intersection = FaceFaceIntersection::compute([&a, &b], &stores); + let intersection = FaceFaceIntersection::compute([&a, &b], &objects); let expected_curves = surfaces.map(|surface| { Handle::::partial() .with_surface(Some(surface)) .as_line_from_points([[0., 0.], [1., 0.]]) - .build(&stores) + .build(&objects) }); let expected_intervals = CurveFaceIntersection::from_intervals([[[-1.], [1.]]]); From 9fe75e24cb65e054bbccb641b3aa38f765b5c696 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:31:36 +0200 Subject: [PATCH 09/57] Rename variables --- .../src/algorithms/intersect/face_point.rs | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/intersect/face_point.rs b/crates/fj-kernel/src/algorithms/intersect/face_point.rs index 6c0403d6f..aaf0bcc67 100644 --- a/crates/fj-kernel/src/algorithms/intersect/face_point.rs +++ b/crates/fj-kernel/src/algorithms/intersect/face_point.rs @@ -139,10 +139,10 @@ mod tests { #[test] fn point_is_outside_face() { - let stores = Objects::new(); + let objects = Objects::new(); - let surface = stores.surfaces.insert(Surface::xy_plane()); - let face = Face::builder(&stores, surface) + let surface = objects.surfaces.insert(Surface::xy_plane()); + let face = Face::builder(&objects, surface) .with_exterior_polygon_from_points([[0., 0.], [1., 1.], [0., 2.]]) .build(); let point = Point::from([2., 1.]); @@ -153,10 +153,10 @@ mod tests { #[test] fn ray_hits_vertex_while_passing_outside() { - let stores = Objects::new(); + let objects = Objects::new(); - let surface = stores.surfaces.insert(Surface::xy_plane()); - let face = Face::builder(&stores, surface) + let surface = objects.surfaces.insert(Surface::xy_plane()); + let face = Face::builder(&objects, surface) .with_exterior_polygon_from_points([[0., 0.], [2., 1.], [0., 2.]]) .build(); let point = Point::from([1., 1.]); @@ -170,10 +170,10 @@ mod tests { #[test] fn ray_hits_vertex_at_cycle_seam() { - let stores = Objects::new(); + let objects = Objects::new(); - let surface = stores.surfaces.insert(Surface::xy_plane()); - let face = Face::builder(&stores, surface) + let surface = objects.surfaces.insert(Surface::xy_plane()); + let face = Face::builder(&objects, surface) .with_exterior_polygon_from_points([[4., 2.], [0., 4.], [0., 0.]]) .build(); let point = Point::from([1., 2.]); @@ -187,10 +187,10 @@ mod tests { #[test] fn ray_hits_vertex_while_staying_inside() { - let stores = Objects::new(); + let objects = Objects::new(); - let surface = stores.surfaces.insert(Surface::xy_plane()); - let face = Face::builder(&stores, surface) + let surface = objects.surfaces.insert(Surface::xy_plane()); + let face = Face::builder(&objects, surface) .with_exterior_polygon_from_points([ [0., 0.], [2., 1.], @@ -209,10 +209,10 @@ mod tests { #[test] fn ray_hits_parallel_edge_and_leaves_face_at_vertex() { - let stores = Objects::new(); + let objects = Objects::new(); - let surface = stores.surfaces.insert(Surface::xy_plane()); - let face = Face::builder(&stores, surface) + let surface = objects.surfaces.insert(Surface::xy_plane()); + let face = Face::builder(&objects, surface) .with_exterior_polygon_from_points([ [0., 0.], [2., 1.], @@ -231,10 +231,10 @@ mod tests { #[test] fn ray_hits_parallel_edge_and_does_not_leave_face_there() { - let stores = Objects::new(); + let objects = Objects::new(); - let surface = stores.surfaces.insert(Surface::xy_plane()); - let face = Face::builder(&stores, surface) + let surface = objects.surfaces.insert(Surface::xy_plane()); + let face = Face::builder(&objects, surface) .with_exterior_polygon_from_points([ [0., 0.], [2., 1.], @@ -254,10 +254,10 @@ mod tests { #[test] fn point_is_coincident_with_edge() { - let stores = Objects::new(); + let objects = Objects::new(); - let surface = stores.surfaces.insert(Surface::xy_plane()); - let face = Face::builder(&stores, surface) + let surface = objects.surfaces.insert(Surface::xy_plane()); + let face = Face::builder(&objects, surface) .with_exterior_polygon_from_points([[0., 0.], [2., 0.], [0., 1.]]) .build(); let point = Point::from([1., 0.]); @@ -280,10 +280,10 @@ mod tests { #[test] fn point_is_coincident_with_vertex() { - let stores = Objects::new(); + let objects = Objects::new(); - let surface = stores.surfaces.insert(Surface::xy_plane()); - let face = Face::builder(&stores, surface) + let surface = objects.surfaces.insert(Surface::xy_plane()); + let face = Face::builder(&objects, surface) .with_exterior_polygon_from_points([[0., 0.], [1., 0.], [0., 1.]]) .build(); let point = Point::from([1., 0.]); From b1fabb7d22d0e41ca153b9ba2af4291173b10eda Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:32:40 +0200 Subject: [PATCH 10/57] Rename variables --- .../src/algorithms/intersect/ray_face.rs | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/intersect/ray_face.rs b/crates/fj-kernel/src/algorithms/intersect/ray_face.rs index ed3553d99..4e16453e2 100644 --- a/crates/fj-kernel/src/algorithms/intersect/ray_face.rs +++ b/crates/fj-kernel/src/algorithms/intersect/ray_face.rs @@ -157,12 +157,12 @@ mod tests { #[test] fn ray_misses_whole_surface() { - let stores = Objects::new(); + let objects = Objects::new(); let ray = HorizontalRayToTheRight::from([0., 0., 0.]); - let surface = stores.surfaces.insert(Surface::yz_plane()); - let face = Face::builder(&stores, surface) + let surface = objects.surfaces.insert(Surface::yz_plane()); + let face = Face::builder(&objects, surface) .with_exterior_polygon_from_points([ [-1., -1.], [1., -1.], @@ -170,19 +170,19 @@ mod tests { [-1., 1.], ]) .build() - .translate([-1., 0., 0.], &stores); + .translate([-1., 0., 0.], &objects); assert_eq!((&ray, &face).intersect(), None); } #[test] fn ray_hits_face() { - let stores = Objects::new(); + let objects = Objects::new(); let ray = HorizontalRayToTheRight::from([0., 0., 0.]); - let surface = stores.surfaces.insert(Surface::yz_plane()); - let face = Face::builder(&stores, surface) + let surface = objects.surfaces.insert(Surface::yz_plane()); + let face = Face::builder(&objects, surface) .with_exterior_polygon_from_points([ [-1., -1.], [1., -1.], @@ -190,7 +190,7 @@ mod tests { [-1., 1.], ]) .build() - .translate([1., 0., 0.], &stores); + .translate([1., 0., 0.], &objects); assert_eq!( (&ray, &face).intersect(), @@ -200,12 +200,12 @@ mod tests { #[test] fn ray_hits_surface_but_misses_face() { - let stores = Objects::new(); + let objects = Objects::new(); let ray = HorizontalRayToTheRight::from([0., 0., 0.]); - let surface = stores.surfaces.insert(Surface::yz_plane()); - let face = Face::builder(&stores, surface) + let surface = objects.surfaces.insert(Surface::yz_plane()); + let face = Face::builder(&objects, surface) .with_exterior_polygon_from_points([ [-1., -1.], [1., -1.], @@ -213,19 +213,19 @@ mod tests { [-1., 1.], ]) .build() - .translate([0., 0., 2.], &stores); + .translate([0., 0., 2.], &objects); assert_eq!((&ray, &face).intersect(), None); } #[test] fn ray_hits_edge() { - let stores = Objects::new(); + let objects = Objects::new(); let ray = HorizontalRayToTheRight::from([0., 0., 0.]); - let surface = stores.surfaces.insert(Surface::yz_plane()); - let face = Face::builder(&stores, surface) + let surface = objects.surfaces.insert(Surface::yz_plane()); + let face = Face::builder(&objects, surface) .with_exterior_polygon_from_points([ [-1., -1.], [1., -1.], @@ -233,7 +233,7 @@ mod tests { [-1., 1.], ]) .build() - .translate([1., 1., 0.], &stores); + .translate([1., 1., 0.], &objects); let edge = face .half_edge_iter() @@ -251,12 +251,12 @@ mod tests { #[test] fn ray_hits_vertex() { - let stores = Objects::new(); + let objects = Objects::new(); let ray = HorizontalRayToTheRight::from([0., 0., 0.]); - let surface = stores.surfaces.insert(Surface::yz_plane()); - let face = Face::builder(&stores, surface) + let surface = objects.surfaces.insert(Surface::yz_plane()); + let face = Face::builder(&objects, surface) .with_exterior_polygon_from_points([ [-1., -1.], [1., -1.], @@ -264,7 +264,7 @@ mod tests { [-1., 1.], ]) .build() - .translate([1., 1., 1.], &stores); + .translate([1., 1., 1.], &objects); let vertex = face .vertex_iter() @@ -280,12 +280,12 @@ mod tests { #[test] fn ray_is_parallel_to_surface_and_hits() { - let stores = Objects::new(); + let objects = Objects::new(); let ray = HorizontalRayToTheRight::from([0., 0., 0.]); - let surface = stores.surfaces.insert(Surface::xy_plane()); - let face = Face::builder(&stores, surface) + let surface = objects.surfaces.insert(Surface::xy_plane()); + let face = Face::builder(&objects, surface) .with_exterior_polygon_from_points([ [-1., -1.], [1., -1.], @@ -302,12 +302,12 @@ mod tests { #[test] fn ray_is_parallel_to_surface_and_misses() { - let stores = Objects::new(); + let objects = Objects::new(); let ray = HorizontalRayToTheRight::from([0., 0., 0.]); - let surface = stores.surfaces.insert(Surface::xy_plane()); - let face = Face::builder(&stores, surface) + let surface = objects.surfaces.insert(Surface::xy_plane()); + let face = Face::builder(&objects, surface) .with_exterior_polygon_from_points([ [-1., -1.], [1., -1.], @@ -315,7 +315,7 @@ mod tests { [-1., 1.], ]) .build() - .translate([0., 0., 1.], &stores); + .translate([0., 0., 1.], &objects); assert_eq!((&ray, &face).intersect(), None) } From 46dbd27d80d8244029ef345d6d83472b67c463c9 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:33:09 +0200 Subject: [PATCH 11/57] Rename argument --- .../fj-kernel/src/algorithms/intersect/surface_surface.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs b/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs index 8f8ee0a9e..baacce198 100644 --- a/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs +++ b/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs @@ -17,7 +17,7 @@ impl SurfaceSurfaceIntersection { /// Compute the intersection between two surfaces pub fn compute( surfaces: [Handle; 2], - stores: &Objects, + objects: &Objects, ) -> Option { // Algorithm from Real-Time Collision Detection by Christer Ericson. See // section 5.4.4, Intersection of Two Planes. @@ -57,9 +57,9 @@ impl SurfaceSurfaceIntersection { let curves = surfaces_and_planes.map(|(surface, plane)| { let path = SurfacePath::Line(plane.project_line(&line)); - let global_form = GlobalCurve::new(stores); + let global_form = GlobalCurve::new(objects); - Curve::new(surface, path, global_form, stores) + Curve::new(surface, path, global_form, objects) }); Some(Self { From 2bf54b1945c39050a3647261fcce099acc0c51f7 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:33:34 +0200 Subject: [PATCH 12/57] Rename variable --- .../src/algorithms/intersect/surface_surface.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs b/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs index baacce198..32c678b6b 100644 --- a/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs +++ b/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs @@ -97,10 +97,10 @@ mod tests { #[test] fn plane_plane() { - let stores = Objects::new(); + let objects = Objects::new(); - let xy = stores.surfaces.insert(Surface::xy_plane()); - let xz = stores.surfaces.insert(Surface::xz_plane()); + let xy = objects.surfaces.insert(Surface::xy_plane()); + let xz = objects.surfaces.insert(Surface::xz_plane()); // Coincident and parallel planes don't have an intersection curve. assert_eq!( @@ -109,10 +109,10 @@ mod tests { xy.clone(), xy.clone().transform( &Transform::translation([0., 0., 1.],), - &stores + &objects ) ], - &stores + &objects ), None, ); @@ -120,14 +120,14 @@ mod tests { let expected_xy = Handle::::partial() .with_surface(Some(xy.clone())) .as_u_axis() - .build(&stores); + .build(&objects); let expected_xz = Handle::::partial() .with_surface(Some(xz.clone())) .as_u_axis() - .build(&stores); + .build(&objects); assert_eq!( - SurfaceSurfaceIntersection::compute([xy, xz], &stores), + SurfaceSurfaceIntersection::compute([xy, xz], &objects), Some(SurfaceSurfaceIntersection { intersection_curves: [expected_xy, expected_xz], }) From 93a02cb73b529998f0a79fecd743cda247150c9c Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:34:06 +0200 Subject: [PATCH 13/57] Rename argument --- crates/fj-kernel/src/algorithms/sweep/curve.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/sweep/curve.rs b/crates/fj-kernel/src/algorithms/sweep/curve.rs index 3a545131c..6b6acdcea 100644 --- a/crates/fj-kernel/src/algorithms/sweep/curve.rs +++ b/crates/fj-kernel/src/algorithms/sweep/curve.rs @@ -14,7 +14,7 @@ impl Sweep for Handle { fn sweep( self, path: impl Into>, - stores: &Objects, + objects: &Objects, ) -> Self::Swept { match self.surface().u() { GlobalPath::Circle(_) => { @@ -63,6 +63,6 @@ impl Sweep for Handle { } }; - stores.surfaces.insert(Surface::new(u, path)) + objects.surfaces.insert(Surface::new(u, path)) } } From a4b59c06d10cac2d3eab3c64bf7e35d965f8b574 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:34:37 +0200 Subject: [PATCH 14/57] Rename argument --- crates/fj-kernel/src/algorithms/sweep/edge.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/sweep/edge.rs b/crates/fj-kernel/src/algorithms/sweep/edge.rs index 346367545..432ff8d5b 100644 --- a/crates/fj-kernel/src/algorithms/sweep/edge.rs +++ b/crates/fj-kernel/src/algorithms/sweep/edge.rs @@ -18,12 +18,12 @@ impl Sweep for (HalfEdge, Color) { fn sweep( self, path: impl Into>, - stores: &Objects, + objects: &Objects, ) -> Self::Swept { let (edge, color) = self; let path = path.into(); - let surface = edge.curve().clone().sweep(path, stores); + let surface = edge.curve().clone().sweep(path, objects); // We can't use the edge we're sweeping from as the bottom edge, as that // is not defined in the right surface. Let's create a new bottom edge, @@ -48,7 +48,7 @@ impl Sweep for (HalfEdge, Color) { surface.clone(), path, edge.curve().global_form().clone(), - stores, + objects, ) }; @@ -84,7 +84,7 @@ impl Sweep for (HalfEdge, Color) { let side_edges = bottom_edge .vertices() .clone() - .map(|vertex| (vertex, surface.clone()).sweep(path, stores)); + .map(|vertex| (vertex, surface.clone()).sweep(path, objects)); let top_edge = { let bottom_vertices = bottom_edge.vertices(); @@ -104,7 +104,7 @@ impl Sweep for (HalfEdge, Color) { .curve() .global_form() .clone() - .translate(path, stores); + .translate(path, objects); // Please note that creating a line here is correct, even if the // global curve is a circle. Projected into the side surface, it @@ -114,7 +114,7 @@ impl Sweep for (HalfEdge, Color) { points_curve_and_surface, )); - Curve::new(surface.clone(), path, global, stores) + Curve::new(surface.clone(), path, global, objects) }; let global = GlobalEdge::new( From 7fa522d20f047adaa292e90fb3299761ec472123 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:34:56 +0200 Subject: [PATCH 15/57] Rename variable --- crates/fj-kernel/src/algorithms/sweep/edge.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/sweep/edge.rs b/crates/fj-kernel/src/algorithms/sweep/edge.rs index 432ff8d5b..429eb0f8b 100644 --- a/crates/fj-kernel/src/algorithms/sweep/edge.rs +++ b/crates/fj-kernel/src/algorithms/sweep/edge.rs @@ -194,36 +194,36 @@ mod tests { #[test] fn sweep() { - let stores = Objects::new(); + let objects = Objects::new(); let half_edge = HalfEdge::partial() - .with_surface(Some(stores.surfaces.insert(Surface::xy_plane()))) + .with_surface(Some(objects.surfaces.insert(Surface::xy_plane()))) .as_line_segment_from_points([[0., 0.], [1., 0.]]) - .build(&stores); + .build(&objects); - let face = (half_edge, Color::default()).sweep([0., 0., 1.], &stores); + let face = (half_edge, Color::default()).sweep([0., 0., 1.], &objects); let expected_face = { - let surface = stores.surfaces.insert(Surface::xz_plane()); + let surface = objects.surfaces.insert(Surface::xz_plane()); let bottom = HalfEdge::partial() .with_surface(Some(surface.clone())) .as_line_segment_from_points([[0., 0.], [1., 0.]]) - .build(&stores); + .build(&objects); let top = HalfEdge::partial() .with_surface(Some(surface.clone())) .as_line_segment_from_points([[0., 1.], [1., 1.]]) - .build(&stores) + .build(&objects) .reverse(); let left = HalfEdge::partial() .with_surface(Some(surface.clone())) .as_line_segment_from_points([[0., 0.], [0., 1.]]) - .build(&stores) + .build(&objects) .reverse(); let right = HalfEdge::partial() .with_surface(Some(surface.clone())) .as_line_segment_from_points([[1., 0.], [1., 1.]]) - .build(&stores); + .build(&objects); let cycle = Cycle::new(surface, [bottom, right, top, left]); From f23cd7b3be67d12ed9bcda1afb6f22feb0fcf10c Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:35:35 +0200 Subject: [PATCH 16/57] Rename argument --- crates/fj-kernel/src/algorithms/sweep/face.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/sweep/face.rs b/crates/fj-kernel/src/algorithms/sweep/face.rs index 22ac7532f..c30ee21f0 100644 --- a/crates/fj-kernel/src/algorithms/sweep/face.rs +++ b/crates/fj-kernel/src/algorithms/sweep/face.rs @@ -14,7 +14,7 @@ impl Sweep for Face { fn sweep( self, path: impl Into>, - stores: &Objects, + objects: &Objects, ) -> Self::Swept { let path = path.into(); @@ -45,7 +45,7 @@ impl Sweep for Face { faces.push(bottom_face); let top_face = { - let mut face = self.clone().translate(path, stores); + let mut face = self.clone().translate(path, objects); if is_negative_sweep { face = face.reverse(); @@ -64,7 +64,7 @@ impl Sweep for Face { half_edge.clone() }; - let face = (half_edge, self.color()).sweep(path, stores); + let face = (half_edge, self.color()).sweep(path, objects); faces.push(face); } From a0ac5291dac02cd189b64e36d12babbcc2c3726a Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:36:19 +0200 Subject: [PATCH 17/57] Rename variables --- crates/fj-kernel/src/algorithms/sweep/face.rs | 40 ++++++++++--------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/sweep/face.rs b/crates/fj-kernel/src/algorithms/sweep/face.rs index c30ee21f0..b465cf181 100644 --- a/crates/fj-kernel/src/algorithms/sweep/face.rs +++ b/crates/fj-kernel/src/algorithms/sweep/face.rs @@ -93,18 +93,18 @@ mod tests { #[test] fn sweep_up() { - let stores = Objects::new(); + let objects = Objects::new(); - let surface = stores.surfaces.insert(Surface::xy_plane()); - let solid = Sketch::builder(&stores, surface.clone()) + let surface = objects.surfaces.insert(Surface::xy_plane()); + let solid = Sketch::builder(&objects, surface.clone()) .build_polygon_from_points(TRIANGLE) - .sweep(UP, &stores); + .sweep(UP, &objects); - let bottom = Face::builder(&stores, surface.clone()) + let bottom = Face::builder(&objects, surface.clone()) .with_exterior_polygon_from_points(TRIANGLE) .build() .reverse(); - let top = Face::builder(&stores, surface.translate(UP, &stores)) + let top = Face::builder(&objects, surface.translate(UP, &objects)) .with_exterior_polygon_from_points(TRIANGLE) .build(); @@ -119,10 +119,12 @@ mod tests { let [a, b] = [window[0], window[1]]; let half_edge = HalfEdge::partial() - .with_surface(Some(stores.surfaces.insert(Surface::xy_plane()))) + .with_surface(Some( + objects.surfaces.insert(Surface::xy_plane()), + )) .as_line_segment_from_points([a, b]) - .build(&stores); - (half_edge, Color::default()).sweep(UP, &stores) + .build(&objects); + (half_edge, Color::default()).sweep(UP, &objects) }); assert!(side_faces.all(|face| solid.find_face(&face).is_some())); @@ -130,19 +132,19 @@ mod tests { #[test] fn sweep_down() { - let stores = Objects::new(); + let objects = Objects::new(); - let surface = stores.surfaces.insert(Surface::xy_plane()); - let solid = Sketch::builder(&stores, surface.clone()) + let surface = objects.surfaces.insert(Surface::xy_plane()); + let solid = Sketch::builder(&objects, surface.clone()) .build_polygon_from_points(TRIANGLE) - .sweep(DOWN, &stores); + .sweep(DOWN, &objects); let bottom = - Face::builder(&stores, surface.clone().translate(DOWN, &stores)) + Face::builder(&objects, surface.clone().translate(DOWN, &objects)) .with_exterior_polygon_from_points(TRIANGLE) .build() .reverse(); - let top = Face::builder(&stores, surface) + let top = Face::builder(&objects, surface) .with_exterior_polygon_from_points(TRIANGLE) .build(); @@ -157,11 +159,13 @@ mod tests { let [a, b] = [window[0], window[1]]; let half_edge = HalfEdge::partial() - .with_surface(Some(stores.surfaces.insert(Surface::xy_plane()))) + .with_surface(Some( + objects.surfaces.insert(Surface::xy_plane()), + )) .as_line_segment_from_points([a, b]) - .build(&stores) + .build(&objects) .reverse(); - (half_edge, Color::default()).sweep(DOWN, &stores) + (half_edge, Color::default()).sweep(DOWN, &objects) }); assert!(side_faces.all(|face| solid.find_face(&face).is_some())); From 264595d5a76d269b418788b51c2ed30b0b1a11bd Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:36:47 +0200 Subject: [PATCH 18/57] Rename argument --- crates/fj-kernel/src/algorithms/sweep/mod.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/fj-kernel/src/algorithms/sweep/mod.rs b/crates/fj-kernel/src/algorithms/sweep/mod.rs index e89f27c3d..70b009d1d 100644 --- a/crates/fj-kernel/src/algorithms/sweep/mod.rs +++ b/crates/fj-kernel/src/algorithms/sweep/mod.rs @@ -16,5 +16,9 @@ pub trait Sweep { type Swept; /// Sweep the object along the given path - fn sweep(self, path: impl Into>, store: &Objects) -> Self::Swept; + fn sweep( + self, + path: impl Into>, + objects: &Objects, + ) -> Self::Swept; } From fcc930a538dca3b9144eb9e3ae3f7bdc3940bb7e Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:37:17 +0200 Subject: [PATCH 19/57] Rename argument --- crates/fj-kernel/src/algorithms/sweep/sketch.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/sweep/sketch.rs b/crates/fj-kernel/src/algorithms/sweep/sketch.rs index 89c85a7e8..ff124af18 100644 --- a/crates/fj-kernel/src/algorithms/sweep/sketch.rs +++ b/crates/fj-kernel/src/algorithms/sweep/sketch.rs @@ -10,13 +10,13 @@ impl Sweep for Sketch { fn sweep( self, path: impl Into>, - stores: &Objects, + objects: &Objects, ) -> Self::Swept { let path = path.into(); let mut shells = Vec::new(); for face in self.into_faces() { - let shell = face.sweep(path, stores); + let shell = face.sweep(path, objects); shells.push(shell); } From ae73ce96335f8752960afabd68781d894a52e97b Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:37:59 +0200 Subject: [PATCH 20/57] Rename arguments --- crates/fj-kernel/src/algorithms/sweep/vertex.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/sweep/vertex.rs b/crates/fj-kernel/src/algorithms/sweep/vertex.rs index 1e02bcd09..5285301f2 100644 --- a/crates/fj-kernel/src/algorithms/sweep/vertex.rs +++ b/crates/fj-kernel/src/algorithms/sweep/vertex.rs @@ -17,7 +17,7 @@ impl Sweep for (Vertex, Handle) { fn sweep( self, path: impl Into>, - stores: &Objects, + objects: &Objects, ) -> Self::Swept { let (vertex, surface) = self; let path = path.into(); @@ -58,7 +58,7 @@ impl Sweep for (Vertex, Handle) { // as that is the most straight-forward part of this operations, and // we're going to need it soon anyway. let (edge_global, vertices_global) = - vertex.global_form().clone().sweep(path, stores); + vertex.global_form().clone().sweep(path, objects); // Next, let's compute the surface coordinates of the two vertices of // the output `Edge`, as we're going to need these for the rest of this @@ -88,7 +88,7 @@ impl Sweep for (Vertex, Handle) { surface.clone(), SurfacePath::Line(line), edge_global.curve().clone(), - stores, + objects, ) }; @@ -130,13 +130,13 @@ impl Sweep for Handle { fn sweep( self, path: impl Into>, - stores: &Objects, + objects: &Objects, ) -> Self::Swept { - let curve = GlobalCurve::new(stores); + let curve = GlobalCurve::new(objects); let a = self.clone(); let b = - GlobalVertex::from_position(self.position() + path.into(), stores); + GlobalVertex::from_position(self.position() + path.into(), objects); let vertices = [a, b]; let global_edge = GlobalEdge::new(curve, vertices.clone()); From 452ec90eb648909507072ed34440bace5ad13ab7 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:38:15 +0200 Subject: [PATCH 21/57] Rename variable --- crates/fj-kernel/src/algorithms/sweep/vertex.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/sweep/vertex.rs b/crates/fj-kernel/src/algorithms/sweep/vertex.rs index 5285301f2..5f07a871c 100644 --- a/crates/fj-kernel/src/algorithms/sweep/vertex.rs +++ b/crates/fj-kernel/src/algorithms/sweep/vertex.rs @@ -161,24 +161,24 @@ mod tests { #[test] fn vertex_surface() { - let stores = Objects::new(); + let objects = Objects::new(); - let surface = stores.surfaces.insert(Surface::xz_plane()); + let surface = objects.surfaces.insert(Surface::xz_plane()); let curve = Handle::::partial() .with_surface(Some(surface.clone())) .as_u_axis() - .build(&stores); + .build(&objects); let vertex = Vertex::partial() .with_position(Some([0.])) .with_curve(Some(curve)) - .build(&stores); + .build(&objects); - let half_edge = (vertex, surface.clone()).sweep([0., 0., 1.], &stores); + let half_edge = (vertex, surface.clone()).sweep([0., 0., 1.], &objects); let expected_half_edge = HalfEdge::partial() .with_surface(Some(surface)) .as_line_segment_from_points([[0., 0.], [0., 1.]]) - .build(&stores); + .build(&objects); assert_eq!(half_edge, expected_half_edge); } } From 604be50686564b4dcc53b8b3949dfc8ca66b8cf3 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:39:01 +0200 Subject: [PATCH 22/57] Rename arguments --- crates/fj-kernel/src/algorithms/transform/curve.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/transform/curve.rs b/crates/fj-kernel/src/algorithms/transform/curve.rs index 1d9148b4a..fd1a13752 100644 --- a/crates/fj-kernel/src/algorithms/transform/curve.rs +++ b/crates/fj-kernel/src/algorithms/transform/curve.rs @@ -9,7 +9,7 @@ use crate::{ use super::TransformObject; impl TransformObject for Handle { - fn transform(self, _: &Transform, stores: &Objects) -> Self { + fn transform(self, _: &Transform, objects: &Objects) -> Self { // `GlobalCurve` doesn't contain any internal geometry. If it did, that // would just be redundant with the geometry of other objects, and this // other geometry is already being transformed by other implementations @@ -18,18 +18,18 @@ impl TransformObject for Handle { // All we need to do here is create a new `GlobalCurve` instance, to // make sure the transformed `GlobalCurve` has a different identity than // the original one. - GlobalCurve::new(stores) + GlobalCurve::new(objects) } } impl TransformObject for PartialCurve { - fn transform(self, transform: &Transform, stores: &Objects) -> Self { + fn transform(self, transform: &Transform, objects: &Objects) -> Self { let surface = self .surface - .map(|surface| surface.transform(transform, stores)); + .map(|surface| surface.transform(transform, objects)); let global_form = self .global_form - .map(|global_form| global_form.0.transform(transform, stores)); + .map(|global_form| global_form.0.transform(transform, objects)); // Don't need to transform `self.path`, as that's defined in surface // coordinates, and thus transforming `surface` takes care of it. From fbc193ceae45bcd784aadc672aa69278a0f295cc Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:39:33 +0200 Subject: [PATCH 23/57] Rename argument --- crates/fj-kernel/src/algorithms/transform/cycle.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/transform/cycle.rs b/crates/fj-kernel/src/algorithms/transform/cycle.rs index 1f5ef536c..2b9bd5c0c 100644 --- a/crates/fj-kernel/src/algorithms/transform/cycle.rs +++ b/crates/fj-kernel/src/algorithms/transform/cycle.rs @@ -5,17 +5,17 @@ use crate::{objects::Objects, partial::PartialCycle}; use super::TransformObject; impl TransformObject for PartialCycle { - fn transform(self, transform: &Transform, stores: &Objects) -> Self { + fn transform(self, transform: &Transform, objects: &Objects) -> Self { let surface = self .surface .clone() - .map(|surface| surface.transform(transform, stores)); + .map(|surface| surface.transform(transform, objects)); let half_edges = self .half_edges .into_iter() .map(|edge| { edge.into_partial() - .transform(transform, stores) + .transform(transform, objects) .with_surface(surface.clone()) .into() }) From 50db73eebaa22c699c64cdcff79984aae5e7d4cf Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:40:12 +0200 Subject: [PATCH 24/57] Rename arguments --- .../src/algorithms/transform/edge.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/transform/edge.rs b/crates/fj-kernel/src/algorithms/transform/edge.rs index 856a3cb8e..fb3ca339b 100644 --- a/crates/fj-kernel/src/algorithms/transform/edge.rs +++ b/crates/fj-kernel/src/algorithms/transform/edge.rs @@ -9,14 +9,14 @@ use crate::{ use super::TransformObject; impl TransformObject for PartialHalfEdge { - fn transform(self, transform: &Transform, stores: &Objects) -> Self { + fn transform(self, transform: &Transform, objects: &Objects) -> Self { let surface = self .surface - .map(|surface| surface.transform(transform, stores)); + .map(|surface| surface.transform(transform, objects)); let curve = self.curve.clone().map(|curve| { curve .into_partial() - .transform(transform, stores) + .transform(transform, objects) .with_surface(surface.clone()) .into() }); @@ -24,7 +24,7 @@ impl TransformObject for PartialHalfEdge { vertices.map(|vertex| { vertex .into_partial() - .transform(transform, stores) + .transform(transform, objects) .with_curve(curve.clone()) .into() }) @@ -32,7 +32,7 @@ impl TransformObject for PartialHalfEdge { let global_form = self.global_form.map(|global_form| { global_form .into_partial() - .transform(transform, stores) + .transform(transform, objects) .with_curve(curve.as_ref().and_then( |curve: &MaybePartial>| curve.global_form(), )) @@ -49,11 +49,12 @@ impl TransformObject for PartialHalfEdge { } impl TransformObject for PartialGlobalEdge { - fn transform(self, transform: &Transform, stores: &Objects) -> Self { - let curve = - self.curve.map(|curve| curve.0.transform(transform, stores)); + fn transform(self, transform: &Transform, objects: &Objects) -> Self { + let curve = self + .curve + .map(|curve| curve.0.transform(transform, objects)); let vertices = self.vertices.map(|vertices| { - vertices.map(|vertex| vertex.transform(transform, stores)) + vertices.map(|vertex| vertex.transform(transform, objects)) }); Self { From aecf689fd72db51b0dbfe2652c2c75ca60b71d42 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:41:23 +0200 Subject: [PATCH 25/57] Rename arguments --- .../fj-kernel/src/algorithms/transform/face.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/transform/face.rs b/crates/fj-kernel/src/algorithms/transform/face.rs index a12349857..59b58f0df 100644 --- a/crates/fj-kernel/src/algorithms/transform/face.rs +++ b/crates/fj-kernel/src/algorithms/transform/face.rs @@ -8,20 +8,20 @@ use crate::{ use super::TransformObject; impl TransformObject for Face { - fn transform(self, transform: &Transform, stores: &Objects) -> Self { - let surface = self.surface().clone().transform(transform, stores); + fn transform(self, transform: &Transform, objects: &Objects) -> Self { + let surface = self.surface().clone().transform(transform, objects); let exterior = self .exterior() .to_partial() - .transform(transform, stores) + .transform(transform, objects) .with_surface(Some(surface.clone())) - .build(stores); + .build(objects); let interiors = self.interiors().map(|cycle| { cycle .to_partial() - .transform(transform, stores) + .transform(transform, objects) .with_surface(Some(surface.clone())) - .build(stores) + .build(objects) }); let color = self.color(); @@ -33,11 +33,11 @@ impl TransformObject for Face { } impl TransformObject for Faces { - fn transform(self, transform: &Transform, stores: &Objects) -> Self { + fn transform(self, transform: &Transform, objects: &Objects) -> Self { let mut faces = Faces::new(); faces.extend( self.into_iter() - .map(|face| face.transform(transform, stores)), + .map(|face| face.transform(transform, objects)), ); faces } From 2b865eddb45b180e1c2e29297f9c86fa4374b9b1 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:42:32 +0200 Subject: [PATCH 26/57] Rename arguments --- .../fj-kernel/src/algorithms/transform/mod.rs | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/transform/mod.rs b/crates/fj-kernel/src/algorithms/transform/mod.rs index 4ba663f9a..41aba27dc 100644 --- a/crates/fj-kernel/src/algorithms/transform/mod.rs +++ b/crates/fj-kernel/src/algorithms/transform/mod.rs @@ -30,14 +30,18 @@ use crate::{ pub trait TransformObject: Sized { /// Transform the object #[must_use] - fn transform(self, transform: &Transform, stores: &Objects) -> Self; + fn transform(self, transform: &Transform, objects: &Objects) -> Self; /// Translate the object /// /// Convenience wrapper around [`TransformObject::transform`]. #[must_use] - fn translate(self, offset: impl Into>, stores: &Objects) -> Self { - self.transform(&Transform::translation(offset), stores) + fn translate( + self, + offset: impl Into>, + objects: &Objects, + ) -> Self { + self.transform(&Transform::translation(offset), objects) } /// Rotate the object @@ -47,9 +51,9 @@ pub trait TransformObject: Sized { fn rotate( self, axis_angle: impl Into>, - stores: &Objects, + objects: &Objects, ) -> Self { - self.transform(&Transform::rotation(axis_angle), stores) + self.transform(&Transform::rotation(axis_angle), objects) } } @@ -58,8 +62,10 @@ where T: HasPartial, T::Partial: TransformObject, { - fn transform(self, transform: &Transform, stores: &Objects) -> Self { - self.to_partial().transform(transform, stores).build(stores) + fn transform(self, transform: &Transform, objects: &Objects) -> Self { + self.to_partial() + .transform(transform, objects) + .build(objects) } } @@ -68,11 +74,11 @@ where T: HasPartial + TransformObject, T::Partial: TransformObject, { - fn transform(self, transform: &Transform, stores: &Objects) -> Self { + fn transform(self, transform: &Transform, objects: &Objects) -> Self { match self { - Self::Full(full) => Self::Full(full.transform(transform, stores)), + Self::Full(full) => Self::Full(full.transform(transform, objects)), Self::Partial(partial) => { - Self::Partial(partial.transform(transform, stores)) + Self::Partial(partial.transform(transform, objects)) } } } From af8de8f6584719c4e72d3a7bc127c38203f994f2 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:42:54 +0200 Subject: [PATCH 27/57] Rename argument --- crates/fj-kernel/src/algorithms/transform/shell.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/transform/shell.rs b/crates/fj-kernel/src/algorithms/transform/shell.rs index 94c1fdd33..5a201dc43 100644 --- a/crates/fj-kernel/src/algorithms/transform/shell.rs +++ b/crates/fj-kernel/src/algorithms/transform/shell.rs @@ -5,11 +5,11 @@ use crate::objects::{Objects, Shell}; use super::TransformObject; impl TransformObject for Shell { - fn transform(self, transform: &Transform, stores: &Objects) -> Self { + fn transform(self, transform: &Transform, objects: &Objects) -> Self { let faces = self .into_faces() .into_iter() - .map(|face| face.transform(transform, stores)); + .map(|face| face.transform(transform, objects)); Self::new().with_faces(faces) } } From a123d6e64d2c1aaf80646dfd952801d14a131e71 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:43:19 +0200 Subject: [PATCH 28/57] Rename argument --- crates/fj-kernel/src/algorithms/transform/sketch.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/transform/sketch.rs b/crates/fj-kernel/src/algorithms/transform/sketch.rs index 5382388ca..3b9f6f5bf 100644 --- a/crates/fj-kernel/src/algorithms/transform/sketch.rs +++ b/crates/fj-kernel/src/algorithms/transform/sketch.rs @@ -5,11 +5,11 @@ use crate::objects::{Objects, Sketch}; use super::TransformObject; impl TransformObject for Sketch { - fn transform(self, transform: &Transform, stores: &Objects) -> Self { + fn transform(self, transform: &Transform, objects: &Objects) -> Self { let faces = self .into_faces() .into_iter() - .map(|face| face.transform(transform, stores)); + .map(|face| face.transform(transform, objects)); Self::new().with_faces(faces) } } From 09cdb227590df272e82fbb2f85aa187415e9b679 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:43:45 +0200 Subject: [PATCH 29/57] Rename argument --- crates/fj-kernel/src/algorithms/transform/solid.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/transform/solid.rs b/crates/fj-kernel/src/algorithms/transform/solid.rs index e5aae6e07..b5d4e77ec 100644 --- a/crates/fj-kernel/src/algorithms/transform/solid.rs +++ b/crates/fj-kernel/src/algorithms/transform/solid.rs @@ -5,10 +5,10 @@ use crate::objects::{Objects, Solid}; use super::TransformObject; impl TransformObject for Solid { - fn transform(self, transform: &Transform, stores: &Objects) -> Self { + fn transform(self, transform: &Transform, objects: &Objects) -> Self { let faces = self .into_shells() - .map(|shell| shell.transform(transform, stores)); + .map(|shell| shell.transform(transform, objects)); Self::new().with_shells(faces) } } From 34301736ba5cf7939ac0f74abebe6f31dbd6c8c0 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:44:11 +0200 Subject: [PATCH 30/57] Rename argument --- crates/fj-kernel/src/algorithms/transform/surface.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/transform/surface.rs b/crates/fj-kernel/src/algorithms/transform/surface.rs index 56232fc6d..cfc2631d8 100644 --- a/crates/fj-kernel/src/algorithms/transform/surface.rs +++ b/crates/fj-kernel/src/algorithms/transform/surface.rs @@ -8,9 +8,9 @@ use crate::{ use super::TransformObject; impl TransformObject for Handle { - fn transform(self, transform: &Transform, stores: &Objects) -> Self { - stores.surfaces.insert(Surface::new( - self.u().transform(transform, stores), + fn transform(self, transform: &Transform, objects: &Objects) -> Self { + objects.surfaces.insert(Surface::new( + self.u().transform(transform, objects), transform.transform_vector(&self.v()), )) } From 45cf50ede214565b24b647d5e070e1dd613ba3a1 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:44:56 +0200 Subject: [PATCH 31/57] Rename arguments --- .../fj-kernel/src/algorithms/transform/vertex.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/transform/vertex.rs b/crates/fj-kernel/src/algorithms/transform/vertex.rs index c038edfa6..f0eed769b 100644 --- a/crates/fj-kernel/src/algorithms/transform/vertex.rs +++ b/crates/fj-kernel/src/algorithms/transform/vertex.rs @@ -8,17 +8,17 @@ use crate::{ use super::TransformObject; impl TransformObject for PartialVertex { - fn transform(self, transform: &Transform, stores: &Objects) -> Self { - let curve = self.curve.map(|curve| curve.transform(transform, stores)); + fn transform(self, transform: &Transform, objects: &Objects) -> Self { + let curve = self.curve.map(|curve| curve.transform(transform, objects)); let surface_form = self.surface_form.map(|surface_form| { surface_form .into_partial() - .transform(transform, stores) + .transform(transform, objects) .into() }); let global_form = self .global_form - .map(|global_form| global_form.transform(transform, stores)); + .map(|global_form| global_form.transform(transform, objects)); // Don't need to transform `self.position`, as that is in curve // coordinates and thus transforming the curve takes care of it. @@ -32,13 +32,13 @@ impl TransformObject for PartialVertex { } impl TransformObject for PartialSurfaceVertex { - fn transform(self, transform: &Transform, stores: &Objects) -> Self { + fn transform(self, transform: &Transform, objects: &Objects) -> Self { let surface = self .surface - .map(|surface| surface.transform(transform, stores)); + .map(|surface| surface.transform(transform, objects)); let global_form = self .global_form - .map(|global_form| global_form.transform(transform, stores)); + .map(|global_form| global_form.transform(transform, objects)); // Don't need to transform `self.position`, as that is in surface // coordinates and thus transforming the surface takes care of it. From 9bbe09e4e5dfca2a5008fdcea247c79bc3afc2e1 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:45:48 +0200 Subject: [PATCH 32/57] Rename variables --- .../src/algorithms/triangulate/mod.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/triangulate/mod.rs b/crates/fj-kernel/src/algorithms/triangulate/mod.rs index 2c6721709..d0a007151 100644 --- a/crates/fj-kernel/src/algorithms/triangulate/mod.rs +++ b/crates/fj-kernel/src/algorithms/triangulate/mod.rs @@ -91,15 +91,15 @@ mod tests { #[test] fn simple() -> anyhow::Result<()> { - let stores = Objects::new(); + let objects = Objects::new(); let a = [0., 0.]; let b = [2., 0.]; let c = [2., 2.]; let d = [0., 1.]; - let surface = stores.surfaces.insert(Surface::xy_plane()); - let face = Face::builder(&stores, surface) + let surface = objects.surfaces.insert(Surface::xy_plane()); + let face = Face::builder(&objects, surface) .with_exterior_polygon_from_points([a, b, c, d]) .build(); @@ -120,7 +120,7 @@ mod tests { #[test] fn simple_hole() -> anyhow::Result<()> { - let stores = Objects::new(); + let objects = Objects::new(); let a = [0., 0.]; let b = [4., 0.]; @@ -132,8 +132,8 @@ mod tests { let g = [3., 3.]; let h = [3., 1.]; - let surface = stores.surfaces.insert(Surface::xy_plane()); - let face = Face::builder(&stores, surface.clone()) + let surface = objects.surfaces.insert(Surface::xy_plane()); + let face = Face::builder(&objects, surface.clone()) .with_exterior_polygon_from_points([a, b, c, d]) .with_interior_polygon_from_points([e, f, g, h]) .build(); @@ -171,7 +171,7 @@ mod tests { #[ignore] #[test] fn sharp_concave_shape() -> anyhow::Result<()> { - let stores = Objects::new(); + let objects = Objects::new(); // // c @@ -192,8 +192,8 @@ mod tests { let d = [0.1, 0.1]; let e = [0., 0.8]; - let surface = stores.surfaces.insert(Surface::xy_plane()); - let face = Face::builder(&stores, surface.clone()) + let surface = objects.surfaces.insert(Surface::xy_plane()); + let face = Face::builder(&objects, surface.clone()) .with_exterior_polygon_from_points([a, b, c, d, e]) .build(); From 02d71a0aca8928118f754025d489915a0e6a4d5e Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:46:35 +0200 Subject: [PATCH 33/57] Update variable names --- crates/fj-kernel/src/algorithms/validate/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/validate/mod.rs b/crates/fj-kernel/src/algorithms/validate/mod.rs index 37f1c5512..c00c31226 100644 --- a/crates/fj-kernel/src/algorithms/validate/mod.rs +++ b/crates/fj-kernel/src/algorithms/validate/mod.rs @@ -38,8 +38,8 @@ pub trait Validate: Sized { /// # algorithms::validate::{Validate, ValidationConfig}, /// # objects::{GlobalVertex, Objects}, /// # }; - /// # let stores = Objects::new(); - /// # let object = GlobalVertex::from_position([0., 0., 0.], &stores); + /// # let objects = Objects::new(); + /// # let object = GlobalVertex::from_position([0., 0., 0.], &objects); /// object.validate(); /// ``` /// ``` rust @@ -47,8 +47,8 @@ pub trait Validate: Sized { /// # algorithms::validate::{Validate, ValidationConfig}, /// # objects::{GlobalVertex, Objects}, /// # }; - /// # let stores = Objects::new(); - /// # let object = GlobalVertex::from_position([0., 0., 0.], &stores); + /// # let objects = Objects::new(); + /// # let object = GlobalVertex::from_position([0., 0., 0.], &objects); /// object.validate_with_config(&ValidationConfig::default()); /// ``` fn validate(self) -> Result, ValidationError> { From 0d77bd631a544f25db4e16330fdb43da9003dd81 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:47:22 +0200 Subject: [PATCH 34/57] Rename variables --- .../fj-kernel/src/algorithms/validate/mod.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/validate/mod.rs b/crates/fj-kernel/src/algorithms/validate/mod.rs index c00c31226..4a7e177a6 100644 --- a/crates/fj-kernel/src/algorithms/validate/mod.rs +++ b/crates/fj-kernel/src/algorithms/validate/mod.rs @@ -175,22 +175,22 @@ mod tests { #[test] fn coherence_edge() { - let stores = Objects::new(); + let objects = Objects::new(); - let surface = stores.surfaces.insert(Surface::xy_plane()); + let surface = objects.surfaces.insert(Surface::xy_plane()); let points_surface = [[0., 0.], [1., 0.]]; let points_global = [[0., 0., 0.], [1., 0., 0.]]; let curve = { let path = SurfacePath::line_from_points(points_surface); - let global_form = GlobalCurve::new(&stores); + let global_form = GlobalCurve::new(&objects); - Curve::new(surface.clone(), path, global_form, &stores) + Curve::new(surface.clone(), path, global_form, &objects) }; let [a_global, b_global] = points_global - .map(|point| GlobalVertex::from_position(point, &stores)); + .map(|point| GlobalVertex::from_position(point, &objects)); let [a_surface, b_surface] = { // Can be cleaned up, once `zip` is stable: @@ -220,7 +220,7 @@ mod tests { let global_edge = GlobalEdge::partial() .from_curve_and_vertices(&curve, &vertices) - .build(&stores); + .build(&objects); let half_edge = HalfEdge::new(vertices, global_edge); let result = @@ -239,7 +239,7 @@ mod tests { #[test] fn uniqueness_vertex() -> anyhow::Result<()> { - let stores = Objects::new(); + let objects = Objects::new(); let mut shape = Vec::new(); let deviation = Scalar::from_f64(0.25); @@ -255,11 +255,11 @@ mod tests { }; // Adding a vertex should work. - shape.push(GlobalVertex::from_position(a, &stores)); + shape.push(GlobalVertex::from_position(a, &objects)); shape.clone().validate_with_config(&config)?; // Adding a second vertex that is considered identical should fail. - shape.push(GlobalVertex::from_position(b, &stores)); + shape.push(GlobalVertex::from_position(b, &objects)); let result = shape.validate_with_config(&config); assert!(matches!(result, Err(ValidationError::Uniqueness(_)))); From 9bd970d5811d7c50bdde605359b13eee2fd9fc2d Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:49:03 +0200 Subject: [PATCH 35/57] Rename struct field --- crates/fj-kernel/src/builder/face.rs | 6 +++--- crates/fj-kernel/src/objects/face.rs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/fj-kernel/src/builder/face.rs b/crates/fj-kernel/src/builder/face.rs index b93f2bc75..f8e4b5778 100644 --- a/crates/fj-kernel/src/builder/face.rs +++ b/crates/fj-kernel/src/builder/face.rs @@ -11,7 +11,7 @@ use crate::{ /// Also see [`Face::builder`]. pub struct FaceBuilder<'a> { /// The stores that the created objects are put in - pub stores: &'a Objects, + pub objects: &'a Objects, /// The surface that the [`Face`] is defined in pub surface: Handle, @@ -37,7 +37,7 @@ impl<'a> FaceBuilder<'a> { .with_surface(Some(self.surface.clone())) .with_poly_chain_from_points(points) .close_with_line_segment() - .build(self.stores), + .build(self.objects), ); self } @@ -52,7 +52,7 @@ impl<'a> FaceBuilder<'a> { .with_surface(Some(self.surface.clone())) .with_poly_chain_from_points(points) .close_with_line_segment() - .build(self.stores), + .build(self.objects), ); self } diff --git a/crates/fj-kernel/src/objects/face.rs b/crates/fj-kernel/src/objects/face.rs index 1bb2aec4d..499991045 100644 --- a/crates/fj-kernel/src/objects/face.rs +++ b/crates/fj-kernel/src/objects/face.rs @@ -41,9 +41,9 @@ pub struct Face { impl Face { /// Build a `Face` using [`FaceBuilder`] - pub fn builder(stores: &Objects, surface: Handle) -> FaceBuilder { + pub fn builder(objects: &Objects, surface: Handle) -> FaceBuilder { FaceBuilder { - stores, + objects, surface, exterior: None, interiors: Vec::new(), From 68835c13a94f625df9b65a092c59f396815da222 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:50:30 +0200 Subject: [PATCH 36/57] Rename struct field --- crates/fj-kernel/src/builder/shell.rs | 28 +++++++++++++-------------- crates/fj-kernel/src/objects/shell.rs | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/crates/fj-kernel/src/builder/shell.rs b/crates/fj-kernel/src/builder/shell.rs index c609cdc1b..ad93b34af 100644 --- a/crates/fj-kernel/src/builder/shell.rs +++ b/crates/fj-kernel/src/builder/shell.rs @@ -15,7 +15,7 @@ use crate::{ /// Also see [`Shell::builder`]. pub struct ShellBuilder<'a> { /// The stores that the created objects are put in - pub stores: &'a Objects, + pub objects: &'a Objects, } impl<'a> ShellBuilder<'a> { @@ -32,12 +32,12 @@ impl<'a> ShellBuilder<'a> { let bottom = { let surface = self - .stores + .objects .surfaces .insert(Surface::xy_plane()) - .translate([Z, Z, -h], self.stores); + .translate([Z, Z, -h], self.objects); - Face::builder(self.stores, surface) + Face::builder(self.objects, surface) .with_exterior_polygon_from_points([ [-h, -h], [h, -h], @@ -58,7 +58,7 @@ impl<'a> ShellBuilder<'a> { .map(|vertex| vertex.global_form().position()); let c = a + [Z, Z, edge_length]; - self.stores + self.objects .surfaces .insert(Surface::plane_from_points([a, b, c])) }) @@ -73,7 +73,7 @@ impl<'a> ShellBuilder<'a> { .with_surface(Some(surface.clone())) .with_global_form(Some(half_edge.global_form().clone())) .as_line_segment_from_points([[Z, Z], [edge_length, Z]]) - .build(self.stores) + .build(self.objects) }) .collect::>(); @@ -95,7 +95,7 @@ impl<'a> ShellBuilder<'a> { Vertex::partial().with_surface_form(Some(to)), ])) .as_line_segment() - .build(self.stores) + .build(self.objects) }) .collect::>(); @@ -132,7 +132,7 @@ impl<'a> ShellBuilder<'a> { Vertex::partial().with_surface_form(Some(to)), ])) .as_line_segment() - .build(self.stores) + .build(self.objects) }) .collect::>() }; @@ -160,7 +160,7 @@ impl<'a> ShellBuilder<'a> { HalfEdge::partial() .with_vertices(Some([from, to])) .as_line_segment() - .build(self.stores) + .build(self.objects) }) .collect::>(); @@ -174,7 +174,7 @@ impl<'a> ShellBuilder<'a> { let cycle = Cycle::partial() .with_surface(Some(surface)) .with_half_edges([bottom, side_up, top, side_down]) - .build(self.stores); + .build(self.objects); Face::from_exterior(cycle) }); @@ -184,10 +184,10 @@ impl<'a> ShellBuilder<'a> { let top = { let surface = self - .stores + .objects .surfaces .insert(Surface::xy_plane()) - .translate([Z, Z, h], self.stores); + .translate([Z, Z, h], self.objects); let points = [[-h, -h], [-h, h], [h, h], [h, -h], [-h, -h]]; @@ -212,7 +212,7 @@ impl<'a> ShellBuilder<'a> { .with_global_form(Some( vertex.global_form().clone(), )) - .build(self.stores); + .build(self.objects); Vertex::partial() .with_position(Some(vertex.position())) .with_surface_form(Some(surface_form)) @@ -224,7 +224,7 @@ impl<'a> ShellBuilder<'a> { .with_vertices(Some(vertices)) .with_global_form(Some(edge.global_form().clone())) .as_line_segment() - .build(self.stores), + .build(self.objects), ); } diff --git a/crates/fj-kernel/src/objects/shell.rs b/crates/fj-kernel/src/objects/shell.rs index 9df04c8c5..7af45d819 100644 --- a/crates/fj-kernel/src/objects/shell.rs +++ b/crates/fj-kernel/src/objects/shell.rs @@ -15,8 +15,8 @@ pub struct Shell { impl Shell { /// Build a `Shell` using [`ShellBuilder`] - pub fn builder(stores: &Objects) -> ShellBuilder { - ShellBuilder { stores } + pub fn builder(objects: &Objects) -> ShellBuilder { + ShellBuilder { objects } } /// Construct an empty instance of `Shell` From ebea38886d05f8eab860f1e671b11d28372b0c3a Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:51:18 +0200 Subject: [PATCH 37/57] Rename struct field --- crates/fj-kernel/src/builder/sketch.rs | 4 ++-- crates/fj-kernel/src/objects/sketch.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/fj-kernel/src/builder/sketch.rs b/crates/fj-kernel/src/builder/sketch.rs index 963e9e92a..7ca130e94 100644 --- a/crates/fj-kernel/src/builder/sketch.rs +++ b/crates/fj-kernel/src/builder/sketch.rs @@ -10,7 +10,7 @@ use crate::{ /// Also see [`Sketch::builder`]. pub struct SketchBuilder<'a> { /// The stores that the created objects are put in - pub stores: &'a Objects, + pub objects: &'a Objects, /// The surface that the [`Sketch`] is defined in pub surface: Handle, @@ -22,7 +22,7 @@ impl<'a> SketchBuilder<'a> { self, points: impl IntoIterator>>, ) -> Sketch { - let face = Face::builder(self.stores, self.surface) + let face = Face::builder(self.objects, self.surface) .with_exterior_polygon_from_points(points) .build(); Sketch::new().with_faces([face]) diff --git a/crates/fj-kernel/src/objects/sketch.rs b/crates/fj-kernel/src/objects/sketch.rs index aadd97e4a..8e441f61e 100644 --- a/crates/fj-kernel/src/objects/sketch.rs +++ b/crates/fj-kernel/src/objects/sketch.rs @@ -16,10 +16,10 @@ pub struct Sketch { impl Sketch { /// Build a `Sketch` using [`SketchBuilder`] pub fn builder( - stores: &Objects, + objects: &Objects, surface: Handle, ) -> SketchBuilder { - SketchBuilder { stores, surface } + SketchBuilder { objects, surface } } /// Construct an empty instance of `Sketch` From 21cf52095ac08b3834eecf9d09129403233736b1 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:52:02 +0200 Subject: [PATCH 38/57] Rename struct field --- crates/fj-kernel/src/builder/solid.rs | 4 ++-- crates/fj-kernel/src/objects/solid.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/fj-kernel/src/builder/solid.rs b/crates/fj-kernel/src/builder/solid.rs index fb6318f51..bbf923841 100644 --- a/crates/fj-kernel/src/builder/solid.rs +++ b/crates/fj-kernel/src/builder/solid.rs @@ -7,7 +7,7 @@ use crate::objects::{Objects, Shell, Solid}; /// Also see [`Solid::builder`]. pub struct SolidBuilder<'a> { /// The stores that the created objects are put in - pub stores: &'a Objects, + pub objects: &'a Objects, } impl<'a> SolidBuilder<'a> { @@ -16,7 +16,7 @@ impl<'a> SolidBuilder<'a> { self, edge_length: impl Into, ) -> Solid { - let shell = Shell::builder(self.stores) + let shell = Shell::builder(self.objects) .build_cube_from_edge_length(edge_length); Solid::new().with_shells([shell]) } diff --git a/crates/fj-kernel/src/objects/solid.rs b/crates/fj-kernel/src/objects/solid.rs index 8f49117da..75208cb00 100644 --- a/crates/fj-kernel/src/objects/solid.rs +++ b/crates/fj-kernel/src/objects/solid.rs @@ -17,8 +17,8 @@ pub struct Solid { impl Solid { /// Build a `Solid` using [`SolidBuilder`] - pub fn builder(stores: &Objects) -> SolidBuilder { - SolidBuilder { stores } + pub fn builder(objects: &Objects) -> SolidBuilder { + SolidBuilder { objects } } /// Construct an empty instance of `Solid` From 315b7bfbccfbf0930acc64e333568325604bd46a Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:53:37 +0200 Subject: [PATCH 39/57] Rename variables --- crates/fj-kernel/src/iter.rs | 58 ++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/crates/fj-kernel/src/iter.rs b/crates/fj-kernel/src/iter.rs index 446614fa7..efaf9b4f2 100644 --- a/crates/fj-kernel/src/iter.rs +++ b/crates/fj-kernel/src/iter.rs @@ -372,13 +372,13 @@ mod tests { #[test] fn curve() { - let stores = Objects::new(); + let objects = Objects::new(); - let surface = stores.surfaces.insert(Surface::xy_plane()); + let surface = objects.surfaces.insert(Surface::xy_plane()); let object = Handle::::partial() .with_surface(Some(surface)) .as_u_axis() - .build(&stores); + .build(&objects); assert_eq!(1, object.curve_iter().count()); assert_eq!(0, object.cycle_iter().count()); @@ -395,14 +395,14 @@ mod tests { #[test] fn cycle() { - let stores = Objects::new(); + let objects = Objects::new(); - let surface = stores.surfaces.insert(Surface::xy_plane()); + let surface = objects.surfaces.insert(Surface::xy_plane()); let object = Cycle::partial() .with_surface(Some(surface)) .with_poly_chain_from_points([[0., 0.], [1., 0.], [0., 1.]]) .close_with_line_segment() - .build(&stores); + .build(&objects); assert_eq!(3, object.curve_iter().count()); assert_eq!(1, object.cycle_iter().count()); @@ -419,10 +419,10 @@ mod tests { #[test] fn face() { - let stores = Objects::new(); + let objects = Objects::new(); - let surface = stores.surfaces.insert(Surface::xy_plane()); - let object = Face::builder(&stores, surface) + let surface = objects.surfaces.insert(Surface::xy_plane()); + let object = Face::builder(&objects, surface) .with_exterior_polygon_from_points([[0., 0.], [1., 0.], [0., 1.]]) .build(); @@ -441,9 +441,9 @@ mod tests { #[test] fn global_curve() { - let stores = Objects::new(); + let objects = Objects::new(); - let object = GlobalCurve::new(&stores); + let object = GlobalCurve::new(&objects); assert_eq!(0, object.curve_iter().count()); assert_eq!(0, object.cycle_iter().count()); @@ -460,9 +460,9 @@ mod tests { #[test] fn global_vertex() { - let stores = Objects::new(); + let objects = Objects::new(); - let object = GlobalVertex::from_position([0., 0., 0.], &stores); + let object = GlobalVertex::from_position([0., 0., 0.], &objects); assert_eq!(0, object.curve_iter().count()); assert_eq!(0, object.cycle_iter().count()); @@ -479,12 +479,12 @@ mod tests { #[test] fn half_edge() { - let stores = Objects::new(); + let objects = Objects::new(); let object = HalfEdge::partial() - .with_surface(Some(stores.surfaces.insert(Surface::xy_plane()))) + .with_surface(Some(objects.surfaces.insert(Surface::xy_plane()))) .as_line_segment_from_points([[0., 0.], [1., 0.]]) - .build(&stores); + .build(&objects); assert_eq!(1, object.curve_iter().count()); assert_eq!(0, object.cycle_iter().count()); @@ -501,9 +501,9 @@ mod tests { #[test] fn shell() { - let stores = Objects::new(); + let objects = Objects::new(); - let object = Shell::builder(&stores).build_cube_from_edge_length(1.); + let object = Shell::builder(&objects).build_cube_from_edge_length(1.); assert_eq!(24, object.curve_iter().count()); assert_eq!(6, object.cycle_iter().count()); @@ -520,10 +520,10 @@ mod tests { #[test] fn sketch() { - let stores = Objects::new(); + let objects = Objects::new(); - let surface = stores.surfaces.insert(Surface::xy_plane()); - let face = Face::builder(&stores, surface) + let surface = objects.surfaces.insert(Surface::xy_plane()); + let face = Face::builder(&objects, surface) .with_exterior_polygon_from_points([[0., 0.], [1., 0.], [0., 1.]]) .build(); let object = Sketch::new().with_faces([face]); @@ -543,9 +543,9 @@ mod tests { #[test] fn solid() { - let stores = Objects::new(); + let objects = Objects::new(); - let object = Solid::builder(&stores).build_cube_from_edge_length(1.); + let object = Solid::builder(&objects).build_cube_from_edge_length(1.); assert_eq!(24, object.curve_iter().count()); assert_eq!(6, object.cycle_iter().count()); @@ -562,9 +562,9 @@ mod tests { #[test] fn surface() { - let stores = Objects::new(); + let objects = Objects::new(); - let object = stores.surfaces.insert(Surface::xy_plane()); + let object = objects.surfaces.insert(Surface::xy_plane()); assert_eq!(0, object.curve_iter().count()); assert_eq!(0, object.cycle_iter().count()); @@ -581,14 +581,14 @@ mod tests { #[test] fn vertex() { - let stores = Objects::new(); + let objects = Objects::new(); - let surface = stores.surfaces.insert(Surface::xy_plane()); + let surface = objects.surfaces.insert(Surface::xy_plane()); let curve = Handle::::partial() .with_surface(Some(surface.clone())) .as_u_axis() - .build(&stores); - let global_vertex = GlobalVertex::from_position([0., 0., 0.], &stores); + .build(&objects); + let global_vertex = GlobalVertex::from_position([0., 0., 0.], &objects); let surface_vertex = SurfaceVertex::new([0., 0.], surface, global_vertex); let object = Vertex::new([0.], curve, surface_vertex); From 2268b4af550c11986bf8f91b0c36cb6ab33bd6a1 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:54:09 +0200 Subject: [PATCH 40/57] Rename arguments --- crates/fj-kernel/src/objects/curve.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/fj-kernel/src/objects/curve.rs b/crates/fj-kernel/src/objects/curve.rs index 2d153aa18..927684978 100644 --- a/crates/fj-kernel/src/objects/curve.rs +++ b/crates/fj-kernel/src/objects/curve.rs @@ -19,9 +19,9 @@ impl Curve { surface: Handle, path: SurfacePath, global_form: impl Into>, - stores: &Objects, + objects: &Objects, ) -> Handle { - stores.curves.insert(Self { + objects.curves.insert(Self { surface, path, global_form: global_form.into(), @@ -50,7 +50,7 @@ pub struct GlobalCurve; impl GlobalCurve { /// Construct a new instance of `Handle` and add it to the store - pub fn new(stores: &Objects) -> Handle { - stores.global_curves.insert(GlobalCurve) + pub fn new(objects: &Objects) -> Handle { + objects.global_curves.insert(GlobalCurve) } } From fabb6ae4346a48174c7a681607808274fa988ec0 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:54:36 +0200 Subject: [PATCH 41/57] Rename variable --- crates/fj-kernel/src/objects/edge.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/fj-kernel/src/objects/edge.rs b/crates/fj-kernel/src/objects/edge.rs index 079502eee..c93f074ec 100644 --- a/crates/fj-kernel/src/objects/edge.rs +++ b/crates/fj-kernel/src/objects/edge.rs @@ -181,9 +181,9 @@ mod tests { #[test] fn global_edge_equality() { - let stores = Objects::new(); + let objects = Objects::new(); - let surface = stores.surfaces.insert(Surface::xy_plane()); + let surface = objects.surfaces.insert(Surface::xy_plane()); let a = [0., 0.]; let b = [1., 0.]; @@ -191,11 +191,11 @@ mod tests { let a_to_b = HalfEdge::partial() .with_surface(Some(surface.clone())) .as_line_segment_from_points([a, b]) - .build(&stores); + .build(&objects); let b_to_a = HalfEdge::partial() .with_surface(Some(surface)) .as_line_segment_from_points([b, a]) - .build(&stores); + .build(&objects); assert_eq!(a_to_b.global_form(), b_to_a.global_form()); } From 1d7c10033272e3f455789f965cc36d9031a7d59e Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:55:00 +0200 Subject: [PATCH 42/57] Rename argument --- crates/fj-kernel/src/objects/vertex.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-kernel/src/objects/vertex.rs b/crates/fj-kernel/src/objects/vertex.rs index 0bf3d51ea..91a36935a 100644 --- a/crates/fj-kernel/src/objects/vertex.rs +++ b/crates/fj-kernel/src/objects/vertex.rs @@ -129,10 +129,10 @@ impl GlobalVertex { /// Construct a `GlobalVertex` from a position pub fn from_position( position: impl Into>, - stores: &Objects, + objects: &Objects, ) -> Handle { let position = position.into(); - stores.global_vertices.insert(Self { position }) + objects.global_vertices.insert(Self { position }) } /// Access the position of the vertex From a7207d98ccfc23c2c138c3e0ebfd490205dc58f3 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:55:27 +0200 Subject: [PATCH 43/57] Rename argument --- crates/fj-kernel/src/partial/maybe_partial.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-kernel/src/partial/maybe_partial.rs b/crates/fj-kernel/src/partial/maybe_partial.rs index f69afd854..b931e11dd 100644 --- a/crates/fj-kernel/src/partial/maybe_partial.rs +++ b/crates/fj-kernel/src/partial/maybe_partial.rs @@ -48,9 +48,9 @@ impl MaybePartial { /// /// If this already is a full object, it is returned. If this is a partial /// object, the full object is built from it, using [`Partial::build`]. - pub fn into_full(self, stores: &Objects) -> T { + pub fn into_full(self, objects: &Objects) -> T { match self { - Self::Partial(partial) => partial.build(stores), + Self::Partial(partial) => partial.build(objects), Self::Full(full) => full, } } From fa899fcb4e8b1412c9f18c5c58457c6fe9c44acd Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:56:05 +0200 Subject: [PATCH 44/57] Rename argument --- crates/fj-kernel/src/partial/objects/curve.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fj-kernel/src/partial/objects/curve.rs b/crates/fj-kernel/src/partial/objects/curve.rs index a517f3567..e760bb264 100644 --- a/crates/fj-kernel/src/partial/objects/curve.rs +++ b/crates/fj-kernel/src/partial/objects/curve.rs @@ -83,16 +83,16 @@ impl PartialCurve { } /// Build a full [`Curve`] from the partial curve - pub fn build(self, stores: &Objects) -> Handle { + pub fn build(self, objects: &Objects) -> Handle { let path = self.path.expect("Can't build `Curve` without path"); let surface = self.surface.expect("Can't build `Curve` without surface"); let global_form = self .global_form - .unwrap_or_else(|| GlobalCurve::new(stores).into()); + .unwrap_or_else(|| GlobalCurve::new(objects).into()); - Curve::new(surface, path, global_form, stores) + Curve::new(surface, path, global_form, objects) } } From e43dcac26f6fcf8d4d33522f7357f1715de862b8 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:56:27 +0200 Subject: [PATCH 45/57] Rename argument --- crates/fj-kernel/src/partial/objects/cycle.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-kernel/src/partial/objects/cycle.rs b/crates/fj-kernel/src/partial/objects/cycle.rs index 4fc9fd9d6..41c84963b 100644 --- a/crates/fj-kernel/src/partial/objects/cycle.rs +++ b/crates/fj-kernel/src/partial/objects/cycle.rs @@ -156,7 +156,7 @@ impl PartialCycle { } /// Build a full [`Cycle`] from the partial cycle - pub fn build(self, stores: &Objects) -> Cycle { + pub fn build(self, objects: &Objects) -> Cycle { let surface = self.surface.expect("Need surface to build `Cycle`"); let surface_for_edges = surface.clone(); let half_edges = self.half_edges.into_iter().map(|half_edge| { @@ -164,7 +164,7 @@ impl PartialCycle { .update_partial(|half_edge| { half_edge.with_surface(Some(surface_for_edges.clone())) }) - .into_full(stores) + .into_full(objects) }); Cycle::new(surface, half_edges) From f54bfe9bc4557a5ca3f687414b40725b8f0ee21e Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:56:53 +0200 Subject: [PATCH 46/57] Rename argument --- crates/fj-kernel/src/partial/objects/edge.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/fj-kernel/src/partial/objects/edge.rs b/crates/fj-kernel/src/partial/objects/edge.rs index d7be68ff0..640caa6e3 100644 --- a/crates/fj-kernel/src/partial/objects/edge.rs +++ b/crates/fj-kernel/src/partial/objects/edge.rs @@ -181,13 +181,13 @@ impl PartialHalfEdge { } /// Build a full [`HalfEdge`] from the partial half-edge - pub fn build(self, stores: &Objects) -> HalfEdge { + pub fn build(self, objects: &Objects) -> HalfEdge { let surface = self.surface; let curve = self .curve .expect("Can't build `HalfEdge` without curve") .update_partial(|curve| curve.with_surface(surface)) - .into_full(stores); + .into_full(objects); let vertices = self .vertices .expect("Can't build `HalfEdge` without vertices") @@ -196,7 +196,7 @@ impl PartialHalfEdge { .update_partial(|vertex| { vertex.with_curve(Some(curve.clone())) }) - .into_full(stores) + .into_full(objects) }); let global_form = self @@ -206,7 +206,7 @@ impl PartialHalfEdge { .from_curve_and_vertices(&curve, &vertices) .into() }) - .into_full(stores); + .into_full(objects); HalfEdge::new(vertices, global_form) } From d5abf06a4604f111d5a761434fa7fdc3f934d58e Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:57:21 +0200 Subject: [PATCH 47/57] Rename argument --- crates/fj-kernel/src/partial/objects/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-kernel/src/partial/objects/mod.rs b/crates/fj-kernel/src/partial/objects/mod.rs index f8eb5de1b..043366bbe 100644 --- a/crates/fj-kernel/src/partial/objects/mod.rs +++ b/crates/fj-kernel/src/partial/objects/mod.rs @@ -27,8 +27,8 @@ macro_rules! impl_traits { impl Partial for $partial { type Full = $full; - fn build(self, stores: &Objects) -> Self::Full { - self.build(stores) + fn build(self, objects: &Objects) -> Self::Full { + self.build(objects) } } From fa90e7f62b1b2ada12e7ec28437456c727a95e81 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:58:03 +0200 Subject: [PATCH 48/57] Rename arguments --- crates/fj-kernel/src/partial/objects/vertex.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/fj-kernel/src/partial/objects/vertex.rs b/crates/fj-kernel/src/partial/objects/vertex.rs index 18ca23ab7..0a3513dae 100644 --- a/crates/fj-kernel/src/partial/objects/vertex.rs +++ b/crates/fj-kernel/src/partial/objects/vertex.rs @@ -86,14 +86,14 @@ impl PartialVertex { /// Panics, if no position has been provided. /// /// Panics, if no curve has been provided. - pub fn build(self, stores: &Objects) -> Vertex { + pub fn build(self, objects: &Objects) -> Vertex { let position = self .position .expect("Cant' build `Vertex` without position"); let curve = self .curve .expect("Can't build `Vertex` without `Curve`") - .into_full(stores); + .into_full(objects); let surface_form = self .surface_form @@ -108,7 +108,7 @@ impl PartialVertex { .with_surface(Some(curve.surface().clone())) .with_global_form(self.global_form) }) - .into_full(stores); + .into_full(objects); Vertex::new(position, curve, surface_form) } @@ -185,7 +185,7 @@ impl PartialSurfaceVertex { /// Panics, if no position has been provided. /// /// Panics, if no surface has been provided. - pub fn build(self, stores: &Objects) -> SurfaceVertex { + pub fn build(self, objects: &Objects) -> SurfaceVertex { let position = self .position .expect("Can't build `SurfaceVertex` without position"); @@ -200,7 +200,7 @@ impl PartialSurfaceVertex { .from_surface_and_position(&surface, position) .into() }) - .into_full(stores); + .into_full(objects); SurfaceVertex::new(position, surface, global_form) } @@ -269,12 +269,12 @@ impl PartialGlobalVertex { } /// Build a full [`GlobalVertex`] from the partial global vertex - pub fn build(self, stores: &Objects) -> Handle { + pub fn build(self, objects: &Objects) -> Handle { let position = self .position .expect("Can't build a `GlobalVertex` without a position"); - GlobalVertex::from_position(position, stores) + GlobalVertex::from_position(position, objects) } } From 61e9510e7c69ce18697e6bc65a961a3981f1e272 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:58:27 +0200 Subject: [PATCH 49/57] Rename argument --- crates/fj-kernel/src/partial/traits.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/fj-kernel/src/partial/traits.rs b/crates/fj-kernel/src/partial/traits.rs index e76cced11..2065f60f9 100644 --- a/crates/fj-kernel/src/partial/traits.rs +++ b/crates/fj-kernel/src/partial/traits.rs @@ -77,5 +77,5 @@ pub trait Partial: Default + for<'a> From<&'a Self::Full> { /// Calling `build` on a partial object that can't infer its missing parts /// is considered a programmer error, hence why this method doesn't return a /// [`Result`]. - fn build(self, stores: &Objects) -> Self::Full; + fn build(self, objects: &Objects) -> Self::Full; } From da5cf263a179739956703fad1dfb8eb6aa2e3ee9 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:58:45 +0200 Subject: [PATCH 50/57] Rename argument --- crates/fj-operations/src/difference_2d.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-operations/src/difference_2d.rs b/crates/fj-operations/src/difference_2d.rs index 8d5e880f9..3c1552580 100644 --- a/crates/fj-operations/src/difference_2d.rs +++ b/crates/fj-operations/src/difference_2d.rs @@ -19,7 +19,7 @@ impl Shape for fj::Difference2d { fn compute_brep( &self, config: &ValidationConfig, - stores: &Objects, + objects: &Objects, planes: &Planes, debug_info: &mut DebugInfo, ) -> Result, ValidationError> { @@ -36,7 +36,7 @@ impl Shape for fj::Difference2d { // - https://doc.rust-lang.org/std/primitive.array.html#method.try_map let [a, b] = self.shapes(); let [a, b] = [a, b].map(|shape| { - shape.compute_brep(config, stores, planes, debug_info) + shape.compute_brep(config, objects, planes, debug_info) }); let [a, b] = [a?, b?]; From c1364d2ab90dc2f7753c0ccde632b62b551c9d02 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:59:09 +0200 Subject: [PATCH 51/57] Rename argument --- crates/fj-operations/src/group.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fj-operations/src/group.rs b/crates/fj-operations/src/group.rs index 7e3229f35..03856d8f9 100644 --- a/crates/fj-operations/src/group.rs +++ b/crates/fj-operations/src/group.rs @@ -17,14 +17,14 @@ impl Shape for fj::Group { fn compute_brep( &self, config: &ValidationConfig, - stores: &Objects, + objects: &Objects, planes: &Planes, debug_info: &mut DebugInfo, ) -> Result, ValidationError> { let mut faces = Faces::new(); - let a = self.a.compute_brep(config, stores, planes, debug_info)?; - let b = self.b.compute_brep(config, stores, planes, debug_info)?; + let a = self.a.compute_brep(config, objects, planes, debug_info)?; + let b = self.b.compute_brep(config, objects, planes, debug_info)?; faces.extend(a.into_inner()); faces.extend(b.into_inner()); From bdbed13583b95f5a04748d6ef8ca9d308ff98775 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 19:59:57 +0200 Subject: [PATCH 52/57] Rename arguments --- crates/fj-operations/src/lib.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/fj-operations/src/lib.rs b/crates/fj-operations/src/lib.rs index a8c9cbb52..d0eaf4fad 100644 --- a/crates/fj-operations/src/lib.rs +++ b/crates/fj-operations/src/lib.rs @@ -45,7 +45,7 @@ pub trait Shape { fn compute_brep( &self, config: &ValidationConfig, - stores: &Objects, + objects: &Objects, planes: &Planes, debug_info: &mut DebugInfo, ) -> Result, ValidationError>; @@ -63,21 +63,21 @@ impl Shape for fj::Shape { fn compute_brep( &self, config: &ValidationConfig, - stores: &Objects, + objects: &Objects, planes: &Planes, debug_info: &mut DebugInfo, ) -> Result, ValidationError> { match self { Self::Shape2d(shape) => shape - .compute_brep(config, stores, planes, debug_info)? + .compute_brep(config, objects, planes, debug_info)? .into_inner() .into_faces() .validate_with_config(config), Self::Group(shape) => { - shape.compute_brep(config, stores, planes, debug_info) + shape.compute_brep(config, objects, planes, debug_info) } Self::Sweep(shape) => shape - .compute_brep(config, stores, planes, debug_info)? + .compute_brep(config, objects, planes, debug_info)? .into_inner() .into_shells() .map(|shell| shell.into_faces()) @@ -88,7 +88,7 @@ impl Shape for fj::Shape { .unwrap_or_default() .validate_with_config(config), Self::Transform(shape) => { - shape.compute_brep(config, stores, planes, debug_info) + shape.compute_brep(config, objects, planes, debug_info) } } } @@ -109,16 +109,16 @@ impl Shape for fj::Shape2d { fn compute_brep( &self, config: &ValidationConfig, - stores: &Objects, + objects: &Objects, planes: &Planes, debug_info: &mut DebugInfo, ) -> Result, ValidationError> { match self { Self::Difference(shape) => { - shape.compute_brep(config, stores, planes, debug_info) + shape.compute_brep(config, objects, planes, debug_info) } Self::Sketch(shape) => { - shape.compute_brep(config, stores, planes, debug_info) + shape.compute_brep(config, objects, planes, debug_info) } } } From dc9ce193f8749fe7ce80479832ab482854844bc8 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 20:01:10 +0200 Subject: [PATCH 53/57] Rename argument --- crates/fj-operations/src/planes.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/fj-operations/src/planes.rs b/crates/fj-operations/src/planes.rs index 9b351ecd6..29d4601fb 100644 --- a/crates/fj-operations/src/planes.rs +++ b/crates/fj-operations/src/planes.rs @@ -25,10 +25,10 @@ impl Planes { /// /// Create one instance of this struct, then share it everywhere it's /// needed. - pub fn new(stores: &Objects) -> Self { - let xy = stores.surfaces.insert(Surface::xy_plane()); - let xz = stores.surfaces.insert(Surface::xz_plane()); - let yz = stores.surfaces.insert(Surface::yz_plane()); + pub fn new(objects: &Objects) -> Self { + let xy = objects.surfaces.insert(Surface::xy_plane()); + let xz = objects.surfaces.insert(Surface::xz_plane()); + let yz = objects.surfaces.insert(Surface::yz_plane()); Self { xy, xz, yz } } From 89a848960152fd1cb41c5e4e949939956df1111d Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 20:01:34 +0200 Subject: [PATCH 54/57] Rename variable --- crates/fj-operations/src/shape_processor.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fj-operations/src/shape_processor.rs b/crates/fj-operations/src/shape_processor.rs index b446bfb89..0bc741e19 100644 --- a/crates/fj-operations/src/shape_processor.rs +++ b/crates/fj-operations/src/shape_processor.rs @@ -43,11 +43,11 @@ impl ShapeProcessor { }; let config = ValidationConfig::default(); - let stores = Objects::new(); - let planes = Planes::new(&stores); + let objects = Objects::new(); + let planes = Planes::new(&objects); let mut debug_info = DebugInfo::new(); let shape = - shape.compute_brep(&config, &stores, &planes, &mut debug_info)?; + shape.compute_brep(&config, &objects, &planes, &mut debug_info)?; let mesh = (&shape.into_inner(), tolerance).triangulate(); Ok(ProcessedShape { From 72f02987d2078e1f48a8bb9b7f4007842990488e Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 20:01:59 +0200 Subject: [PATCH 55/57] Rename argument --- crates/fj-operations/src/sketch.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fj-operations/src/sketch.rs b/crates/fj-operations/src/sketch.rs index 9dafad662..9da518db1 100644 --- a/crates/fj-operations/src/sketch.rs +++ b/crates/fj-operations/src/sketch.rs @@ -18,7 +18,7 @@ impl Shape for fj::Sketch { fn compute_brep( &self, config: &ValidationConfig, - stores: &Objects, + objects: &Objects, planes: &Planes, _: &mut DebugInfo, ) -> Result, ValidationError> { @@ -32,7 +32,7 @@ impl Shape for fj::Sketch { let half_edge = HalfEdge::partial() .with_surface(Some(surface.clone())) .as_circle_from_radius(circle.radius()) - .build(stores); + .build(objects); let cycle = Cycle::new(surface, [half_edge]); Face::from_exterior(cycle).with_color(Color(self.color())) @@ -41,7 +41,7 @@ impl Shape for fj::Sketch { let points = poly_chain.to_points().into_iter().map(Point::from); - Face::builder(stores, surface) + Face::builder(objects, surface) .with_exterior_polygon_from_points(points) .build() .with_color(Color(self.color())) From 3332b629c9467e60260d4e04dc19db001c677285 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 20:02:22 +0200 Subject: [PATCH 56/57] Rename argument --- crates/fj-operations/src/sweep.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fj-operations/src/sweep.rs b/crates/fj-operations/src/sweep.rs index 850221a73..036c43465 100644 --- a/crates/fj-operations/src/sweep.rs +++ b/crates/fj-operations/src/sweep.rs @@ -18,16 +18,16 @@ impl Shape for fj::Sweep { fn compute_brep( &self, config: &ValidationConfig, - stores: &Objects, + objects: &Objects, planes: &Planes, debug_info: &mut DebugInfo, ) -> Result, ValidationError> { let sketch = self .shape() - .compute_brep(config, stores, planes, debug_info)?; + .compute_brep(config, objects, planes, debug_info)?; let path = Vector::from(self.path()); - let solid = sketch.into_inner().sweep(path, stores); + let solid = sketch.into_inner().sweep(path, objects); solid.validate_with_config(config) } From 10839ba562a7282e7ec851e7b4e46936acfeda20 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 10 Oct 2022 20:02:41 +0200 Subject: [PATCH 57/57] Rename argument --- crates/fj-operations/src/transform.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fj-operations/src/transform.rs b/crates/fj-operations/src/transform.rs index f90b01eec..52d0f7858 100644 --- a/crates/fj-operations/src/transform.rs +++ b/crates/fj-operations/src/transform.rs @@ -18,15 +18,15 @@ impl Shape for fj::Transform { fn compute_brep( &self, config: &ValidationConfig, - stores: &Objects, + objects: &Objects, planes: &Planes, debug_info: &mut DebugInfo, ) -> Result, ValidationError> { let faces = self .shape - .compute_brep(config, stores, planes, debug_info)? + .compute_brep(config, objects, planes, debug_info)? .into_inner() - .transform(&make_transform(self), stores); + .transform(&make_transform(self), objects); faces.validate_with_config(config) }