Read vertex geometry in bounding box calculation

This commit is contained in:
Hanno Braun 2024-06-28 18:55:32 +02:00
parent 8778855744
commit bed86118de

View File

@ -10,9 +10,8 @@ impl super::BoundingVolume<2>
for (&Handle<HalfEdge>, &Handle<Vertex>, &Handle<Surface>)
{
fn aabb(self, geometry: &Geometry) -> Option<Aabb<2>> {
let (half_edge, _end_vertex, surface) = self;
let (half_edge, end_vertex, surface) = self;
let half_edge_geom = geometry.of_half_edge(half_edge);
let path = geometry
.of_curve(half_edge.curve())
.unwrap()
@ -34,9 +33,17 @@ impl super::BoundingVolume<2>
})
}
SurfacePath::Line(_) => {
let points = half_edge_geom.boundary.inner.map(|point_curve| {
path.point_from_path_coords(point_curve)
});
let points =
[half_edge.start_vertex(), end_vertex].map(|vertex| {
let point_curve = geometry
.of_vertex(vertex)
.unwrap()
.local_on(half_edge.curve())
.unwrap()
.position;
path.point_from_path_coords(point_curve)
});
Some(Aabb::<2>::from_points(points))
}