1use super::super::transition_sides::TransitionSide::*;
2use super::super::voxel_coordinates::*;
3use super::rotation::*;
4
5#[rustfmt::skip]
9pub const ROTATIONS: [Rotation; 6] = [
10 Rotation::from(
11 LowX,
12 (0, 0, 1), (0, 0, -1), (0, 1, 0), (1, 0, 0),
13 (1, 0, 0), (0, 0, 1), (0, 1, 0), (-1, 0, 0)), Rotation::from(
15 HighX,
16 (1, 0, 0), (0, 0, 1), (0, 1, 0), (-1, 0, 0),
17 (0, 0, 1), (0, 0, -1), (0, 1, 0), (1, 0, 0)),
18 Rotation::from(
19 LowY,
20 (0, 0, 1), (1, 0, 0), (0, 0, -1), (0, 1, 0), (0, 1, 0), (1, 0, 0), (0, 0, 1), (0, -1, 0)),
22 Rotation::from(
23 HighY,
24 (0, 1, 0), (1, 0, 0), (0, 0, 1), (0, -1, 0),
25 (0, 0, 1), (1, 0, 0), (0, 0, -1), (0, 1, 0)),
26 Rotation::from(
27 LowZ,
28 (0, 0, 0), (1, 0, 0), (0, 1, 0), (0, 0, 1), (0, 0, 0), (1, 0, 0), (0, 1, 0), (0, 0, 1)),
30 Rotation::from(
31 HighZ,
32 (1, 0, 1), (-1, 0, 0), (0, 1, 0), (0, 0, -1),
33 (1, 0, 1), (-1, 0, 0), (0, 1, 0), (0, 0, -1)),
34];
35
36pub struct RegularCellVoxelIndex(pub usize);
37
38pub const REGULAR_CELL_VOXELS: [RegularVoxelDelta; 8] = [
39 RegularVoxelDelta { x: 0, y: 0, z: 0 }, RegularVoxelDelta { x: 1, y: 0, z: 0 }, RegularVoxelDelta { x: 0, y: 1, z: 0 }, RegularVoxelDelta { x: 1, y: 1, z: 0 },
43 RegularVoxelDelta { x: 0, y: 0, z: 1 },
44 RegularVoxelDelta { x: 1, y: 0, z: 1 },
45 RegularVoxelDelta { x: 0, y: 1, z: 1 },
46 RegularVoxelDelta { x: 1, y: 1, z: 1 },
47];
48
49pub fn get_regular_voxel_delta(index: RegularCellVoxelIndex) -> RegularVoxelDelta {
50 REGULAR_CELL_VOXELS[index.0]
51}
52
53pub struct TransitionCellGridPointIndex(pub usize);
55
56pub enum TransitionCellGridPoint {
57 HighResFace(HighResolutionVoxelDelta),
58 RegularFace(usize, usize),
59}
60
61const fn tcell_highres_face_gridpoint(u: isize, v: isize) -> TransitionCellGridPoint {
62 TransitionCellGridPoint::HighResFace(HighResolutionVoxelDelta { u, v, w: 0 })
63}
64
65const fn tcell_reg_face_gridpoint(u: usize, v: usize) -> TransitionCellGridPoint {
66 TransitionCellGridPoint::RegularFace(u, v)
67}
68
69pub const TRANSITION_CELL_GRID_POINTS: [TransitionCellGridPoint; 13] = [
70 tcell_highres_face_gridpoint(0, 0),
71 tcell_highres_face_gridpoint(1, 0),
72 tcell_highres_face_gridpoint(2, 0),
73 tcell_highres_face_gridpoint(0, 1),
74 tcell_highres_face_gridpoint(1, 1),
75 tcell_highres_face_gridpoint(2, 1),
76 tcell_highres_face_gridpoint(0, 2),
77 tcell_highres_face_gridpoint(1, 2),
78 tcell_highres_face_gridpoint(2, 2),
79 tcell_reg_face_gridpoint(0, 0),
80 tcell_reg_face_gridpoint(1, 0),
81 tcell_reg_face_gridpoint(0, 1),
82 tcell_reg_face_gridpoint(1, 1),
83];
84
85pub const TRANSITION_HIGH_RES_FACE_CASE_CONTRIBUTIONS: [(HighResolutionVoxelDelta, usize); 9] = [
86 (HighResolutionVoxelDelta::from(0, 0, 0), 0x01),
87 (HighResolutionVoxelDelta::from(1, 0, 0), 0x02),
88 (HighResolutionVoxelDelta::from(2, 0, 0), 0x04),
89 (HighResolutionVoxelDelta::from(0, 1, 0), 0x80),
90 (HighResolutionVoxelDelta::from(1, 1, 0), 0x100),
91 (HighResolutionVoxelDelta::from(2, 1, 0), 0x08),
92 (HighResolutionVoxelDelta::from(0, 2, 0), 0x40),
93 (HighResolutionVoxelDelta::from(1, 2, 0), 0x20),
94 (HighResolutionVoxelDelta::from(2, 2, 0), 0x10),
95];