From add21ddcb968ce74f821ed411ae134e897c42839 Mon Sep 17 00:00:00 2001 From: Alessandro Muntoni Date: Thu, 16 Nov 2023 10:42:03 +0100 Subject: [PATCH 1/2] fix import custom point attributes, fix #335 --- .../tests/example_custom_mesh_attributes.py | 22 +++++++++++++++++++ src/meshlab | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/pymeshlab/tests/example_custom_mesh_attributes.py b/pymeshlab/tests/example_custom_mesh_attributes.py index 90176e88..b5bd4fd5 100644 --- a/pymeshlab/tests/example_custom_mesh_attributes.py +++ b/pymeshlab/tests/example_custom_mesh_attributes.py @@ -1,4 +1,5 @@ import pymeshlab +import numpy def example_custom_mesh_attributes(): @@ -51,3 +52,24 @@ def example_custom_mesh_attributes(): # - __ca_fs__: Custom Attribute Face Scalar; # - __ca_fp__: Custom Attribute Face Point; ms.save_current_mesh(output_path + 'cube_custom_attr.ply', binary=False, __ca_vs__v_attr=True) + + # add a point attribute manually using numpy array + + # generate numpy array + attrs = numpy.array([ + [-0.5, -0.5, -0.5], + [0.5, -0.5, -0.5], + [-0.5, 0.5, -0.5], + [0.5, 0.5, -0.5], + [-0.5, -0.5, 0.5], + [0.5, -0.5, 0.5], + [-0.5, 0.5, 0.5], + [0.5, 0.5, 0.5]]) + + # add a new custom point attribute + m.add_vertex_custom_point_attribute(attrs, 'numpy_attr') + + # get the attribute and print it + ret_attr = m.vertex_custom_point_attribute_matrix('numpy_attr') + + print(ret_attr) \ No newline at end of file diff --git a/src/meshlab b/src/meshlab index 30bd2e8b..06c2e556 160000 --- a/src/meshlab +++ b/src/meshlab @@ -1 +1 @@ -Subproject commit 30bd2e8bb898855f9c687eb83d7a0a9688c9c1bb +Subproject commit 06c2e556beed1b1f86a4870920f81db89a93e763 From 330d0b5a50ee930c30ef27c2bb881b2ef3443c2d Mon Sep 17 00:00:00 2001 From: Alessandro Muntoni Date: Mon, 20 Nov 2023 14:51:54 +0100 Subject: [PATCH 2/2] docs: floating point precision paragraph --- docs/index.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/index.rst b/docs/index.rst index 92653661..a186f5e4 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -14,6 +14,13 @@ PyMeshLab is a Python library that interfaces to `MeshLab`_, the popular open so about +Floating point precision +======================== + +Unlike the default version of MeshLab, PyMeshLab is built using double precision floating point numbers, that is the default precision used in Python. This allows to avoid precision loss when importing and exporting meshes, and when applying filters to them. +Therefore, some filters can behave differently from the default MeshLab version, especially those that are sensible to precision loss. To replicate the PyMeshLab behavior in MeshLab, you can use the double precision, which is available for download in the MeshLab repository +with a version number having the suffix "d" (e.g. MeshLab2022.02d). + Filters renaming ================