nalgebra
nalgebra copied to clipboard
Infinite loop on pooly defined matrix in UnitQuaternion::from_matrix.
This snippet manages to get the execution stuck when running. I know that the values are bad, but also an infinite loop might not be the most desirable outcome of this.
fn infitite_loop() {
let mut rot = na::SMatrix::<f64, 3,3>::zeros();
rot.fill(f64::NAN);
let _q = UnitQuaternion::from_matrix(&rot);
}
If the behavior is intended, apologies then.
I found the issue causing this
file:/nalgebra/src/geometry/rotation_specialization.rs
Upon finding max_iter as 0 we are setting it to the usize::MAX which make it loop forever, but it was alright as we had a breaking machanism for the loop: norm_squared <= new_norm_squared
But this mechanism also fails when NaN values are used.
Please help me solve this problem as i'm new to Rust🦀 and Open Source.