From 7f3519a98e55a04483bdcf90f9ffa50bbbe1e37d Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 14 Oct 2022 14:45:02 +0200 Subject: [PATCH] Add vertex getters to `MaybePartial` --- crates/fj-kernel/src/partial/maybe_partial.rs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/crates/fj-kernel/src/partial/maybe_partial.rs b/crates/fj-kernel/src/partial/maybe_partial.rs index 973f0ccb6..dc8edd741 100644 --- a/crates/fj-kernel/src/partial/maybe_partial.rs +++ b/crates/fj-kernel/src/partial/maybe_partial.rs @@ -105,6 +105,28 @@ impl MaybePartial { } impl MaybePartial { + /// Access the back vertex + pub fn back(&self) -> Option> { + match self { + Self::Full(full) => Some(full.back().clone().into()), + Self::Partial(partial) => { + let [back, _] = &partial.vertices; + back.clone() + } + } + } + + /// Access the front vertex + pub fn front(&self) -> Option> { + match self { + Self::Full(full) => Some(full.front().clone().into()), + Self::Partial(partial) => { + let [_, front] = &partial.vertices; + front.clone() + } + } + } + /// Access the vertices pub fn vertices(&self) -> [Option>; 2] { match self {