Skip to content

Fix wrong header when saving PolygonMesh to ply file#5169

Merged
mvieth merged 2 commits intoPointCloudLibrary:masterfrom
mvieth:ply_mesh_header
Feb 17, 2022
Merged

Fix wrong header when saving PolygonMesh to ply file#5169
mvieth merged 2 commits intoPointCloudLibrary:masterfrom
mvieth:ply_mesh_header

Conversation

@mvieth
Copy link
Copy Markdown
Member

@mvieth mvieth commented Feb 14, 2022

Closes #3251
Fixes #3246
Please also see commit messages for details.

…onMesh

Previously, the fields in the header had a fixed order: x, y, z, red, green, blue, alpha, nx, ny, nz, curvature. In the body however, the values were written in the order in which they actually occurred in the given PolygonMesh. If that was not the same order as in the header, the written PLY file was wrong.
Now, the header also uses the order specified in the given PolygonMesh.
Other (minor) changes:
- Avoid duplicated code (for writing the header), put it in a shared function instead
- Remove variable `c`, it is always 0
- Use more range-for-loops
@mvieth mvieth marked this pull request as ready for review February 15, 2022 17:15
@mvieth mvieth added the changelog: fix Meta-information for changelog generation label Feb 15, 2022
@mvieth mvieth merged commit 578b18b into PointCloudLibrary:master Feb 17, 2022
@mvieth mvieth deleted the ply_mesh_header branch February 17, 2022 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: fix Meta-information for changelog generation module: io

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] use pcl::io::savePLYFile to save PolygonMesh, it incorrectly do not match PLY header with vertex data

2 participants