From 844d1c08a1a86d63fb0ead3e77392ba812850140 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Wed, 12 Oct 2022 15:50:31 +0200 Subject: [PATCH] Add methods to override single vertices --- crates/fj-kernel/src/partial/objects/edge.rs | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/crates/fj-kernel/src/partial/objects/edge.rs b/crates/fj-kernel/src/partial/objects/edge.rs index e8048ce2f..32688a371 100644 --- a/crates/fj-kernel/src/partial/objects/edge.rs +++ b/crates/fj-kernel/src/partial/objects/edge.rs @@ -60,6 +60,30 @@ impl PartialHalfEdge { self } + /// Update the partial half-edge with the given from vertex + pub fn with_from_vertex( + mut self, + vertex: Option>>, + ) -> Self { + if let Some(vertex) = vertex { + let [from, _] = &mut self.vertices; + *from = Some(vertex.into()); + } + self + } + + /// Update the partial half-edge with the given from vertex + pub fn with_to_vertex( + mut self, + vertex: Option>>, + ) -> Self { + if let Some(vertex) = vertex { + let [_, to] = &mut self.vertices; + *to = Some(vertex.into()); + } + self + } + /// Update the partial half-edge with the given vertices pub fn with_vertices( mut self,