Implement Clone for FloatingCurve

This commit is contained in:
Hanno Braun 2025-05-05 12:04:51 +02:00
parent af589bde5e
commit 63775d1789
3 changed files with 13 additions and 15 deletions

View File

@ -60,9 +60,7 @@ impl AnchoredCurve {
pub fn translate(&self, offset: impl Into<Vector<3>>) -> Self {
Self {
origin: self.origin + offset,
floating: FloatingCurve {
inner: self.floating.inner.clone_curve_geometry(),
},
floating: self.floating.clone(),
}
}
@ -79,9 +77,7 @@ impl Clone for AnchoredCurve {
fn clone(&self) -> Self {
Self {
origin: self.origin,
floating: FloatingCurve {
inner: self.floating.inner.clone_curve_geometry(),
},
floating: self.floating.clone(),
}
}
}
@ -97,6 +93,14 @@ impl FloatingCurve {
}
}
impl Clone for FloatingCurve {
fn clone(&self) -> Self {
Self {
inner: self.inner.clone_curve_geometry(),
}
}
}
pub trait CurveGeometry {
fn clone_curve_geometry(&self) -> Box<dyn CurveGeometry>;
fn vector_from_local_point(&self, point: Point<1>) -> Vector<3>;

View File

@ -39,9 +39,7 @@ impl SweptCurve {
let v = {
let v = AnchoredCurve {
origin: self.u.point_from_local(u),
floating: FloatingCurve {
inner: self.v.inner.clone_curve_geometry(),
},
floating: self.v.clone(),
};
v.project_point(point)
@ -62,9 +60,7 @@ impl SweptCurve {
pub fn translate(&self, offset: impl Into<Vector<3>>) -> Self {
Self {
u: self.u.translate(offset),
v: FloatingCurve {
inner: self.v.inner.clone_curve_geometry(),
},
v: self.v.clone(),
}
}
}

View File

@ -88,9 +88,7 @@ fn build_connecting_faces(
let curve = Curve {
geometry: AnchoredCurve {
origin: a.point,
floating: FloatingCurve {
inner: connecting_curve.inner.clone_curve_geometry(),
},
floating: connecting_curve.clone(),
},
};