From a665815bf5f61776153cee0efe849179e0e8e9f9 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Thu, 15 Aug 2024 19:47:45 +0200 Subject: [PATCH] Make `Path` generic over dimensionality --- crates/fj-core/src/algorithms/approx/curve.rs | 2 +- crates/fj-core/src/geometry/curve.rs | 2 +- crates/fj-core/src/geometry/path.rs | 8 ++++---- crates/fj-core/src/operations/build/curve.rs | 2 +- crates/fj-core/src/operations/geometry/curve.rs | 4 ++-- crates/fj-core/src/operations/sweep/path.rs | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/crates/fj-core/src/algorithms/approx/curve.rs b/crates/fj-core/src/algorithms/approx/curve.rs index 1801bd1de..bfbb37594 100644 --- a/crates/fj-core/src/algorithms/approx/curve.rs +++ b/crates/fj-core/src/algorithms/approx/curve.rs @@ -43,7 +43,7 @@ pub fn approx_curve_with_cache( } fn approx_curve( - path: &Path, + path: &Path<2>, surface: &SurfaceGeom, boundary: CurveBoundary>, tolerance: impl Into, diff --git a/crates/fj-core/src/geometry/curve.rs b/crates/fj-core/src/geometry/curve.rs index e1ebc0ab9..7033f6dd1 100644 --- a/crates/fj-core/src/geometry/curve.rs +++ b/crates/fj-core/src/geometry/curve.rs @@ -40,5 +40,5 @@ impl CurveGeom { #[derive(Clone, Debug)] pub struct LocalCurveGeom { /// The path that defines the curve on its surface - pub path: Path, + pub path: Path<2>, } diff --git a/crates/fj-core/src/geometry/path.rs b/crates/fj-core/src/geometry/path.rs index 54eb87ca9..4fc977575 100644 --- a/crates/fj-core/src/geometry/path.rs +++ b/crates/fj-core/src/geometry/path.rs @@ -6,15 +6,15 @@ use fj_math::{Circle, Line, Point, Scalar, Transform, Vector}; /// A path through surface (2D) space #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] -pub enum Path { +pub enum Path { /// A circle - Circle(Circle<2>), + Circle(Circle), /// A line - Line(Line<2>), + Line(Line), } -impl Path { +impl Path<2> { /// Build a circle from the given radius pub fn circle_from_center_and_radius( center: impl Into>, diff --git a/crates/fj-core/src/operations/build/curve.rs b/crates/fj-core/src/operations/build/curve.rs index a5b36b52a..a734e543e 100644 --- a/crates/fj-core/src/operations/build/curve.rs +++ b/crates/fj-core/src/operations/build/curve.rs @@ -14,7 +14,7 @@ use crate::{ pub trait BuildCurve { /// Build a curve from the provided path and surface fn from_path_and_surface( - path: Path, + path: Path<2>, surface: Handle, core: &mut Core, ) -> Handle { diff --git a/crates/fj-core/src/operations/geometry/curve.rs b/crates/fj-core/src/operations/geometry/curve.rs index 4f8c7a540..3e67550ce 100644 --- a/crates/fj-core/src/operations/geometry/curve.rs +++ b/crates/fj-core/src/operations/geometry/curve.rs @@ -20,7 +20,7 @@ pub trait UpdateCurveGeometry { /// Define the geometry as a path on a surface fn make_path_on_surface( self, - path: Path, + path: Path<2>, surface: Handle, geometry: &mut Layer, ) -> Self; @@ -59,7 +59,7 @@ impl UpdateCurveGeometry for Handle { fn make_path_on_surface( self, - path: Path, + path: Path<2>, surface: Handle, geometry: &mut Layer, ) -> Self { diff --git a/crates/fj-core/src/operations/sweep/path.rs b/crates/fj-core/src/operations/sweep/path.rs index d9bd43235..2287179df 100644 --- a/crates/fj-core/src/operations/sweep/path.rs +++ b/crates/fj-core/src/operations/sweep/path.rs @@ -32,7 +32,7 @@ pub trait SweepSurfacePath { ) -> Handle; } -impl SweepSurfacePath for Path { +impl SweepSurfacePath for Path<2> { fn sweep_surface_path( &self, surface: &SurfaceGeom,