This commit is contained in:
Hanno Braun 2025-04-04 12:47:23 +02:00
parent 654d837c24
commit 5fa10def8b

View File

@ -2,10 +2,7 @@ use crate::{
handle::Handle, handle::Handle,
math::Plane, math::Plane,
topology::{ topology::{
curve::Curve, curve::Curve, face::Face, half_edge::HalfEdge, solid::Solid,
face::{Face, HalfEdgeWithEndVertex},
half_edge::HalfEdge,
solid::Solid,
surface::Surface, surface::Surface,
}, },
}; };
@ -57,18 +54,10 @@ fn build_connecting_faces(bottom: &Face, top: &Face) -> Vec<Handle<Face>> {
bottom bottom
.half_edges_with_end_vertex() .half_edges_with_end_vertex()
.zip(top.half_edges_with_end_vertex()) .zip(top.half_edges_with_end_vertex())
.map( .map(|(bottom, top)| {
|( let is_internal =
bottom, match [bottom.half_edge.is_internal, top.half_edge.is_internal]
HalfEdgeWithEndVertex { {
half_edge: top_half_edge,
end_vertex: top_half_edge_end,
},
)| {
let is_internal = match [
bottom.half_edge.is_internal,
top_half_edge.is_internal,
] {
[true, true] => true, [true, true] => true,
[false, false] => false, [false, false] => false,
_ => { _ => {
@ -79,29 +68,28 @@ fn build_connecting_faces(bottom: &Face, top: &Face) -> Vec<Handle<Face>> {
} }
}; };
let a = &bottom.half_edge.start; let a = &bottom.half_edge.start;
let b = bottom.end_vertex; let b = bottom.end_vertex;
let c = top_half_edge_end; let c = top.end_vertex;
let d = &top_half_edge.start; let d = &top.half_edge.start;
let surface = Handle::new(Surface { let surface = Handle::new(Surface {
geometry: Box::new(Plane::from_points( geometry: Box::new(Plane::from_points(
[a, b, d].map(|vertex| vertex.point), [a, b, d].map(|vertex| vertex.point),
)), )),
}); });
let face = Face::new( let face = Face::new(
surface, surface,
[a, b, c, d].map(|vertex| { [a, b, c, d].map(|vertex| {
Handle::new(HalfEdge { Handle::new(HalfEdge {
curve: Handle::new(Curve {}), curve: Handle::new(Curve {}),
start: vertex.clone(), start: vertex.clone(),
is_internal: false, is_internal: false,
}) })
}), }),
is_internal, is_internal,
); );
Handle::new(face) Handle::new(face)
}, })
)
.collect::<Vec<_>>() .collect::<Vec<_>>()
} }