use glam::Vec3A;
const UPPER_Z: f32 = 0.5;
const LOWER_Z: f32 = -0.5;
pub(crate) fn triangulate_between_edges(
vertices: &mut Vec<Vec3A>,
points: &[(f32, f32)],
edges: &[(usize, usize)],
) {
for edge in edges.iter() {
vertices.push(Vec3A::new(points[edge.0].0, points[edge.0].1, UPPER_Z));
vertices.push(Vec3A::new(points[edge.1].0, points[edge.1].1, UPPER_Z));
vertices.push(Vec3A::new(points[edge.0].0, points[edge.0].1, LOWER_Z));
vertices.push(Vec3A::new(points[edge.1].0, points[edge.1].1, LOWER_Z));
vertices.push(Vec3A::new(points[edge.0].0, points[edge.0].1, LOWER_Z));
vertices.push(Vec3A::new(points[edge.1].0, points[edge.1].1, UPPER_Z));
}
}
pub(crate) fn triangulate_between_edges_indexed(
vertices: &mut [Vec3A],
indices: &mut Vec<u32>,
edges: &[(usize, usize)],
) {
let flat_count = (vertices.len() / 2) as u32;
for e in edges.iter() {
indices.push(e.0 as u32);
indices.push(e.1 as u32);
indices.push(flat_count + e.1 as u32);
indices.push(flat_count + e.0 as u32);
indices.push(e.0 as u32);
indices.push(flat_count + e.1 as u32);
}
}