From f466be59f0d8c698adb7c0ae913f9bbbacf75132 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 13 Dec 2022 14:24:32 +0100 Subject: [PATCH 01/11] Bypass `new` in `PartialObject::from_full` impls Most of those constructors aren't doing anything special anyway. For those that do, the `from_full` implementations are overriding their custom behavior, by providing all optional values. --- crates/fj-kernel/src/partial/objects/curve.rs | 12 +++---- crates/fj-kernel/src/partial/objects/cycle.rs | 6 ++-- crates/fj-kernel/src/partial/objects/edge.rs | 23 +++++++------ crates/fj-kernel/src/partial/objects/face.rs | 11 ++++--- crates/fj-kernel/src/partial/objects/shell.rs | 6 ++-- .../fj-kernel/src/partial/objects/sketch.rs | 6 ++-- crates/fj-kernel/src/partial/objects/solid.rs | 6 ++-- .../fj-kernel/src/partial/objects/surface.rs | 4 ++- .../fj-kernel/src/partial/objects/vertex.rs | 32 ++++++++++++------- 9 files changed, 60 insertions(+), 46 deletions(-) diff --git a/crates/fj-kernel/src/partial/objects/curve.rs b/crates/fj-kernel/src/partial/objects/curve.rs index 54fa9d7e1..b0fae8c29 100644 --- a/crates/fj-kernel/src/partial/objects/curve.rs +++ b/crates/fj-kernel/src/partial/objects/curve.rs @@ -40,11 +40,11 @@ impl PartialObject for PartialCurve { type Full = Curve; fn from_full(curve: &Self::Full, cache: &mut FullToPartialCache) -> Self { - Self::new( - Some(curve.path()), - Some(Partial::from_full(curve.surface().clone(), cache)), - Some(Partial::from_full(curve.global_form().clone(), cache)), - ) + Self { + path: Some(curve.path()), + surface: Partial::from_full(curve.surface().clone(), cache), + global_form: Partial::from_full(curve.global_form().clone(), cache), + } } fn build(self, objects: &mut Service) -> Self::Full { @@ -77,7 +77,7 @@ impl PartialObject for PartialGlobalCurve { type Full = GlobalCurve; fn from_full(_: &Self::Full, _: &mut FullToPartialCache) -> Self { - Self::new() + Self } fn build(self, _: &mut Service) -> Self::Full { diff --git a/crates/fj-kernel/src/partial/objects/cycle.rs b/crates/fj-kernel/src/partial/objects/cycle.rs index 2c21d79f6..ee8563298 100644 --- a/crates/fj-kernel/src/partial/objects/cycle.rs +++ b/crates/fj-kernel/src/partial/objects/cycle.rs @@ -29,13 +29,13 @@ impl PartialObject for PartialCycle { type Full = Cycle; fn from_full(cycle: &Self::Full, cache: &mut FullToPartialCache) -> Self { - Self::new( - cycle + Self { + half_edges: cycle .half_edges() .cloned() .map(|half_edge| Partial::from_full(half_edge, cache)) .collect(), - ) + } } fn build(self, objects: &mut Service) -> Self::Full { diff --git a/crates/fj-kernel/src/partial/objects/edge.rs b/crates/fj-kernel/src/partial/objects/edge.rs index 22b9bd22c..831665865 100644 --- a/crates/fj-kernel/src/partial/objects/edge.rs +++ b/crates/fj-kernel/src/partial/objects/edge.rs @@ -71,13 +71,16 @@ impl PartialObject for PartialHalfEdge { half_edge: &Self::Full, cache: &mut FullToPartialCache, ) -> Self { - Self::new( - half_edge + Self { + vertices: half_edge .vertices() .clone() - .map(|vertex| Some(Partial::from_full(vertex, cache))), - Some(Partial::from_full(half_edge.global_form().clone(), cache)), - ) + .map(|vertex| Partial::from_full(vertex, cache)), + global_form: Partial::from_full( + half_edge.global_form().clone(), + cache, + ), + } } fn build(self, objects: &mut Service) -> Self::Full { @@ -124,13 +127,13 @@ impl PartialObject for PartialGlobalEdge { global_edge: &Self::Full, cache: &mut FullToPartialCache, ) -> Self { - Self::new( - Some(Partial::from_full(global_edge.curve().clone(), cache)), - global_edge + Self { + curve: Partial::from_full(global_edge.curve().clone(), cache), + vertices: global_edge .vertices() .access_in_normalized_order() - .map(|vertex| Some(Partial::from_full(vertex, cache))), - ) + .map(|vertex| Partial::from_full(vertex, cache)), + } } fn build(self, objects: &mut Service) -> Self::Full { diff --git a/crates/fj-kernel/src/partial/objects/face.rs b/crates/fj-kernel/src/partial/objects/face.rs index 28de124da..61caf47ba 100644 --- a/crates/fj-kernel/src/partial/objects/face.rs +++ b/crates/fj-kernel/src/partial/objects/face.rs @@ -42,13 +42,14 @@ impl PartialObject for PartialFace { type Full = Face; fn from_full(face: &Self::Full, cache: &mut FullToPartialCache) -> Self { - Self::new( - Some(Partial::from_full(face.exterior().clone(), cache)), - face.interiors() + Self { + exterior: Partial::from_full(face.exterior().clone(), cache), + interiors: face + .interiors() .map(|cycle| Partial::from_full(cycle.clone(), cache)) .collect(), - Some(face.color()), - ) + color: Some(face.color()), + } } fn build(self, objects: &mut Service) -> Self::Full { diff --git a/crates/fj-kernel/src/partial/objects/shell.rs b/crates/fj-kernel/src/partial/objects/shell.rs index e13275690..82ddda4af 100644 --- a/crates/fj-kernel/src/partial/objects/shell.rs +++ b/crates/fj-kernel/src/partial/objects/shell.rs @@ -22,13 +22,13 @@ impl PartialObject for PartialShell { type Full = Shell; fn from_full(shell: &Self::Full, cache: &mut FullToPartialCache) -> Self { - Self::new( - shell + Self { + faces: shell .faces() .into_iter() .map(|face| Partial::from_full(face.clone(), cache)) .collect(), - ) + } } fn build(self, objects: &mut Service) -> Self::Full { diff --git a/crates/fj-kernel/src/partial/objects/sketch.rs b/crates/fj-kernel/src/partial/objects/sketch.rs index c0b239b3a..45da5498c 100644 --- a/crates/fj-kernel/src/partial/objects/sketch.rs +++ b/crates/fj-kernel/src/partial/objects/sketch.rs @@ -22,13 +22,13 @@ impl PartialObject for PartialSketch { type Full = Sketch; fn from_full(sketch: &Self::Full, cache: &mut FullToPartialCache) -> Self { - Self::new( - sketch + Self { + faces: sketch .faces() .into_iter() .map(|face| Partial::from_full(face.clone(), cache)) .collect(), - ) + } } fn build(self, objects: &mut Service) -> Self::Full { diff --git a/crates/fj-kernel/src/partial/objects/solid.rs b/crates/fj-kernel/src/partial/objects/solid.rs index 557c15b80..82a024d43 100644 --- a/crates/fj-kernel/src/partial/objects/solid.rs +++ b/crates/fj-kernel/src/partial/objects/solid.rs @@ -22,12 +22,12 @@ impl PartialObject for PartialSolid { type Full = Solid; fn from_full(solid: &Self::Full, cache: &mut FullToPartialCache) -> Self { - Self::new( - solid + Self { + shells: solid .shells() .map(|shell| Partial::from_full(shell.clone(), cache)) .collect(), - ) + } } fn build(self, objects: &mut Service) -> Self::Full { diff --git a/crates/fj-kernel/src/partial/objects/surface.rs b/crates/fj-kernel/src/partial/objects/surface.rs index 96ad6edf7..c9705514a 100644 --- a/crates/fj-kernel/src/partial/objects/surface.rs +++ b/crates/fj-kernel/src/partial/objects/surface.rs @@ -23,7 +23,9 @@ impl PartialObject for PartialSurface { type Full = Surface; fn from_full(surface: &Self::Full, _: &mut FullToPartialCache) -> Self { - Self::new(Some(surface.geometry())) + Self { + geometry: Some(surface.geometry()), + } } fn build(self, _: &mut Service) -> Self::Full { diff --git a/crates/fj-kernel/src/partial/objects/vertex.rs b/crates/fj-kernel/src/partial/objects/vertex.rs index eb4ece440..5401869f4 100644 --- a/crates/fj-kernel/src/partial/objects/vertex.rs +++ b/crates/fj-kernel/src/partial/objects/vertex.rs @@ -56,11 +56,14 @@ impl PartialObject for PartialVertex { type Full = Vertex; fn from_full(vertex: &Self::Full, cache: &mut FullToPartialCache) -> Self { - Self::new( - Some(vertex.position()), - Some(Partial::from_full(vertex.curve().clone(), cache)), - Some(Partial::from_full(vertex.surface_form().clone(), cache)), - ) + Self { + position: Some(vertex.position()), + curve: Partial::from_full(vertex.curve().clone(), cache), + surface_form: Partial::from_full( + vertex.surface_form().clone(), + cache, + ), + } } fn build(mut self, objects: &mut Service) -> Self::Full { @@ -125,14 +128,17 @@ impl PartialObject for PartialSurfaceVertex { surface_vertex: &Self::Full, cache: &mut FullToPartialCache, ) -> Self { - Self::new( - Some(surface_vertex.position()), - Some(Partial::from_full(surface_vertex.surface().clone(), cache)), - Some(Partial::from_full( + Self { + position: Some(surface_vertex.position()), + surface: Partial::from_full( + surface_vertex.surface().clone(), + cache, + ), + global_form: Partial::from_full( surface_vertex.global_form().clone(), cache, - )), - ) + ), + } } fn build(mut self, objects: &mut Service) -> Self::Full { @@ -177,7 +183,9 @@ impl PartialObject for PartialGlobalVertex { global_vertex: &Self::Full, _: &mut FullToPartialCache, ) -> Self { - Self::new(Some(global_vertex.position())) + Self { + position: Some(global_vertex.position()), + } } fn build(self, _: &mut Service) -> Self::Full { From 67a1c1c9b769ed0eaeed6da6418a0b5b60484fb5 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 13 Dec 2022 15:10:51 +0100 Subject: [PATCH 02/11] Refactor --- crates/fj-kernel/src/partial/objects/vertex.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/fj-kernel/src/partial/objects/vertex.rs b/crates/fj-kernel/src/partial/objects/vertex.rs index 5401869f4..28d2d651e 100644 --- a/crates/fj-kernel/src/partial/objects/vertex.rs +++ b/crates/fj-kernel/src/partial/objects/vertex.rs @@ -30,11 +30,10 @@ impl PartialVertex { let surface = Partial::new(); let curve = curve.unwrap_or_else(|| { - Partial::from_partial(PartialCurve::new( - None, - Some(surface.clone()), - None, - )) + Partial::from_partial(PartialCurve { + surface: surface.clone(), + ..Default::default() + }) }); let surface_form = surface_form.unwrap_or_else(|| { Partial::from_partial(PartialSurfaceVertex::new( From e7b73acb636dc8b816de9477a2deeb7c1b45d2c6 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 13 Dec 2022 15:13:14 +0100 Subject: [PATCH 03/11] Make variable name more specific --- crates/fj-kernel/src/builder/shell.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fj-kernel/src/builder/shell.rs b/crates/fj-kernel/src/builder/shell.rs index eecedc379..72ec75cf1 100644 --- a/crates/fj-kernel/src/builder/shell.rs +++ b/crates/fj-kernel/src/builder/shell.rs @@ -313,7 +313,7 @@ impl ShellBuilder { [a.clone(), b, c, d, a] }; - let mut edges = Vec::new(); + let mut half_edges = Vec::new(); for (surface_vertices, edge) in surface_vertices .as_slice() .array_windows_ext() @@ -339,11 +339,11 @@ impl ShellBuilder { half_edge.update_as_line_segment(); - edges.push(Partial::from_partial(half_edge)); + half_edges.push(Partial::from_partial(half_edge)); } PartialFace { - exterior: Partial::from_partial(PartialCycle::new(edges)), + exterior: Partial::from_partial(PartialCycle::new(half_edges)), ..Default::default() } }; From c17691f1d51a5e55084e135ccf8644a44b8019d6 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 13 Dec 2022 15:13:29 +0100 Subject: [PATCH 04/11] Refactor --- crates/fj-kernel/src/builder/shell.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/fj-kernel/src/builder/shell.rs b/crates/fj-kernel/src/builder/shell.rs index 72ec75cf1..486d372a6 100644 --- a/crates/fj-kernel/src/builder/shell.rs +++ b/crates/fj-kernel/src/builder/shell.rs @@ -343,7 +343,7 @@ impl ShellBuilder { } PartialFace { - exterior: Partial::from_partial(PartialCycle::new(half_edges)), + exterior: Partial::from_partial(PartialCycle { half_edges }), ..Default::default() } }; From c7789ecf91c01c669e85907f3bd5053dafeb57fe Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 13 Dec 2022 15:15:06 +0100 Subject: [PATCH 05/11] Refactor --- crates/fj-operations/src/sketch.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/fj-operations/src/sketch.rs b/crates/fj-operations/src/sketch.rs index 4fb98eb79..57c786cfb 100644 --- a/crates/fj-operations/src/sketch.rs +++ b/crates/fj-operations/src/sketch.rs @@ -42,8 +42,9 @@ impl Shape for fj::Sketch { Partial::from_partial(half_edge) }; - let cycle = - Partial::from_partial(PartialCycle::new(vec![half_edge])); + let cycle = Partial::from_partial(PartialCycle { + half_edges: vec![half_edge], + }); let face = PartialFace { exterior: cycle, From a6afc44f2055e90d545e430938973372b6f49930 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 13 Dec 2022 15:17:39 +0100 Subject: [PATCH 06/11] Refactor --- crates/fj-kernel/src/partial/objects/edge.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/fj-kernel/src/partial/objects/edge.rs b/crates/fj-kernel/src/partial/objects/edge.rs index 831665865..174d305ee 100644 --- a/crates/fj-kernel/src/partial/objects/edge.rs +++ b/crates/fj-kernel/src/partial/objects/edge.rs @@ -28,11 +28,10 @@ impl PartialHalfEdge { let vertices = vertices.map(|vertex| { vertex.unwrap_or_else(|| { - Partial::from_partial(PartialVertex::new( - None, - Some(curve.clone()), - None, - )) + Partial::from_partial(PartialVertex { + curve: curve.clone(), + ..Default::default() + }) }) }); From b6b1c3187c070907b3cb6b459d0311191343ef45 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 13 Dec 2022 15:19:00 +0100 Subject: [PATCH 07/11] Refactor --- crates/fj-kernel/src/partial/objects/edge.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/fj-kernel/src/partial/objects/edge.rs b/crates/fj-kernel/src/partial/objects/edge.rs index 174d305ee..82c5e9d36 100644 --- a/crates/fj-kernel/src/partial/objects/edge.rs +++ b/crates/fj-kernel/src/partial/objects/edge.rs @@ -40,14 +40,14 @@ impl PartialHalfEdge { vertices.each_ref_ext().map(|vertex: &Partial| { let surface_vertex = vertex.read().surface_form.clone(); let global_vertex = surface_vertex.read().global_form.clone(); - Some(global_vertex) + global_vertex }); let global_form = global_form.unwrap_or_else(|| { - Partial::from_partial(PartialGlobalEdge::new( - Some(global_curve), - global_vertices, - )) + Partial::from_partial(PartialGlobalEdge { + curve: global_curve, + vertices: global_vertices, + }) }); Self { From 6c5cc7ecc5c0f40dbad0a4892cf213fde93dae7b Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 13 Dec 2022 15:27:46 +0100 Subject: [PATCH 08/11] Refactor --- crates/fj-kernel/src/partial/objects/vertex.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/fj-kernel/src/partial/objects/vertex.rs b/crates/fj-kernel/src/partial/objects/vertex.rs index 28d2d651e..80188c29f 100644 --- a/crates/fj-kernel/src/partial/objects/vertex.rs +++ b/crates/fj-kernel/src/partial/objects/vertex.rs @@ -36,11 +36,10 @@ impl PartialVertex { }) }); let surface_form = surface_form.unwrap_or_else(|| { - Partial::from_partial(PartialSurfaceVertex::new( - None, - Some(surface), - None, - )) + Partial::from_partial(PartialSurfaceVertex { + surface, + ..Default::default() + }) }); Self { From c4ad70e527b212d7b42bb1ca293f9ef58678583a Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 13 Dec 2022 15:11:29 +0100 Subject: [PATCH 09/11] Remove unused partial object constructor arguments --- crates/fj-kernel/src/partial/objects/curve.rs | 17 ++----- crates/fj-kernel/src/partial/objects/cycle.rs | 8 +-- crates/fj-kernel/src/partial/objects/edge.rs | 42 +++++++--------- crates/fj-kernel/src/partial/objects/face.rs | 16 ++---- crates/fj-kernel/src/partial/objects/shell.rs | 6 +-- .../fj-kernel/src/partial/objects/sketch.rs | 6 +-- crates/fj-kernel/src/partial/objects/solid.rs | 6 +-- .../fj-kernel/src/partial/objects/surface.rs | 6 +-- .../fj-kernel/src/partial/objects/vertex.rs | 49 +++++++------------ 9 files changed, 61 insertions(+), 95 deletions(-) diff --git a/crates/fj-kernel/src/partial/objects/curve.rs b/crates/fj-kernel/src/partial/objects/curve.rs index b0fae8c29..6e04e538f 100644 --- a/crates/fj-kernel/src/partial/objects/curve.rs +++ b/crates/fj-kernel/src/partial/objects/curve.rs @@ -20,18 +20,11 @@ pub struct PartialCurve { impl PartialCurve { /// Construct an instance of `PartialCurve` - pub fn new( - path: Option, - surface: Option>, - global_form: Option>, - ) -> Self { - let surface = surface.unwrap_or_default(); - let global_form = global_form.unwrap_or_default(); - + pub fn new() -> Self { Self { - path, - surface, - global_form, + path: None, + surface: Partial::default(), + global_form: Partial::default(), } } } @@ -58,7 +51,7 @@ impl PartialObject for PartialCurve { impl Default for PartialCurve { fn default() -> Self { - Self::new(None, None, None) + Self::new() } } diff --git a/crates/fj-kernel/src/partial/objects/cycle.rs b/crates/fj-kernel/src/partial/objects/cycle.rs index ee8563298..48dc1abe6 100644 --- a/crates/fj-kernel/src/partial/objects/cycle.rs +++ b/crates/fj-kernel/src/partial/objects/cycle.rs @@ -13,8 +13,10 @@ pub struct PartialCycle { impl PartialCycle { /// Construct an instance of `PartialCycle` - pub fn new(half_edges: Vec>) -> Self { - Self { half_edges } + pub fn new() -> Self { + Self { + half_edges: Vec::new(), + } } /// Access the surface of the [`Cycle`] @@ -50,6 +52,6 @@ impl PartialObject for PartialCycle { impl Default for PartialCycle { fn default() -> Self { - Self::new(Vec::new()) + Self::new() } } diff --git a/crates/fj-kernel/src/partial/objects/edge.rs b/crates/fj-kernel/src/partial/objects/edge.rs index 82c5e9d36..ffe585aef 100644 --- a/crates/fj-kernel/src/partial/objects/edge.rs +++ b/crates/fj-kernel/src/partial/objects/edge.rs @@ -1,3 +1,5 @@ +use std::array; + use fj_interop::ext::ArrayExt; use crate::{ @@ -20,18 +22,13 @@ pub struct PartialHalfEdge { impl PartialHalfEdge { /// Construct an instance of `PartialHalfEdge` - pub fn new( - vertices: [Option>; 2], - global_form: Option>, - ) -> Self { + pub fn new() -> Self { let curve = Partial::::new(); - let vertices = vertices.map(|vertex| { - vertex.unwrap_or_else(|| { - Partial::from_partial(PartialVertex { - curve: curve.clone(), - ..Default::default() - }) + let vertices = array::from_fn(|_| { + Partial::from_partial(PartialVertex { + curve: curve.clone(), + ..Default::default() }) }); @@ -43,11 +40,9 @@ impl PartialHalfEdge { global_vertex }); - let global_form = global_form.unwrap_or_else(|| { - Partial::from_partial(PartialGlobalEdge { - curve: global_curve, - vertices: global_vertices, - }) + let global_form = Partial::from_partial(PartialGlobalEdge { + curve: global_curve, + vertices: global_vertices, }); Self { @@ -92,7 +87,7 @@ impl PartialObject for PartialHalfEdge { impl Default for PartialHalfEdge { fn default() -> Self { - Self::new([None, None], None) + Self::new() } } @@ -108,14 +103,11 @@ pub struct PartialGlobalEdge { impl PartialGlobalEdge { /// Construct an instance of `PartialGlobalEdge` - pub fn new( - curve: Option>, - vertices: [Option>; 2], - ) -> Self { - let curve = curve.unwrap_or_default(); - let vertices = vertices.map(Option::unwrap_or_default); - - Self { curve, vertices } + pub fn new() -> Self { + Self { + curve: Partial::new(), + vertices: array::from_fn(|_| Partial::new()), + } } } @@ -145,6 +137,6 @@ impl PartialObject for PartialGlobalEdge { impl Default for PartialGlobalEdge { fn default() -> Self { - Self::new(None, [None, None]) + Self::new() } } diff --git a/crates/fj-kernel/src/partial/objects/face.rs b/crates/fj-kernel/src/partial/objects/face.rs index 61caf47ba..650df3bf6 100644 --- a/crates/fj-kernel/src/partial/objects/face.rs +++ b/crates/fj-kernel/src/partial/objects/face.rs @@ -23,17 +23,11 @@ pub struct PartialFace { impl PartialFace { /// Construct an instance of `PartialFace` - pub fn new( - exterior: Option>, - interiors: Vec>, - color: Option, - ) -> Self { - let exterior = exterior.unwrap_or_default(); - + pub fn new() -> Self { Self { - exterior, - interiors, - color, + exterior: Partial::new(), + interiors: Vec::new(), + color: None, } } } @@ -64,6 +58,6 @@ impl PartialObject for PartialFace { impl Default for PartialFace { fn default() -> Self { - Self::new(None, Vec::new(), None) + Self::new() } } diff --git a/crates/fj-kernel/src/partial/objects/shell.rs b/crates/fj-kernel/src/partial/objects/shell.rs index 82ddda4af..63ae42470 100644 --- a/crates/fj-kernel/src/partial/objects/shell.rs +++ b/crates/fj-kernel/src/partial/objects/shell.rs @@ -13,8 +13,8 @@ pub struct PartialShell { impl PartialShell { /// Construct an instance of `PartialShell` - pub fn new(faces: Vec>) -> Self { - Self { faces } + pub fn new() -> Self { + Self { faces: Vec::new() } } } @@ -39,6 +39,6 @@ impl PartialObject for PartialShell { impl Default for PartialShell { fn default() -> Self { - Self::new(Vec::new()) + Self::new() } } diff --git a/crates/fj-kernel/src/partial/objects/sketch.rs b/crates/fj-kernel/src/partial/objects/sketch.rs index 45da5498c..5b50e1efc 100644 --- a/crates/fj-kernel/src/partial/objects/sketch.rs +++ b/crates/fj-kernel/src/partial/objects/sketch.rs @@ -13,8 +13,8 @@ pub struct PartialSketch { impl PartialSketch { /// Construct an instance of `PartialSketch` - pub fn new(faces: Vec>) -> Self { - Self { faces } + pub fn new() -> Self { + Self { faces: Vec::new() } } } @@ -39,6 +39,6 @@ impl PartialObject for PartialSketch { impl Default for PartialSketch { fn default() -> Self { - Self::new(Vec::new()) + Self::new() } } diff --git a/crates/fj-kernel/src/partial/objects/solid.rs b/crates/fj-kernel/src/partial/objects/solid.rs index 82a024d43..98e31a862 100644 --- a/crates/fj-kernel/src/partial/objects/solid.rs +++ b/crates/fj-kernel/src/partial/objects/solid.rs @@ -13,8 +13,8 @@ pub struct PartialSolid { impl PartialSolid { /// Construct an instance of `PartialSolid` - pub fn new(shells: Vec>) -> Self { - Self { shells } + pub fn new() -> Self { + Self { shells: Vec::new() } } } @@ -38,6 +38,6 @@ impl PartialObject for PartialSolid { impl Default for PartialSolid { fn default() -> Self { - Self::new(Vec::new()) + Self::new() } } diff --git a/crates/fj-kernel/src/partial/objects/surface.rs b/crates/fj-kernel/src/partial/objects/surface.rs index c9705514a..8dad07750 100644 --- a/crates/fj-kernel/src/partial/objects/surface.rs +++ b/crates/fj-kernel/src/partial/objects/surface.rs @@ -14,8 +14,8 @@ pub struct PartialSurface { impl PartialSurface { /// Construct an instance of `PartialSurface` - pub fn new(geometry: Option) -> Self { - Self { geometry } + pub fn new() -> Self { + Self { geometry: None } } } @@ -39,6 +39,6 @@ impl PartialObject for PartialSurface { impl Default for PartialSurface { fn default() -> Self { - Self::new(None) + Self::new() } } diff --git a/crates/fj-kernel/src/partial/objects/vertex.rs b/crates/fj-kernel/src/partial/objects/vertex.rs index 80188c29f..cbd88e5b7 100644 --- a/crates/fj-kernel/src/partial/objects/vertex.rs +++ b/crates/fj-kernel/src/partial/objects/vertex.rs @@ -22,28 +22,20 @@ pub struct PartialVertex { impl PartialVertex { /// Construct an instance of `PartialVertex` - pub fn new( - position: Option>, - curve: Option>, - surface_form: Option>, - ) -> Self { + pub fn new() -> Self { let surface = Partial::new(); - let curve = curve.unwrap_or_else(|| { - Partial::from_partial(PartialCurve { - surface: surface.clone(), - ..Default::default() - }) + let curve = Partial::from_partial(PartialCurve { + surface: surface.clone(), + ..Default::default() }); - let surface_form = surface_form.unwrap_or_else(|| { - Partial::from_partial(PartialSurfaceVertex { - surface, - ..Default::default() - }) + let surface_form = Partial::from_partial(PartialSurfaceVertex { + surface, + ..Default::default() }); Self { - position, + position: None, curve, surface_form, } @@ -84,7 +76,7 @@ impl PartialObject for PartialVertex { impl Default for PartialVertex { fn default() -> Self { - Self::new(None, None, None) + Self::new() } } @@ -103,18 +95,11 @@ pub struct PartialSurfaceVertex { impl PartialSurfaceVertex { /// Construct an instance of `PartialSurfaceVertex` - pub fn new( - position: Option>, - surface: Option>, - global_form: Option>, - ) -> Self { - let surface = surface.unwrap_or_default(); - let global_form = global_form.unwrap_or_default(); - + pub fn new() -> Self { Self { - position, - surface, - global_form, + position: None, + surface: Partial::new(), + global_form: Partial::new(), } } } @@ -156,7 +141,7 @@ impl PartialObject for PartialSurfaceVertex { impl Default for PartialSurfaceVertex { fn default() -> Self { - Self::new(None, None, None) + Self::new() } } @@ -169,8 +154,8 @@ pub struct PartialGlobalVertex { impl PartialGlobalVertex { /// Construct an instance of `PartialGlobalVertex` - pub fn new(position: Option>) -> Self { - Self { position } + pub fn new() -> Self { + Self { position: None } } } @@ -197,6 +182,6 @@ impl PartialObject for PartialGlobalVertex { impl Default for PartialGlobalVertex { fn default() -> Self { - Self::new(None) + Self::new() } } From 7fc718c2f4852b10edde2cfb5267c5ccc8f1049f Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 13 Dec 2022 15:31:57 +0100 Subject: [PATCH 10/11] Invert relationship between `new` and `Default` Derive those `Default` implementations, where possible. --- crates/fj-kernel/src/partial/objects/curve.rs | 24 ++----- crates/fj-kernel/src/partial/objects/cycle.rs | 12 +--- crates/fj-kernel/src/partial/objects/edge.rs | 67 ++++++++----------- crates/fj-kernel/src/partial/objects/face.rs | 14 +--- crates/fj-kernel/src/partial/objects/shell.rs | 10 +-- .../fj-kernel/src/partial/objects/sketch.rs | 10 +-- crates/fj-kernel/src/partial/objects/solid.rs | 10 +-- .../fj-kernel/src/partial/objects/surface.rs | 10 +-- .../fj-kernel/src/partial/objects/vertex.rs | 58 ++++++---------- 9 files changed, 66 insertions(+), 149 deletions(-) diff --git a/crates/fj-kernel/src/partial/objects/curve.rs b/crates/fj-kernel/src/partial/objects/curve.rs index 6e04e538f..a7dcfec48 100644 --- a/crates/fj-kernel/src/partial/objects/curve.rs +++ b/crates/fj-kernel/src/partial/objects/curve.rs @@ -6,7 +6,7 @@ use crate::{ }; /// A partial [`Curve`] -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Default)] pub struct PartialCurve { /// The path that defines the curve pub path: Option, @@ -21,11 +21,7 @@ pub struct PartialCurve { impl PartialCurve { /// Construct an instance of `PartialCurve` pub fn new() -> Self { - Self { - path: None, - surface: Partial::default(), - global_form: Partial::default(), - } + Self::default() } } @@ -49,20 +45,14 @@ impl PartialObject for PartialCurve { } } -impl Default for PartialCurve { - fn default() -> Self { - Self::new() - } -} - /// A partial [`GlobalCurve`] -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Default)] pub struct PartialGlobalCurve; impl PartialGlobalCurve { /// Construct an instance of `PartialGlobalCurve` pub fn new() -> Self { - Self + Self::default() } } @@ -77,9 +67,3 @@ impl PartialObject for PartialGlobalCurve { GlobalCurve } } - -impl Default for PartialGlobalCurve { - fn default() -> Self { - Self::new() - } -} diff --git a/crates/fj-kernel/src/partial/objects/cycle.rs b/crates/fj-kernel/src/partial/objects/cycle.rs index 48dc1abe6..393f192b5 100644 --- a/crates/fj-kernel/src/partial/objects/cycle.rs +++ b/crates/fj-kernel/src/partial/objects/cycle.rs @@ -5,7 +5,7 @@ use crate::{ }; /// A partial [`Cycle`] -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Default)] pub struct PartialCycle { /// The half-edges that make up the cycle pub half_edges: Vec>, @@ -14,9 +14,7 @@ pub struct PartialCycle { impl PartialCycle { /// Construct an instance of `PartialCycle` pub fn new() -> Self { - Self { - half_edges: Vec::new(), - } + Self::default() } /// Access the surface of the [`Cycle`] @@ -49,9 +47,3 @@ impl PartialObject for PartialCycle { Cycle::new(half_edges) } } - -impl Default for PartialCycle { - fn default() -> Self { - Self::new() - } -} diff --git a/crates/fj-kernel/src/partial/objects/edge.rs b/crates/fj-kernel/src/partial/objects/edge.rs index ffe585aef..8f16e14bc 100644 --- a/crates/fj-kernel/src/partial/objects/edge.rs +++ b/crates/fj-kernel/src/partial/objects/edge.rs @@ -23,32 +23,7 @@ pub struct PartialHalfEdge { impl PartialHalfEdge { /// Construct an instance of `PartialHalfEdge` pub fn new() -> Self { - let curve = Partial::::new(); - - let vertices = array::from_fn(|_| { - Partial::from_partial(PartialVertex { - curve: curve.clone(), - ..Default::default() - }) - }); - - let global_curve = curve.read().global_form.clone(); - let global_vertices = - vertices.each_ref_ext().map(|vertex: &Partial| { - let surface_vertex = vertex.read().surface_form.clone(); - let global_vertex = surface_vertex.read().global_form.clone(); - global_vertex - }); - - let global_form = Partial::from_partial(PartialGlobalEdge { - curve: global_curve, - vertices: global_vertices, - }); - - Self { - vertices, - global_form, - } + Self::default() } /// Access the curve the partial edge is defined on @@ -87,12 +62,37 @@ impl PartialObject for PartialHalfEdge { impl Default for PartialHalfEdge { fn default() -> Self { - Self::new() + let curve = Partial::::new(); + + let vertices = array::from_fn(|_| { + Partial::from_partial(PartialVertex { + curve: curve.clone(), + ..Default::default() + }) + }); + + let global_curve = curve.read().global_form.clone(); + let global_vertices = + vertices.each_ref_ext().map(|vertex: &Partial| { + let surface_vertex = vertex.read().surface_form.clone(); + let global_vertex = surface_vertex.read().global_form.clone(); + global_vertex + }); + + let global_form = Partial::from_partial(PartialGlobalEdge { + curve: global_curve, + vertices: global_vertices, + }); + + Self { + vertices, + global_form, + } } } /// A partial [`GlobalEdge`] -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Default)] pub struct PartialGlobalEdge { /// The curve that defines the edge's geometry pub curve: Partial, @@ -104,10 +104,7 @@ pub struct PartialGlobalEdge { impl PartialGlobalEdge { /// Construct an instance of `PartialGlobalEdge` pub fn new() -> Self { - Self { - curve: Partial::new(), - vertices: array::from_fn(|_| Partial::new()), - } + Self::default() } } @@ -134,9 +131,3 @@ impl PartialObject for PartialGlobalEdge { GlobalEdge::new(curve, vertices) } } - -impl Default for PartialGlobalEdge { - fn default() -> Self { - Self::new() - } -} diff --git a/crates/fj-kernel/src/partial/objects/face.rs b/crates/fj-kernel/src/partial/objects/face.rs index 650df3bf6..c16957c3a 100644 --- a/crates/fj-kernel/src/partial/objects/face.rs +++ b/crates/fj-kernel/src/partial/objects/face.rs @@ -7,7 +7,7 @@ use crate::{ }; /// A partial [`Face`] -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Default)] pub struct PartialFace { /// The cycle that bounds the face on the outside pub exterior: Partial, @@ -24,11 +24,7 @@ pub struct PartialFace { impl PartialFace { /// Construct an instance of `PartialFace` pub fn new() -> Self { - Self { - exterior: Partial::new(), - interiors: Vec::new(), - color: None, - } + Self::default() } } @@ -55,9 +51,3 @@ impl PartialObject for PartialFace { Face::new(exterior, interiors, color) } } - -impl Default for PartialFace { - fn default() -> Self { - Self::new() - } -} diff --git a/crates/fj-kernel/src/partial/objects/shell.rs b/crates/fj-kernel/src/partial/objects/shell.rs index 63ae42470..03752186c 100644 --- a/crates/fj-kernel/src/partial/objects/shell.rs +++ b/crates/fj-kernel/src/partial/objects/shell.rs @@ -5,7 +5,7 @@ use crate::{ }; /// A partial [`Shell`] -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Default)] pub struct PartialShell { /// The faces that make up the shell pub faces: Vec>, @@ -14,7 +14,7 @@ pub struct PartialShell { impl PartialShell { /// Construct an instance of `PartialShell` pub fn new() -> Self { - Self { faces: Vec::new() } + Self::default() } } @@ -36,9 +36,3 @@ impl PartialObject for PartialShell { Shell::new(faces) } } - -impl Default for PartialShell { - fn default() -> Self { - Self::new() - } -} diff --git a/crates/fj-kernel/src/partial/objects/sketch.rs b/crates/fj-kernel/src/partial/objects/sketch.rs index 5b50e1efc..571e0b593 100644 --- a/crates/fj-kernel/src/partial/objects/sketch.rs +++ b/crates/fj-kernel/src/partial/objects/sketch.rs @@ -5,7 +5,7 @@ use crate::{ }; /// A partial [`Sketch`] -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Default)] pub struct PartialSketch { /// The faces that make up the sketch pub faces: Vec>, @@ -14,7 +14,7 @@ pub struct PartialSketch { impl PartialSketch { /// Construct an instance of `PartialSketch` pub fn new() -> Self { - Self { faces: Vec::new() } + Self::default() } } @@ -36,9 +36,3 @@ impl PartialObject for PartialSketch { Sketch::new(faces) } } - -impl Default for PartialSketch { - fn default() -> Self { - Self::new() - } -} diff --git a/crates/fj-kernel/src/partial/objects/solid.rs b/crates/fj-kernel/src/partial/objects/solid.rs index 98e31a862..2aa9953ab 100644 --- a/crates/fj-kernel/src/partial/objects/solid.rs +++ b/crates/fj-kernel/src/partial/objects/solid.rs @@ -5,7 +5,7 @@ use crate::{ }; /// A partial [`Solid`] -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Default)] pub struct PartialSolid { /// The shells that make up the solid pub shells: Vec>, @@ -14,7 +14,7 @@ pub struct PartialSolid { impl PartialSolid { /// Construct an instance of `PartialSolid` pub fn new() -> Self { - Self { shells: Vec::new() } + Self::default() } } @@ -35,9 +35,3 @@ impl PartialObject for PartialSolid { Solid::new(shells) } } - -impl Default for PartialSolid { - fn default() -> Self { - Self::new() - } -} diff --git a/crates/fj-kernel/src/partial/objects/surface.rs b/crates/fj-kernel/src/partial/objects/surface.rs index 8dad07750..f52062d99 100644 --- a/crates/fj-kernel/src/partial/objects/surface.rs +++ b/crates/fj-kernel/src/partial/objects/surface.rs @@ -6,7 +6,7 @@ use crate::{ }; /// A partial [`Surface`] -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Default)] pub struct PartialSurface { /// The surface's geometry pub geometry: Option, @@ -15,7 +15,7 @@ pub struct PartialSurface { impl PartialSurface { /// Construct an instance of `PartialSurface` pub fn new() -> Self { - Self { geometry: None } + Self::default() } } @@ -36,9 +36,3 @@ impl PartialObject for PartialSurface { Surface::new(geometry) } } - -impl Default for PartialSurface { - fn default() -> Self { - Self::new() - } -} diff --git a/crates/fj-kernel/src/partial/objects/vertex.rs b/crates/fj-kernel/src/partial/objects/vertex.rs index cbd88e5b7..dad727f0c 100644 --- a/crates/fj-kernel/src/partial/objects/vertex.rs +++ b/crates/fj-kernel/src/partial/objects/vertex.rs @@ -23,22 +23,7 @@ pub struct PartialVertex { impl PartialVertex { /// Construct an instance of `PartialVertex` pub fn new() -> Self { - let surface = Partial::new(); - - let curve = Partial::from_partial(PartialCurve { - surface: surface.clone(), - ..Default::default() - }); - let surface_form = Partial::from_partial(PartialSurfaceVertex { - surface, - ..Default::default() - }); - - Self { - position: None, - curve, - surface_form, - } + Self::default() } } @@ -76,12 +61,27 @@ impl PartialObject for PartialVertex { impl Default for PartialVertex { fn default() -> Self { - Self::new() + let surface = Partial::new(); + + let curve = Partial::from_partial(PartialCurve { + surface: surface.clone(), + ..Default::default() + }); + let surface_form = Partial::from_partial(PartialSurfaceVertex { + surface, + ..Default::default() + }); + + Self { + position: None, + curve, + surface_form, + } } } /// A partial [`SurfaceVertex`] -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Default)] pub struct PartialSurfaceVertex { /// The position of the vertex on the surface pub position: Option>, @@ -96,11 +96,7 @@ pub struct PartialSurfaceVertex { impl PartialSurfaceVertex { /// Construct an instance of `PartialSurfaceVertex` pub fn new() -> Self { - Self { - position: None, - surface: Partial::new(), - global_form: Partial::new(), - } + Self::default() } } @@ -139,14 +135,8 @@ impl PartialObject for PartialSurfaceVertex { } } -impl Default for PartialSurfaceVertex { - fn default() -> Self { - Self::new() - } -} - /// A partial [`GlobalVertex`] -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Default)] pub struct PartialGlobalVertex { /// The position of the vertex pub position: Option>, @@ -155,7 +145,7 @@ pub struct PartialGlobalVertex { impl PartialGlobalVertex { /// Construct an instance of `PartialGlobalVertex` pub fn new() -> Self { - Self { position: None } + Self::default() } } @@ -179,9 +169,3 @@ impl PartialObject for PartialGlobalVertex { GlobalVertex::new(position) } } - -impl Default for PartialGlobalVertex { - fn default() -> Self { - Self::new() - } -} From 4f8ff908cb1a07d3860a3f8766a9e8b4d6f9aa27 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 13 Dec 2022 15:40:09 +0100 Subject: [PATCH 11/11] Remove unused partial object constructors --- crates/fj-kernel/src/partial/objects/curve.rs | 14 ------------- crates/fj-kernel/src/partial/objects/cycle.rs | 5 ----- crates/fj-kernel/src/partial/objects/edge.rs | 12 ----------- crates/fj-kernel/src/partial/objects/face.rs | 7 ------- crates/fj-kernel/src/partial/objects/shell.rs | 7 ------- .../fj-kernel/src/partial/objects/sketch.rs | 7 ------- crates/fj-kernel/src/partial/objects/solid.rs | 7 ------- .../fj-kernel/src/partial/objects/surface.rs | 7 ------- .../fj-kernel/src/partial/objects/vertex.rs | 21 ------------------- 9 files changed, 87 deletions(-) diff --git a/crates/fj-kernel/src/partial/objects/curve.rs b/crates/fj-kernel/src/partial/objects/curve.rs index a7dcfec48..9210f5945 100644 --- a/crates/fj-kernel/src/partial/objects/curve.rs +++ b/crates/fj-kernel/src/partial/objects/curve.rs @@ -18,13 +18,6 @@ pub struct PartialCurve { pub global_form: Partial, } -impl PartialCurve { - /// Construct an instance of `PartialCurve` - pub fn new() -> Self { - Self::default() - } -} - impl PartialObject for PartialCurve { type Full = Curve; @@ -49,13 +42,6 @@ impl PartialObject for PartialCurve { #[derive(Clone, Debug, Default)] pub struct PartialGlobalCurve; -impl PartialGlobalCurve { - /// Construct an instance of `PartialGlobalCurve` - pub fn new() -> Self { - Self::default() - } -} - impl PartialObject for PartialGlobalCurve { type Full = GlobalCurve; diff --git a/crates/fj-kernel/src/partial/objects/cycle.rs b/crates/fj-kernel/src/partial/objects/cycle.rs index 393f192b5..ba1f21fb8 100644 --- a/crates/fj-kernel/src/partial/objects/cycle.rs +++ b/crates/fj-kernel/src/partial/objects/cycle.rs @@ -12,11 +12,6 @@ pub struct PartialCycle { } impl PartialCycle { - /// Construct an instance of `PartialCycle` - pub fn new() -> Self { - Self::default() - } - /// Access the surface of the [`Cycle`] pub fn surface(&self) -> Option> { self.half_edges diff --git a/crates/fj-kernel/src/partial/objects/edge.rs b/crates/fj-kernel/src/partial/objects/edge.rs index 8f16e14bc..6076c2134 100644 --- a/crates/fj-kernel/src/partial/objects/edge.rs +++ b/crates/fj-kernel/src/partial/objects/edge.rs @@ -21,11 +21,6 @@ pub struct PartialHalfEdge { } impl PartialHalfEdge { - /// Construct an instance of `PartialHalfEdge` - pub fn new() -> Self { - Self::default() - } - /// Access the curve the partial edge is defined on pub fn curve(&self) -> Partial { let [vertex, _] = &self.vertices; @@ -101,13 +96,6 @@ pub struct PartialGlobalEdge { pub vertices: [Partial; 2], } -impl PartialGlobalEdge { - /// Construct an instance of `PartialGlobalEdge` - pub fn new() -> Self { - Self::default() - } -} - impl PartialObject for PartialGlobalEdge { type Full = GlobalEdge; diff --git a/crates/fj-kernel/src/partial/objects/face.rs b/crates/fj-kernel/src/partial/objects/face.rs index c16957c3a..b39e04ff0 100644 --- a/crates/fj-kernel/src/partial/objects/face.rs +++ b/crates/fj-kernel/src/partial/objects/face.rs @@ -21,13 +21,6 @@ pub struct PartialFace { pub color: Option, } -impl PartialFace { - /// Construct an instance of `PartialFace` - pub fn new() -> Self { - Self::default() - } -} - impl PartialObject for PartialFace { type Full = Face; diff --git a/crates/fj-kernel/src/partial/objects/shell.rs b/crates/fj-kernel/src/partial/objects/shell.rs index 03752186c..6802310a3 100644 --- a/crates/fj-kernel/src/partial/objects/shell.rs +++ b/crates/fj-kernel/src/partial/objects/shell.rs @@ -11,13 +11,6 @@ pub struct PartialShell { pub faces: Vec>, } -impl PartialShell { - /// Construct an instance of `PartialShell` - pub fn new() -> Self { - Self::default() - } -} - impl PartialObject for PartialShell { type Full = Shell; diff --git a/crates/fj-kernel/src/partial/objects/sketch.rs b/crates/fj-kernel/src/partial/objects/sketch.rs index 571e0b593..2481543fb 100644 --- a/crates/fj-kernel/src/partial/objects/sketch.rs +++ b/crates/fj-kernel/src/partial/objects/sketch.rs @@ -11,13 +11,6 @@ pub struct PartialSketch { pub faces: Vec>, } -impl PartialSketch { - /// Construct an instance of `PartialSketch` - pub fn new() -> Self { - Self::default() - } -} - impl PartialObject for PartialSketch { type Full = Sketch; diff --git a/crates/fj-kernel/src/partial/objects/solid.rs b/crates/fj-kernel/src/partial/objects/solid.rs index 2aa9953ab..6384d8bc9 100644 --- a/crates/fj-kernel/src/partial/objects/solid.rs +++ b/crates/fj-kernel/src/partial/objects/solid.rs @@ -11,13 +11,6 @@ pub struct PartialSolid { pub shells: Vec>, } -impl PartialSolid { - /// Construct an instance of `PartialSolid` - pub fn new() -> Self { - Self::default() - } -} - impl PartialObject for PartialSolid { type Full = Solid; diff --git a/crates/fj-kernel/src/partial/objects/surface.rs b/crates/fj-kernel/src/partial/objects/surface.rs index f52062d99..0c85241e2 100644 --- a/crates/fj-kernel/src/partial/objects/surface.rs +++ b/crates/fj-kernel/src/partial/objects/surface.rs @@ -12,13 +12,6 @@ pub struct PartialSurface { pub geometry: Option, } -impl PartialSurface { - /// Construct an instance of `PartialSurface` - pub fn new() -> Self { - Self::default() - } -} - impl PartialObject for PartialSurface { type Full = Surface; diff --git a/crates/fj-kernel/src/partial/objects/vertex.rs b/crates/fj-kernel/src/partial/objects/vertex.rs index dad727f0c..171f7aadc 100644 --- a/crates/fj-kernel/src/partial/objects/vertex.rs +++ b/crates/fj-kernel/src/partial/objects/vertex.rs @@ -20,13 +20,6 @@ pub struct PartialVertex { pub surface_form: Partial, } -impl PartialVertex { - /// Construct an instance of `PartialVertex` - pub fn new() -> Self { - Self::default() - } -} - impl PartialObject for PartialVertex { type Full = Vertex; @@ -93,13 +86,6 @@ pub struct PartialSurfaceVertex { pub global_form: Partial, } -impl PartialSurfaceVertex { - /// Construct an instance of `PartialSurfaceVertex` - pub fn new() -> Self { - Self::default() - } -} - impl PartialObject for PartialSurfaceVertex { type Full = SurfaceVertex; @@ -142,13 +128,6 @@ pub struct PartialGlobalVertex { pub position: Option>, } -impl PartialGlobalVertex { - /// Construct an instance of `PartialGlobalVertex` - pub fn new() -> Self { - Self::default() - } -} - impl PartialObject for PartialGlobalVertex { type Full = GlobalVertex;