diff --git a/crates/fj-kernel/src/algorithms/sweep/edge.rs b/crates/fj-kernel/src/algorithms/sweep/edge.rs index 0a5ab39a4..bb63a6064 100644 --- a/crates/fj-kernel/src/algorithms/sweep/edge.rs +++ b/crates/fj-kernel/src/algorithms/sweep/edge.rs @@ -186,7 +186,10 @@ fn create_non_continuous_side_face( let [_, prev_last] = edges[i].vertices().get_or_panic(); let [next_first, _] = edges[j].vertices().get_or_panic(); - if prev_last.global_form() != next_first.global_form() { + // Need to compare surface forms here, as the global forms might be + // coincident when sweeping circles, despite the vertices being + // different! + if prev_last.surface_form() != next_first.surface_form() { edges[j] = edges[j].reverse(); } diff --git a/crates/fj-kernel/src/builder/edge.rs b/crates/fj-kernel/src/builder/edge.rs index 941ec97fc..2379091bb 100644 --- a/crates/fj-kernel/src/builder/edge.rs +++ b/crates/fj-kernel/src/builder/edge.rs @@ -20,22 +20,25 @@ impl EdgeBuilder { /// Create a circle from the given radius pub fn circle_from_radius(&self, radius: Scalar) -> Edge { - let curve_local = CurveKind::Circle(Circle::new( - Point::origin(), - Vector::from([radius, Scalar::ZERO]), - Vector::from([Scalar::ZERO, radius]), - )); - let curve_global = - GlobalCurve::from_kind(CurveKind::Circle(Circle::new( + let curve = { + let local = CurveKind::Circle(Circle::new( Point::origin(), - Vector::from([radius, Scalar::ZERO, Scalar::ZERO]), - Vector::from([Scalar::ZERO, radius, Scalar::ZERO]), - ))); - - Edge::from_curve_and_vertices( - Curve::new(self.surface, curve_local, curve_global), - VerticesOfEdge::none(), - ) + Vector::from([radius, Scalar::ZERO]), + Vector::from([Scalar::ZERO, radius]), + )); + let global = + GlobalCurve::from_kind(CurveKind::Circle(Circle::new( + Point::origin(), + Vector::from([radius, Scalar::ZERO, Scalar::ZERO]), + Vector::from([Scalar::ZERO, radius, Scalar::ZERO]), + ))); + + Curve::new(self.surface, local, global) + }; + + let vertices = VerticesOfEdge::none(); + + Edge::from_curve_and_vertices(curve, vertices) } /// Create a line segment from two points