cruise-automation / webviz

web-based visualization libraries
https://webviz.io/
Apache License 2.0
2.01k stars 408 forks source link

Wrong visulization when coordinate values are large #764

Open pkulijing opened 1 year ago

pkulijing commented 1 year ago

Large coordinate values are not handled correctly

A cube put at (0, 0) with the camera targeted on it is correctly rendered image After changing its coordinates to large values, its shape is obviously distorted: image

Reproducing code: https://codesandbox.io/s/objective-darkness-t02fi7?file=/index.js

After a fast glance of the code, I think the reason is the limit of single-precision floating point. Worldview uses float to render shapes, which can preserve roughly 6~7 decimal digits. Thus in the above case, some dm-level and all cm level information is lost, resulting in the distortion. Data pre-processing is needed for such large values, i.e. use the value after mod calculation instead of the raw values (7018.084 instead of 837018.084).

jtbandes commented 1 year ago

Try out https://github.com/foxglove/studio. We do some more intelligent math when you are viewing things centered around certain coordinate frames that are far away from others. There’s a chance it may help for your use case.