Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
alemuntoni committed Nov 22, 2023
2 parents dbdaa50 + 330d0b5 commit 4f1d5e9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
================

Expand Down
22 changes: 22 additions & 0 deletions pymeshlab/tests/example_custom_mesh_attributes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pymeshlab
import numpy


def example_custom_mesh_attributes():
Expand Down Expand Up @@ -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)

0 comments on commit 4f1d5e9

Please sign in to comment.