Suggestion, implement an axis angle object instead of creating rotations from angle * axis
- Dominant language
- Rust
- Stars
- 4.8k
- Forks
- 565
- PR merge metrics
- No merged PRs in 30d
Description
Consider this snippet:
```rust
let axis_angle : Vec3 = axis.normalize() * angle;
camera.rotation *= na::UnitQuaternion::::new(axis_angle);
```
Assume that axis and angle are computed from the cross and dot products of 2 vectors. If the 2 vectors are aligned then the axis is NAN. Making the axis invalid.
But if you pass them as two separate objects like how C++'s eigen does it, the library can check that the angle is 0 and return a unit quaternion without incurring nans, like this:
```rust
let axis =
if Float::abs(angle) > 0.0 { vb.cross(&va) } else { Vec3::new(0.0, 1.0, 0.0) };
```
It would make the library more numerically robust.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.