示例#1
0
def arc_chord_2_angle( A_C, C, eps=1.0E-7 ):
    """Use bisection to find the angle that gives the proper
    arc and chord information.

    ..  todo:: move this to propcirc, where it belongs.
    """
    def f_a_c_ac( A_r ):
        return A_r/math.sin( A_r/2 ) - 2*A_C/C
    return bisection( f_a_c_ac, eps, math.pi, eps )
示例#2
0
def design_final( shape, **args ):
    """Given a shape (Square or Circle),
    and some parameters, final design.

    :param V: target volume
    :param N: given angle
    :param D: given size or diameter
    :param M: hopper height, larger than the minimum
    :returns: dict with design parameters added.
    """
    args= AttrDict( args )
    def height_from_h( H ):
        args.H = H
        shape.height( args )
        return args.K - args.M
    args.H = bisection( height_from_h, args.M, args.H-1 )
    return args
示例#3
0
def design_hopper( shape, **args ):
    """Given a shape (Square or Circle),
    and some parameters, initial design with
    minimum height, H, for the hopper.

    :param V: target volume
    :param N: given angle
    :param D: given size or diameter
    :returns: dict with design parameters added.
    """
    args= AttrDict( args )
    def hopper_vol_from_h( H ):
        args.H = H
        shape.volume( args )
        return args.V - args.V_H
    # In principle, we should develop a rational upper limit.
    # The overall volume, though, is a good estimator for the
    # upper bound.
    args.H = bisection( hopper_vol_from_h, 0, args.V )
    return args