Repository navigation
vtkSTLWriter fixes - #3754
Merged
Merged
vtkSTLWriter fixes#3754
Conversation
The writer read the point count of a cell, then read exactly three point ids. For a quad, the writer read the fourth point id as the point count of the next cell. Thus all the subsequent facets were incorrect, and the writer could throw an error. The writer now reads all the point ids of each cell. It splits each polygon into a triangle fan from its first point. Fixes Kitware#3713
The writer calculated the binary file size with 50 * polys.length / 4. This value is correct only when all the cells are triangles. For quads or larger polygons, the size was a fraction and it was incorrect. The writer now counts the triangles that it writes, and uses this count for the buffer size. Fixes Kitware#3711
daker
force-pushed
the
stlwriter-fixes
branch
from
November 9, 2026 12:21
dc72522 to
4302bff
Compare
The writer wrote polyData.getNumberOfCells() as the facet count. This value counts all the cell types, also the vertices, lines and strips that the writer does not write. Thus the count in the header did not agree with the file body. The writer now writes the number of triangles that it writes. Fixes Kitware#3712
daker
force-pushed
the
stlwriter-fixes
branch
from
November 9, 2026 12:26
4302bff to
3958298
Compare
finetjul
approved these changes
Nov 9, 2026
getPoint writes into an output array. The loop makes v1, v2 and v3 one time and does not make new arrays for each triangle. In a triangle fan, the third point of one triangle is the second point of the next triangle. The loop swaps v2 and v3, and reads and transforms one new point for each triangle.
|
🎉 This PR is included in version 38.0.6 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Fixes #3711
Fixes #3712
Fixes #3713
Results
Changes
PR Checklist