From 6699483193a8b367de7c1e3275ea63617d9e26c1 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 16 Feb 2024 12:34:27 +0100 Subject: [PATCH 1/3] Rename `fj_core::Instance` to `Core` The new name is shorter, matches the variable and argument names that are already in use, and doesn't clash with `fj::Instance`. --- crates/fj-core/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 | 6 ++-- .../src/algorithms/intersect/face_point.rs | 18 +++++------ .../src/algorithms/intersect/ray_face.rs | 16 +++++----- .../algorithms/intersect/surface_surface.rs | 4 +-- .../fj-core/src/algorithms/triangulate/mod.rs | 8 ++--- crates/fj-core/src/instance.rs | 6 ++-- crates/fj-core/src/lib.rs | 2 +- crates/fj-core/src/operations/build/cycle.rs | 6 ++-- crates/fj-core/src/operations/build/face.rs | 8 ++--- .../fj-core/src/operations/build/half_edge.rs | 10 +++--- crates/fj-core/src/operations/build/region.rs | 8 ++--- crates/fj-core/src/operations/build/shell.rs | 6 ++-- crates/fj-core/src/operations/build/solid.rs | 4 +-- crates/fj-core/src/operations/holes.rs | 10 +++--- .../src/operations/insert/insert_trait.rs | 12 +++---- crates/fj-core/src/operations/join/cycle.rs | 10 +++--- crates/fj-core/src/operations/merge.rs | 6 ++-- .../fj-core/src/operations/replace/curve.rs | 32 +++++++++---------- .../src/operations/replace/half_edge.rs | 28 ++++++++-------- .../fj-core/src/operations/replace/vertex.rs | 32 +++++++++---------- .../fj-core/src/operations/reverse/cycle.rs | 6 ++-- crates/fj-core/src/operations/reverse/edge.rs | 4 +-- crates/fj-core/src/operations/reverse/face.rs | 14 ++++---- crates/fj-core/src/operations/reverse/mod.rs | 6 ++-- .../fj-core/src/operations/reverse/region.rs | 6 ++-- crates/fj-core/src/operations/split/edge.rs | 6 ++-- crates/fj-core/src/operations/split/face.rs | 6 ++-- .../fj-core/src/operations/split/half_edge.rs | 6 ++-- crates/fj-core/src/operations/sweep/cycle.rs | 6 ++-- crates/fj-core/src/operations/sweep/face.rs | 6 ++-- .../fj-core/src/operations/sweep/half_edge.rs | 6 ++-- crates/fj-core/src/operations/sweep/region.rs | 8 ++--- .../src/operations/sweep/shell_face.rs | 6 ++-- crates/fj-core/src/operations/sweep/sketch.rs | 6 ++-- crates/fj-core/src/operations/sweep/vertex.rs | 6 ++-- .../fj-core/src/operations/transform/curve.rs | 4 +-- .../fj-core/src/operations/transform/cycle.rs | 4 +-- .../fj-core/src/operations/transform/edge.rs | 4 +-- .../fj-core/src/operations/transform/face.rs | 4 +-- .../fj-core/src/operations/transform/mod.rs | 16 ++++------ .../src/operations/transform/region.rs | 4 +-- .../fj-core/src/operations/transform/shell.rs | 4 +-- .../fj-core/src/operations/transform/solid.rs | 4 +-- .../src/operations/transform/surface.rs | 4 +-- .../src/operations/transform/vertex.rs | 4 +-- crates/fj-core/src/operations/update/cycle.rs | 14 ++++---- crates/fj-core/src/operations/update/face.rs | 14 ++++---- .../src/operations/update/half_edge.rs | 18 +++++------ .../fj-core/src/operations/update/region.rs | 22 ++++++------- crates/fj-core/src/operations/update/shell.rs | 14 ++++---- .../fj-core/src/operations/update/sketch.rs | 14 ++++---- crates/fj-core/src/operations/update/solid.rs | 14 ++++---- crates/fj-core/src/validate/cycle.rs | 4 +-- crates/fj-core/src/validate/edge.rs | 4 +-- crates/fj-core/src/validate/face.rs | 6 ++-- crates/fj-core/src/validate/shell.rs | 8 ++--- crates/fj-core/src/validate/sketch.rs | 6 ++-- crates/fj-core/src/validate/solid.rs | 10 +++--- crates/fj/src/instance.rs | 4 +-- models/all/src/lib.rs | 2 +- models/color/src/lib.rs | 2 +- models/cuboid/src/lib.rs | 5 +-- models/holes/src/lib.rs | 5 +-- models/spacer/src/lib.rs | 2 +- models/split/src/lib.rs | 6 +--- models/star/src/lib.rs | 2 +- models/vertices-indices/src/lib.rs | 2 +- 70 files changed, 285 insertions(+), 299 deletions(-) diff --git a/crates/fj-core/src/algorithms/approx/curve.rs b/crates/fj-core/src/algorithms/approx/curve.rs index d3fa3fc31d..b0a658a2af 100644 --- a/crates/fj-core/src/algorithms/approx/curve.rs +++ b/crates/fj-core/src/algorithms/approx/curve.rs @@ -181,12 +181,12 @@ mod tests { geometry::{CurveBoundary, GlobalPath, SurfaceGeometry, SurfacePath}, objects::{Curve, Surface}, operations::insert::Insert, - Instance, + Core, }; #[test] fn approx_line_on_flat_surface() { - let mut core = Instance::new(); + let mut core = Core::new(); let curve = Curve::new().insert(&mut core); let (surface_path, boundary) = @@ -203,7 +203,7 @@ mod tests { #[test] fn approx_line_on_curved_surface_but_not_along_curve() { - let mut core = Instance::new(); + let mut core = Core::new(); let curve = Curve::new().insert(&mut core); let (surface_path, boundary) = @@ -223,7 +223,7 @@ mod tests { #[test] fn approx_line_on_curved_surface_along_curve() { - let mut core = Instance::new(); + let mut core = Core::new(); let global_path = GlobalPath::circle_from_radius(1.); let curve = Curve::new().insert(&mut core); @@ -257,7 +257,7 @@ mod tests { #[test] fn approx_circle_on_flat_surface() { - let mut core = Instance::new(); + let mut core = Core::new(); let curve = Curve::new().insert(&mut core); let surface_path = diff --git a/crates/fj-core/src/algorithms/intersect/curve_edge.rs b/crates/fj-core/src/algorithms/intersect/curve_edge.rs index 7b73d57c8d..91a1129c60 100644 --- a/crates/fj-core/src/algorithms/intersect/curve_edge.rs +++ b/crates/fj-core/src/algorithms/intersect/curve_edge.rs @@ -73,14 +73,14 @@ mod tests { use crate::{ geometry::SurfacePath, objects::HalfEdge, - operations::build::BuildHalfEdge, Instance, + operations::build::BuildHalfEdge, Core, }; use super::CurveEdgeIntersection; #[test] fn compute_edge_in_front_of_curve_origin() { - let mut core = Instance::new(); + let mut core = Core::new(); let path = SurfacePath::u_axis(); let edge = @@ -98,7 +98,7 @@ mod tests { #[test] fn compute_edge_behind_curve_origin() { - let mut core = Instance::new(); + let mut core = Core::new(); let path = SurfacePath::u_axis(); let edge = @@ -116,7 +116,7 @@ mod tests { #[test] fn compute_edge_parallel_to_curve() { - let mut core = Instance::new(); + let mut core = Core::new(); let path = SurfacePath::u_axis(); let edge = @@ -129,7 +129,7 @@ mod tests { #[test] fn compute_edge_on_curve() { - let mut core = Instance::new(); + let mut core = Core::new(); let path = SurfacePath::u_axis(); let edge = diff --git a/crates/fj-core/src/algorithms/intersect/curve_face.rs b/crates/fj-core/src/algorithms/intersect/curve_face.rs index dc5472a42e..8d2776e257 100644 --- a/crates/fj-core/src/algorithms/intersect/curve_face.rs +++ b/crates/fj-core/src/algorithms/intersect/curve_face.rs @@ -159,14 +159,14 @@ mod tests { build::{BuildCycle, BuildFace}, update::{UpdateFace, UpdateRegion}, }, - Instance, + Core, }; use super::CurveFaceIntersection; #[test] fn compute() { - let mut core = Instance::new(); + let mut core = Core::new(); let (path, _) = SurfacePath::line_from_points([[-3., 0.], [-2., 0.]]); diff --git a/crates/fj-core/src/algorithms/intersect/face_face.rs b/crates/fj-core/src/algorithms/intersect/face_face.rs index da459655f9..eb60b7ebda 100644 --- a/crates/fj-core/src/algorithms/intersect/face_face.rs +++ b/crates/fj-core/src/algorithms/intersect/face_face.rs @@ -68,14 +68,14 @@ mod tests { build::{BuildCycle, BuildFace}, update::{UpdateFace, UpdateRegion}, }, - Instance, + Core, }; use super::FaceFaceIntersection; #[test] fn compute_no_intersection() { - let mut core = Instance::new(); + let mut core = Core::new(); #[rustfmt::skip] let points = [ @@ -106,7 +106,7 @@ mod tests { #[test] fn compute_one_intersection() { - let mut core = Instance::new(); + let mut core = Core::new(); #[rustfmt::skip] let points = [ diff --git a/crates/fj-core/src/algorithms/intersect/face_point.rs b/crates/fj-core/src/algorithms/intersect/face_point.rs index 38a98a1a29..a634dc6dd3 100644 --- a/crates/fj-core/src/algorithms/intersect/face_point.rs +++ b/crates/fj-core/src/algorithms/intersect/face_point.rs @@ -140,12 +140,12 @@ mod tests { build::{BuildCycle, BuildFace}, update::{UpdateFace, UpdateRegion}, }, - Instance, + Core, }; #[test] fn point_is_outside_face() { - let mut core = Instance::new(); + let mut core = Core::new(); let face = Face::unbound(core.layers.objects.surfaces.xy_plane(), &mut core) @@ -171,7 +171,7 @@ mod tests { #[test] fn ray_hits_vertex_while_passing_outside() { - let mut core = Instance::new(); + let mut core = Core::new(); let face = Face::unbound(core.layers.objects.surfaces.xy_plane(), &mut core) @@ -200,7 +200,7 @@ mod tests { #[test] fn ray_hits_vertex_at_cycle_seam() { - let mut core = Instance::new(); + let mut core = Core::new(); let face = Face::unbound(core.layers.objects.surfaces.xy_plane(), &mut core) @@ -229,7 +229,7 @@ mod tests { #[test] fn ray_hits_vertex_while_staying_inside() { - let mut core = Instance::new(); + let mut core = Core::new(); let face = Face::unbound(core.layers.objects.surfaces.xy_plane(), &mut core) @@ -258,7 +258,7 @@ mod tests { #[test] fn ray_hits_parallel_edge_and_leaves_face_at_vertex() { - let mut core = Instance::new(); + let mut core = Core::new(); let face = Face::unbound(core.layers.objects.surfaces.xy_plane(), &mut core) @@ -287,7 +287,7 @@ mod tests { #[test] fn ray_hits_parallel_edge_and_does_not_leave_face_there() { - let mut core = Instance::new(); + let mut core = Core::new(); let face = Face::unbound(core.layers.objects.surfaces.xy_plane(), &mut core) @@ -322,7 +322,7 @@ mod tests { #[test] fn point_is_coincident_with_edge() { - let mut core = Instance::new(); + let mut core = Core::new(); let face = Face::unbound(core.layers.objects.surfaces.xy_plane(), &mut core) @@ -359,7 +359,7 @@ mod tests { #[test] fn point_is_coincident_with_vertex() { - let mut core = Instance::new(); + let mut core = Core::new(); let face = Face::unbound(core.layers.objects.surfaces.xy_plane(), &mut core) diff --git a/crates/fj-core/src/algorithms/intersect/ray_face.rs b/crates/fj-core/src/algorithms/intersect/ray_face.rs index 4b62b1f03f..23e70a3853 100644 --- a/crates/fj-core/src/algorithms/intersect/ray_face.rs +++ b/crates/fj-core/src/algorithms/intersect/ray_face.rs @@ -154,12 +154,12 @@ mod tests { transform::TransformObject, update::{UpdateFace, UpdateRegion}, }, - Instance, + Core, }; #[test] fn ray_misses_whole_surface() { - let mut core = Instance::new(); + let mut core = Core::new(); let ray = HorizontalRayToTheRight::from([0., 0., 0.]); @@ -191,7 +191,7 @@ mod tests { #[test] fn ray_hits_face() { - let mut core = Instance::new(); + let mut core = Core::new(); let ray = HorizontalRayToTheRight::from([0., 0., 0.]); @@ -226,7 +226,7 @@ mod tests { #[test] fn ray_hits_surface_but_misses_face() { - let mut core = Instance::new(); + let mut core = Core::new(); let ray = HorizontalRayToTheRight::from([0., 0., 0.]); @@ -258,7 +258,7 @@ mod tests { #[test] fn ray_hits_edge() { - let mut core = Instance::new(); + let mut core = Core::new(); let ray = HorizontalRayToTheRight::from([0., 0., 0.]); @@ -300,7 +300,7 @@ mod tests { #[test] fn ray_hits_vertex() { - let mut core = Instance::new(); + let mut core = Core::new(); let ray = HorizontalRayToTheRight::from([0., 0., 0.]); @@ -343,7 +343,7 @@ mod tests { #[test] fn ray_is_parallel_to_surface_and_hits() { - let mut core = Instance::new(); + let mut core = Core::new(); let ray = HorizontalRayToTheRight::from([0., 0., 0.]); @@ -377,7 +377,7 @@ mod tests { #[test] fn ray_is_parallel_to_surface_and_misses() { - let mut core = Instance::new(); + let mut core = Core::new(); let ray = HorizontalRayToTheRight::from([0., 0., 0.]); diff --git a/crates/fj-core/src/algorithms/intersect/surface_surface.rs b/crates/fj-core/src/algorithms/intersect/surface_surface.rs index edf2bf724b..a5be37894b 100644 --- a/crates/fj-core/src/algorithms/intersect/surface_surface.rs +++ b/crates/fj-core/src/algorithms/intersect/surface_surface.rs @@ -76,14 +76,14 @@ mod tests { use pretty_assertions::assert_eq; use crate::{ - geometry::SurfacePath, operations::transform::TransformObject, Instance, + geometry::SurfacePath, operations::transform::TransformObject, Core, }; use super::SurfaceSurfaceIntersection; #[test] fn plane_plane() { - let mut core = Instance::new(); + let mut core = Core::new(); let xy = core.layers.objects.surfaces.xy_plane(); let xz = core.layers.objects.surfaces.xz_plane(); diff --git a/crates/fj-core/src/algorithms/triangulate/mod.rs b/crates/fj-core/src/algorithms/triangulate/mod.rs index 653fe89bc3..534cca377a 100644 --- a/crates/fj-core/src/algorithms/triangulate/mod.rs +++ b/crates/fj-core/src/algorithms/triangulate/mod.rs @@ -84,14 +84,14 @@ mod tests { build::{BuildCycle, BuildFace}, update::{UpdateFace, UpdateRegion}, }, - Instance, + Core, }; use super::Triangulate; #[test] fn simple() -> anyhow::Result<()> { - let mut core = Instance::new(); + let mut core = Core::new(); let a = [0., 0.]; let b = [2., 0.]; @@ -127,7 +127,7 @@ mod tests { #[test] fn simple_hole() -> anyhow::Result<()> { - let mut core = Instance::new(); + let mut core = Core::new(); let a = [0., 0.]; let b = [4., 0.]; @@ -185,7 +185,7 @@ mod tests { #[test] fn sharp_concave_shape() -> anyhow::Result<()> { - let mut core = Instance::new(); + let mut core = Core::new(); // e c // |\ /| diff --git a/crates/fj-core/src/instance.rs b/crates/fj-core/src/instance.rs index 242c2f5d71..ae8c0e39ce 100644 --- a/crates/fj-core/src/instance.rs +++ b/crates/fj-core/src/instance.rs @@ -1,6 +1,6 @@ //! Main entry point to the `fj-core` API //! -//! See [`Instance`]. +//! See [`Core`]. use crate::{layers::Layers, validate::ValidationConfig}; @@ -8,12 +8,12 @@ use crate::{layers::Layers, validate::ValidationConfig}; /// /// This is the main entry point to `fj-core`'s API. #[derive(Default)] -pub struct Instance { +pub struct Core { /// The layers of data that make up the state of a core instance pub layers: Layers, } -impl Instance { +impl Core { /// Construct an instance of `Instance` pub fn new() -> Self { Self::default() diff --git a/crates/fj-core/src/lib.rs b/crates/fj-core/src/lib.rs index 5f87b5489f..e8511e6c13 100644 --- a/crates/fj-core/src/lib.rs +++ b/crates/fj-core/src/lib.rs @@ -92,4 +92,4 @@ pub mod validate; mod instance; -pub use self::instance::Instance; +pub use self::instance::Core; diff --git a/crates/fj-core/src/operations/build/cycle.rs b/crates/fj-core/src/operations/build/cycle.rs index 454cf5c205..118c09102e 100644 --- a/crates/fj-core/src/operations/build/cycle.rs +++ b/crates/fj-core/src/operations/build/cycle.rs @@ -4,7 +4,7 @@ use itertools::Itertools; use crate::{ objects::{Cycle, HalfEdge}, operations::{build::BuildHalfEdge, insert::Insert, update::UpdateCycle}, - Instance, + Core, }; /// Build a [`Cycle`] @@ -22,14 +22,14 @@ pub trait BuildCycle { fn circle( center: impl Into>, radius: impl Into, - core: &mut Instance, + core: &mut Core, ) -> Cycle { let circle = HalfEdge::circle(center, radius, core); Cycle::empty().add_half_edges([circle], core) } /// Build a polygon - fn polygon(points: Ps, core: &mut Instance) -> Cycle + fn polygon(points: Ps, core: &mut Core) -> Cycle where P: Into>, Ps: IntoIterator, diff --git a/crates/fj-core/src/operations/build/face.rs b/crates/fj-core/src/operations/build/face.rs index 7927e3e486..910a8ce735 100644 --- a/crates/fj-core/src/operations/build/face.rs +++ b/crates/fj-core/src/operations/build/face.rs @@ -10,7 +10,7 @@ use crate::{ insert::{Insert, IsInserted, IsInsertedNo}, }, storage::Handle, - Instance, + Core, }; /// Build a [`Face`] @@ -20,7 +20,7 @@ use crate::{ /// [module-level documentation]: super pub trait BuildFace { /// Build a face with an empty exterior, no interiors, and no color - fn unbound(surface: Handle, core: &mut Instance) -> Face { + fn unbound(surface: Handle, core: &mut Core) -> Face { let exterior = Cycle::empty().insert(core); let region = Region::new(exterior, [], None).insert(core); Face::new(surface, region) @@ -29,7 +29,7 @@ pub trait BuildFace { /// Build a triangle fn triangle( points: [impl Into>; 3], - core: &mut Instance, + core: &mut Core, ) -> Polygon<3> { let (surface, points_surface) = Surface::plane_from_points(points); let surface = surface.insert(core); @@ -63,7 +63,7 @@ pub trait BuildFace { fn polygon( surface: Handle, points: Ps, - core: &mut Instance, + core: &mut Core, ) -> Face where P: Into>, diff --git a/crates/fj-core/src/operations/build/half_edge.rs b/crates/fj-core/src/operations/build/half_edge.rs index 9ccb1e312c..b786e7a8ea 100644 --- a/crates/fj-core/src/operations/build/half_edge.rs +++ b/crates/fj-core/src/operations/build/half_edge.rs @@ -6,7 +6,7 @@ use crate::{ objects::{Curve, HalfEdge, Vertex}, operations::insert::Insert, storage::Handle, - Instance, + Core, }; /// Build a [`HalfEdge`] @@ -19,7 +19,7 @@ pub trait BuildHalfEdge { fn unjoined( path: SurfacePath, boundary: impl Into>>, - core: &mut Instance, + core: &mut Core, ) -> HalfEdge { let curve = Curve::new().insert(core); let start_vertex = Vertex::new().insert(core); @@ -49,7 +49,7 @@ pub trait BuildHalfEdge { start: impl Into>, end: impl Into>, angle_rad: impl Into, - core: &mut Instance, + core: &mut Core, ) -> HalfEdge { let angle_rad = angle_rad.into(); if angle_rad <= -Scalar::TAU || angle_rad >= Scalar::TAU { @@ -70,7 +70,7 @@ pub trait BuildHalfEdge { fn circle( center: impl Into>, radius: impl Into, - core: &mut Instance, + core: &mut Core, ) -> HalfEdge { let path = SurfacePath::circle_from_center_and_radius(center, radius); let boundary = @@ -83,7 +83,7 @@ pub trait BuildHalfEdge { fn line_segment( points_surface: [impl Into>; 2], boundary: Option<[Point<1>; 2]>, - core: &mut Instance, + core: &mut Core, ) -> HalfEdge { let boundary = boundary.unwrap_or_else(|| [[0.], [1.]].map(Point::from)); diff --git a/crates/fj-core/src/operations/build/region.rs b/crates/fj-core/src/operations/build/region.rs index 01888cb40e..cb96c61dc1 100644 --- a/crates/fj-core/src/operations/build/region.rs +++ b/crates/fj-core/src/operations/build/region.rs @@ -3,7 +3,7 @@ use fj_math::{Point, Scalar}; use crate::{ objects::{Cycle, Region}, operations::{build::BuildCycle, insert::Insert}, - Instance, + Core, }; /// Build a [`Region`] @@ -13,7 +13,7 @@ use crate::{ /// [module-level documentation]: super pub trait BuildRegion { /// Build an empty region - fn empty(core: &mut Instance) -> Region { + fn empty(core: &mut Core) -> Region { let exterior = Cycle::empty().insert(core); let interiors = []; let color = None; @@ -25,14 +25,14 @@ pub trait BuildRegion { fn circle( center: impl Into>, radius: impl Into, - core: &mut Instance, + core: &mut Core, ) -> Region { let exterior = Cycle::circle(center, radius, core).insert(core); Region::new(exterior, [], None) } /// Build a polygon - fn polygon(points: Ps, core: &mut Instance) -> Region + fn polygon(points: Ps, core: &mut Core) -> Region where P: Into>, Ps: IntoIterator, diff --git a/crates/fj-core/src/operations/build/shell.rs b/crates/fj-core/src/operations/build/shell.rs index 872663ab32..d8860fc820 100644 --- a/crates/fj-core/src/operations/build/shell.rs +++ b/crates/fj-core/src/operations/build/shell.rs @@ -15,7 +15,7 @@ use crate::{ UpdateCycle, UpdateFace, UpdateHalfEdge, UpdateRegion, UpdateShell, }, }, - Instance, + Core, }; /// Build a [`Shell`] @@ -33,7 +33,7 @@ pub trait BuildShell { fn from_vertices_and_indices( vertices: impl IntoIterator>>, indices: impl IntoIterator, - core: &mut Instance, + core: &mut Core, ) -> Shell { let vertices = vertices .into_iter() @@ -138,7 +138,7 @@ pub trait BuildShell { /// build a correct tetrahedron, regardless of that order. fn tetrahedron( points: [impl Into>; 4], - core: &mut Instance, + core: &mut Core, ) -> TetrahedronShell { let [a, b, c, d] = points.map(Into::into); diff --git a/crates/fj-core/src/operations/build/solid.rs b/crates/fj-core/src/operations/build/solid.rs index b4e30a894a..84a02965e8 100644 --- a/crates/fj-core/src/operations/build/solid.rs +++ b/crates/fj-core/src/operations/build/solid.rs @@ -7,7 +7,7 @@ use crate::{ insert::{Insert, IsInsertedYes}, update::UpdateSolid, }, - Instance, + Core, }; /// Build a [`Solid`] @@ -26,7 +26,7 @@ pub trait BuildSolid { /// See [`BuildShell::tetrahedron`] for more information. fn tetrahedron( points: [impl Into>; 4], - core: &mut Instance, + core: &mut Core, ) -> Tetrahedron { let shell = Shell::tetrahedron(points, core).insert(core); let solid = Solid::empty().add_shells([shell.shell.clone()], core); diff --git a/crates/fj-core/src/operations/holes.rs b/crates/fj-core/src/operations/holes.rs index 77c0e8f87f..350254bb82 100644 --- a/crates/fj-core/src/operations/holes.rs +++ b/crates/fj-core/src/operations/holes.rs @@ -5,7 +5,7 @@ use fj_math::{Point, Scalar, Vector}; use crate::{ objects::{Cycle, Face, HalfEdge, Region, Shell}, storage::Handle, - Instance, + Core, }; use super::{ @@ -24,7 +24,7 @@ pub trait AddHole { location: HoleLocation, radius: impl Into, path: impl Into>, - core: &mut Instance, + core: &mut Core, ) -> Self; /// Add a through hole between the provided locations @@ -32,7 +32,7 @@ pub trait AddHole { &self, locations: [HoleLocation; 2], radius: impl Into, - core: &mut Instance, + core: &mut Core, ) -> Self; } @@ -42,7 +42,7 @@ impl AddHole for Shell { location: HoleLocation, radius: impl Into, path: impl Into>, - core: &mut Instance, + core: &mut Core, ) -> Self { let entry = HalfEdge::circle(location.position, radius, core).insert(core); @@ -89,7 +89,7 @@ impl AddHole for Shell { &self, [entry_location, exit_location]: [HoleLocation; 2], radius: impl Into, - core: &mut Instance, + core: &mut Core, ) -> Self { let radius = radius.into(); diff --git a/crates/fj-core/src/operations/insert/insert_trait.rs b/crates/fj-core/src/operations/insert/insert_trait.rs index 3ec696231e..e23cdff6ef 100644 --- a/crates/fj-core/src/operations/insert/insert_trait.rs +++ b/crates/fj-core/src/operations/insert/insert_trait.rs @@ -5,7 +5,7 @@ use crate::{ }, operations::build::{Polygon, TetrahedronShell}, storage::Handle, - Instance, + Core, }; use super::{IsInsertedNo, IsInsertedYes}; @@ -28,7 +28,7 @@ pub trait Insert: Sized { /// specific reason to do so, and you are handling validation errors in a /// non-standard way. #[must_use] - fn insert(self, core: &mut Instance) -> Self::Inserted; + fn insert(self, core: &mut Core) -> Self::Inserted; } macro_rules! impl_insert { @@ -37,7 +37,7 @@ macro_rules! impl_insert { impl Insert for $ty { type Inserted = Handle; - fn insert(self, core: &mut Instance) -> Self::Inserted { + fn insert(self, core: &mut Core) -> Self::Inserted { let handle = core.layers.objects.$store.reserve(); let object = (handle.clone(), self).into(); core.layers.objects.insert( @@ -73,7 +73,7 @@ where { type Inserted = Self; - fn insert(self, _: &mut Instance) -> Self::Inserted { + fn insert(self, _: &mut Core) -> Self::Inserted { self } } @@ -81,7 +81,7 @@ where impl Insert for Polygon { type Inserted = Polygon; - fn insert(self, core: &mut Instance) -> Self::Inserted { + fn insert(self, core: &mut Core) -> Self::Inserted { Polygon { face: self.face.insert(core), half_edges: self.half_edges, @@ -93,7 +93,7 @@ impl Insert for Polygon { impl Insert for TetrahedronShell { type Inserted = TetrahedronShell; - fn insert(self, core: &mut Instance) -> Self::Inserted { + fn insert(self, core: &mut Core) -> Self::Inserted { TetrahedronShell { shell: self.shell.insert(core), abc: self.abc, diff --git a/crates/fj-core/src/operations/join/cycle.rs b/crates/fj-core/src/operations/join/cycle.rs index da78d9bebf..e05a8effaa 100644 --- a/crates/fj-core/src/operations/join/cycle.rs +++ b/crates/fj-core/src/operations/join/cycle.rs @@ -11,14 +11,14 @@ use crate::{ update::{UpdateCycle, UpdateHalfEdge}, }, storage::Handle, - Instance, + Core, }; /// Join a [`Cycle`] to another pub trait JoinCycle { /// Add half-edges to the cycle that are joined to the provided ones #[must_use] - fn add_joined_edges(&self, edges: Es, core: &mut Instance) -> Self + fn add_joined_edges(&self, edges: Es, core: &mut Core) -> Self where Es: IntoIterator< Item = (Handle, SurfacePath, CurveBoundary>), @@ -72,12 +72,12 @@ pub trait JoinCycle { other: &Cycle, range: RangeInclusive, other_range: RangeInclusive, - core: &mut Instance, + core: &mut Core, ) -> Self; } impl JoinCycle for Cycle { - fn add_joined_edges(&self, edges: Es, core: &mut Instance) -> Self + fn add_joined_edges(&self, edges: Es, core: &mut Core) -> Self where Es: IntoIterator< Item = (Handle, SurfacePath, CurveBoundary>), @@ -104,7 +104,7 @@ impl JoinCycle for Cycle { other: &Cycle, range: RangeInclusive, range_other: RangeInclusive, - core: &mut Instance, + core: &mut Core, ) -> Self { assert_eq!( range.end() - range.start(), diff --git a/crates/fj-core/src/operations/merge.rs b/crates/fj-core/src/operations/merge.rs index fcf402bd7f..560deb63c6 100644 --- a/crates/fj-core/src/operations/merge.rs +++ b/crates/fj-core/src/operations/merge.rs @@ -3,7 +3,7 @@ //! See [`Merge`], which is currently the only trait in this module, for more //! information. -use crate::{objects::Solid, Instance}; +use crate::{objects::Solid, Core}; use super::update::UpdateSolid; @@ -11,11 +11,11 @@ use super::update::UpdateSolid; pub trait Merge { /// Merge this solid with another #[must_use] - fn merge(&self, other: &Self, core: &mut Instance) -> Self; + fn merge(&self, other: &Self, core: &mut Core) -> Self; } impl Merge for Solid { - fn merge(&self, other: &Self, core: &mut Instance) -> Self { + fn merge(&self, other: &Self, core: &mut Core) -> Self { self.add_shells(other.shells().iter().cloned(), core) } } diff --git a/crates/fj-core/src/operations/replace/curve.rs b/crates/fj-core/src/operations/replace/curve.rs index 82e9f17ce8..9ee37380a1 100644 --- a/crates/fj-core/src/operations/replace/curve.rs +++ b/crates/fj-core/src/operations/replace/curve.rs @@ -6,7 +6,7 @@ use crate::{ }, operations::{insert::Insert, update::UpdateHalfEdge}, storage::Handle, - Instance, + Core, }; use super::ReplaceOutput; @@ -23,7 +23,7 @@ pub trait ReplaceCurve: IsObject + Sized { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput; } @@ -32,7 +32,7 @@ impl ReplaceCurve for HalfEdge { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { if original.id() == self.curve().id() { ReplaceOutput::Updated(self.update_curve(|_, _| replacement, core)) @@ -47,7 +47,7 @@ impl ReplaceCurve for Cycle { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { let mut replacement_happened = false; @@ -76,7 +76,7 @@ impl ReplaceCurve for Region { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { let mut replacement_happened = false; @@ -116,7 +116,7 @@ impl ReplaceCurve for Sketch { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { let mut replacement_happened = false; @@ -145,7 +145,7 @@ impl ReplaceCurve for Face { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { let region = self.region().replace_curve(original, replacement, core); @@ -167,7 +167,7 @@ impl ReplaceCurve for Shell { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { let mut replacement_happened = false; @@ -194,7 +194,7 @@ impl ReplaceCurve for Solid { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { let mut replacement_happened = false; @@ -223,7 +223,7 @@ impl ReplaceCurve for Handle { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { self.deref() .replace_curve(original, replacement, core) @@ -236,7 +236,7 @@ impl ReplaceCurve for Handle { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { self.deref() .replace_curve(original, replacement, core) @@ -249,7 +249,7 @@ impl ReplaceCurve for Handle { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { self.deref() .replace_curve(original, replacement, core) @@ -262,7 +262,7 @@ impl ReplaceCurve for Handle { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { self.deref() .replace_curve(original, replacement, core) @@ -275,7 +275,7 @@ impl ReplaceCurve for Handle { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { self.deref() .replace_curve(original, replacement, core) @@ -288,7 +288,7 @@ impl ReplaceCurve for Handle { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { self.deref() .replace_curve(original, replacement, core) @@ -301,7 +301,7 @@ impl ReplaceCurve for Handle { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { self.deref() .replace_curve(original, replacement, core) diff --git a/crates/fj-core/src/operations/replace/half_edge.rs b/crates/fj-core/src/operations/replace/half_edge.rs index 29d7aa7b55..6ab6ae3164 100644 --- a/crates/fj-core/src/operations/replace/half_edge.rs +++ b/crates/fj-core/src/operations/replace/half_edge.rs @@ -4,7 +4,7 @@ use crate::{ objects::{Cycle, Face, HalfEdge, IsObject, Region, Shell, Sketch, Solid}, operations::insert::Insert, storage::Handle, - Instance, + Core, }; use super::ReplaceOutput; @@ -21,7 +21,7 @@ pub trait ReplaceHalfEdge: IsObject + Sized { &self, original: &Handle, replacements: [Handle; N], - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput; } @@ -30,7 +30,7 @@ impl ReplaceHalfEdge for Cycle { &self, original: &Handle, replacements: [Handle; N], - _: &mut Instance, + _: &mut Core, ) -> ReplaceOutput { if let Some(half_edges) = self.half_edges().replace(original, replacements) @@ -47,7 +47,7 @@ impl ReplaceHalfEdge for Region { &self, original: &Handle, replacements: [Handle; N], - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { let mut replacement_happened = false; @@ -89,7 +89,7 @@ impl ReplaceHalfEdge for Sketch { &self, original: &Handle, replacements: [Handle; N], - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { let mut replacement_happened = false; @@ -118,7 +118,7 @@ impl ReplaceHalfEdge for Face { &self, original: &Handle, replacements: [Handle; N], - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { let region = self.region() @@ -142,7 +142,7 @@ impl ReplaceHalfEdge for Shell { &self, original: &Handle, replacements: [Handle; N], - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { let mut replacement_happened = false; @@ -170,7 +170,7 @@ impl ReplaceHalfEdge for Solid { &self, original: &Handle, replacements: [Handle; N], - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { let mut replacement_happened = false; @@ -199,7 +199,7 @@ impl ReplaceHalfEdge for Handle { &self, original: &Handle, replacements: [Handle; N], - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { self.deref() .replace_half_edge(original, replacements, core) @@ -212,7 +212,7 @@ impl ReplaceHalfEdge for Handle { &self, original: &Handle, replacements: [Handle; N], - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { self.deref() .replace_half_edge(original, replacements, core) @@ -225,7 +225,7 @@ impl ReplaceHalfEdge for Handle { &self, original: &Handle, replacements: [Handle; N], - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { self.deref() .replace_half_edge(original, replacements, core) @@ -238,7 +238,7 @@ impl ReplaceHalfEdge for Handle { &self, original: &Handle, replacements: [Handle; N], - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { self.deref() .replace_half_edge(original, replacements, core) @@ -251,7 +251,7 @@ impl ReplaceHalfEdge for Handle { &self, original: &Handle, replacements: [Handle; N], - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { self.deref() .replace_half_edge(original, replacements, core) @@ -264,7 +264,7 @@ impl ReplaceHalfEdge for Handle { &self, original: &Handle, replacements: [Handle; N], - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { self.deref() .replace_half_edge(original, replacements, core) diff --git a/crates/fj-core/src/operations/replace/vertex.rs b/crates/fj-core/src/operations/replace/vertex.rs index 6672335a01..968a743729 100644 --- a/crates/fj-core/src/operations/replace/vertex.rs +++ b/crates/fj-core/src/operations/replace/vertex.rs @@ -6,7 +6,7 @@ use crate::{ }, operations::{insert::Insert, update::UpdateHalfEdge}, storage::Handle, - Instance, + Core, }; use super::ReplaceOutput; @@ -23,7 +23,7 @@ pub trait ReplaceVertex: IsObject + Sized { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput; } @@ -32,7 +32,7 @@ impl ReplaceVertex for HalfEdge { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { if original.id() == self.start_vertex().id() { ReplaceOutput::Updated( @@ -49,7 +49,7 @@ impl ReplaceVertex for Cycle { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { let mut replacement_happened = false; @@ -78,7 +78,7 @@ impl ReplaceVertex for Region { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { let mut replacement_happened = false; @@ -118,7 +118,7 @@ impl ReplaceVertex for Sketch { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { let mut replacement_happened = false; @@ -147,7 +147,7 @@ impl ReplaceVertex for Face { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { let region = self.region().replace_vertex(original, replacement, core); @@ -169,7 +169,7 @@ impl ReplaceVertex for Shell { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { let mut replacement_happened = false; @@ -196,7 +196,7 @@ impl ReplaceVertex for Solid { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { let mut replacement_happened = false; @@ -225,7 +225,7 @@ impl ReplaceVertex for Handle { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { self.deref() .replace_vertex(original, replacement, core) @@ -238,7 +238,7 @@ impl ReplaceVertex for Handle { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { self.deref() .replace_vertex(original, replacement, core) @@ -251,7 +251,7 @@ impl ReplaceVertex for Handle { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { self.deref() .replace_vertex(original, replacement, core) @@ -264,7 +264,7 @@ impl ReplaceVertex for Handle { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { let mut replacement_happened = false; @@ -293,7 +293,7 @@ impl ReplaceVertex for Handle { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { self.deref() .replace_vertex(original, replacement, core) @@ -306,7 +306,7 @@ impl ReplaceVertex for Handle { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { self.deref() .replace_vertex(original, replacement, core) @@ -319,7 +319,7 @@ impl ReplaceVertex for Handle { &self, original: &Handle, replacement: Handle, - core: &mut Instance, + core: &mut Core, ) -> ReplaceOutput { self.deref() .replace_vertex(original, replacement, core) diff --git a/crates/fj-core/src/operations/reverse/cycle.rs b/crates/fj-core/src/operations/reverse/cycle.rs index 3cfc85dddb..7332edc0f3 100644 --- a/crates/fj-core/src/operations/reverse/cycle.rs +++ b/crates/fj-core/src/operations/reverse/cycle.rs @@ -1,13 +1,13 @@ use crate::{ objects::{Cycle, HalfEdge}, operations::insert::Insert, - Instance, + Core, }; use super::{Reverse, ReverseCurveCoordinateSystems}; impl Reverse for Cycle { - fn reverse(&self, core: &mut Instance) -> Self { + fn reverse(&self, core: &mut Core) -> Self { let mut edges = self .half_edges() .pairs() @@ -29,7 +29,7 @@ impl Reverse for Cycle { } impl ReverseCurveCoordinateSystems for Cycle { - fn reverse_curve_coordinate_systems(&self, core: &mut Instance) -> Self { + fn reverse_curve_coordinate_systems(&self, core: &mut Core) -> Self { let edges = self.half_edges().iter().map(|edge| { edge.reverse_curve_coordinate_systems(core).insert(core) }); diff --git a/crates/fj-core/src/operations/reverse/edge.rs b/crates/fj-core/src/operations/reverse/edge.rs index 95c1a35c5b..e58f7c7b31 100644 --- a/crates/fj-core/src/operations/reverse/edge.rs +++ b/crates/fj-core/src/operations/reverse/edge.rs @@ -1,9 +1,9 @@ -use crate::{objects::HalfEdge, Instance}; +use crate::{objects::HalfEdge, Core}; use super::ReverseCurveCoordinateSystems; impl ReverseCurveCoordinateSystems for HalfEdge { - fn reverse_curve_coordinate_systems(&self, _: &mut Instance) -> Self { + fn reverse_curve_coordinate_systems(&self, _: &mut Core) -> Self { let path = self.path().reverse(); let boundary = self.boundary().reverse(); diff --git a/crates/fj-core/src/operations/reverse/face.rs b/crates/fj-core/src/operations/reverse/face.rs index 0bcc8cbae2..7ec620ebc2 100644 --- a/crates/fj-core/src/operations/reverse/face.rs +++ b/crates/fj-core/src/operations/reverse/face.rs @@ -6,27 +6,27 @@ use crate::{ build::Polygon, insert::{Insert, IsInsertedNo, IsInsertedYes}, }, - Instance, + Core, }; use super::{Reverse, ReverseCurveCoordinateSystems}; impl Reverse for Face { - fn reverse(&self, core: &mut Instance) -> Self { + fn reverse(&self, core: &mut Core) -> Self { let region = self.region().reverse(core).insert(core); Face::new(self.surface().clone(), region) } } impl Reverse for Polygon { - fn reverse(&self, core: &mut Instance) -> Self { + fn reverse(&self, core: &mut Core) -> Self { let face = self.face.borrow().reverse(core); self.replace_face(face) } } impl Reverse for Polygon { - fn reverse(&self, core: &mut Instance) -> Self { + fn reverse(&self, core: &mut Core) -> Self { let face: &Face = self.face.borrow(); let face = face.reverse(core).insert(core); @@ -35,7 +35,7 @@ impl Reverse for Polygon { } impl ReverseCurveCoordinateSystems for Face { - fn reverse_curve_coordinate_systems(&self, core: &mut Instance) -> Self { + fn reverse_curve_coordinate_systems(&self, core: &mut Core) -> Self { let region = self .region() .reverse_curve_coordinate_systems(core) @@ -47,7 +47,7 @@ impl ReverseCurveCoordinateSystems for Face { impl ReverseCurveCoordinateSystems for Polygon { - fn reverse_curve_coordinate_systems(&self, core: &mut Instance) -> Self { + fn reverse_curve_coordinate_systems(&self, core: &mut Core) -> Self { let face = self.face.borrow().reverse_curve_coordinate_systems(core); self.replace_face(face) } @@ -56,7 +56,7 @@ impl ReverseCurveCoordinateSystems impl ReverseCurveCoordinateSystems for Polygon { - fn reverse_curve_coordinate_systems(&self, core: &mut Instance) -> Self { + fn reverse_curve_coordinate_systems(&self, core: &mut Core) -> Self { let face: &Face = self.face.borrow(); let face = face.reverse_curve_coordinate_systems(core).insert(core); diff --git a/crates/fj-core/src/operations/reverse/mod.rs b/crates/fj-core/src/operations/reverse/mod.rs index 3ebad82842..ae130cec8d 100644 --- a/crates/fj-core/src/operations/reverse/mod.rs +++ b/crates/fj-core/src/operations/reverse/mod.rs @@ -1,6 +1,6 @@ //! Reverse the direction/orientation of objects -use crate::Instance; +use crate::Core; mod cycle; mod edge; @@ -11,7 +11,7 @@ mod region; pub trait Reverse { /// Reverse the direction/orientation of the object #[must_use] - fn reverse(&self, core: &mut Instance) -> Self; + fn reverse(&self, core: &mut Core) -> Self; } /// Reverse the direction of the curve coordinate systems within an object @@ -20,5 +20,5 @@ pub trait ReverseCurveCoordinateSystems { /// /// This will not have any effect on object positions in global coordinates. #[must_use] - fn reverse_curve_coordinate_systems(&self, core: &mut Instance) -> Self; + fn reverse_curve_coordinate_systems(&self, core: &mut Core) -> Self; } diff --git a/crates/fj-core/src/operations/reverse/region.rs b/crates/fj-core/src/operations/reverse/region.rs index 712b387a96..8af95d882a 100644 --- a/crates/fj-core/src/operations/reverse/region.rs +++ b/crates/fj-core/src/operations/reverse/region.rs @@ -1,9 +1,9 @@ -use crate::{objects::Region, operations::insert::Insert, Instance}; +use crate::{objects::Region, operations::insert::Insert, Core}; use super::{Reverse, ReverseCurveCoordinateSystems}; impl Reverse for Region { - fn reverse(&self, core: &mut Instance) -> Self { + fn reverse(&self, core: &mut Core) -> Self { let exterior = self.exterior().reverse(core).insert(core); let interiors = self .interiors() @@ -15,7 +15,7 @@ impl Reverse for Region { } impl ReverseCurveCoordinateSystems for Region { - fn reverse_curve_coordinate_systems(&self, core: &mut Instance) -> Self { + fn reverse_curve_coordinate_systems(&self, core: &mut Core) -> Self { let exterior = self .exterior() .reverse_curve_coordinate_systems(core) diff --git a/crates/fj-core/src/operations/split/edge.rs b/crates/fj-core/src/operations/split/edge.rs index 19b4368d85..f2b378839d 100644 --- a/crates/fj-core/src/operations/split/edge.rs +++ b/crates/fj-core/src/operations/split/edge.rs @@ -8,7 +8,7 @@ use crate::{ }, queries::SiblingOfHalfEdge, storage::Handle, - Instance, + Core, }; /// Split a pair of [`HalfEdge`]s into two @@ -23,7 +23,7 @@ pub trait SplitEdge: Sized { &self, half_edge: &Handle, point: impl Into>, - core: &mut Instance, + core: &mut Core, ) -> (Self, [[Handle; 2]; 2]); } @@ -32,7 +32,7 @@ impl SplitEdge for Shell { &self, half_edge: &Handle, point: impl Into>, - core: &mut Instance, + core: &mut Core, ) -> (Self, [[Handle; 2]; 2]) { let point = point.into(); diff --git a/crates/fj-core/src/operations/split/face.rs b/crates/fj-core/src/operations/split/face.rs index a7f489e9a0..f512e24a6a 100644 --- a/crates/fj-core/src/operations/split/face.rs +++ b/crates/fj-core/src/operations/split/face.rs @@ -14,7 +14,7 @@ use crate::{ }, }, storage::Handle, - Instance, + Core, }; /// Split a face into two @@ -40,7 +40,7 @@ pub trait SplitFace: Sized { &self, face: &Handle, line: [(&Handle, impl Into>); 2], - core: &mut Instance, + core: &mut Core, ) -> (Self, [Handle; 2]); } @@ -49,7 +49,7 @@ impl SplitFace for Shell { &self, face: &Handle, line: [(&Handle, impl Into>); 2], - core: &mut Instance, + core: &mut Core, ) -> (Self, [Handle; 2]) { // The code below might assume that the half-edges that define the line // are part of the face's exterior. Let's make that explicit here. diff --git a/crates/fj-core/src/operations/split/half_edge.rs b/crates/fj-core/src/operations/split/half_edge.rs index f573dea8a0..cb2d0d8e5a 100644 --- a/crates/fj-core/src/operations/split/half_edge.rs +++ b/crates/fj-core/src/operations/split/half_edge.rs @@ -3,7 +3,7 @@ use fj_math::Point; use crate::{ objects::{HalfEdge, Vertex}, operations::insert::Insert, - Instance, + Core, }; /// Split a [`HalfEdge`] into two @@ -27,7 +27,7 @@ pub trait SplitHalfEdge { fn split_half_edge( &self, point: impl Into>, - core: &mut Instance, + core: &mut Core, ) -> [HalfEdge; 2]; } @@ -35,7 +35,7 @@ impl SplitHalfEdge for HalfEdge { fn split_half_edge( &self, point: impl Into>, - core: &mut Instance, + core: &mut Core, ) -> [HalfEdge; 2] { let point = point.into(); diff --git a/crates/fj-core/src/operations/sweep/cycle.rs b/crates/fj-core/src/operations/sweep/cycle.rs index 83bfbedb7d..6b7c4b0920 100644 --- a/crates/fj-core/src/operations/sweep/cycle.rs +++ b/crates/fj-core/src/operations/sweep/cycle.rs @@ -6,7 +6,7 @@ use crate::{ operations::{ build::BuildCycle, join::JoinCycle, sweep::half_edge::SweepHalfEdge, }, - Instance, + Core, }; use super::SweepCache; @@ -41,7 +41,7 @@ pub trait SweepCycle { color: Option, path: impl Into>, cache: &mut SweepCache, - core: &mut Instance, + core: &mut Core, ) -> SweptCycle; } @@ -52,7 +52,7 @@ impl SweepCycle for Cycle { color: Option, path: impl Into>, cache: &mut SweepCache, - core: &mut Instance, + core: &mut Core, ) -> SweptCycle { let path = path.into(); diff --git a/crates/fj-core/src/operations/sweep/face.rs b/crates/fj-core/src/operations/sweep/face.rs index d6086c0d31..439b8b0cdf 100644 --- a/crates/fj-core/src/operations/sweep/face.rs +++ b/crates/fj-core/src/operations/sweep/face.rs @@ -4,7 +4,7 @@ use crate::{ objects::{Face, Shell}, operations::insert::Insert, storage::Handle, - Instance, + Core, }; use super::{SweepCache, SweepRegion}; @@ -20,7 +20,7 @@ pub trait SweepFace { &self, path: impl Into>, cache: &mut SweepCache, - core: &mut Instance, + core: &mut Core, ) -> Shell; } @@ -29,7 +29,7 @@ impl SweepFace for Handle { &self, path: impl Into>, cache: &mut SweepCache, - core: &mut Instance, + core: &mut Core, ) -> Shell { // Please note that this function uses the words "bottom" and "top" in a // specific sense: diff --git a/crates/fj-core/src/operations/sweep/half_edge.rs b/crates/fj-core/src/operations/sweep/half_edge.rs index c20e5efeac..f88efdd1c2 100644 --- a/crates/fj-core/src/operations/sweep/half_edge.rs +++ b/crates/fj-core/src/operations/sweep/half_edge.rs @@ -9,7 +9,7 @@ use crate::{ update::{UpdateCycle, UpdateHalfEdge}, }, storage::Handle, - Instance, + Core, }; use super::{vertex::SweepVertex, SweepCache, SweepSurfacePath}; @@ -40,7 +40,7 @@ pub trait SweepHalfEdge { color: Option, path: impl Into>, cache: &mut SweepCache, - core: &mut Instance, + core: &mut Core, ) -> (Face, Handle); } @@ -52,7 +52,7 @@ impl SweepHalfEdge for HalfEdge { color: Option, path: impl Into>, cache: &mut SweepCache, - core: &mut Instance, + core: &mut Core, ) -> (Face, Handle) { let path = path.into(); diff --git a/crates/fj-core/src/operations/sweep/region.rs b/crates/fj-core/src/operations/sweep/region.rs index 39a3747058..608e8d0970 100644 --- a/crates/fj-core/src/operations/sweep/region.rs +++ b/crates/fj-core/src/operations/sweep/region.rs @@ -7,7 +7,7 @@ use crate::{ insert::Insert, reverse::Reverse, transform::TransformObject, }, storage::Handle, - Instance, + Core, }; use super::{SweepCache, SweepCycle}; @@ -34,7 +34,7 @@ pub trait SweepRegion { surface: &Surface, path: impl Into>, cache: &mut SweepCache, - core: &mut Instance, + core: &mut Core, ) -> SweptRegion; } @@ -44,7 +44,7 @@ impl SweepRegion for Region { surface: &Surface, path: impl Into>, cache: &mut SweepCache, - core: &mut Instance, + core: &mut Core, ) -> SweptRegion { let path = path.into(); @@ -99,7 +99,7 @@ fn sweep_cycle( faces: &mut Vec, path: Vector<3>, cache: &mut SweepCache, - core: &mut Instance, + core: &mut Core, ) -> Handle { let swept_cycle = bottom_cycle.reverse(core).sweep_cycle( bottom_surface, diff --git a/crates/fj-core/src/operations/sweep/shell_face.rs b/crates/fj-core/src/operations/sweep/shell_face.rs index 11af144814..3deb888cd6 100644 --- a/crates/fj-core/src/operations/sweep/shell_face.rs +++ b/crates/fj-core/src/operations/sweep/shell_face.rs @@ -9,7 +9,7 @@ use crate::{ update::UpdateShell, }, storage::Handle, - Instance, + Core, }; /// # Sweep a [`Face`] that is part of a [`Shell`] @@ -34,7 +34,7 @@ pub trait SweepFaceOfShell { &self, face: Handle, path: impl Into>, - core: &mut Instance, + core: &mut Core, ) -> Self; } @@ -43,7 +43,7 @@ impl SweepFaceOfShell for Shell { &self, face: Handle, path: impl Into>, - core: &mut Instance, + core: &mut Core, ) -> Self { let path = path.into(); diff --git a/crates/fj-core/src/operations/sweep/sketch.rs b/crates/fj-core/src/operations/sweep/sketch.rs index 3d5a625d9f..5e1a0e141a 100644 --- a/crates/fj-core/src/operations/sweep/sketch.rs +++ b/crates/fj-core/src/operations/sweep/sketch.rs @@ -5,7 +5,7 @@ use crate::{ objects::{Face, Sketch, Solid, Surface}, operations::{insert::Insert, reverse::Reverse}, storage::Handle, - Instance, + Core, }; use super::{face::SweepFace, SweepCache}; @@ -21,7 +21,7 @@ pub trait SweepSketch { &self, surface: Handle, path: impl Into>, - core: &mut Instance, + core: &mut Core, ) -> Solid; } @@ -30,7 +30,7 @@ impl SweepSketch for Sketch { &self, surface: Handle, path: impl Into>, - core: &mut Instance, + core: &mut Core, ) -> Solid { let path = path.into(); let mut cache = SweepCache::default(); diff --git a/crates/fj-core/src/operations/sweep/vertex.rs b/crates/fj-core/src/operations/sweep/vertex.rs index 129785738e..411d760c8c 100644 --- a/crates/fj-core/src/operations/sweep/vertex.rs +++ b/crates/fj-core/src/operations/sweep/vertex.rs @@ -2,7 +2,7 @@ use crate::{ objects::{Curve, Vertex}, operations::insert::Insert, storage::Handle, - Instance, + Core, }; use super::SweepCache; @@ -34,7 +34,7 @@ pub trait SweepVertex: Sized { fn sweep_vertex( &self, cache: &mut SweepCache, - core: &mut Instance, + core: &mut Core, ) -> (Handle, Handle); } @@ -42,7 +42,7 @@ impl SweepVertex for Handle { fn sweep_vertex( &self, cache: &mut SweepCache, - core: &mut Instance, + core: &mut Core, ) -> (Handle, Handle) { let curve = cache .curves diff --git a/crates/fj-core/src/operations/transform/curve.rs b/crates/fj-core/src/operations/transform/curve.rs index 5b17aed341..433ac9b6fa 100644 --- a/crates/fj-core/src/operations/transform/curve.rs +++ b/crates/fj-core/src/operations/transform/curve.rs @@ -1,6 +1,6 @@ use fj_math::Transform; -use crate::{objects::Curve, Instance}; +use crate::{objects::Curve, Core}; use super::{TransformCache, TransformObject}; @@ -8,7 +8,7 @@ impl TransformObject for Curve { fn transform_with_cache( &self, _: &Transform, - _: &mut Instance, + _: &mut Core, _: &mut TransformCache, ) -> Self { // There's nothing to actually transform here, as `Curve` holds no data. diff --git a/crates/fj-core/src/operations/transform/cycle.rs b/crates/fj-core/src/operations/transform/cycle.rs index 6f64536da8..4d2e44ec67 100644 --- a/crates/fj-core/src/operations/transform/cycle.rs +++ b/crates/fj-core/src/operations/transform/cycle.rs @@ -1,6 +1,6 @@ use fj_math::Transform; -use crate::{objects::Cycle, Instance}; +use crate::{objects::Cycle, Core}; use super::{TransformCache, TransformObject}; @@ -8,7 +8,7 @@ impl TransformObject for Cycle { fn transform_with_cache( &self, transform: &Transform, - core: &mut Instance, + core: &mut Core, cache: &mut TransformCache, ) -> Self { let edges = self.half_edges().iter().map(|edge| { diff --git a/crates/fj-core/src/operations/transform/edge.rs b/crates/fj-core/src/operations/transform/edge.rs index 78781bf1e7..5aa5424f14 100644 --- a/crates/fj-core/src/operations/transform/edge.rs +++ b/crates/fj-core/src/operations/transform/edge.rs @@ -1,6 +1,6 @@ use fj_math::Transform; -use crate::{objects::HalfEdge, Instance}; +use crate::{objects::HalfEdge, Core}; use super::{TransformCache, TransformObject}; @@ -8,7 +8,7 @@ impl TransformObject for HalfEdge { fn transform_with_cache( &self, transform: &Transform, - core: &mut Instance, + core: &mut Core, cache: &mut TransformCache, ) -> Self { // Don't need to transform the path, as that's defined in surface diff --git a/crates/fj-core/src/operations/transform/face.rs b/crates/fj-core/src/operations/transform/face.rs index f217a1c18c..5ab2bd8366 100644 --- a/crates/fj-core/src/operations/transform/face.rs +++ b/crates/fj-core/src/operations/transform/face.rs @@ -1,6 +1,6 @@ use fj_math::Transform; -use crate::{objects::Face, Instance}; +use crate::{objects::Face, Core}; use super::{TransformCache, TransformObject}; @@ -8,7 +8,7 @@ impl TransformObject for Face { fn transform_with_cache( &self, transform: &Transform, - core: &mut Instance, + core: &mut Core, cache: &mut TransformCache, ) -> Self { let surface = self diff --git a/crates/fj-core/src/operations/transform/mod.rs b/crates/fj-core/src/operations/transform/mod.rs index f3d9edbb26..b47b473f7d 100644 --- a/crates/fj-core/src/operations/transform/mod.rs +++ b/crates/fj-core/src/operations/transform/mod.rs @@ -18,7 +18,7 @@ use type_map::TypeMap; use crate::{ operations::insert::Insert, storage::{Handle, ObjectId}, - Instance, + Core, }; /// Transform an object @@ -32,7 +32,7 @@ use crate::{ /// hasn't been done so far, is that no one has put in the work yet. pub trait TransformObject: Sized { /// Transform the object - fn transform(&self, transform: &Transform, core: &mut Instance) -> Self { + fn transform(&self, transform: &Transform, core: &mut Core) -> Self { let mut cache = TransformCache::default(); self.transform_with_cache(transform, core, &mut cache) } @@ -41,18 +41,14 @@ pub trait TransformObject: Sized { fn transform_with_cache( &self, transform: &Transform, - core: &mut Instance, + core: &mut Core, cache: &mut TransformCache, ) -> Self; /// Translate the object /// /// Convenience wrapper around [`TransformObject::transform`]. - fn translate( - &self, - offset: impl Into>, - core: &mut Instance, - ) -> Self { + fn translate(&self, offset: impl Into>, core: &mut Core) -> Self { self.transform(&Transform::translation(offset), core) } @@ -62,7 +58,7 @@ pub trait TransformObject: Sized { fn rotate( &self, axis_angle: impl Into>, - core: &mut Instance, + core: &mut Core, ) -> Self { self.transform(&Transform::rotation(axis_angle), core) } @@ -75,7 +71,7 @@ where fn transform_with_cache( &self, transform: &Transform, - core: &mut Instance, + core: &mut Core, cache: &mut TransformCache, ) -> Self { if let Some(object) = cache.get(self) { diff --git a/crates/fj-core/src/operations/transform/region.rs b/crates/fj-core/src/operations/transform/region.rs index 48e79e2bfd..f1fb393e72 100644 --- a/crates/fj-core/src/operations/transform/region.rs +++ b/crates/fj-core/src/operations/transform/region.rs @@ -1,4 +1,4 @@ -use crate::{objects::Region, Instance}; +use crate::{objects::Region, Core}; use super::TransformObject; @@ -6,7 +6,7 @@ impl TransformObject for Region { fn transform_with_cache( &self, transform: &fj_math::Transform, - core: &mut Instance, + core: &mut Core, cache: &mut super::TransformCache, ) -> Self { // Color does not need to be transformed. diff --git a/crates/fj-core/src/operations/transform/shell.rs b/crates/fj-core/src/operations/transform/shell.rs index 4132b6af14..7b8feaf2e0 100644 --- a/crates/fj-core/src/operations/transform/shell.rs +++ b/crates/fj-core/src/operations/transform/shell.rs @@ -1,6 +1,6 @@ use fj_math::Transform; -use crate::{objects::Shell, Instance}; +use crate::{objects::Shell, Core}; use super::{TransformCache, TransformObject}; @@ -8,7 +8,7 @@ impl TransformObject for Shell { fn transform_with_cache( &self, transform: &Transform, - core: &mut Instance, + core: &mut Core, cache: &mut TransformCache, ) -> Self { let faces = self diff --git a/crates/fj-core/src/operations/transform/solid.rs b/crates/fj-core/src/operations/transform/solid.rs index a1c3ddb66c..22253d5718 100644 --- a/crates/fj-core/src/operations/transform/solid.rs +++ b/crates/fj-core/src/operations/transform/solid.rs @@ -1,6 +1,6 @@ use fj_math::Transform; -use crate::{objects::Solid, Instance}; +use crate::{objects::Solid, Core}; use super::{TransformCache, TransformObject}; @@ -8,7 +8,7 @@ impl TransformObject for Solid { fn transform_with_cache( &self, transform: &Transform, - core: &mut Instance, + core: &mut Core, cache: &mut TransformCache, ) -> Self { let shells = diff --git a/crates/fj-core/src/operations/transform/surface.rs b/crates/fj-core/src/operations/transform/surface.rs index eb21e06d0c..579d606b4e 100644 --- a/crates/fj-core/src/operations/transform/surface.rs +++ b/crates/fj-core/src/operations/transform/surface.rs @@ -1,6 +1,6 @@ use fj_math::Transform; -use crate::{objects::Surface, Instance}; +use crate::{objects::Surface, Core}; use super::{TransformCache, TransformObject}; @@ -8,7 +8,7 @@ impl TransformObject for Surface { fn transform_with_cache( &self, transform: &Transform, - _: &mut Instance, + _: &mut Core, _: &mut TransformCache, ) -> Self { let geometry = self.geometry().transform(transform); diff --git a/crates/fj-core/src/operations/transform/vertex.rs b/crates/fj-core/src/operations/transform/vertex.rs index c89bbe38a0..a08ef57dc6 100644 --- a/crates/fj-core/src/operations/transform/vertex.rs +++ b/crates/fj-core/src/operations/transform/vertex.rs @@ -1,6 +1,6 @@ use fj_math::Transform; -use crate::{objects::Vertex, Instance}; +use crate::{objects::Vertex, Core}; use super::{TransformCache, TransformObject}; @@ -8,7 +8,7 @@ impl TransformObject for Vertex { fn transform_with_cache( &self, _: &Transform, - _: &mut Instance, + _: &mut Core, _: &mut TransformCache, ) -> Self { // There's nothing to actually transform here, as `Vertex` holds no diff --git a/crates/fj-core/src/operations/update/cycle.rs b/crates/fj-core/src/operations/update/cycle.rs index a94ea5090e..3a56af1e04 100644 --- a/crates/fj-core/src/operations/update/cycle.rs +++ b/crates/fj-core/src/operations/update/cycle.rs @@ -2,7 +2,7 @@ use crate::{ objects::{Cycle, HalfEdge}, operations::insert::Insert, storage::Handle, - Instance, + Core, }; /// Update a [`Cycle`] @@ -12,7 +12,7 @@ pub trait UpdateCycle { fn add_half_edges( &self, half_edges: impl IntoIterator, - core: &mut Instance, + core: &mut Core, ) -> Self where T: Insert>; @@ -28,8 +28,8 @@ pub trait UpdateCycle { fn update_half_edge( &self, handle: &Handle, - update: impl FnOnce(&Handle, &mut Instance) -> [T; N], - core: &mut Instance, + update: impl FnOnce(&Handle, &mut Core) -> [T; N], + core: &mut Core, ) -> Self where T: Insert>; @@ -39,7 +39,7 @@ impl UpdateCycle for Cycle { fn add_half_edges( &self, half_edges: impl IntoIterator, - core: &mut Instance, + core: &mut Core, ) -> Self where T: Insert>, @@ -54,8 +54,8 @@ impl UpdateCycle for Cycle { fn update_half_edge( &self, handle: &Handle, - update: impl FnOnce(&Handle, &mut Instance) -> [T; N], - core: &mut Instance, + update: impl FnOnce(&Handle, &mut Core) -> [T; N], + core: &mut Core, ) -> Self where T: Insert>, diff --git a/crates/fj-core/src/operations/update/face.rs b/crates/fj-core/src/operations/update/face.rs index ac9d914847..8df9dc624b 100644 --- a/crates/fj-core/src/operations/update/face.rs +++ b/crates/fj-core/src/operations/update/face.rs @@ -2,7 +2,7 @@ use crate::{ objects::{Face, Region}, operations::{build::Polygon, insert::Insert}, storage::Handle, - Instance, + Core, }; /// Update a [`Face`] @@ -11,8 +11,8 @@ pub trait UpdateFace { #[must_use] fn update_region( &self, - update: impl FnOnce(&Handle, &mut Instance) -> T, - core: &mut Instance, + update: impl FnOnce(&Handle, &mut Core) -> T, + core: &mut Core, ) -> Self where T: Insert>; @@ -21,8 +21,8 @@ pub trait UpdateFace { impl UpdateFace for Face { fn update_region( &self, - update: impl FnOnce(&Handle, &mut Instance) -> T, - core: &mut Instance, + update: impl FnOnce(&Handle, &mut Core) -> T, + core: &mut Core, ) -> Self where T: Insert>, @@ -35,8 +35,8 @@ impl UpdateFace for Face { impl UpdateFace for Polygon { fn update_region( &self, - update: impl FnOnce(&Handle, &mut Instance) -> T, - core: &mut Instance, + update: impl FnOnce(&Handle, &mut Core) -> T, + core: &mut Core, ) -> Self where T: Insert>, diff --git a/crates/fj-core/src/operations/update/half_edge.rs b/crates/fj-core/src/operations/update/half_edge.rs index dfd96f5798..e04acbb6c1 100644 --- a/crates/fj-core/src/operations/update/half_edge.rs +++ b/crates/fj-core/src/operations/update/half_edge.rs @@ -5,7 +5,7 @@ use crate::{ objects::{Curve, HalfEdge, Vertex}, operations::insert::Insert, storage::Handle, - Instance, + Core, }; /// Update a [`HalfEdge`] @@ -28,8 +28,8 @@ pub trait UpdateHalfEdge { #[must_use] fn update_curve( &self, - update: impl FnOnce(&Handle, &mut Instance) -> T, - core: &mut Instance, + update: impl FnOnce(&Handle, &mut Core) -> T, + core: &mut Core, ) -> Self where T: Insert>; @@ -38,8 +38,8 @@ pub trait UpdateHalfEdge { #[must_use] fn update_start_vertex( &self, - update: impl FnOnce(&Handle, &mut Instance) -> T, - core: &mut Instance, + update: impl FnOnce(&Handle, &mut Core) -> T, + core: &mut Core, ) -> Self where T: Insert>; @@ -72,8 +72,8 @@ impl UpdateHalfEdge for HalfEdge { fn update_curve( &self, - update: impl FnOnce(&Handle, &mut Instance) -> T, - core: &mut Instance, + update: impl FnOnce(&Handle, &mut Core) -> T, + core: &mut Core, ) -> Self where T: Insert>, @@ -88,8 +88,8 @@ impl UpdateHalfEdge for HalfEdge { fn update_start_vertex( &self, - update: impl FnOnce(&Handle, &mut Instance) -> T, - core: &mut Instance, + update: impl FnOnce(&Handle, &mut Core) -> T, + core: &mut Core, ) -> Self where T: Insert>, diff --git a/crates/fj-core/src/operations/update/region.rs b/crates/fj-core/src/operations/update/region.rs index f3a6338e3b..adff50ef1b 100644 --- a/crates/fj-core/src/operations/update/region.rs +++ b/crates/fj-core/src/operations/update/region.rs @@ -2,7 +2,7 @@ use crate::{ objects::{Cycle, Region}, operations::insert::Insert, storage::Handle, - Instance, + Core, }; /// Update a [`Region`] @@ -11,8 +11,8 @@ pub trait UpdateRegion { #[must_use] fn update_exterior( &self, - update: impl FnOnce(&Handle, &mut Instance) -> T, - core: &mut Instance, + update: impl FnOnce(&Handle, &mut Core) -> T, + core: &mut Core, ) -> Self where T: Insert>; @@ -22,7 +22,7 @@ pub trait UpdateRegion { fn add_interiors( &self, interiors: impl IntoIterator, - core: &mut Instance, + core: &mut Core, ) -> Self where T: Insert>; @@ -38,8 +38,8 @@ pub trait UpdateRegion { fn update_interior( &self, handle: &Handle, - update: impl FnOnce(&Handle, &mut Instance) -> [T; N], - core: &mut Instance, + update: impl FnOnce(&Handle, &mut Core) -> [T; N], + core: &mut Core, ) -> Self where T: Insert>; @@ -48,8 +48,8 @@ pub trait UpdateRegion { impl UpdateRegion for Region { fn update_exterior( &self, - update: impl FnOnce(&Handle, &mut Instance) -> T, - core: &mut Instance, + update: impl FnOnce(&Handle, &mut Core) -> T, + core: &mut Core, ) -> Self where T: Insert>, @@ -61,7 +61,7 @@ impl UpdateRegion for Region { fn add_interiors( &self, interiors: impl IntoIterator, - core: &mut Instance, + core: &mut Core, ) -> Self where T: Insert>, @@ -74,8 +74,8 @@ impl UpdateRegion for Region { fn update_interior( &self, handle: &Handle, - update: impl FnOnce(&Handle, &mut Instance) -> [T; N], - core: &mut Instance, + update: impl FnOnce(&Handle, &mut Core) -> [T; N], + core: &mut Core, ) -> Self where T: Insert>, diff --git a/crates/fj-core/src/operations/update/shell.rs b/crates/fj-core/src/operations/update/shell.rs index 0c83c2240e..5116b89dd5 100644 --- a/crates/fj-core/src/operations/update/shell.rs +++ b/crates/fj-core/src/operations/update/shell.rs @@ -2,7 +2,7 @@ use crate::{ objects::{Face, Shell}, operations::insert::Insert, storage::Handle, - Instance, + Core, }; /// Update a [`Shell`] @@ -12,7 +12,7 @@ pub trait UpdateShell { fn add_faces( &self, faces: impl IntoIterator, - core: &mut Instance, + core: &mut Core, ) -> Self where T: Insert>; @@ -28,8 +28,8 @@ pub trait UpdateShell { fn update_face( &self, handle: &Handle, - update: impl FnOnce(&Handle, &mut Instance) -> [T; N], - core: &mut Instance, + update: impl FnOnce(&Handle, &mut Core) -> [T; N], + core: &mut Core, ) -> Self where T: Insert>; @@ -43,7 +43,7 @@ impl UpdateShell for Shell { fn add_faces( &self, faces: impl IntoIterator, - core: &mut Instance, + core: &mut Core, ) -> Self where T: Insert>, @@ -56,8 +56,8 @@ impl UpdateShell for Shell { fn update_face( &self, handle: &Handle, - update: impl FnOnce(&Handle, &mut Instance) -> [T; N], - core: &mut Instance, + update: impl FnOnce(&Handle, &mut Core) -> [T; N], + core: &mut Core, ) -> Self where T: Insert>, diff --git a/crates/fj-core/src/operations/update/sketch.rs b/crates/fj-core/src/operations/update/sketch.rs index a6d568eb69..e13087e44c 100644 --- a/crates/fj-core/src/operations/update/sketch.rs +++ b/crates/fj-core/src/operations/update/sketch.rs @@ -2,7 +2,7 @@ use crate::{ objects::{Region, Sketch}, operations::insert::Insert, storage::Handle, - Instance, + Core, }; /// Update a [`Sketch`] @@ -12,7 +12,7 @@ pub trait UpdateSketch { fn add_regions( &self, regions: impl IntoIterator, - core: &mut Instance, + core: &mut Core, ) -> Self where T: Insert>; @@ -28,8 +28,8 @@ pub trait UpdateSketch { fn update_region( &self, handle: &Handle, - update: impl FnOnce(&Handle, &mut Instance) -> [T; N], - core: &mut Instance, + update: impl FnOnce(&Handle, &mut Core) -> [T; N], + core: &mut Core, ) -> Self where T: Insert>; @@ -39,7 +39,7 @@ impl UpdateSketch for Sketch { fn add_regions( &self, regions: impl IntoIterator, - core: &mut Instance, + core: &mut Core, ) -> Self where T: Insert>, @@ -52,8 +52,8 @@ impl UpdateSketch for Sketch { fn update_region( &self, handle: &Handle, - update: impl FnOnce(&Handle, &mut Instance) -> [T; N], - core: &mut Instance, + update: impl FnOnce(&Handle, &mut Core) -> [T; N], + core: &mut Core, ) -> Self where T: Insert>, diff --git a/crates/fj-core/src/operations/update/solid.rs b/crates/fj-core/src/operations/update/solid.rs index 180f9ac876..c6ce788bcf 100644 --- a/crates/fj-core/src/operations/update/solid.rs +++ b/crates/fj-core/src/operations/update/solid.rs @@ -2,7 +2,7 @@ use crate::{ objects::{Shell, Solid}, operations::insert::Insert, storage::Handle, - Instance, + Core, }; /// Update a [`Solid`] @@ -12,7 +12,7 @@ pub trait UpdateSolid { fn add_shells( &self, shells: impl IntoIterator, - core: &mut Instance, + core: &mut Core, ) -> Self where T: Insert>; @@ -28,8 +28,8 @@ pub trait UpdateSolid { fn update_shell( &self, handle: &Handle, - update: impl FnOnce(&Handle, &mut Instance) -> [T; N], - core: &mut Instance, + update: impl FnOnce(&Handle, &mut Core) -> [T; N], + core: &mut Core, ) -> Self where T: Insert>; @@ -39,7 +39,7 @@ impl UpdateSolid for Solid { fn add_shells( &self, shells: impl IntoIterator, - core: &mut Instance, + core: &mut Core, ) -> Self where T: Insert>, @@ -52,8 +52,8 @@ impl UpdateSolid for Solid { fn update_shell( &self, handle: &Handle, - update: impl FnOnce(&Handle, &mut Instance) -> [T; N], - core: &mut Instance, + update: impl FnOnce(&Handle, &mut Core) -> [T; N], + core: &mut Core, ) -> Self where T: Insert>, diff --git a/crates/fj-core/src/validate/cycle.rs b/crates/fj-core/src/validate/cycle.rs index 9bb0f59e86..ce2473e457 100644 --- a/crates/fj-core/src/validate/cycle.rs +++ b/crates/fj-core/src/validate/cycle.rs @@ -84,12 +84,12 @@ mod tests { update::UpdateCycle, }, validate::{cycle::CycleValidationError, Validate, ValidationError}, - Instance, + Core, }; #[test] fn edges_connected() -> anyhow::Result<()> { - let mut core = Instance::new(); + let mut core = Core::new(); let valid = Cycle::polygon([[0.0, 0.0], [1.0, 0.0], [1.0, 1.0]], &mut core); diff --git a/crates/fj-core/src/validate/edge.rs b/crates/fj-core/src/validate/edge.rs index 0eca08d3b5..c3e7999d5d 100644 --- a/crates/fj-core/src/validate/edge.rs +++ b/crates/fj-core/src/validate/edge.rs @@ -71,12 +71,12 @@ mod tests { objects::HalfEdge, operations::build::BuildHalfEdge, validate::{EdgeValidationError, Validate, ValidationError}, - Instance, + Core, }; #[test] fn edge_vertices_are_coincident() -> anyhow::Result<()> { - let mut core = Instance::new(); + let mut core = Core::new(); let valid = HalfEdge::line_segment([[0., 0.], [1., 0.]], None, &mut core); diff --git a/crates/fj-core/src/validate/face.rs b/crates/fj-core/src/validate/face.rs index 180c02d5b4..fcf16ee14d 100644 --- a/crates/fj-core/src/validate/face.rs +++ b/crates/fj-core/src/validate/face.rs @@ -94,12 +94,12 @@ mod tests { update::{UpdateCycle, UpdateFace, UpdateRegion}, }, validate::{FaceValidationError, Validate, ValidationError}, - Instance, + Core, }; #[test] fn boundary() -> anyhow::Result<()> { - let mut core = Instance::new(); + let mut core = Core::new(); let invalid = Face::unbound(core.layers.objects.surfaces.xy_plane(), &mut core); @@ -129,7 +129,7 @@ mod tests { #[test] fn interior_winding() -> anyhow::Result<()> { - let mut core = Instance::new(); + let mut core = Core::new(); let valid = Face::unbound(core.layers.objects.surfaces.xy_plane(), &mut core) diff --git a/crates/fj-core/src/validate/shell.rs b/crates/fj-core/src/validate/shell.rs index c75e8546ea..5dba7492c3 100644 --- a/crates/fj-core/src/validate/shell.rs +++ b/crates/fj-core/src/validate/shell.rs @@ -404,12 +404,12 @@ mod tests { }, }, validate::{shell::ShellValidationError, Validate, ValidationError}, - Instance, + Core, }; #[test] fn curve_coordinate_system_mismatch() -> anyhow::Result<()> { - let mut core = Instance::new(); + let mut core = Core::new(); let valid = Shell::tetrahedron( [[0., 0., 0.], [0., 1., 0.], [1., 0., 0.], [0., 0., 1.]], @@ -456,7 +456,7 @@ mod tests { #[test] fn half_edge_has_no_sibling() -> anyhow::Result<()> { - let mut core = Instance::new(); + let mut core = Core::new(); let valid = Shell::tetrahedron( [[0., 0., 0.], [0., 1., 0.], [1., 0., 0.], [0., 0., 1.]], @@ -477,7 +477,7 @@ mod tests { #[test] fn coincident_half_edges_are_not_siblings() -> anyhow::Result<()> { - let mut core = Instance::new(); + let mut core = Core::new(); let valid = Shell::tetrahedron( [[0., 0., 0.], [0., 1., 0.], [1., 0., 0.], [0., 0., 1.]], diff --git a/crates/fj-core/src/validate/sketch.rs b/crates/fj-core/src/validate/sketch.rs index d886cd8e35..7de935d230 100644 --- a/crates/fj-core/src/validate/sketch.rs +++ b/crates/fj-core/src/validate/sketch.rs @@ -59,12 +59,12 @@ mod tests { references::ReferenceCountError, SketchValidationError, Validate, ValidationError, }, - Instance, + Core, }; #[test] fn should_find_cycle_multiple_references() -> anyhow::Result<()> { - let mut core = Instance::new(); + let mut core = Core::new(); let shared_cycle = Cycle::new(vec![]).insert(&mut core); @@ -97,7 +97,7 @@ mod tests { #[test] fn should_find_half_edge_multiple_references() -> anyhow::Result<()> { - let mut core = Instance::new(); + let mut core = Core::new(); let half_edge = HalfEdge::line_segment([[0., 0.], [1., 0.]], None, &mut core) diff --git a/crates/fj-core/src/validate/solid.rs b/crates/fj-core/src/validate/solid.rs index cc705419dd..befa649eba 100644 --- a/crates/fj-core/src/validate/solid.rs +++ b/crates/fj-core/src/validate/solid.rs @@ -185,12 +185,12 @@ mod tests { references::ReferenceCountError, SolidValidationError, Validate, ValidationError, }, - Instance, + Core, }; #[test] fn should_find_face_multiple_references() -> anyhow::Result<()> { - let mut core = Instance::new(); + let mut core = Core::new(); let shared_face = Face::new( Surface::new(SurfaceGeometry { @@ -243,7 +243,7 @@ mod tests { #[test] fn should_find_region_multiple_references() -> anyhow::Result<()> { - let mut core = Instance::new(); + let mut core = Core::new(); let shared_region = Region::new( Cycle::new(vec![ @@ -296,7 +296,7 @@ mod tests { #[test] fn should_find_cycle_multiple_references() -> anyhow::Result<()> { - let mut core = Instance::new(); + let mut core = Core::new(); let shared_cycle = Cycle::new(vec![ @@ -346,7 +346,7 @@ mod tests { #[test] fn should_find_half_edge_multiple_references() -> anyhow::Result<()> { - let mut core = Instance::new(); + let mut core = Core::new(); let shared_edge = HalfEdge::circle([0., 0.], 1., &mut core).insert(&mut core); diff --git a/crates/fj/src/instance.rs b/crates/fj/src/instance.rs index 6a07f2256d..549a05b4d6 100644 --- a/crates/fj/src/instance.rs +++ b/crates/fj/src/instance.rs @@ -20,7 +20,7 @@ use crate::Args; #[derive(Default)] pub struct Instance { /// The instance of the Fornjot core - pub core: fj_core::Instance, + pub core: fj_core::Core, } impl Instance { @@ -31,7 +31,7 @@ impl Instance { /// Construct an instance of `Instance`, using the provided configuration pub fn with_validation_config(config: ValidationConfig) -> Self { - let core = fj_core::Instance::with_validation_config(config); + let core = fj_core::Core::with_validation_config(config); Self { core } } diff --git a/models/all/src/lib.rs b/models/all/src/lib.rs index d0520cd327..7e71b4c97e 100644 --- a/models/all/src/lib.rs +++ b/models/all/src/lib.rs @@ -8,7 +8,7 @@ use fj::{ math::{Scalar, Vector}, }; -pub fn model(core: &mut fj::core::Instance) -> Solid { +pub fn model(core: &mut fj::core::Core) -> Solid { // Just combine all the other models using offsets/rotations that won't // result in neat vertex positions or axis-aligned edges/faces. This is // useful for testing. diff --git a/models/color/src/lib.rs b/models/color/src/lib.rs index fab80c971a..0e32e71866 100644 --- a/models/color/src/lib.rs +++ b/models/color/src/lib.rs @@ -7,7 +7,7 @@ use fj::core::{ }, }; -pub fn model(core: &mut fj::core::Instance) -> Solid { +pub fn model(core: &mut fj::core::Core) -> Solid { let size = 1.; let cuboid = cuboid::model([size, size, size], core); diff --git a/models/cuboid/src/lib.rs b/models/cuboid/src/lib.rs index 047d04dd16..38a0da8186 100644 --- a/models/cuboid/src/lib.rs +++ b/models/cuboid/src/lib.rs @@ -10,10 +10,7 @@ use fj::{ math::{Scalar, Vector}, }; -pub fn model( - size: impl Into>, - core: &mut fj::core::Instance, -) -> Solid { +pub fn model(size: impl Into>, core: &mut fj::core::Core) -> Solid { let [x, y, z] = size.into().components; let bottom_surface = core.layers.objects.surfaces.xy_plane(); diff --git a/models/holes/src/lib.rs b/models/holes/src/lib.rs index 42da648812..527d445251 100644 --- a/models/holes/src/lib.rs +++ b/models/holes/src/lib.rs @@ -9,10 +9,7 @@ use fj::{ math::Scalar, }; -pub fn model( - radius: impl Into, - core: &mut fj::core::Instance, -) -> Solid { +pub fn model(radius: impl Into, core: &mut fj::core::Core) -> Solid { let radius = radius.into(); let size = radius * 4.; diff --git a/models/spacer/src/lib.rs b/models/spacer/src/lib.rs index 2a58de1302..d51cc0e8b1 100644 --- a/models/spacer/src/lib.rs +++ b/models/spacer/src/lib.rs @@ -15,7 +15,7 @@ pub fn model( outer: f64, inner: f64, height: f64, - core: &mut fj::core::Instance, + core: &mut fj::core::Core, ) -> Solid { let bottom_surface = core.layers.objects.surfaces.xy_plane(); let sweep_path = Vector::from([0., 0., height]); diff --git a/models/split/src/lib.rs b/models/split/src/lib.rs index 55d90f97e4..4d1ca96b38 100644 --- a/models/split/src/lib.rs +++ b/models/split/src/lib.rs @@ -5,11 +5,7 @@ use fj::core::{ }, }; -pub fn model( - size: f64, - split_pos: f64, - core: &mut fj::core::Instance, -) -> Solid { +pub fn model(size: f64, split_pos: f64, core: &mut fj::core::Core) -> Solid { let cuboid = cuboid::model([size, size, size], core); cuboid.update_shell( diff --git a/models/star/src/lib.rs b/models/star/src/lib.rs index 295d03e169..a3a21cdf3b 100644 --- a/models/star/src/lib.rs +++ b/models/star/src/lib.rs @@ -18,7 +18,7 @@ pub fn model( r1: f64, r2: f64, h: f64, - core: &mut fj::core::Instance, + core: &mut fj::core::Core, ) -> Solid { let num_vertices = num_points * 2; let vertex_iter = (0..num_vertices).map(|i| { diff --git a/models/vertices-indices/src/lib.rs b/models/vertices-indices/src/lib.rs index 638debb33a..0f45596ec2 100644 --- a/models/vertices-indices/src/lib.rs +++ b/models/vertices-indices/src/lib.rs @@ -6,7 +6,7 @@ use fj::core::{ }, }; -pub fn model(core: &mut fj::core::Instance) -> Solid { +pub fn model(core: &mut fj::core::Core) -> Solid { Solid::empty().add_shells( [Shell::from_vertices_and_indices( [[0., 0., 0.], [1., 0., 0.], [0., 1., 0.], [0., 0., 1.]], From e48e688b3594502338e0107e8eff60fc03e6ec1e Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 16 Feb 2024 12:35:55 +0100 Subject: [PATCH 2/3] Update module name --- crates/fj-core/src/{instance.rs => core.rs} | 0 crates/fj-core/src/lib.rs | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename crates/fj-core/src/{instance.rs => core.rs} (100%) diff --git a/crates/fj-core/src/instance.rs b/crates/fj-core/src/core.rs similarity index 100% rename from crates/fj-core/src/instance.rs rename to crates/fj-core/src/core.rs diff --git a/crates/fj-core/src/lib.rs b/crates/fj-core/src/lib.rs index e8511e6c13..6118c0b6df 100644 --- a/crates/fj-core/src/lib.rs +++ b/crates/fj-core/src/lib.rs @@ -90,6 +90,6 @@ pub mod queries; pub mod storage; pub mod validate; -mod instance; +mod core; -pub use self::instance::Core; +pub use self::core::Core; From f55cff86f0c245620f2af4c65136b6f413017117 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 16 Feb 2024 12:36:11 +0100 Subject: [PATCH 3/3] Update import --- crates/fj/src/instance.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/fj/src/instance.rs b/crates/fj/src/instance.rs index 549a05b4d6..28e575d64e 100644 --- a/crates/fj/src/instance.rs +++ b/crates/fj/src/instance.rs @@ -7,6 +7,7 @@ use fj_core::{ triangulate::Triangulate, }, validate::{ValidationConfig, ValidationErrors}, + Core, }; use fj_interop::Model; use fj_math::{Aabb, Point, Scalar}; @@ -20,7 +21,7 @@ use crate::Args; #[derive(Default)] pub struct Instance { /// The instance of the Fornjot core - pub core: fj_core::Core, + pub core: Core, } impl Instance {