diff --git a/crates/fj-core/src/objects/kinds/cycle.rs b/crates/fj-core/src/objects/kinds/cycle.rs index 61bb4179a..2e0ac0cf9 100644 --- a/crates/fj-core/src/objects/kinds/cycle.rs +++ b/crates/fj-core/src/objects/kinds/cycle.rs @@ -1,7 +1,7 @@ use fj_math::{Scalar, Winding}; use crate::{ - geometry::SurfacePath, + geometry::{Geometry, SurfacePath}, objects::{HalfEdge, ObjectSet}, storage::Handle, }; @@ -29,7 +29,7 @@ impl Cycle { /// Please note that this is not *the* winding of the cycle, only one of the /// two possible windings, depending on the direction you look at the /// surface that the cycle is defined on from. - pub fn winding(&self) -> Winding { + pub fn winding(&self, _: &Geometry) -> Winding { // The cycle could be made up of one or two circles. If that is the // case, the winding of the cycle is determined by the winding of the // first circle. diff --git a/crates/fj-core/src/objects/kinds/face.rs b/crates/fj-core/src/objects/kinds/face.rs index 5f65e8c8b..c0f22fc7a 100644 --- a/crates/fj-core/src/objects/kinds/face.rs +++ b/crates/fj-core/src/objects/kinds/face.rs @@ -65,8 +65,8 @@ impl Face { /// Faces *do* have an orientation, meaning they have definite front and /// back sides. The front side is the side, where the face's exterior cycle /// is wound counter-clockwise. - pub fn coord_handedness(&self, _: &Geometry) -> Handedness { - match self.region.exterior().winding() { + pub fn coord_handedness(&self, geometry: &Geometry) -> Handedness { + match self.region.exterior().winding(geometry) { Winding::Ccw => Handedness::RightHanded, Winding::Cw => Handedness::LeftHanded, } diff --git a/crates/fj-core/src/operations/sweep/sketch.rs b/crates/fj-core/src/operations/sweep/sketch.rs index 087ad51a6..d2f6d33a9 100644 --- a/crates/fj-core/src/operations/sweep/sketch.rs +++ b/crates/fj-core/src/operations/sweep/sketch.rs @@ -40,7 +40,10 @@ impl SweepSketch for Sketch { let region = { // The following code assumes that the sketch is winded counter- // clockwise. Let's check that real quick. - assert!(region.exterior().winding().is_ccw()); + assert!(region + .exterior() + .winding(&core.layers.geometry) + .is_ccw()); let is_negative_sweep = { let u = match core.layers.geometry.of_surface(&surface).u { diff --git a/crates/fj-core/src/validate/face.rs b/crates/fj-core/src/validate/face.rs index fc0bc81ad..3a7c04756 100644 --- a/crates/fj-core/src/validate/face.rs +++ b/crates/fj-core/src/validate/face.rs @@ -58,7 +58,7 @@ impl FaceValidationError { fn check_interior_winding( face: &Face, - _: &Geometry, + geometry: &Geometry, errors: &mut Vec, ) { if face.region().exterior().half_edges().is_empty() { @@ -67,7 +67,7 @@ impl FaceValidationError { return; } - let exterior_winding = face.region().exterior().winding(); + let exterior_winding = face.region().exterior().winding(geometry); for interior in face.region().interiors() { if interior.half_edges().is_empty() { @@ -75,7 +75,7 @@ impl FaceValidationError { // like a job for a different validation check. continue; } - let interior_winding = interior.winding(); + let interior_winding = interior.winding(geometry); if exterior_winding == interior_winding { errors.push( diff --git a/crates/fj-core/src/validate/sketch.rs b/crates/fj-core/src/validate/sketch.rs index 53eb034e0..6a23c46ab 100644 --- a/crates/fj-core/src/validate/sketch.rs +++ b/crates/fj-core/src/validate/sketch.rs @@ -78,13 +78,13 @@ impl SketchValidationError { fn check_exterior_cycles( sketch: &Sketch, - _: &Geometry, + geometry: &Geometry, _config: &ValidationConfig, errors: &mut Vec, ) { sketch.regions().iter().for_each(|region| { let cycle = region.exterior(); - if cycle.winding() == Winding::Cw { + if cycle.winding(geometry) == Winding::Cw { errors.push(ValidationError::Sketch( SketchValidationError::ClockwiseExteriorCycle { cycle: cycle.clone(), @@ -96,7 +96,7 @@ impl SketchValidationError { fn check_interior_cycles( sketch: &Sketch, - _: &Geometry, + geometry: &Geometry, _config: &ValidationConfig, errors: &mut Vec, ) { @@ -104,7 +104,7 @@ impl SketchValidationError { region .interiors() .iter() - .filter(|interior| interior.winding() == Winding::Ccw) + .filter(|interior| interior.winding(geometry) == Winding::Ccw) .for_each(|cycle| { errors.push(ValidationError::Sketch( SketchValidationError::CounterClockwiseInteriorCycle {