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