MCPcopy Create free account
hub / github.com/Notgnoshi/generative / grid

Function grid

tools/grid.rs:123–141  ·  view source on GitHub ↗
(
    width: usize,
    height: usize,
    size_x: f64,
    size_y: f64,
    grid_type: GridType,
)

Source from the content-addressed store, hash-verified

121}
122
123fn grid(
124 width: usize,
125 height: usize,
126 size_x: f64,
127 size_y: f64,
128 grid_type: GridType,
129) -> GeometryGraph<Undirected> {
130 if width == 0 || height == 0 {
131 return GeometryGraph::<Undirected>::default();
132 }
133
134 match grid_type {
135 GridType::Triangle => tri_grid(width, height, size_x, size_y),
136 GridType::Quad => quad_grid(width, height, size_x, size_y),
137 GridType::Ragged => ragged_grid(width, height, size_x, size_y),
138 GridType::Hexagon => hex_grid(width, height, size_x, size_y),
139 GridType::Radial => unreachable!("Radial grid types are implemented differently"),
140 }
141}
142
143fn tri_i2x(i: usize, size_x: f64, odd: bool) -> f64 {
144 let mut x = (i as f64) * size_x;

Callers 1

mainFunction · 0.85

Calls 4

tri_gridFunction · 0.85
quad_gridFunction · 0.85
ragged_gridFunction · 0.85
hex_gridFunction · 0.85

Tested by

no test coverage detected