mirror of
https://github.com/hannobraun/Fornjot
synced 2025-08-06 17:26:06 +00:00
Extract dedicated approximate_half_edge
function
This commit is contained in:
parent
2220295b16
commit
d3c770e0f6
@ -55,15 +55,7 @@ pub fn triangulate(face: &Face) -> TriMesh {
|
|||||||
fn half_edges_to_points(face: &Face, target: &mut Vec<TriangulationPoint>) {
|
fn half_edges_to_points(face: &Face, target: &mut Vec<TriangulationPoint>) {
|
||||||
target.extend(
|
target.extend(
|
||||||
face.half_edges_with_end_vertex()
|
face.half_edges_with_end_vertex()
|
||||||
.map(
|
.map(approximate_half_edge)
|
||||||
|HalfEdgeWithEndVertex {
|
|
||||||
half_edge,
|
|
||||||
end_vertex: _,
|
|
||||||
}| {
|
|
||||||
let start = &half_edge.start;
|
|
||||||
start.point
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.map(|point_global| {
|
.map(|point_global| {
|
||||||
// Here, we project a 3D point (from the vertex) into the face's
|
// Here, we project a 3D point (from the vertex) into the face's
|
||||||
// surface, creating a 2D point. Through the surface, this 2D
|
// surface, creating a 2D point. Through the surface, this 2D
|
||||||
@ -93,6 +85,16 @@ fn half_edges_to_points(face: &Face, target: &mut Vec<TriangulationPoint>) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn approximate_half_edge(
|
||||||
|
HalfEdgeWithEndVertex {
|
||||||
|
half_edge,
|
||||||
|
end_vertex: _,
|
||||||
|
}: HalfEdgeWithEndVertex,
|
||||||
|
) -> Point<3> {
|
||||||
|
let start = &half_edge.start;
|
||||||
|
start.point
|
||||||
|
}
|
||||||
|
|
||||||
fn polygon_from_half_edges(
|
fn polygon_from_half_edges(
|
||||||
points_from_half_edges: &[TriangulationPoint],
|
points_from_half_edges: &[TriangulationPoint],
|
||||||
) -> Polygon {
|
) -> Polygon {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user