The behavior of na::clamp on vectors is strange.
Open
enhancement
P-medium
- Dominant language
- Rust
- Stars
- 4.8k
- Forks
- 565
- PR merge metrics
- No merged PRs in 30d
Description
See also the conversation #434.
It appears the `na::clamp` function is based on the comparison operators which themselves rely on the `PartialOrd` trait. However those comparison operators don't return a sensible value whenever the two vectors being compared are actually not comparable (`partial_cmp` returns `None`).
One solution to avoid confusion is to make it so `na::clamp` works only on scalars, and add a `.clamp` method to the vectors/matrices.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.