Make Path generic over dimensionality

This commit is contained in:
Hanno Braun 2024-08-15 19:47:45 +02:00
parent e7a2634108
commit a665815bf5
6 changed files with 10 additions and 10 deletions

View File

@ -43,7 +43,7 @@ pub fn approx_curve_with_cache(
} }
fn approx_curve( fn approx_curve(
path: &Path, path: &Path<2>,
surface: &SurfaceGeom, surface: &SurfaceGeom,
boundary: CurveBoundary<Point<1>>, boundary: CurveBoundary<Point<1>>,
tolerance: impl Into<Tolerance>, tolerance: impl Into<Tolerance>,

View File

@ -40,5 +40,5 @@ impl CurveGeom {
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct LocalCurveGeom { pub struct LocalCurveGeom {
/// The path that defines the curve on its surface /// The path that defines the curve on its surface
pub path: Path, pub path: Path<2>,
} }

View File

@ -6,15 +6,15 @@ use fj_math::{Circle, Line, Point, Scalar, Transform, Vector};
/// A path through surface (2D) space /// A path through surface (2D) space
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
pub enum Path { pub enum Path<const D: usize> {
/// A circle /// A circle
Circle(Circle<2>), Circle(Circle<D>),
/// A line /// A line
Line(Line<2>), Line(Line<D>),
} }
impl Path { impl Path<2> {
/// Build a circle from the given radius /// Build a circle from the given radius
pub fn circle_from_center_and_radius( pub fn circle_from_center_and_radius(
center: impl Into<Point<2>>, center: impl Into<Point<2>>,

View File

@ -14,7 +14,7 @@ use crate::{
pub trait BuildCurve { pub trait BuildCurve {
/// Build a curve from the provided path and surface /// Build a curve from the provided path and surface
fn from_path_and_surface( fn from_path_and_surface(
path: Path, path: Path<2>,
surface: Handle<Surface>, surface: Handle<Surface>,
core: &mut Core, core: &mut Core,
) -> Handle<Curve> { ) -> Handle<Curve> {

View File

@ -20,7 +20,7 @@ pub trait UpdateCurveGeometry {
/// Define the geometry as a path on a surface /// Define the geometry as a path on a surface
fn make_path_on_surface( fn make_path_on_surface(
self, self,
path: Path, path: Path<2>,
surface: Handle<Surface>, surface: Handle<Surface>,
geometry: &mut Layer<Geometry>, geometry: &mut Layer<Geometry>,
) -> Self; ) -> Self;
@ -59,7 +59,7 @@ impl UpdateCurveGeometry for Handle<Curve> {
fn make_path_on_surface( fn make_path_on_surface(
self, self,
path: Path, path: Path<2>,
surface: Handle<Surface>, surface: Handle<Surface>,
geometry: &mut Layer<Geometry>, geometry: &mut Layer<Geometry>,
) -> Self { ) -> Self {

View File

@ -32,7 +32,7 @@ pub trait SweepSurfacePath {
) -> Handle<Surface>; ) -> Handle<Surface>;
} }
impl SweepSurfacePath for Path { impl SweepSurfacePath for Path<2> {
fn sweep_surface_path( fn sweep_surface_path(
&self, &self,
surface: &SurfaceGeom, surface: &SurfaceGeom,