use voronoid::{BoundingBox, Tessellation, Algorithm3DGrid, Cell3DFaces};
#[test]
fn test_mapping_face_counts() {
let bounds = BoundingBox::new([0.0, 0.0, 0.0], [1.0, 1.0, 1.0]);
let algo = Algorithm3DGrid::new(4, 4, 4, &bounds);
let mut tess = Tessellation::<3, Cell3DFaces, _>::new(bounds, algo);
let mut generators = Vec::new();
for x in [0.25, 0.75] {
for y in [0.25, 0.75] {
for z in [0.25, 0.75] {
generators.push(x);
generators.push(y);
generators.push(z);
}
}
}
tess.set_generators(&generators);
let face_counts: Vec<usize> = tess.map(|cell| cell.face_counts().len());
assert_eq!(face_counts.len(), 8, "Should have results for 8 cells");
for (i, &count) in face_counts.iter().enumerate() {
assert_eq!(count, 6, "Cell {} should have 6 faces", i);
}
}