SIGNED-DISTANCE-FIELD-RS
Fast Signed Distance Fields for Rust
This crate approximates a signed distance field, given a binary image. The algorithm is inspired by the paper "The dead reckoning signed distance transform" by George J. Grevara (2004). Don't forget to compile in release mode!
Features
In the process of computing the signed distance field, the algorithm constructs an image with each pixel containing the vectors which point to the nearest edge. This vector distance field is made available after computing the plain distance field and can be used for further processing. Also, the library offers a simple conversion from distance fields to images with integer precision.
Getting Started
Update your Cargo.toml
:
= { = "0.6.3", = [ "piston_image" ] }
use *;
Piston Images
This library can be configured to offer some
simple conversions to and from piston images.
The feature flag piston_image
unlocks these functions.
The image crate is not required to calculate the
signed distance field, including piston image is truly optional.
Cons (yet)
- Single Core only
- Maybe not as accurate as a naive approach
- Neither GPU not SIMD acceleration explicitly used
What's up next?
- Consider optimizing for SIMD and multithreading
- Consider adding alternative algorithms, possibly with GPU utilization