meshlabxml/mp_func.py
def vq_function(script, function='vi', normalize=False, color=False):
    """:Quality function using muparser to generate new Quality for every vertex<br>It's possibile to use the following per-vertex variables in the expression:<br>x, y, z, nx, ny, nz (normal), r, g, b (color), q (quality), rad, vi, <br>and all custom <i>vertex attributes</i> already defined by user.


    function function to generate new Quality for every vertex
    normalize if checked normalize all quality values in range [0..1]
    color if checked map quality generated values into per-vertex color

    """
    filter_xml = ''.join([
        '  <filter name="Per Vertex Quality Function">\n',
        '    <Param name="q" ',
        'value="{}" '.format(str(function).replace('&', '&amp;').replace('<', '&lt;')),
        'description="func q = " ',
        'type="RichString" ',
        '/>\n',
        '    <Param name="normalize" ',
        'value="{}" '.format(str(normalize).lower()),
        'description="normalize" ',
        'type="RichBool" ',
        '/>\n',
        '    <Param name="map" ',
        'value="{}" '.format(str(color).lower()),
        'description="map into color" ',
        'type="RichBool" ',
        '/>\n',
        '  </filter>\n'])
    util.write_filter(script, filter_xml)
    return None
def vq_function(script, function='vi', normalize=False, color=False):
    """:Quality function using muparser to generate new Quality for every vertex<br>It's possibile to use the following per-vertex variables in the expression:<br>x, y, z, nx, ny, nz (normal), r, g, b (color), q (quality), rad, vi, <br>and all custom <i>vertex attributes</i> already defined by user.


    function function to generate new Quality for every vertex
    normalize if checked normalize all quality values in range [0..1]
    color if checked map quality generated values into per-vertex color

    """
    filter_xml = ''.join([
        '  <filter name="Per Vertex Quality Function">\n',
        '    <Param name="q" ',
        'value="{}" '.format(str(function).replace('&', '&amp;').replace('<', '&lt;')),
        'description="func q = " ',
        'type="RichString" ',
        '/>\n',
        '    <Param name="normalize" ',
        'value="{}" '.format(str(normalize).lower()),
        'description="normalize" ',
        'type="RichBool" ',
        '/>\n',
        '    <Param name="map" ',
        'value="{}" '.format(str(color).lower()),
        'description="map into color" ',
        'type="RichBool" ',
        '/>\n',
        '  </filter>\n'])
    util.write_filter(script, filter_xml)
    return None
def vq_function ( script , function = 'vi' , normalize = False , color = False ) : filter_xml = '' . join ( [ '  <filter name="Per Vertex Quality Function">\n' , '    <Param name="q" ' , 'value="{}" ' . format ( str ( function ) . replace ( '&' , '&amp;' ) . replace ( '<' , '&lt;' ) ) , 'description="func q = " ' , 'type="RichString" ' , '/>\n' , '    <Param name="normalize" ' , 'value="{}" ' . format ( str ( normalize ) . lower ( ) ) , 'description="normalize" ' , 'type="RichBool" ' , '/>\n' , '    <Param name="map" ' , 'value="{}" ' . format ( str ( color ) . lower ( ) ) , 'description="map into color" ' , 'type="RichBool" ' , '/>\n' , '  </filter>\n' ] ) util . write_filter ( script , filter_xml ) return None
:Quality function using muparser to generate new Quality for every vertex<br>It's possibile to use the following per-vertex variables in the expression:<br>x, y, z, nx, ny, nz (normal), r, g, b (color), q (quality), rad, vi, <br>and all custom <i>vertex attributes</i> already defined by user.


    function function to generate new Quality for every vertex
    normalize if checked normalize all quality values in range [0..1]
    color if checked map quality generated values into per-vertex color
: Quality function using muparser to generate new Quality for every vertex<br > It s possibile to use the following per - vertex variables in the expression : <br > x y z nx ny nz ( normal ) r g b ( color ) q ( quality ) rad vi <br > and all custom <i > vertex attributes< / i > already defined by user .