mirror of
https://github.com/hannobraun/Fornjot
synced 2025-07-15 06:26:05 +00:00
Prepare to support arcs in sketches
This commit is contained in:
parent
b852dfd6cd
commit
7415e1f4b0
@ -37,15 +37,17 @@ 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 = vertices.iter().map(|([start, end], is_internal)| {
|
let half_edges =
|
||||||
let curve = Handle::new(Curve::line_from_vertices([&start, &end]));
|
vertices.iter().map(|(_, [start, end], is_internal)| {
|
||||||
|
let curve =
|
||||||
|
Handle::new(Curve::line_from_vertices([&start, &end]));
|
||||||
|
|
||||||
Handle::new(HalfEdge {
|
Handle::new(HalfEdge {
|
||||||
curve,
|
curve,
|
||||||
start,
|
start,
|
||||||
is_internal,
|
is_internal,
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
Face::new(surface, half_edges, false)
|
Face::new(surface, half_edges, false)
|
||||||
}
|
}
|
||||||
@ -107,17 +109,19 @@ impl VerticesFromSegments {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn iter(&self) -> impl Iterator<Item = ([Handle<Vertex>; 2], bool)> {
|
fn iter(
|
||||||
|
&self,
|
||||||
|
) -> 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(|((_, start), (_, end))| {
|
.map(|((segment, start), (_, 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;
|
||||||
|
|
||||||
([start, end], is_internal)
|
(segment, [start, end], is_internal)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user