mirror of
https://github.com/hannobraun/Fornjot
synced 2025-11-25 17:02:37 +00:00
Make Path generic over dimensionality
This commit is contained in:
parent
e7a2634108
commit
a665815bf5
@ -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>,
|
||||
|
||||
@ -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>,
|
||||
}
|
||||
|
||||
@ -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>>,
|
||||
|
||||
@ -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> {
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user