hex_grid/
pixel_orientation.rs

1#[derive(Copy, Clone, Eq, PartialEq)]
2pub struct PixelOrientation {
3    pub right_increasing: bool,
4    pub up_increasing: bool,
5}
6
7impl PixelOrientation {
8    /**
9     * Convert coordinates between right_increasing/up_increasing and the given orientation
10     */
11    pub(crate) fn orient(&self, (x, y): (f32, f32)) -> (f32, f32) {
12        let x = if self.right_increasing {
13            x
14        } else {
15            -x
16        };
17        let y = if self.up_increasing {
18            y
19        } else {
20            -y
21        };
22        (x, y)
23    }
24}