dimforge / dimforge/nalgebra

Point's Display implementation doesn't respect formatter params

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

Description

Normally, Rust data structures propagate formatter params recursively to individual values.

nalgebra does this too for matrices and vectors, but Points seem to ignore the formatter params.

Sample code:

```rust
let matrix = nalgebra::Matrix3::::new_random();
let vec = nalgebra::Vector3::::new_random();
let point = nalgebra::Point3::from(nalgebra::Vector3::::new_random());

println!("Matrix {matrix}");
println!("Vector {vec}");
println!("Point {point}");
println!("---");
println!("Matrix {matrix:.3}");
println!("Vector {vec:.3}");
println!("Point {point:.3}");
```

Output:

```
Matrix
┌ ┐
│ 0.8598913012304822 0.9260866371615168 0.46836528545042544 │
│ 0.6925437372908951 0.5359048989574623 0.3807341326886613 │
│ 0.6538521469022629 0.45065417326429935 0.46616147800849017 │
└ ┘

Vector
┌ ┐
│ 0.5324899032766206 │
│ 0.9758313347345605 │
│ 0.7908423868945029 │
└ ┘

Point {0.5597363785908459, 0.49737074839321604, 0.5159609296629915}
---
Matrix
┌ ┐
│ 0.860 0.926 0.468 │
│ 0.693 0.536 0.381 │
│ 0.654 0.451 0.466 │
└ ┘

Vector
┌ ┐
│ 0.532 │
│ 0.976 │
│ 0.791 │
└ ┘

Point {0.5597363785908459, 0.49737074839321604, 0.5159609296629915}
```

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.