Пример #1
0
def add_ups(node, h=0.1, **kwargs):
    if node.get('has_head', None) is True:
        nd = np.array(list(node.geom))
        nd[-1] += h
        new = Node(gutil.tuplify(nd), is_head=True)
        node.connect_to(new, remove_head=True, tap_edge=True)
        node.write('has_head', False)
        node.write('head_tee', True)
        new.write('$create', '$head')
    return node
Пример #2
0
def tap_is_input(node_in_tap, node_out1, node_out2, new_pnt):
    tap_edge, pred_node = node_in_tap.predecessors(both=True)[0]
    pt_tuple = gutil.tuplify(new_pnt.numpy)

    if tap_edge.curve.line.length < 1.:
        node_in_tap.geom = pt_tuple
        node_in = node_in_tap
        tap_edge.write('tap_edge', True)
    else:
        node_in = Node(pt_tuple, tee_index=0, tee_mid=True)
        node_in_tap.connect_to(node_in, **tap_edge.tmps, tap_edge=True)

    node_in.write('tap_input', False)
    node_in.write('is_tee', True)
    for n in [node_out1, node_out2]:
        o_edge, o_succ = n.successors(both=True)[0]
        node_in.connect_to(o_succ, **o_edge.tmps)
        o_edge.delete()
    return node_in