diff --git a/docs/index.rst b/docs/index.rst index 9265366..a186f5e 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 ================ diff --git a/pymeshlab/tests/example_custom_mesh_attributes.py b/pymeshlab/tests/example_custom_mesh_attributes.py index 90176e8..b5bd4fd 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