PercentageValue

The PercentageValue class is a simple class that allows to pass some parameters to filters as a Percentage of something (specified on the documentation of every filter). A PercentageValue object contains a single float value bounded between 0 and 100.

Here is a simple example of usage of the class:

ms = pymeshlab.MeshSet()
[...]
ms.generate_resampled_uniform_mesh(cellsize=PercentageValue(2.0), offset=PercentageValue(30.0))

In this case the filter will make an uniform resampling of the input mesh using a grid with a cell size of 2% of the diagonal of the bounding box of the mesh. This class is necessary to distinguish between relative Percentage values and absolute values (which are of type PureValue).

Check the Apply Filter Parameters: Ranged Percentage tutorial for further examples.

class pmeshlab.PercentageValue
__init__(self: pmeshlab.PercentageValue, arg0: float) None

Constructor of the Percentage class. Takes as input a float value between 0 and 100 (default: 0) and initializes the percentage. Raises a InvalidPercentageException if the value is not between 0 and 100.

set_value(self: pmeshlab.PercentageValue, arg0: float) None

Sets the value of the percentage. Raises a InvalidPercentageException if the value is not between 0 and 100.

value(self: pmeshlab.PercentageValue) float

Returns the value of the percentage [0-100].