jbuckmccready / cavalier_contours

2D polyline/shape library for offsetting, combining, etc.
Apache License 2.0
144 stars 12 forks source link

How should epsilon/tolerance values be organized? #3

Closed jbuckmccready closed 3 years ago

jbuckmccready commented 3 years ago

How should epsilon/tolerance values be specified? There can be multiple epsilon values within an algorithm each of which may use different values (e.g. epsilon used or determining if two points overlap may be different than the epsilon used for fuzzy comparing in a distance check).

Currently in C++ they are just hard coded constants but it would be good to have them as part of the API with easy to use sensible defaults.

Currently I think all epsilon values should be explicitly passed to functions and have them be bundled inside of an options struct. The options struct then implements the Default trait with sensible default values, from the consuming side then specific epsilon values (or other option fields) could be changed from the default.

jbuckmccready commented 3 years ago

All epsilon values will be explicitly passed inside of options structs that have a sensible Default trait implementation (or by explicit parameter for lower level/simple functions).