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(
path: &Path,
path: &Path<2>,
surface: &SurfaceGeom,
boundary: CurveBoundary<Point<1>>,
tolerance: impl Into<Tolerance>,

View File

@ -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>,
}

View File

@ -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<const D: usize> {
/// A circle
Circle(Circle<2>),
Circle(Circle<D>),
/// A line
Line(Line<2>),
Line(Line<D>),
}
impl Path {
impl Path<2> {
/// Build a circle from the given radius
pub fn circle_from_center_and_radius(
center: impl Into<Point<2>>,

View File

@ -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<Surface>,
core: &mut Core,
) -> Handle<Curve> {

View File

@ -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<Surface>,
geometry: &mut Layer<Geometry>,
) -> Self;
@ -59,7 +59,7 @@ impl UpdateCurveGeometry for Handle<Curve> {
fn make_path_on_surface(
self,
path: Path,
path: Path<2>,
surface: Handle<Surface>,
geometry: &mut Layer<Geometry>,
) -> Self {

View File

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