meshlabxml/transform.py
def radial_flare2(script, flare_radius=None, start_radius=None, end_radius=None,
                  end_height=None):
    """
    flare_radius must be >= end_height (height)
    end_radius max = flare_radius + r
    
    end_radius (num): radius of mesh at end of flare
    
    +15 r= 8.8205
    -15 r= 1.1795
    
    z=10, 5 +/-15 - +/-15*0.74535599249992989880305788957709
    """
    # TODO: set radius limit, make it so flare continues to expand linearly after radius limit
    # if(r<=radius_limit, flare, factor*z+constant
    # TODO: add option to specify radius at height instead of radius
    if (end_radius is not None) and (end_height is not None):
        # this is only correct if r is constant
        # start_radius here is really r at end_height
        #flare_radius = '-((start_radius-end_radius)^2 + end_height^2)/(2*(start_radius-end_radius))'
        if (end_radius - start_radius) < end_height:
            flare_radius = -((start_radius-end_radius)**2 + end_height**2)/(2*(start_radius-end_radius))
            #print('flare_radius = %s' % flare_radius)
        else:
            print('Error, end_radius is too large for end_height; angle is > 90d')

    r_func = 'if(z>0, (r) + (flare_radius) - (flare_radius)*sqrt(1-z^2/(flare_radius)^2), (r))'.replace('flare_radius', str(flare_radius))
    #r_func = 'if(z>0, (r) + (flare_radius) - (flare_radius)*sqrt(1-z^2/(flare_radius)^2), (r))'.replace('flare_radius', str(flare_radius)).replace('start_radius', str(start_radius)).replace('end_radius', str(end_radius)).replace('end_height', str(end_height))
    function_cyl_co(script, r_func)
    return None
def radial_flare2(script, flare_radius=None, start_radius=None, end_radius=None,
                  end_height=None):
    """
    flare_radius must be >= end_height (height)
    end_radius max = flare_radius + r
    
    end_radius (num): radius of mesh at end of flare
    
    +15 r= 8.8205
    -15 r= 1.1795
    
    z=10, 5 +/-15 - +/-15*0.74535599249992989880305788957709
    """
    # TODO: set radius limit, make it so flare continues to expand linearly after radius limit
    # if(r<=radius_limit, flare, factor*z+constant
    # TODO: add option to specify radius at height instead of radius
    if (end_radius is not None) and (end_height is not None):
        # this is only correct if r is constant
        # start_radius here is really r at end_height
        #flare_radius = '-((start_radius-end_radius)^2 + end_height^2)/(2*(start_radius-end_radius))'
        if (end_radius - start_radius) < end_height:
            flare_radius = -((start_radius-end_radius)**2 + end_height**2)/(2*(start_radius-end_radius))
            #print('flare_radius = %s' % flare_radius)
        else:
            print('Error, end_radius is too large for end_height; angle is > 90d')

    r_func = 'if(z>0, (r) + (flare_radius) - (flare_radius)*sqrt(1-z^2/(flare_radius)^2), (r))'.replace('flare_radius', str(flare_radius))
    #r_func = 'if(z>0, (r) + (flare_radius) - (flare_radius)*sqrt(1-z^2/(flare_radius)^2), (r))'.replace('flare_radius', str(flare_radius)).replace('start_radius', str(start_radius)).replace('end_radius', str(end_radius)).replace('end_height', str(end_height))
    function_cyl_co(script, r_func)
    return None
def radial_flare2 ( script , flare_radius = None , start_radius = None , end_radius = None , end_height = None ) : # TODO: set radius limit, make it so flare continues to expand linearly after radius limit # if(r<=radius_limit, flare, factor*z+constant # TODO: add option to specify radius at height instead of radius if ( end_radius is not None ) and ( end_height is not None ) : # this is only correct if r is constant # start_radius here is really r at end_height #flare_radius = '-((start_radius-end_radius)^2 + end_height^2)/(2*(start_radius-end_radius))' if ( end_radius - start_radius ) < end_height : flare_radius = - ( ( start_radius - end_radius ) ** 2 + end_height ** 2 ) / ( 2 * ( start_radius - end_radius ) ) #print('flare_radius = %s' % flare_radius) else : print ( 'Error, end_radius is too large for end_height; angle is > 90d' ) r_func = 'if(z>0, (r) + (flare_radius) - (flare_radius)*sqrt(1-z^2/(flare_radius)^2), (r))' . replace ( 'flare_radius' , str ( flare_radius ) ) #r_func = 'if(z>0, (r) + (flare_radius) - (flare_radius)*sqrt(1-z^2/(flare_radius)^2), (r))'.replace('flare_radius', str(flare_radius)).replace('start_radius', str(start_radius)).replace('end_radius', str(end_radius)).replace('end_height', str(end_height)) function_cyl_co ( script , r_func ) return None
flare_radius must be >= end_height (height)
    end_radius max = flare_radius + r
    
    end_radius (num): radius of mesh at end of flare
    
    +15 r= 8.8205
    -15 r= 1.1795
    
    z=10, 5 +/-15 - +/-15*0.74535599249992989880305788957709
flare_radius must be > = end_height ( height ) end_radius max = flare_radius + r end_radius ( num ) : radius of mesh at end of flare + 15 r = 8 . 8205 - 15 r = 1 . 1795 z = 10 5 + / - 15 - + / - 15 * 0 . 74535599249992989880305788957709