Skip to main content

Crate concave_hull

Crate concave_hull 

Source
Expand description

§concave-hull

concave-hull is an implementation of the gift opening concave hull algorithm, written in Rust.

The top level export is a function called concave_hull. See the docs for that function for details on usage, or check the example at examples/basic.rs

§Choosing the concavity parameter

Concave hulls are a somewhat subjective thing. While it’s possible to generate a concave hull which minimizes the area of the final polygon, this is often undesirable, as it leads to very crinkly shapes. To remedy this, a concavity parameter is exposed, which controls how tight the final concave hull is around the point cloud. In general, you should pick a concavity parameter which produces “desirable” results on your datasets, whatever that means for your application. Here is some guidance:

  • The concavity parameter ranges from zero to positive infinity
  • 0 produces a maximally crinkly shape
  • +inf prevents any concavity, returning the convex hull of the point cloud
  • 40 is usually a good starting point

Note that the concavity parameter is not scale invariant. This means that a point cloud which covers an area from 0 to 100 will need a smaller concavity parameter than an equivalent point cloud that covers an area from 0 to 1000.

§Features

This crate has two features for precision:

  • f32 (default feature): Enables f32-precision versions of the concave hull computation and relevant re-exports (an f32-precision point, for example)
  • f64: Enables f64-precision versions of the concave hull computation and relevant re-exports (an f64-precision point, for example)

If neither feature is enabled, then this crate has no public exports. Enabling both simultaneously is supported (cargo features must be purely additive), with relevant functions being exported under the f32 or f64 submodules, respectively.

This crate has one additional feature, benches, which is only used for benchmarks. End users of this library should never enable it.

Modules§

f32
Spatial points and concave hull generation for f32 precision