dimforge / dimforge/nalgebra

nalgebra_glm's Functions Don't Account for Unsigned Integer Types.

Open
#1,322 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
4.8k
Forks
565
PR merge metrics
No merged PRs in 30d

Description

Hi, I am using `nalgebra_glm` for my ray tracing project.
In my code, I define generic wrapper types (for example: `TBounds3` defined by two `TVec3`s)

I realize that many functions in `nalgebra_glm` are bounded by the `Number` trait, which is bounded by `Signed`. Therefore, I cannot use `nalgebra_glm`'s built-in functions on unsigned types.

The code below does not compile:
```rust
let v = UVec2::new(2, 2);
let v2 = UVec2::new(1, 4);
nalgebra_glm::min2(&v, &v2);
```
Despite making complete sense in this case.

I think a possible solution is to replace the `Signed` trait bound with `Num` in the `Number` trait definition and add a `Signed` bound where necessary. (sign and abs functions)

I can start a PR process if you are interested.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.