meshlabxml/transform.py
def rotate(script, axis='z', angle=0.0):
    """An alternative rotate implementation that uses a geometric function.
    This is more accurate than the built-in version."""
    angle = math.radians(angle)
    if axis.lower() == 'x':
        vert_function(script,
                 x_func='x',
                 y_func='y*cos({angle})-z*sin({angle})'.format(angle=angle),
                 z_func='y*sin({angle})+z*cos({angle})'.format(angle=angle))
    elif axis.lower() == 'y':
        vert_function(script,
                 x_func='z*sin({angle})+x*cos({angle})'.format(angle=angle),
                 y_func='y',
                 z_func='z*cos({angle})-x*sin({angle})'.format(angle=angle))
    elif axis.lower() == 'z':
        vert_function(script,
                 x_func='x*cos({angle})-y*sin({angle})'.format(angle=angle),
                 y_func='x*sin({angle})+y*cos({angle})'.format(angle=angle),
                 z_func='z')
    else:
        print('Axis name is not valid; exiting ...')
        sys.exit(1)
    return None
def rotate(script, axis='z', angle=0.0):
    """An alternative rotate implementation that uses a geometric function.
    This is more accurate than the built-in version."""
    angle = math.radians(angle)
    if axis.lower() == 'x':
        vert_function(script,
                 x_func='x',
                 y_func='y*cos({angle})-z*sin({angle})'.format(angle=angle),
                 z_func='y*sin({angle})+z*cos({angle})'.format(angle=angle))
    elif axis.lower() == 'y':
        vert_function(script,
                 x_func='z*sin({angle})+x*cos({angle})'.format(angle=angle),
                 y_func='y',
                 z_func='z*cos({angle})-x*sin({angle})'.format(angle=angle))
    elif axis.lower() == 'z':
        vert_function(script,
                 x_func='x*cos({angle})-y*sin({angle})'.format(angle=angle),
                 y_func='x*sin({angle})+y*cos({angle})'.format(angle=angle),
                 z_func='z')
    else:
        print('Axis name is not valid; exiting ...')
        sys.exit(1)
    return None
An alternative rotate implementation that uses a geometric function.
    This is more accurate than the built-in version.