Prepare for follow-on change

This commit is contained in:
Hanno Braun 2025-04-16 11:09:46 +02:00
parent a787b06b9d
commit 85cfac7f63

View File

@ -37,8 +37,8 @@ impl Sketch {
pub fn to_face(&self, surface: Handle<Surface>) -> Face { pub fn to_face(&self, surface: Handle<Surface>) -> Face {
let vertices = VerticesFromSegments::new(&self.segments, &surface); let vertices = VerticesFromSegments::new(&self.segments, &surface);
let half_edges = let half_edges = vertices.iter().map(
vertices.iter().map(|(segment, [start, end], is_internal)| { |([(segment, start), (_, end)], is_internal)| {
let curve = match segment { let curve = match segment {
SketchSegment::Arc { .. } => { SketchSegment::Arc { .. } => {
// We are creating a line here, temporarily, while // We are creating a line here, temporarily, while
@ -55,7 +55,8 @@ impl Sketch {
start, start,
is_internal, is_internal,
}) })
}); },
);
Face::new(surface, half_edges, false) Face::new(surface, half_edges, false)
} }
@ -119,17 +120,18 @@ impl VerticesFromSegments {
fn iter( fn iter(
&self, &self,
) -> impl Iterator<Item = (SketchSegment, [Handle<Vertex>; 2], bool)> { ) -> impl Iterator<Item = ([(SketchSegment, Handle<Vertex>); 2], bool)>
{
self.segments_with_start_vertex self.segments_with_start_vertex
.iter() .iter()
.cloned() .cloned()
.circular_tuple_windows() .circular_tuple_windows()
.map(|((segment, start), (_, end))| { .map(|((segment, start), (next_segment, end))| {
let [start_is_coincident, end_is_coincident] = [&start, &end] let [start_is_coincident, end_is_coincident] = [&start, &end]
.map(|vertex| self.coincident_vertices.contains(vertex)); .map(|vertex| self.coincident_vertices.contains(vertex));
let is_internal = start_is_coincident && end_is_coincident; let is_internal = start_is_coincident && end_is_coincident;
(segment, [start, end], is_internal) ([(segment, start), (next_segment, end)], is_internal)
}) })
} }
} }