fesoliveira014 / voronator-rs

Delaunay triangulation and Voronoi diagram generation. Ported from Mapbox's Delaunator and d3-voronoi
MIT License
53 stars 13 forks source link

Please make rayon optional e.g. for WebAssembly support. #12

Closed finnbear closed 2 years ago

finnbear commented 2 years ago

I wanted to use this in a web game, but ran into

panicked at 'The global thread pool has not been initialized.: ThreadPoolBuildError { kind: IOError(Error { kind: Unsupported, message: "operation not supported on this platform" }) }'

It seems this library uses rayon internally, which isn't compatible (without jumping through hoops like setting up web workers).

A possible solution would be to use my crate maybe_parallel_iterator. From the perspective of this crate, all par_iter[_mut] would be replaced with maybe_par_iter[_mut]. Then, you can pass the rayon feature to the crate to enable parallelism.