h3arrow/algorithm/
convex_hull.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use crate::array::to_geo::{
    cellindexarray_to_multipolygon, directededgeindexarray_to_multipoint,
    vertexindexarray_to_multipoint,
};
use crate::array::{CellIndexArray, DirectedEdgeIndexArray, VertexIndexArray};
use geo::convex_hull::ConvexHull;
use geo_types::Polygon;

impl<'a> ConvexHull<'a, f64> for CellIndexArray {
    type Scalar = f64;

    fn convex_hull(&'a self) -> Polygon<Self::Scalar> {
        cellindexarray_to_multipolygon(self).convex_hull()
    }
}

impl<'a> ConvexHull<'a, f64> for VertexIndexArray {
    type Scalar = f64;

    fn convex_hull(&'a self) -> Polygon<Self::Scalar> {
        vertexindexarray_to_multipoint(self).convex_hull()
    }
}

impl<'a> ConvexHull<'a, f64> for DirectedEdgeIndexArray {
    type Scalar = f64;

    fn convex_hull(&'a self) -> Polygon<Self::Scalar> {
        directededgeindexarray_to_multipoint(self).convex_hull()
    }
}