-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OFF import: Handle binary format #4994
base: master
Are you sure you want to change the base?
Conversation
Could you add a binary file as a test? |
If you want to try, you need pmp-library/pmp-library#197 then: mkdir build
cd build
cmake ..
make -j
./mconvert -b -i foo.off -o foo.b.off |
Sure. Not sure where to add that though, are they auto-generated at build time? |
Seems macOS doesn't like the IEEE-754 test… I wanted to make sure we'd get compatible floats when reading… |
For tests, read https://github.com/openscad/openscad/blob/master/doc/testing.txt Line 717 in 55be9cf
|
Looks like you're just missing parentheses for the macOS issue |
No it also gives the error |
Finally found a way to generate binary OFF files: https://github.com/pmp-library/pmp-library However it seems it saves them as little-endian, while the specs says it should be big-endian. So we just try and support both, and do best-effort at autodetecting it.
vertcube.off from https://people.sc.fsu.edu/~jburkardt/data/off/off.html This file has colors, comments, and some whitespace vertcube.le.b.off is the binary converted from it with mconvert from PMP-library, as little-endian.
b4241ce
to
f89850b
Compare
Seems the STL import just assumes everyone has 32bit standard floats.
#error Byte order undefined or unknown. Currently only BOOST_ENDIAN_BIG_BYTE and BOOST_ENDIAN_LITTLE_BYTE are supported. | ||
#endif | ||
|
||
// Specs says data is big-endian, however PMP-library used little-endian |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say this is a PMP bug. Should we really follow that example and support software outputting buggy files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends if it's been used widely or not…
Let's see how they handle pmp-library/pmp-library#198 |
Looks like the PMP issue was resolved |
Finally found a way to generate binary OFF files:
https://github.com/pmp-library/pmp-library
However it seems it saves them as little-endian, while the specs says it should be big-endian. So we just try and support both, and do best-effort at autodetecting it.
Validated with all the previous samples.