-
Notifications
You must be signed in to change notification settings - Fork 563
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support differing list-lengths in ASCII-PLYs
PLY allows defining list-properties, where every instance of the property can have a different length. This can for instance be useful when storing submeshes in the metadata of a PLY-file. trimesh only supported PLY-files with list-properties, if every instance of the list had the same length. Properties with lists of differing lengths let the parser crash at the `vstack`-call in `ply.ply_ascii`, as arrays of differing size cannot be stacked. The implementation at hand adds support for lists of differing length. The drawback of the new implementation is an increased load-time for elements containing lists. I tried to mitigate this effect by checking whether an element has no list or just one where every instance has the same length and using the numpy-based algorithm to get the data in this case, while iterating all rows, if there's more than one list or one list with instances of differing lengths.
- Loading branch information
1 parent
0a6f298
commit 2beb7d7
Showing
3 changed files
with
131 additions
and
32 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
ply | ||
format ascii 1.0 | ||
element vertex 5 | ||
property float x | ||
property float y | ||
property float z | ||
element point_list 2 | ||
property list uchar uint point_indices1 | ||
property list uchar uint point_indices2 | ||
property float some_float | ||
end_header | ||
-0.06325 0.0359793 0.0420873 | ||
-0.06275 0.0360343 0.0425949 | ||
-0.0645 0.0365101 0.0404362 | ||
-0.064 0.0366195 0.0414512 | ||
-0.0635 0.0367289 0.0424662 | ||
3 10 11 12 2 13 14 1.1 | ||
2 10 11 3 12 13 14 2.2 |
This file contains 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
This file contains 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