Skip to content

Fix bug in readSTL#1638

Merged
jdumas merged 2 commits into
libigl:masterfrom
n-taka:PR
Nov 2, 2020
Merged

Fix bug in readSTL#1638
jdumas merged 2 commits into
libigl:masterfrom
n-taka:PR

Conversation

@n-taka

@n-taka n-taka commented Nov 2, 2020

Copy link
Copy Markdown
Contributor

reset the position of the current character in the input

Fixes # .

[Describe your changes and what you've already done to test it.]

Commit 1e905cb introduces bug in readSTL.

  • when is_stl_binary(...) is called, the position of the current character for std::istream input is accidentally updated because of input.read(...). So, I just add input.seekg(...) to reset the position.

Check all that apply (change to [x])

  • All changes meet libigl style-guidelines.
  • Adds new .cpp file.
  • Adds corresponding unit test.
  • This is a minor change.

reset the position of the current character in the input

@jdumas jdumas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! But the seekg should only be inside the two if statements (L53 and L56). In case of binary file you need to continue reading the next 4 bytes for the number of triangles.

@n-taka

n-taka commented Nov 2, 2020

Copy link
Copy Markdown
Contributor Author

@jdumas Thank you for pointing out!
I quickly update the position of seekg function call.

@jdumas jdumas merged commit 0a92f2c into libigl:master Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants