From d3d74884298437c9f4f61634c631d17c275fa5f8 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Wed, 22 Feb 2023 13:52:55 +0100 Subject: [PATCH] Remove unused code --- .../src/algorithms/transform/curve.rs | 17 +-------------- crates/fj-kernel/src/insert.rs | 5 ++--- crates/fj-kernel/src/objects/full/curve.rs | 4 ---- crates/fj-kernel/src/objects/mod.rs | 2 +- crates/fj-kernel/src/objects/object.rs | 5 ++--- crates/fj-kernel/src/objects/stores.rs | 7 ++----- crates/fj-kernel/src/partial/mod.rs | 2 +- crates/fj-kernel/src/partial/objects/curve.rs | 18 +--------------- crates/fj-kernel/src/partial/traits.rs | 1 - crates/fj-kernel/src/validate/curve.rs | 11 +--------- crates/fj-kernel/src/validate/edge.rs | 21 +------------------ 11 files changed, 12 insertions(+), 81 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/transform/curve.rs b/crates/fj-kernel/src/algorithms/transform/curve.rs index 27489c417..b12f0c1d8 100644 --- a/crates/fj-kernel/src/algorithms/transform/curve.rs +++ b/crates/fj-kernel/src/algorithms/transform/curve.rs @@ -1,7 +1,7 @@ use fj_math::Transform; use crate::{ - objects::{Curve, GlobalCurve, Objects}, + objects::{Curve, Objects}, services::Service, }; @@ -21,18 +21,3 @@ impl TransformObject for Curve { Self::new(path) } } - -impl TransformObject for GlobalCurve { - fn transform_with_cache( - self, - _: &Transform, - _: &mut Service, - _: &mut TransformCache, - ) -> Self { - // `GlobalCurve` doesn't contain any internal geometry. If it did, that - // would just be redundant with the geometry of other objects, and this - // other geometry is already being transformed by other implementations - // of this trait. - self - } -} diff --git a/crates/fj-kernel/src/insert.rs b/crates/fj-kernel/src/insert.rs index 98831ad34..8cd1d03bc 100644 --- a/crates/fj-kernel/src/insert.rs +++ b/crates/fj-kernel/src/insert.rs @@ -4,8 +4,8 @@ use crate::{ objects::{ - Curve, Cycle, Face, GlobalCurve, GlobalEdge, GlobalVertex, HalfEdge, - Objects, Shell, Sketch, Solid, Surface, SurfaceVertex, + Curve, Cycle, Face, GlobalEdge, GlobalVertex, HalfEdge, Objects, Shell, + Sketch, Solid, Surface, SurfaceVertex, }, services::{Service, ServiceObjectsExt}, storage::Handle, @@ -37,7 +37,6 @@ impl_insert!( Curve, curves; Cycle, cycles; Face, faces; - GlobalCurve, global_curves; GlobalEdge, global_edges; GlobalVertex, global_vertices; HalfEdge, half_edges; diff --git a/crates/fj-kernel/src/objects/full/curve.rs b/crates/fj-kernel/src/objects/full/curve.rs index 4bce36c06..c291ce6ff 100644 --- a/crates/fj-kernel/src/objects/full/curve.rs +++ b/crates/fj-kernel/src/objects/full/curve.rs @@ -17,7 +17,3 @@ impl Curve { self.path } } - -/// A curve, defined in global (3D) coordinates -#[derive(Clone, Copy, Debug)] -pub struct GlobalCurve; diff --git a/crates/fj-kernel/src/objects/mod.rs b/crates/fj-kernel/src/objects/mod.rs index 9fe7e2f9d..e957c10ab 100644 --- a/crates/fj-kernel/src/objects/mod.rs +++ b/crates/fj-kernel/src/objects/mod.rs @@ -79,7 +79,7 @@ mod stores; pub use self::{ full::{ - curve::{Curve, GlobalCurve}, + curve::Curve, cycle::{Cycle, HalfEdgesOfCycle}, edge::{GlobalEdge, HalfEdge, VerticesInNormalizedOrder}, face::{Face, FaceSet, Handedness}, diff --git a/crates/fj-kernel/src/objects/object.rs b/crates/fj-kernel/src/objects/object.rs index 2bf627d87..869403ea3 100644 --- a/crates/fj-kernel/src/objects/object.rs +++ b/crates/fj-kernel/src/objects/object.rs @@ -2,8 +2,8 @@ use std::any::Any; use crate::{ objects::{ - Curve, Cycle, Face, GlobalCurve, GlobalEdge, GlobalVertex, HalfEdge, - Objects, Shell, Sketch, Solid, Surface, SurfaceVertex, + Curve, Cycle, Face, GlobalEdge, GlobalVertex, HalfEdge, Objects, Shell, + Sketch, Solid, Surface, SurfaceVertex, }, storage::{Handle, ObjectId}, validate::{Validate, ValidationError}, @@ -111,7 +111,6 @@ object!( Curve, "curve", curves; Cycle, "cycle", cycles; Face, "face", faces; - GlobalCurve, "global curve", global_curves; GlobalEdge, "global edge", global_edges; GlobalVertex, "global vertex", global_vertices; HalfEdge, "half-edge", half_edges; diff --git a/crates/fj-kernel/src/objects/stores.rs b/crates/fj-kernel/src/objects/stores.rs index 73e3c7df8..bcb2dcd88 100644 --- a/crates/fj-kernel/src/objects/stores.rs +++ b/crates/fj-kernel/src/objects/stores.rs @@ -6,8 +6,8 @@ use crate::{ }; use super::{ - Curve, Cycle, Face, GlobalCurve, GlobalEdge, GlobalVertex, HalfEdge, Shell, - Sketch, Solid, Surface, SurfaceVertex, + Curve, Cycle, Face, GlobalEdge, GlobalVertex, HalfEdge, Shell, Sketch, + Solid, Surface, SurfaceVertex, }; /// The available object stores @@ -22,9 +22,6 @@ pub struct Objects { /// Store for [`Face`]s pub faces: Store, - /// Store for [`GlobalCurve`]s - pub global_curves: Store, - /// Store for [`GlobalEdge`]s pub global_edges: Store, diff --git a/crates/fj-kernel/src/partial/mod.rs b/crates/fj-kernel/src/partial/mod.rs index f6209de04..cb6469170 100644 --- a/crates/fj-kernel/src/partial/mod.rs +++ b/crates/fj-kernel/src/partial/mod.rs @@ -16,7 +16,7 @@ mod wrapper; pub use self::{ objects::{ - curve::{MaybeSurfacePath, PartialCurve, PartialGlobalCurve}, + curve::{MaybeSurfacePath, PartialCurve}, cycle::PartialCycle, edge::{PartialGlobalEdge, PartialHalfEdge}, face::PartialFace, diff --git a/crates/fj-kernel/src/partial/objects/curve.rs b/crates/fj-kernel/src/partial/objects/curve.rs index 7f3174d40..baa43c241 100644 --- a/crates/fj-kernel/src/partial/objects/curve.rs +++ b/crates/fj-kernel/src/partial/objects/curve.rs @@ -2,7 +2,7 @@ use fj_math::Scalar; use crate::{ geometry::path::SurfacePath, - objects::{Curve, GlobalCurve, Objects}, + objects::{Curve, Objects}, partial::{FullToPartialCache, PartialObject}, services::Service, }; @@ -61,19 +61,3 @@ impl From for MaybeSurfacePath { Self::Defined(path) } } - -/// A partial [`GlobalCurve`] -#[derive(Clone, Debug, Default)] -pub struct PartialGlobalCurve; - -impl PartialObject for PartialGlobalCurve { - type Full = GlobalCurve; - - fn from_full(_: &Self::Full, _: &mut FullToPartialCache) -> Self { - Self - } - - fn build(self, _: &mut Service) -> Self::Full { - GlobalCurve - } -} diff --git a/crates/fj-kernel/src/partial/traits.rs b/crates/fj-kernel/src/partial/traits.rs index 2b14305c3..33da816c3 100644 --- a/crates/fj-kernel/src/partial/traits.rs +++ b/crates/fj-kernel/src/partial/traits.rs @@ -36,7 +36,6 @@ impl_trait!( Curve, PartialCurve; Cycle, PartialCycle; Face, PartialFace; - GlobalCurve, PartialGlobalCurve; GlobalEdge, PartialGlobalEdge; GlobalVertex, PartialGlobalVertex; HalfEdge, PartialHalfEdge; diff --git a/crates/fj-kernel/src/validate/curve.rs b/crates/fj-kernel/src/validate/curve.rs index 250eaea47..2f40a7820 100644 --- a/crates/fj-kernel/src/validate/curve.rs +++ b/crates/fj-kernel/src/validate/curve.rs @@ -1,4 +1,4 @@ -use crate::objects::{Curve, GlobalCurve}; +use crate::objects::Curve; use super::{Validate, ValidationConfig, ValidationError}; @@ -10,12 +10,3 @@ impl Validate for Curve { ) { } } - -impl Validate for GlobalCurve { - fn validate_with_config( - &self, - _: &ValidationConfig, - _: &mut Vec, - ) { - } -} diff --git a/crates/fj-kernel/src/validate/edge.rs b/crates/fj-kernel/src/validate/edge.rs index 224512fc9..811358843 100644 --- a/crates/fj-kernel/src/validate/edge.rs +++ b/crates/fj-kernel/src/validate/edge.rs @@ -1,7 +1,7 @@ use fj_math::{Point, Scalar}; use crate::{ - objects::{GlobalCurve, GlobalEdge, GlobalVertex, HalfEdge, Surface}, + objects::{GlobalEdge, GlobalVertex, HalfEdge, Surface}, storage::Handle, }; @@ -30,25 +30,6 @@ impl Validate for GlobalEdge { /// [`HalfEdge`] validation failed #[derive(Clone, Debug, thiserror::Error)] pub enum HalfEdgeValidationError { - /// [`HalfEdge`]'s [`GlobalCurve`]s do not match - #[error( - "Global form of `HalfEdge`'s `Curve` does not match `GlobalCurve` of \n\ - the `HalfEdge`'s `GlobalEdge`\n\ - - `GlobalCurve` from `Curve`: {global_curve_from_curve:#?}\n\ - - `GlobalCurve` from `GlobalEdge`: {global_curve_from_global_form:#?}\n\ - - `HalfEdge`: {half_edge:#?}", - )] - GlobalCurveMismatch { - /// The [`GlobalCurve`] from the [`HalfEdge`]'s `Curve` - global_curve_from_curve: Handle, - - /// The [`GlobalCurve`] from the [`HalfEdge`]'s global form - global_curve_from_global_form: Handle, - - /// The half-edge - half_edge: HalfEdge, - }, - /// [`HalfEdge`]'s [`GlobalVertex`] objects do not match #[error( "Global forms of `HalfEdge` vertices do not match vertices of \n\