mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-12 13:58:28 +00:00
Prepare to support curved sweeps
This commit is contained in:
parent
84d4ca3e23
commit
34918962d4
@ -1,8 +1,9 @@
|
||||
use fj_interop::{Tolerance, TriMesh};
|
||||
use fj_math::Vector;
|
||||
use fj_viewer::Viewer;
|
||||
|
||||
use crate::{
|
||||
geometry::{Sketch, SweptCurve, ToTriMesh},
|
||||
geometry::{Line, Sketch, SweptCurve, ToTriMesh},
|
||||
handle::Handle,
|
||||
operations::sweep::SweepExt,
|
||||
topology::surface::Surface,
|
||||
@ -43,7 +44,9 @@ pub fn model(viewer: &Viewer) -> TriMesh {
|
||||
|
||||
viewer.display(top.to_tri_mesh(tolerance));
|
||||
|
||||
let solid = top.sweep([0., 0., -2.]);
|
||||
let solid = top.sweep(Line {
|
||||
direction: Vector::from([0., 0., -2.]),
|
||||
});
|
||||
viewer.display(solid.to_tri_mesh(tolerance));
|
||||
|
||||
solid.to_tri_mesh(tolerance)
|
||||
|
@ -1,6 +1,5 @@
|
||||
use fj_math::Vector;
|
||||
|
||||
use crate::{
|
||||
geometry::Line,
|
||||
handle::Handle,
|
||||
topology::{face::Face, solid::Solid},
|
||||
};
|
||||
@ -19,11 +18,13 @@ pub trait SweepExt {
|
||||
///
|
||||
/// It should be seen as more of a placeholder for a real implementation of
|
||||
/// this operation.
|
||||
fn sweep(self, path: impl Into<Vector<3>>) -> Solid;
|
||||
fn sweep(self, path: Line) -> Solid;
|
||||
}
|
||||
|
||||
impl SweepExt for Handle<Face> {
|
||||
fn sweep(self, path: impl Into<Vector<3>>) -> Solid {
|
||||
fn sweep(self, path: Line) -> Solid {
|
||||
let path = path.direction;
|
||||
|
||||
let bottom = self;
|
||||
let top = Handle::new(bottom.flip().translate(path));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user