From d451c304b76ce525cf9dfc9e2e2fee13f1b0f135 Mon Sep 17 00:00:00 2001 From: gennyble Date: Mon, 11 Sep 2023 20:09:33 -0500 Subject: ahh2 --- prism/src/rotate.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 prism/src/rotate.rs (limited to 'prism/src/rotate.rs') diff --git a/prism/src/rotate.rs b/prism/src/rotate.rs new file mode 100644 index 0000000..82f29d1 --- /dev/null +++ b/prism/src/rotate.rs @@ -0,0 +1,11 @@ +pub fn rotate_180(data: &mut [T]) { + let mut rat = vec![data[0]; data.len()]; + + for (idx, px) in data.chunks(3).rev().enumerate() { + rat[idx * 3] = px[0]; + rat[idx * 3 + 1] = px[1]; + rat[idx * 3 + 2] = px[2]; + } + + data.copy_from_slice(&rat); +} -- cgit 1.4.1-3-g733a5