mirror of
https://github.com/hannobraun/Fornjot
synced 2025-09-19 15:50:30 +00:00
Add FloatingCurve::new
This commit is contained in:
parent
2e5106fe12
commit
af589bde5e
@ -29,9 +29,7 @@ impl AnchoredCurve {
|
||||
) -> Self {
|
||||
Self {
|
||||
origin,
|
||||
floating: FloatingCurve {
|
||||
inner: Box::new(curve),
|
||||
},
|
||||
floating: FloatingCurve::new(curve),
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,6 +89,13 @@ impl Clone for AnchoredCurve {
|
||||
pub struct FloatingCurve {
|
||||
pub inner: Box<dyn CurveGeometry>,
|
||||
}
|
||||
impl FloatingCurve {
|
||||
pub fn new(curve: impl CurveGeometry + 'static) -> Self {
|
||||
Self {
|
||||
inner: Box::new(curve),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait CurveGeometry {
|
||||
fn clone_curve_geometry(&self) -> Box<dyn CurveGeometry>;
|
||||
|
@ -17,7 +17,7 @@ impl SweptCurve {
|
||||
|
||||
Self {
|
||||
u: AnchoredCurve::from_origin_and_curve(origin, u),
|
||||
v: FloatingCurve { inner: Box::new(v) },
|
||||
v: FloatingCurve::new(v),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,11 +45,9 @@ pub fn model(viewer: &Viewer) -> TriMesh {
|
||||
viewer.display(top.to_tri_mesh(tolerance));
|
||||
|
||||
let solid = top.sweep(
|
||||
FloatingCurve {
|
||||
inner: Box::new(Line {
|
||||
direction: Vector::from([0., 0., -2.]),
|
||||
}),
|
||||
},
|
||||
FloatingCurve::new(Line {
|
||||
direction: Vector::from([0., 0., -2.]),
|
||||
}),
|
||||
[1.],
|
||||
);
|
||||
viewer.display(solid.to_tri_mesh(tolerance));
|
||||
|
Loading…
x
Reference in New Issue
Block a user