pyvista-miniply 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,53 @@
1
+ cmake_minimum_required(VERSION 3.15...3.26)
2
+
3
+ project(nanobind_project LANGUAGES CXX)
4
+ # find_package(OpenMP REQUIRED)
5
+
6
+ # Try to import all Python components potentially needed by nanobind
7
+ find_package(Python 3.8
8
+ REQUIRED COMPONENTS Interpreter Development.Module
9
+ OPTIONAL_COMPONENTS Development.SABIModule)
10
+
11
+ # Import nanobind through CMake's find_package mechanism
12
+ find_package(nanobind CONFIG REQUIRED)
13
+
14
+ nanobind_add_module(
15
+ # Name of the extension
16
+ _wrapper
17
+
18
+ # Target the stable ABI for Python 3.12+, which reduces
19
+ # the number of binary wheels that must be built. This
20
+ # does nothing on older Python versions
21
+ STABLE_ABI
22
+
23
+ # conserve space by reusing a shared libnanobind across libraries
24
+ NB_STATIC
25
+
26
+ src/wrapper.cpp
27
+ src/miniply/miniply.cpp
28
+ )
29
+
30
+ # Link OpenMP
31
+ # if(OpenMP_CXX_FOUND)
32
+ # target_link_libraries(_wrapper PRIVATE OpenMP::OpenMP_CXX)
33
+ # endif()
34
+
35
+ # Compiler-specific options
36
+ if(MSVC)
37
+ # Use MSVC optimization levels and OpenMP setup
38
+ target_compile_options(_wrapper PRIVATE /O2 /std:c++17)
39
+ # /openmp:llvm
40
+ else()
41
+ # Assuming GCC or Clang
42
+ target_compile_options(_wrapper PRIVATE -O3)
43
+ # -fopenmp
44
+ endif()
45
+
46
+ # Example debugging
47
+ # set solib-search-path /home/user/python/.venv311/lib/python3.11/site-packages/stl_reader/
48
+ # set breakpoint with b qual.cpp:4872
49
+ # target_compile_options(stl_reader PRIVATE -g -O0)
50
+ # target_compile_options(pfh PRIVATE -g -O0)
51
+
52
+ # Install directive for scikit-build-core
53
+ install(TARGETS _wrapper LIBRARY DESTINATION pyvista_miniply)
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023-2024 PyVista
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,290 @@
1
+ Metadata-Version: 2.1
2
+ Name: pyvista-miniply
3
+ Version: 0.3.0
4
+ Summary: Rapidly read in PLY files using a wrapper over miniply
5
+ Author-Email: PyVista Developers <info@pyvista.org>
6
+ Classifier: License :: OSI Approved :: MIT License
7
+ Classifier: Operating System :: Microsoft :: Windows
8
+ Classifier: Operating System :: POSIX
9
+ Classifier: Intended Audience :: Science/Research
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Programming Language :: Python :: 3.14
15
+ Requires-Python: >=3.10
16
+ Requires-Dist: numpy
17
+ Provides-Extra: pyvista
18
+ Requires-Dist: pyvista; extra == "pyvista"
19
+ Description-Content-Type: text/x-rst
20
+
21
+ #################
22
+ pyvista-miniply
23
+ #################
24
+
25
+ |pypi| |MIT|
26
+
27
+ .. |pypi| image:: https://img.shields.io/pypi/v/pyvista-miniply.svg?logo=python&logoColor=white
28
+ :target: https://pypi.org/project/pyvista-miniply/
29
+
30
+ .. |MIT| image:: https://img.shields.io/badge/License-MIT-yellow.svg
31
+ :target: https://opensource.org/licenses/MIT
32
+
33
+ ``pyvista-miniply`` is a Python library for rapidly reading PLY files.
34
+ It is a Python wrapper around the fast C++ PLY reading library provided
35
+ by `miniply <https://github.com/vilya/miniply>`_. Thanks @vilya!
36
+
37
+ The main advantage of ``pyvista-miniply`` over other PLY reading
38
+ libraries is its performance. See the benchmarks below for more details.
39
+
40
+ **************
41
+ Installation
42
+ **************
43
+
44
+ The recommended way to install ``pyvista-miniply`` is via PyPI:
45
+
46
+ .. code:: sh
47
+
48
+ pip install pyvista-miniply
49
+
50
+ Optionally with PyVista:
51
+
52
+ .. code:: sh
53
+
54
+ pip install pyvista-miniply[pyvista]
55
+
56
+ You can also clone the repository and install it from source:
57
+
58
+ .. code:: sh
59
+
60
+ git clone https://github.com/pyvista/pyvista-miniply.git
61
+ cd pyvista-miniply
62
+ git submodule update --init --recursive
63
+ pip install .
64
+
65
+ *******
66
+ Usage
67
+ *******
68
+
69
+ Load in the vertices, indices, normals, UV, and color information from a
70
+ PLY file:
71
+
72
+ .. code:: pycon
73
+
74
+ >>> import pyvista_miniply
75
+ >>> vertices, indices, normals, uv, color = pyvista_miniply.read("example.ply")
76
+ >>> vertices
77
+ array([[ 5.0000000e-01, -5.0000000e-01, -5.5511151e-17],
78
+ [ 4.0000001e-01, -5.0000000e-01, -4.4408922e-17],
79
+ [ 3.0000001e-01, -5.0000000e-01, -3.3306692e-17],
80
+ ...,
81
+ [-4.2500001e-01, 5.0000000e-01, 4.7184480e-17],
82
+ [-4.7499999e-01, 4.4999999e-01, 5.2735593e-17],
83
+ [-5.0000000e-01, 4.2500001e-01, 5.5511151e-17]], dtype=float32)
84
+ >>> indices
85
+ array([[ 0, 442, 441],
86
+ [ 442, 122, 443],
87
+ [ 443, 121, 441],
88
+ ...,
89
+ [1677, 438, 1679],
90
+ [1679, 439, 1676],
91
+ [1677, 1679, 1676]], dtype=int32)
92
+ >>> normals
93
+ array([[-1.110223e-16, 0.000000e+00, -1.000000e+00],
94
+ [-1.110223e-16, 0.000000e+00, -1.000000e+00],
95
+ [-1.110223e-16, 0.000000e+00, -1.000000e+00],
96
+ ...,
97
+ [-1.110223e-16, 0.000000e+00, -1.000000e+00],
98
+ [-1.110223e-16, 0.000000e+00, -1.000000e+00],
99
+ [-1.110223e-16, 0.000000e+00, -1.000000e+00]], dtype=float32)
100
+ >>> uv
101
+ array([[0. , 0. ],
102
+ [0.1 , 0. ],
103
+ [0.2 , 0. ],
104
+ ...,
105
+ [0.92499995, 1. ],
106
+ [0.975 , 0.95 ],
107
+ [1. , 0.92499995]], dtype=float32)
108
+ >>> color
109
+ array([[ 0, 0, 0],
110
+ [ 0, 0, 0],
111
+ [ 0, 0, 0],
112
+ ...,
113
+ [254, 254, 254],
114
+ [254, 254, 254],
115
+ [255, 255, 255]], dtype=uint8)
116
+
117
+ You can also read in the PLY file as a `PyVista
118
+ <https://github.com/pyvista>`_ PolyData and immediately plot it.
119
+
120
+ .. code:: pycon
121
+
122
+ >>> import pyvista_miniply
123
+ >>> mesh = pyvista_miniply.read_as_mesh("example.ply")
124
+ >>> mesh
125
+ PolyData (0x7f0653579c00)
126
+ N Cells: 200
127
+ N Points: 121
128
+ N Strips: 0
129
+ X Bounds: -5.000e-01, 5.000e-01
130
+ Y Bounds: -5.000e-01, 5.000e-01
131
+ Z Bounds: -5.551e-17, 5.551e-17
132
+ N Arrays: 2
133
+
134
+ >>> mesh.plot()
135
+
136
+ .. image:: https://github.com/pyvista/pyvista-miniply/raw/main/demo.png
137
+
138
+ When ``pyvista-miniply`` is installed alongside ``pyvista >= 0.48``,
139
+ ``pyvista.read`` automatically dispatches ``.ply`` files through
140
+ ``pyvista-miniply`` via the ``pyvista.readers`` entry point, no manual
141
+ registration is required:
142
+
143
+ .. code:: pycon
144
+
145
+ >>> import pyvista as pv
146
+ >>> mesh = pv.read("example.ply") # now powered by pyvista-miniply
147
+
148
+ ***********
149
+ Benchmark
150
+ ***********
151
+
152
+ The main reason behind writing yet another PLY file reader for Python is
153
+ to leverage the highly performant ``miniply`` library.
154
+
155
+ There is already a benchmark demonstrating how ``miniply`` outperforms
156
+ in comparison to competing C and C++ libraries at `ply_io_benchmark
157
+ <https://github.com/mhalber/ply_io_benchmark>`_ when reading PLY files.
158
+ The benchmark here shows how ``pyvista-miniply`` performs relative to
159
+ other Python PLY file readers.
160
+
161
+ Here are the timings from reading in a 1,000,000 point binary PLY file
162
+ on an Intel i9-14900KF:
163
+
164
+ +-------------------+-----------------+
165
+ | Library | Time (seconds) |
166
+ +===================+=================+
167
+ | pyvista-miniply | 0.027 |
168
+ +-------------------+-----------------+
169
+ | open3d | 0.102 |
170
+ +-------------------+-----------------+
171
+ | PyVista (VTK) | 0.214 |
172
+ +-------------------+-----------------+
173
+ | meshio | 0.249 |
174
+ +-------------------+-----------------+
175
+ | plyfile | 4.039 |
176
+ +-------------------+-----------------+
177
+
178
+ **Benchmark source:**
179
+
180
+ .. code:: python
181
+
182
+ import time
183
+ from timeit import timeit
184
+
185
+ import numpy as np
186
+ import pyvista as pv
187
+ import pyvista_miniply
188
+ import plyfile
189
+ import meshio
190
+ import open3d
191
+
192
+ number = 10
193
+
194
+ filename = "tmp.ply"
195
+ mesh = pv.Plane(i_resolution=999, j_resolution=999).triangulate()
196
+ mesh.clear_data()
197
+ mesh.save(filename)
198
+
199
+ telap = timeit(lambda: pyvista_miniply.read(filename), number=number)
200
+ print(f"pyvista_miniply: {telap/number:.3f}")
201
+
202
+ telap = timeit(lambda: open3d.io.read_point_cloud(filename), number=number)
203
+ print(f"open3d: {telap/number:.3f}")
204
+
205
+ telap = timeit(lambda: pv.read(filename), number=number)
206
+ print(f"VTK/PyVista: {telap/number:.3f}")
207
+
208
+ telap = timeit(lambda: meshio.read(filename), number=number)
209
+ print(f"meshio: {telap/number:.3f}")
210
+
211
+ # plyfile
212
+ number = 3 # less because it takes a while
213
+ telap = timeit(lambda: plyfile.PlyData.read(filename), number=number)
214
+ print(f"plyfile: {telap/number:.3f}")
215
+
216
+ Comparison with VTK and PyVista
217
+ ===============================
218
+
219
+ Here's an additional benchmark comparing VTK/PyVista with
220
+ ``pyvista-miniply``:
221
+
222
+ .. code:: python
223
+
224
+ import numpy as np
225
+ import time
226
+ import pyvista as pv
227
+ import matplotlib.pyplot as plt
228
+ import pyvista_miniply
229
+
230
+ times = []
231
+ filename = 'tmp.ply'
232
+ for res in range(50, 800, 50):
233
+ mesh = pv.Plane(i_resolution=res, j_resolution=res).triangulate().subdivide(2)
234
+ mesh.clear_data()
235
+ mesh.save(filename)
236
+
237
+ tstart = time.time()
238
+ pv_mesh = pv.read(filename)
239
+ vtk_time = time.time() - tstart
240
+
241
+ tstart = time.time()
242
+ ply_mesh = pyvista_miniply.read_as_mesh(filename)
243
+ ply_reader_time = time.time() - tstart
244
+
245
+ assert np.allclose(pv_mesh['Normals'], ply_mesh['Normals'])
246
+ assert np.allclose(pv_mesh.points, ply_mesh.points)
247
+ assert np.allclose(pv_mesh._connectivity_array, ply_mesh._connectivity_array)
248
+
249
+ times.append([mesh.n_points, vtk_time, ply_reader_time])
250
+ print(times[-1])
251
+
252
+
253
+ times = np.array(times)
254
+ plt.figure(1)
255
+ plt.title('PLY load time')
256
+ plt.plot(times[:, 0], times[:, 1], label='VTK')
257
+ plt.plot(times[:, 0], times[:, 2], label='pyvista-miniply')
258
+ plt.xlabel('Number of Points')
259
+ plt.ylabel('Time to Load (seconds)')
260
+ plt.legend()
261
+
262
+ plt.figure(2)
263
+ plt.title('PLY load time (Log-Log)')
264
+ plt.loglog(times[:, 0], times[:, 1], label='VTK')
265
+ plt.loglog(times[:, 0], times[:, 2], label='pyvista-miniply')
266
+ plt.xlabel('Number of Points')
267
+ plt.ylabel('Time to Load (seconds)')
268
+ plt.legend()
269
+ plt.show()
270
+
271
+ .. image:: https://github.com/pyvista/pyvista-miniply/raw/main/bench0.png
272
+
273
+ .. image:: https://github.com/pyvista/pyvista-miniply/raw/main/bench1.png
274
+
275
+ *****************************
276
+ License and Acknowledgments
277
+ *****************************
278
+
279
+ This project relies on ``miniply`` and credit goes to the original
280
+ author for the excellent C++ library. That work is licensed under the
281
+ MIT License.
282
+
283
+ The work in this repository is also licensed under the MIT License.
284
+
285
+ *********
286
+ Support
287
+ *********
288
+
289
+ If you are having issues, please feel free to raise an `Issue
290
+ <https://github.com/pyvista/pyvista-miniply/issues>`_.
@@ -0,0 +1,270 @@
1
+ #################
2
+ pyvista-miniply
3
+ #################
4
+
5
+ |pypi| |MIT|
6
+
7
+ .. |pypi| image:: https://img.shields.io/pypi/v/pyvista-miniply.svg?logo=python&logoColor=white
8
+ :target: https://pypi.org/project/pyvista-miniply/
9
+
10
+ .. |MIT| image:: https://img.shields.io/badge/License-MIT-yellow.svg
11
+ :target: https://opensource.org/licenses/MIT
12
+
13
+ ``pyvista-miniply`` is a Python library for rapidly reading PLY files.
14
+ It is a Python wrapper around the fast C++ PLY reading library provided
15
+ by `miniply <https://github.com/vilya/miniply>`_. Thanks @vilya!
16
+
17
+ The main advantage of ``pyvista-miniply`` over other PLY reading
18
+ libraries is its performance. See the benchmarks below for more details.
19
+
20
+ **************
21
+ Installation
22
+ **************
23
+
24
+ The recommended way to install ``pyvista-miniply`` is via PyPI:
25
+
26
+ .. code:: sh
27
+
28
+ pip install pyvista-miniply
29
+
30
+ Optionally with PyVista:
31
+
32
+ .. code:: sh
33
+
34
+ pip install pyvista-miniply[pyvista]
35
+
36
+ You can also clone the repository and install it from source:
37
+
38
+ .. code:: sh
39
+
40
+ git clone https://github.com/pyvista/pyvista-miniply.git
41
+ cd pyvista-miniply
42
+ git submodule update --init --recursive
43
+ pip install .
44
+
45
+ *******
46
+ Usage
47
+ *******
48
+
49
+ Load in the vertices, indices, normals, UV, and color information from a
50
+ PLY file:
51
+
52
+ .. code:: pycon
53
+
54
+ >>> import pyvista_miniply
55
+ >>> vertices, indices, normals, uv, color = pyvista_miniply.read("example.ply")
56
+ >>> vertices
57
+ array([[ 5.0000000e-01, -5.0000000e-01, -5.5511151e-17],
58
+ [ 4.0000001e-01, -5.0000000e-01, -4.4408922e-17],
59
+ [ 3.0000001e-01, -5.0000000e-01, -3.3306692e-17],
60
+ ...,
61
+ [-4.2500001e-01, 5.0000000e-01, 4.7184480e-17],
62
+ [-4.7499999e-01, 4.4999999e-01, 5.2735593e-17],
63
+ [-5.0000000e-01, 4.2500001e-01, 5.5511151e-17]], dtype=float32)
64
+ >>> indices
65
+ array([[ 0, 442, 441],
66
+ [ 442, 122, 443],
67
+ [ 443, 121, 441],
68
+ ...,
69
+ [1677, 438, 1679],
70
+ [1679, 439, 1676],
71
+ [1677, 1679, 1676]], dtype=int32)
72
+ >>> normals
73
+ array([[-1.110223e-16, 0.000000e+00, -1.000000e+00],
74
+ [-1.110223e-16, 0.000000e+00, -1.000000e+00],
75
+ [-1.110223e-16, 0.000000e+00, -1.000000e+00],
76
+ ...,
77
+ [-1.110223e-16, 0.000000e+00, -1.000000e+00],
78
+ [-1.110223e-16, 0.000000e+00, -1.000000e+00],
79
+ [-1.110223e-16, 0.000000e+00, -1.000000e+00]], dtype=float32)
80
+ >>> uv
81
+ array([[0. , 0. ],
82
+ [0.1 , 0. ],
83
+ [0.2 , 0. ],
84
+ ...,
85
+ [0.92499995, 1. ],
86
+ [0.975 , 0.95 ],
87
+ [1. , 0.92499995]], dtype=float32)
88
+ >>> color
89
+ array([[ 0, 0, 0],
90
+ [ 0, 0, 0],
91
+ [ 0, 0, 0],
92
+ ...,
93
+ [254, 254, 254],
94
+ [254, 254, 254],
95
+ [255, 255, 255]], dtype=uint8)
96
+
97
+ You can also read in the PLY file as a `PyVista
98
+ <https://github.com/pyvista>`_ PolyData and immediately plot it.
99
+
100
+ .. code:: pycon
101
+
102
+ >>> import pyvista_miniply
103
+ >>> mesh = pyvista_miniply.read_as_mesh("example.ply")
104
+ >>> mesh
105
+ PolyData (0x7f0653579c00)
106
+ N Cells: 200
107
+ N Points: 121
108
+ N Strips: 0
109
+ X Bounds: -5.000e-01, 5.000e-01
110
+ Y Bounds: -5.000e-01, 5.000e-01
111
+ Z Bounds: -5.551e-17, 5.551e-17
112
+ N Arrays: 2
113
+
114
+ >>> mesh.plot()
115
+
116
+ .. image:: https://github.com/pyvista/pyvista-miniply/raw/main/demo.png
117
+
118
+ When ``pyvista-miniply`` is installed alongside ``pyvista >= 0.48``,
119
+ ``pyvista.read`` automatically dispatches ``.ply`` files through
120
+ ``pyvista-miniply`` via the ``pyvista.readers`` entry point, no manual
121
+ registration is required:
122
+
123
+ .. code:: pycon
124
+
125
+ >>> import pyvista as pv
126
+ >>> mesh = pv.read("example.ply") # now powered by pyvista-miniply
127
+
128
+ ***********
129
+ Benchmark
130
+ ***********
131
+
132
+ The main reason behind writing yet another PLY file reader for Python is
133
+ to leverage the highly performant ``miniply`` library.
134
+
135
+ There is already a benchmark demonstrating how ``miniply`` outperforms
136
+ in comparison to competing C and C++ libraries at `ply_io_benchmark
137
+ <https://github.com/mhalber/ply_io_benchmark>`_ when reading PLY files.
138
+ The benchmark here shows how ``pyvista-miniply`` performs relative to
139
+ other Python PLY file readers.
140
+
141
+ Here are the timings from reading in a 1,000,000 point binary PLY file
142
+ on an Intel i9-14900KF:
143
+
144
+ +-------------------+-----------------+
145
+ | Library | Time (seconds) |
146
+ +===================+=================+
147
+ | pyvista-miniply | 0.027 |
148
+ +-------------------+-----------------+
149
+ | open3d | 0.102 |
150
+ +-------------------+-----------------+
151
+ | PyVista (VTK) | 0.214 |
152
+ +-------------------+-----------------+
153
+ | meshio | 0.249 |
154
+ +-------------------+-----------------+
155
+ | plyfile | 4.039 |
156
+ +-------------------+-----------------+
157
+
158
+ **Benchmark source:**
159
+
160
+ .. code:: python
161
+
162
+ import time
163
+ from timeit import timeit
164
+
165
+ import numpy as np
166
+ import pyvista as pv
167
+ import pyvista_miniply
168
+ import plyfile
169
+ import meshio
170
+ import open3d
171
+
172
+ number = 10
173
+
174
+ filename = "tmp.ply"
175
+ mesh = pv.Plane(i_resolution=999, j_resolution=999).triangulate()
176
+ mesh.clear_data()
177
+ mesh.save(filename)
178
+
179
+ telap = timeit(lambda: pyvista_miniply.read(filename), number=number)
180
+ print(f"pyvista_miniply: {telap/number:.3f}")
181
+
182
+ telap = timeit(lambda: open3d.io.read_point_cloud(filename), number=number)
183
+ print(f"open3d: {telap/number:.3f}")
184
+
185
+ telap = timeit(lambda: pv.read(filename), number=number)
186
+ print(f"VTK/PyVista: {telap/number:.3f}")
187
+
188
+ telap = timeit(lambda: meshio.read(filename), number=number)
189
+ print(f"meshio: {telap/number:.3f}")
190
+
191
+ # plyfile
192
+ number = 3 # less because it takes a while
193
+ telap = timeit(lambda: plyfile.PlyData.read(filename), number=number)
194
+ print(f"plyfile: {telap/number:.3f}")
195
+
196
+ Comparison with VTK and PyVista
197
+ ===============================
198
+
199
+ Here's an additional benchmark comparing VTK/PyVista with
200
+ ``pyvista-miniply``:
201
+
202
+ .. code:: python
203
+
204
+ import numpy as np
205
+ import time
206
+ import pyvista as pv
207
+ import matplotlib.pyplot as plt
208
+ import pyvista_miniply
209
+
210
+ times = []
211
+ filename = 'tmp.ply'
212
+ for res in range(50, 800, 50):
213
+ mesh = pv.Plane(i_resolution=res, j_resolution=res).triangulate().subdivide(2)
214
+ mesh.clear_data()
215
+ mesh.save(filename)
216
+
217
+ tstart = time.time()
218
+ pv_mesh = pv.read(filename)
219
+ vtk_time = time.time() - tstart
220
+
221
+ tstart = time.time()
222
+ ply_mesh = pyvista_miniply.read_as_mesh(filename)
223
+ ply_reader_time = time.time() - tstart
224
+
225
+ assert np.allclose(pv_mesh['Normals'], ply_mesh['Normals'])
226
+ assert np.allclose(pv_mesh.points, ply_mesh.points)
227
+ assert np.allclose(pv_mesh._connectivity_array, ply_mesh._connectivity_array)
228
+
229
+ times.append([mesh.n_points, vtk_time, ply_reader_time])
230
+ print(times[-1])
231
+
232
+
233
+ times = np.array(times)
234
+ plt.figure(1)
235
+ plt.title('PLY load time')
236
+ plt.plot(times[:, 0], times[:, 1], label='VTK')
237
+ plt.plot(times[:, 0], times[:, 2], label='pyvista-miniply')
238
+ plt.xlabel('Number of Points')
239
+ plt.ylabel('Time to Load (seconds)')
240
+ plt.legend()
241
+
242
+ plt.figure(2)
243
+ plt.title('PLY load time (Log-Log)')
244
+ plt.loglog(times[:, 0], times[:, 1], label='VTK')
245
+ plt.loglog(times[:, 0], times[:, 2], label='pyvista-miniply')
246
+ plt.xlabel('Number of Points')
247
+ plt.ylabel('Time to Load (seconds)')
248
+ plt.legend()
249
+ plt.show()
250
+
251
+ .. image:: https://github.com/pyvista/pyvista-miniply/raw/main/bench0.png
252
+
253
+ .. image:: https://github.com/pyvista/pyvista-miniply/raw/main/bench1.png
254
+
255
+ *****************************
256
+ License and Acknowledgments
257
+ *****************************
258
+
259
+ This project relies on ``miniply`` and credit goes to the original
260
+ author for the excellent C++ library. That work is licensed under the
261
+ MIT License.
262
+
263
+ The work in this repository is also licensed under the MIT License.
264
+
265
+ *********
266
+ Support
267
+ *********
268
+
269
+ If you are having issues, please feel free to raise an `Issue
270
+ <https://github.com/pyvista/pyvista-miniply/issues>`_.