From 44028e273332c2805ee13a25b34492666834f1e0 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Wed, 16 Nov 2022 15:35:59 +0100 Subject: [PATCH] Add some second-order implementations of `Get` --- crates/fj-kernel/src/objects/edge.rs | 6 ++++++ crates/fj-kernel/src/objects/vertex.rs | 20 +++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/crates/fj-kernel/src/objects/edge.rs b/crates/fj-kernel/src/objects/edge.rs index 3ae07f724..bdc84d25a 100644 --- a/crates/fj-kernel/src/objects/edge.rs +++ b/crates/fj-kernel/src/objects/edge.rs @@ -66,6 +66,12 @@ impl Get for HalfEdge { } } +impl Get for HalfEdge { + fn get(&self) -> Handle { + self.global_form().curve().clone() + } +} + impl fmt::Display for HalfEdge { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let [a, b] = self.vertices().clone().map(|vertex| vertex.position()); diff --git a/crates/fj-kernel/src/objects/vertex.rs b/crates/fj-kernel/src/objects/vertex.rs index ea55c5e3c..d7b14adab 100644 --- a/crates/fj-kernel/src/objects/vertex.rs +++ b/crates/fj-kernel/src/objects/vertex.rs @@ -2,7 +2,7 @@ use fj_math::Point; use crate::{get::Get, storage::Handle}; -use super::{Curve, Surface}; +use super::{Curve, GlobalCurve, Surface}; /// A vertex /// @@ -68,6 +68,24 @@ impl Get for Vertex { } } +impl Get for Vertex { + fn get(&self) -> Handle { + self.curve().surface().clone() + } +} + +impl Get for Vertex { + fn get(&self) -> Handle { + self.curve().global_form().clone() + } +} + +impl Get for Vertex { + fn get(&self) -> Handle { + self.surface_form().global_form().clone() + } +} + /// A vertex, defined in surface (2D) coordinates #[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] pub struct SurfaceVertex {