i_overlay 6.0.0

Boolean Operations for 2D Polygons: Supports intersection, union, difference, xor, and self-intersections for all polygon varieties.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::segm::segment::Segment;
use i_key_sort::sort::two_keys_cmp::TwoKeysAndCmpSort;

pub(crate) trait ShapeSegmentsSort {
    fn sort_by_ab(&mut self, parallel: bool);
}

impl<C: Send + Sync + Copy> ShapeSegmentsSort for [Segment<C>] {
    #[inline]
    fn sort_by_ab(&mut self, parallel: bool) {
        self.sort_by_two_keys_then_by(
            parallel,
            |s| s.x_segment.a.x,
            |s| s.x_segment.a.y,
            |s0, s1| s0.x_segment.b.cmp(&s1.x_segment.b),
        )
    }
}