From 0471cf257bef06dc503f230f071b8645ea151eb1 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 26 Aug 2024 20:10:50 +0200 Subject: [PATCH] Add placeholder for `CurveGeom2` trait --- crates/fj-core/src/geometry/curve.rs | 32 ++++++++++++++++++++++++++++ crates/fj-core/src/geometry/mod.rs | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/crates/fj-core/src/geometry/curve.rs b/crates/fj-core/src/geometry/curve.rs index 7033f6dd1..583041c8a 100644 --- a/crates/fj-core/src/geometry/curve.rs +++ b/crates/fj-core/src/geometry/curve.rs @@ -1,5 +1,7 @@ use std::collections::BTreeMap; +use fj_math::{Circle, Line}; + use crate::{storage::Handle, topology::Surface}; use super::Path; @@ -42,3 +44,33 @@ pub struct LocalCurveGeom { /// The path that defines the curve on its surface pub path: Path<2>, } + +/// # Uniform representation of curve geometry +/// +/// This trait provides a generic and uniform interface to curve geometry. It is +/// implemented by types that represent specific kinds of curve geometry. +/// +/// It is generic over the dimensionality of the generated polyline. Typically, +/// two variants should be implemented per curve geometry type: +/// +/// - `CurveGeom2<2>` for surface-local geometry. +/// - `CurveGeom2<3>` for global 3D geometry. +/// +/// ## Implementation Note +/// +/// The name, `CurveGeom2`, is a placeholder. A `CurveGeom` struct already +/// exists. It is currently unclear if and in what form such a struct will still +/// exist, once the new geometry system is in place. +/// +/// We'll have a much clearer image of the situation then. Hopefully, by then it +/// will be clearer what specific role this trait will play in relation to other +/// curve geometry types, and a better name will reveal itself. +pub trait CurveGeom2 {} + +impl CurveGeom2 for Circle {} + +impl CurveGeom2 for Line {} + +// This implementation is temporary, to ease the transition towards a curve +// geometry trait. Eventually, `CurveGeom2` is expected to replace `Path`. +impl CurveGeom2 for Path {} diff --git a/crates/fj-core/src/geometry/mod.rs b/crates/fj-core/src/geometry/mod.rs index 108db3a92..819b5da12 100644 --- a/crates/fj-core/src/geometry/mod.rs +++ b/crates/fj-core/src/geometry/mod.rs @@ -9,7 +9,7 @@ mod vertex; pub use self::{ boundary::{CurveBoundary, CurveBoundaryElement}, - curve::{CurveGeom, LocalCurveGeom}, + curve::{CurveGeom, CurveGeom2, LocalCurveGeom}, geometry::Geometry, path::Path, surface::SurfaceGeom,