diff --git a/crates/fj-core/src/algorithms/approx/curve.rs b/crates/fj-core/src/algorithms/approx/curve.rs index d3fa3fc31..b0a658a2a 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 7b73d57c8..91a1129c6 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 dc5472a42..8d2776e25 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 da459655f..eb60b7ebd 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 38a98a1a2..a634dc6dd 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 4b62b1f03..23e70a385 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 edf2bf724..a5be37894 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 653fe89bc..534cca377 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/core.rs similarity index 91% rename from crates/fj-core/src/instance.rs rename to crates/fj-core/src/core.rs index 242c2f5d7..ae8c0e39c 100644 --- a/crates/fj-core/src/instance.rs +++ b/crates/fj-core/src/core.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 5f87b5489..6118c0b6d 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::Instance; +pub use self::core::Core; diff --git a/crates/fj-core/src/operations/build/cycle.rs b/crates/fj-core/src/operations/build/cycle.rs index 454cf5c20..118c09102 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 7927e3e48..910a8ce73 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 9ccb1e312..b786e7a8e 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 01888cb40..cb96c61dc 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 872663ab3..d8860fc82 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 b4e30a894..84a02965e 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 77c0e8f87..350254bb8 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 3ec696231..e23cdff6e 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 da78d9beb..e05a8effa 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 fcf402bd7..560deb63c 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 82e9f17ce..9ee37380a 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 29d7aa7b5..6ab6ae316 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 6672335a0..968a74372 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 3cfc85ddd..7332edc0f 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 95c1a35c5..e58f7c7b3 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 0bcc8cbae..7ec620ebc 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 3ebad8284..ae130cec8 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 712b387a9..8af95d882 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 19b4368d8..f2b378839 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 a7f489e9a..f512e24a6 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 f573dea8a..cb2d0d8e5 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 83bfbedb7..6b7c4b092 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 d6086c0d3..439b8b0cd 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 c20e5efea..f88efdd1c 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 39a374705..608e8d097 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 11af14481..3deb888cd 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 3d5a625d9..5e1a0e141 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 129785738..411d760c8 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 5b17aed34..433ac9b6f 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 6f64536da..4d2e44ec6 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 78781bf1e..5aa5424f1 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 f217a1c18..5ab2bd836 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 f3d9edbb2..b47b473f7 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 48e79e2bf..f1fb393e7 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 4132b6af1..7b8feaf2e 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 a1c3ddb66..22253d571 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 eb21e06d0..579d606b4 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 c89bbe38a..a08ef57dc 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 a94ea5090..3a56af1e0 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 ac9d91484..8df9dc624 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 dfd96f579..e04acbb6c 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 f3a6338e3..adff50ef1 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 0c83c2240..5116b89dd 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 a6d568eb6..e13087e44 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 180f9ac87..c6ce788bc 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 9bb0f59e8..ce2473e45 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 0eca08d3b..c3e7999d5 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 180c02d5b..fcf16ee14 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 c75e8546e..5dba7492c 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 d886cd8e3..7de935d23 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 cc705419d..befa649eb 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 6a07f2256..28e575d64 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::Instance, + pub core: Core, } impl Instance { @@ -31,7 +32,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 d0520cd32..7e71b4c97 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 fab80c971..0e32e7186 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 047d04dd1..38a0da818 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 42da64881..527d44525 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 2a58de130..d51cc0e8b 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 55d90f97e..4d1ca96b3 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 295d03e16..a3a21cdf3 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 638debb33..0f45596ec 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.]],