Rotation3::anlge() returns NaN
- Dominant language
- Rust
- Stars
- 4.8k
- Forks
- 565
- PR merge metrics
- No merged PRs in 30d
Description
I am trying to convert a column major 4x4 homogenous matrix to a isometry3.
However in this example I get Nan values when trying to call scaled_axis():
[example in play.rust-lang.org](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=168162f1b5f7155fa61db8b2b6cad158)
```rust
use nalgebra::{Isometry3, Rotation3, Vector3, Matrix4, Matrix3};
pub fn array_to_isometry(array: &[f64; 16]) -> Isometry3 {
let rotation_matrix: Matrix3 = Matrix4::from_column_slice(array).remove_column(3).remove_row(3);
println!("rotation_matrix: {}", rotation_matrix);
let rotation = Rotation3::from_matrix(&rotation_matrix);
println!("rot: {}", rotation);
println!("axis: {:?}", rotation.axis().unwrap());
println!("angle: {}", rotation.angle());
println!("rot_nan: {:?}", rotation.scaled_axis());
Isometry3::new(Vector3::new(array[12], array[13], array[14]), rotation.scaled_axis())
}
fn main() {
let y = [0.9999903734042686, 0.0000000002540163079878255, -0.00000000012581154368346085, 0.0, 0.0000000002540163079878255, -0.9999903734042686, 0.00000000004614105974113725, 0.0, -0.00000000012581275483128821, -0.000000000046141503958700795, -1.0, 0.0, 0.30689056659844144, 0.0000000000692086410879149, 0.4868820527992277, 1.0];
array_to_isometry(&y);
}
```
These NaN values come from the angle() method.
The same conversion with eigen in cpp works
```cpp
sstd::array y = {0.9999903734042686, 0.0000000002540163079878255, -0.00000000012581154368346085, 0.0, 0.0000000002540163079878255, -0.9999903734042686, 0.00000000004614105974113725, 0.0, -0.00000000012581275483128821, -0.000000000046141503958700795, -1.0, 0.0, 0.30689056659844144, 0.0000000000692086410879149, 0.4868820527992277, 1.0};
Eigen::Isometry3d transform(Eigen::Matrix4d::Map(y.data()));
std::cout<
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.