From d3c770e0f6ca117ce2a6f62ed109eed64b5f6994 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Thu, 10 Apr 2025 11:59:05 +0200 Subject: [PATCH] Extract dedicated `approximate_half_edge` function --- .../2025-03-18/src/extra/triangulate.rs | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/experiments/2025-03-18/src/extra/triangulate.rs b/experiments/2025-03-18/src/extra/triangulate.rs index d425d7f52..f3e633356 100644 --- a/experiments/2025-03-18/src/extra/triangulate.rs +++ b/experiments/2025-03-18/src/extra/triangulate.rs @@ -55,15 +55,7 @@ pub fn triangulate(face: &Face) -> TriMesh { fn half_edges_to_points(face: &Face, target: &mut Vec) { target.extend( face.half_edges_with_end_vertex() - .map( - |HalfEdgeWithEndVertex { - half_edge, - end_vertex: _, - }| { - let start = &half_edge.start; - start.point - }, - ) + .map(approximate_half_edge) .map(|point_global| { // Here, we project a 3D point (from the vertex) into the face's // surface, creating a 2D point. Through the surface, this 2D @@ -93,6 +85,16 @@ fn half_edges_to_points(face: &Face, target: &mut Vec) { ) } +fn approximate_half_edge( + HalfEdgeWithEndVertex { + half_edge, + end_vertex: _, + }: HalfEdgeWithEndVertex, +) -> Point<3> { + let start = &half_edge.start; + start.point +} + fn polygon_from_half_edges( points_from_half_edges: &[TriangulationPoint], ) -> Polygon {