This commit is contained in:
Hanno Braun 2025-02-21 20:38:55 +01:00
parent 3c06851a9b
commit ace80850de

View File

@ -7,17 +7,14 @@ use crate::{
topology::vertex::Vertex, topology::vertex::Vertex,
}; };
pub fn triangulate<'r>( pub fn triangulate(vertices: &[Handle<Vertex>], surface: &Plane) -> TriMesh {
vertices: impl IntoIterator<Item = &'r Handle<Vertex>>,
surface: &Plane,
) -> TriMesh {
// This is a placeholder implementation that only supports convex faces. // This is a placeholder implementation that only supports convex faces.
let mut triangulation = spade::ConstrainedDelaunayTriangulation::<_>::new(); let mut triangulation = spade::ConstrainedDelaunayTriangulation::<_>::new();
triangulation triangulation
.add_constraint_edges( .add_constraint_edges(
vertices.into_iter().map(|vertex| { vertices.iter().map(|vertex| {
// 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
// point has a position in 3D space. // point has a position in 3D space.