Function reverse_clockwising

Source
pub fn reverse_clockwising(indices: &mut [[u32; 3]])
Expand description

Reverses the winding order of triangle faces.

This function flips the winding order of triangles from counter-clockwise to clockwise or vice versa. This effectively flips the direction of face normals, which is useful when you need to invert a mesh or correct winding order issues.

§Arguments

  • indices - Mutable slice of triangle indices to reverse

§Example

use parry3d::transformation::utils::reverse_clockwising;

let mut triangles = vec![
    [0, 1, 2],
    [2, 3, 0],
];

// Reverse the winding order
reverse_clockwising(&mut triangles);

// First two vertices of each triangle are swapped
assert_eq!(triangles[0], [1, 0, 2]);
assert_eq!(triangles[1], [3, 2, 0]);