From a7bf71681568fe21284e1b78cd5feeed4fa75017 Mon Sep 17 00:00:00 2001 From: gabsi26 Date: Tue, 24 May 2022 17:26:40 +0200 Subject: [PATCH] Sides of sweep are now also flipped if needed Signed-off-by: gabsi26 --- crates/fj-kernel/src/algorithms/sweep.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/sweep.rs b/crates/fj-kernel/src/algorithms/sweep.rs index 525ecbc855..2b20aded91 100644 --- a/crates/fj-kernel/src/algorithms/sweep.rs +++ b/crates/fj-kernel/src/algorithms/sweep.rs @@ -124,11 +124,22 @@ pub fn sweep_shape( let top_edge = source_to_top.edges().get(&edge_source).unwrap().clone(); - let surface = + let surface = if path.dot(&Vector::from([0., 0., 1.])) + >= fj_math::Scalar::from_f64(0.) + { target.insert(Surface::SweptCurve(SweptCurve { curve: bottom_edge.get().curve(), path, - }))?; + }))? + } else { + target.insert( + Surface::SweptCurve(SweptCurve { + curve: bottom_edge.get().curve(), + path, + }) + .reverse(), //////////////////////////////////// + )? + }; let cycle = target.merge(Cycle::new(vec![ bottom_edge,