pub fn push_rectangle_indices(
ul: u32,
ur: u32,
dl: u32,
dr: u32,
out: &mut Vec<[u32; 3]>,
)Expand description
Pushes two triangles forming a rectangle to the index buffer.
Given four corner point indices, this function creates two counter-clockwise triangles that form a rectangle (quad). The winding order ensures the normal points in the consistent direction based on the right-hand rule.
§Arguments
ul- Index of the upper-left pointur- Index of the upper-right pointdl- Index of the down-left pointdr- Index of the down-right pointout- Output buffer where triangle indices will be pushed
§Example
use parry3d::transformation::utils::push_rectangle_indices;
let mut indices = Vec::new();
// Create a quad from points 0, 1, 2, 3
// Layout: 0 --- 1
// | |
// 2 --- 3
push_rectangle_indices(0, 1, 2, 3, &mut indices);
assert_eq!(indices.len(), 2); // Two triangles
assert_eq!(indices[0], [0, 2, 3]); // First triangle
assert_eq!(indices[1], [3, 1, 0]); // Second triangle