Make return type more explicit

This commit is contained in:
Hanno Braun 2025-04-04 12:45:54 +02:00
parent 83808c2262
commit b95b027d92
2 changed files with 22 additions and 5 deletions

View File

@ -2,7 +2,10 @@ use crate::{
handle::Handle,
math::Plane,
topology::{
curve::Curve, face::Face, half_edge::HalfEdge, solid::Solid,
curve::Curve,
face::{Face, HalfEdgeWithEndVertex},
half_edge::HalfEdge,
solid::Solid,
surface::Surface,
},
};
@ -56,8 +59,14 @@ fn build_connecting_faces(bottom: &Face, top: &Face) -> Vec<Handle<Face>> {
.zip(top.half_edges_with_end_vertex())
.map(
|(
(bottom_half_edge, bottom_half_edge_end),
(top_half_edge, top_half_edge_end),
HalfEdgeWithEndVertex {
half_edge: bottom_half_edge,
end_vertex: bottom_half_edge_end,
},
HalfEdgeWithEndVertex {
half_edge: top_half_edge,
end_vertex: top_half_edge_end,
},
)| {
let is_internal = match [
bottom_half_edge.is_internal,

View File

@ -29,11 +29,14 @@ impl Face {
pub fn half_edges_with_end_vertex(
&self,
) -> impl Iterator<Item = (&Handle<HalfEdge>, &Handle<Vertex>)> {
) -> impl Iterator<Item = HalfEdgeWithEndVertex> {
self.half_edges
.iter()
.circular_tuple_windows()
.map(|(a, b)| (a, &b.start))
.map(|(a, b)| HalfEdgeWithEndVertex {
half_edge: a,
end_vertex: &b.start,
})
}
}
@ -42,3 +45,8 @@ impl ToTriMesh for Face {
triangulate(self)
}
}
pub struct HalfEdgeWithEndVertex<'r> {
pub half_edge: &'r Handle<HalfEdge>,
pub end_vertex: &'r Handle<Vertex>,
}