mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-12 05:48:27 +00:00
Implement Clone
for FloatingCurve
This commit is contained in:
parent
af589bde5e
commit
63775d1789
@ -60,9 +60,7 @@ impl AnchoredCurve {
|
|||||||
pub fn translate(&self, offset: impl Into<Vector<3>>) -> Self {
|
pub fn translate(&self, offset: impl Into<Vector<3>>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
origin: self.origin + offset,
|
origin: self.origin + offset,
|
||||||
floating: FloatingCurve {
|
floating: self.floating.clone(),
|
||||||
inner: self.floating.inner.clone_curve_geometry(),
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,9 +77,7 @@ impl Clone for AnchoredCurve {
|
|||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
Self {
|
Self {
|
||||||
origin: self.origin,
|
origin: self.origin,
|
||||||
floating: FloatingCurve {
|
floating: self.floating.clone(),
|
||||||
inner: self.floating.inner.clone_curve_geometry(),
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -97,6 +93,14 @@ impl FloatingCurve {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Clone for FloatingCurve {
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
Self {
|
||||||
|
inner: self.inner.clone_curve_geometry(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub trait CurveGeometry {
|
pub trait CurveGeometry {
|
||||||
fn clone_curve_geometry(&self) -> Box<dyn CurveGeometry>;
|
fn clone_curve_geometry(&self) -> Box<dyn CurveGeometry>;
|
||||||
fn vector_from_local_point(&self, point: Point<1>) -> Vector<3>;
|
fn vector_from_local_point(&self, point: Point<1>) -> Vector<3>;
|
||||||
|
@ -39,9 +39,7 @@ impl SweptCurve {
|
|||||||
let v = {
|
let v = {
|
||||||
let v = AnchoredCurve {
|
let v = AnchoredCurve {
|
||||||
origin: self.u.point_from_local(u),
|
origin: self.u.point_from_local(u),
|
||||||
floating: FloatingCurve {
|
floating: self.v.clone(),
|
||||||
inner: self.v.inner.clone_curve_geometry(),
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
v.project_point(point)
|
v.project_point(point)
|
||||||
@ -62,9 +60,7 @@ impl SweptCurve {
|
|||||||
pub fn translate(&self, offset: impl Into<Vector<3>>) -> Self {
|
pub fn translate(&self, offset: impl Into<Vector<3>>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
u: self.u.translate(offset),
|
u: self.u.translate(offset),
|
||||||
v: FloatingCurve {
|
v: self.v.clone(),
|
||||||
inner: self.v.inner.clone_curve_geometry(),
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,9 +88,7 @@ fn build_connecting_faces(
|
|||||||
let curve = Curve {
|
let curve = Curve {
|
||||||
geometry: AnchoredCurve {
|
geometry: AnchoredCurve {
|
||||||
origin: a.point,
|
origin: a.point,
|
||||||
floating: FloatingCurve {
|
floating: connecting_curve.clone(),
|
||||||
inner: connecting_curve.inner.clone_curve_geometry(),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user