From 30f7be047496ef688f1602568e755b5a9f941bc8 Mon Sep 17 00:00:00 2001 From: Brian Pugh Date: Mon, 19 Aug 2019 10:41:14 -0700 Subject: [PATCH 1/2] Also allow "vertex_index" in ply files --- pyntcloud/__init__.py | 2 +- pyntcloud/io/ply.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyntcloud/__init__.py b/pyntcloud/__init__.py index 334f139..87feacc 100644 --- a/pyntcloud/__init__.py +++ b/pyntcloud/__init__.py @@ -1 +1 @@ -from .core_class import PyntCloud +from .core_class import PyntCloud diff --git a/pyntcloud/io/ply.py b/pyntcloud/io/ply.py index ef26801..eeb3bbd 100644 --- a/pyntcloud/io/ply.py +++ b/pyntcloud/io/ply.py @@ -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 From 0169c0349cdb785391160b16aadf6cac4dc957f3 Mon Sep 17 00:00:00 2001 From: Brian Pugh Date: Mon, 19 Aug 2019 14:52:43 -0700 Subject: [PATCH 2/2] Added test for vertex_index --- tests/data/diamond_ascii_vertex_index.ply | 31 +++++++++++++++++++++++ tests/integration/io/test_from_file.py | 1 + 2 files changed, 32 insertions(+) create mode 100644 tests/data/diamond_ascii_vertex_index.ply diff --git a/tests/data/diamond_ascii_vertex_index.ply b/tests/data/diamond_ascii_vertex_index.ply new file mode 100644 index 0000000..fde2d75 --- /dev/null +++ b/tests/data/diamond_ascii_vertex_index.ply @@ -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 diff --git a/tests/integration/io/test_from_file.py b/tests/integration/io/test_from_file.py index 3393f64..1b1fd24 100644 --- a/tests/integration/io/test_from_file.py +++ b/tests/integration/io/test_from_file.py @@ -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),