1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
pub fn map(point: [u16; 2], scale: [u16; 2]) -> [f32; 2] {
let new_point: [f32; 2] = [
(point[0] as f32 / scale[0] as f32),
(point[1] as f32 / scale[1] as f32),
];
[(new_point[0] * 2.0) - 1.0, (new_point[1] * 2.0) - 1.0]
}
pub fn map_colors(color: [u8; 4]) -> [f32; 4] {
[
color[0] as f32 / 255.0,
color[1] as f32 / 255.0,
color[2] as f32 / 255.0,
color[3] as f32 / 255.0,
]
}
pub fn map_circ(point: [f32; 2], scale: [u16; 2]) -> [f32; 2] {
let new_point: [f32; 2] = [(point[0] / scale[0] as f32), (point[1] / scale[1] as f32)];
[(new_point[0] * 2.0) - 1.0, (new_point[1] * 2.0) - 1.0]
}