math2 0.0.2

Geometry, layout and rasterization utilities powering the Grida canvas
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use math2::{Range, group_ranges_by_uniform_gap};

fn r(a: f32, b: f32) -> Range {
    [a, b]
}

#[test]
fn group_three_uniform_gaps() {
    let ranges = vec![r(0.0, 10.0), r(15.0, 25.0), r(30.0, 40.0)];
    let result = group_ranges_by_uniform_gap(&ranges, None, 0.0);
    assert!(result.contains(&math2::range::UniformGapGroup {
        loop_indices: vec![0, 1, 2],
        min: 0.0,
        max: 40.0,
        gap: 5.0
    }));
}