Skip to content

Commit

Permalink
Merge pull request #254 from BrianPugh/master
Browse files Browse the repository at this point in the history
Also allow "vertex_index" in ply files
  • Loading branch information
daavoo authored Aug 19, 2019
2 parents 94c47a0 + 0169c03 commit 05c7c7c
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyntcloud/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .core_class import PyntCloud
from .core_class import PyntCloud
2 changes: 1 addition & 1 deletion pyntcloud/io/ply.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def read_ply(filename):
# element mesh
if b'list' in line:

if b"vertex_indices" in line[-1]:
if b"vertex_indices" in line[-1] or b"vertex_index" in line[-1]:
mesh_names = ["n_points", "v1", "v2", "v3"]
else:
has_texture = True
Expand Down
31 changes: 31 additions & 0 deletions tests/data/diamond_ascii_vertex_index.ply
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
ply
format ascii 1.0
comment VCGLIB generated
element vertex 6
property float x
property float y
property float z
property float nx
property float ny
property float nz
property uchar red
property uchar green
property uchar blue
property uchar alpha
element face 8
property list uchar int vertex_index
end_header
0.5 0 0.5 0 -1 0 255 0 0 255
0 0.5 0.5 -1 0 0 255 0 0 255
0.5 0.5 0 0 0 -1 0 255 0 255
1 0.5 0.5 1 0 0 255 0 0 255
0.5 1 0.5 0 1 0 255 0 0 255
0.5 0.5 1 0 0 1 0 0 255 255
3 0 1 2
3 0 3 2
3 3 4 2
3 4 1 2
3 0 1 5
3 0 3 5
3 3 4 5
3 4 1 5
1 change: 1 addition & 0 deletions tests/integration/io/test_from_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def assert_mesh(data):
@pytest.mark.parametrize("extension,color,mesh", [
(".ply", True, True),
("_ascii.ply", True, True),
("_ascii_vertex_index.ply", True, True),
(".npz", True, True),
(".obj", False, True),
(".off", False, False),
Expand Down

0 comments on commit 05c7c7c

Please sign in to comment.