# [−][src]Crate contour

Computes isorings and contour polygons by applying marching squares to a rectangular array of numeric values.

Outputs ring coordinates (using `contour_rings`) or polygons contours (using `ContourBuilder`) as a Vec of GeoJSON Feature.

This is a port of d3-contour.

#### Example:

```let c = ContourBuilder::new(10, 10, false); // x dim., y dim., smoothing
let res = c.contours(&vec![
0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 1., 1., 1., 0., 0., 0., 0.,
0., 0., 0., 1., 1., 1., 0., 0., 0., 0.,
0., 0., 0., 1., 1., 1., 0., 0., 0., 0.,
0., 0., 0., 1., 1., 1., 0., 0., 0., 0.,
0., 0., 0., 1., 1., 1., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0.
], &[0.5]); // values, thresholds```

Output:

``````[Feature {
bbox: None,
geometry: Some(Geometry {
bbox: None,
value: MultiPolygon([[[
[6., 7.5], [6., 6.5], [6., 5.5], [6., 4.5],
[6., 3.5], [5.5, 3.], [4.5, 3.], [3.5, 3.],
[3., 3.5], [3., 4.5], [3., 5.5], [3., 6.5],
[3., 7.5], [3.5, 8.], [4.5, 8.], [5.5, 8.],
[6., 7.5]]]]),
foreign_members: None
}),
id: None,
properties: Some({"value": Number(0.5)}),
foreign_members: None
}]
``````

## Structs

 ContourBuilder Contours generator to be used on a rectangular `Slice` of values to get a `Vec` of Features of MultiPolygon (use `contour_rings` internally).

## Functions

 contour_rings Computes isoring for the given `Slice` of `values` according to the `threshold` value (the inside of the isoring is the surface where input `values` are greater than or equal to the given threshold value).