Provide surface to private method

This prepares for a follow-on change, as the surface will be needed
there shortly.
This commit is contained in:
Hanno Braun 2024-04-25 14:06:12 +02:00 committed by Hanno Braun
parent 61f246213f
commit 30549bc82e

View File

@ -3,7 +3,7 @@ use fj_math::{Point, Scalar};
use crate::{
geometry::Geometry,
storage::Handle,
topology::{Cycle, Face, HalfEdge, Region, Sketch},
topology::{Cycle, Face, HalfEdge, Region, Sketch, Surface},
validation::{validation_check::ValidationCheck, ValidationConfig},
};
@ -63,7 +63,7 @@ impl ValidationCheck<Face> for AdjacentHalfEdgesNotConnected {
geometry: &'r Geometry,
config: &'r ValidationConfig,
) -> impl Iterator<Item = Self> + 'r {
check_region(object.region(), geometry, config)
check_region(object.region(), object.surface(), geometry, config)
}
}
@ -73,26 +73,27 @@ impl ValidationCheck<Sketch> for AdjacentHalfEdgesNotConnected {
geometry: &'r Geometry,
config: &'r ValidationConfig,
) -> impl Iterator<Item = Self> + 'r {
object
.regions()
.iter()
.flat_map(|region| check_region(region, geometry, config))
object.regions().iter().flat_map(|region| {
check_region(region, object.surface(), geometry, config)
})
}
}
fn check_region<'r>(
region: &'r Region,
surface: &'r Handle<Surface>,
geometry: &'r Geometry,
config: &'r ValidationConfig,
) -> impl Iterator<Item = AdjacentHalfEdgesNotConnected> + 'r {
[region.exterior()]
.into_iter()
.chain(region.interiors())
.flat_map(|cycle| check_cycle(cycle, geometry, config))
.flat_map(|cycle| check_cycle(cycle, surface, geometry, config))
}
fn check_cycle<'r>(
cycle: &'r Cycle,
_: &'r Handle<Surface>,
geometry: &'r Geometry,
config: &'r ValidationConfig,
) -> impl Iterator<Item = AdjacentHalfEdgesNotConnected> + 'r {