openframeworks / openframeworks/openFrameworks

ofMesh::save outputs invalid indices / ofMesh::load out of range

Open
#2,951 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug core prelim-analysis section-3D
Dominant language
C++
Stars
10.4k
Forks
2.6k
Avg merge
1d 21h
Merged PRs (30d)
9

Description

While investigating the problem #2944, I noticed this ofMesh::load crash is due to ofMesh::load/save parsing. If I load a ply file generated by ofMesh::save of Mac oF 0.8.0, debugger gives vector out of range error at getVertices on Visual Studio (weird but no problem on Xcode). I saved a pointcloud w/o faces; however, ofMesh appends ceil(numVertices / 3) number of faces to the ply file, which may contain invalid vertex indices because default ofMesh mode is GL_TRIANGLES.

So probably changes are needed to

ofMesh::save:
https://github.com/openframeworks/openFrameworks/blob/master/libs/openFrameworks/3d/ofMesh.cpp#L1027

https://github.com/openframeworks/openFrameworks/blob/master/libs/openFrameworks/3d/ofMesh.cpp#L1083

ofMesh::load:

https://github.com/openframeworks/openFrameworks/blob/master/libs/openFrameworks/3d/ofMesh.cpp#L909

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in libs/openFrameworks/3d/ofMesh.cpp at the referenced getVertices, save, and load locations. Reproduce with a point cloud without faces, saved as PLY by ofMesh on Mac openFrameworks 0.8.0, then inspect the generated face indices and load behavior in Visual Studio. Done means saved PLY files do not contain invalid indices and loading them does not go out of range.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.