show_xyz_arrows.py
def draw_arrow(xyz1,xyz2, radius=0.5, gap=0.0, hlength=-1, hradius=-1,
              color='blue red', name=''):
    '''
Draw an arrow; borrows heavily from cgi arrows.
    '''
    radius, gap = float(radius), float(gap)
    hlength, hradius = float(hlength), float(hradius)
    xyz1 = list(xyz1)
    xyz2 = list(xyz2)
    try:
        color1, color2 = color.split()
    except:
        color1 = color2 = color
    color1 = list(cmd.get_color_tuple(color1))
    color2 = list(cmd.get_color_tuple(color2))

    normal = cpv.normalize(cpv.sub(xyz1, xyz2))

    if hlength < 0:
        hlength = radius * 3.0
    if hradius < 0:
        hradius = hlength * 0.6

    if gap:
        diff = cpv.scale(normal, gap)
        xyz1 = cpv.sub(xyz1, diff)
        xyz2 = cpv.add(xyz2, diff)

    xyz3 = cpv.add(cpv.scale(normal, hlength), xyz2)

    obj = [cgo.CYLINDER] + xyz1 + xyz3 + [radius] + color1 + color2 + \
          [cgo.CONE] + xyz3 + xyz2 + [hradius, 0.0] + color2 + color2 + \
          [1.0, 0.0]

    if not name:
        name = cmd.get_unused_name('arrow')

    cmd.load_cgo(obj, name)

Draw an arrow; borrows heavily from cgi arrows.
    
Draw an arrow; borrows heavily from cgi arrows.
Draw an arrow ; borrows heavily from cgi arrows .
def draw_arrow(xyz1,xyz2, radius=0.5, gap=0.0, hlength=-1, hradius=-1,
              color='blue red', name=''):
    radius, gap = float(radius), float(gap)
    hlength, hradius = float(hlength), float(hradius)
    xyz1 = list(xyz1)
    xyz2 = list(xyz2)
    try:
        color1, color2 = color.split()
    except:
        color1 = color2 = color
    color1 = list(cmd.get_color_tuple(color1))
    color2 = list(cmd.get_color_tuple(color2))
    normal = cpv.normalize(cpv.sub(xyz1, xyz2))
    if hlength < 0:
        hlength = radius * 3.0
    if hradius < 0:
        hradius = hlength * 0.6
    if gap:
        diff = cpv.scale(normal, gap)
        xyz1 = cpv.sub(xyz1, diff)
        xyz2 = cpv.add(xyz2, diff)
    xyz3 = cpv.add(cpv.scale(normal, hlength), xyz2)
    obj = [cgo.CYLINDER] + xyz1 + xyz3 + [radius] + color1 + color2 + \
          [cgo.CONE] + xyz3 + xyz2 + [hradius, 0.0] + color2 + color2 + \
          [1.0, 0.0]
    if not name:
        name = cmd.get_unused_name('arrow')
    cmd.load_cgo(obj, name)
def draw_arrow ( xyz1 , xyz2 , radius = 0.5 , gap = 0.0 , hlength = - 1 , hradius = - 1 , color = 'blue red' , name = '' ) : radius , gap = float ( radius ) , float ( gap ) hlength , hradius = float ( hlength ) , float ( hradius ) xyz1 = list ( xyz1 ) xyz2 = list ( xyz2 ) try : color1 , color2 = color . split ( ) except : color1 = color2 = color color1 = list ( cmd . get_color_tuple ( color1 ) ) color2 = list ( cmd . get_color_tuple ( color2 ) ) normal = cpv . normalize ( cpv . sub ( xyz1 , xyz2 ) ) if hlength < 0 : hlength = radius * 3.0 if hradius < 0 : hradius = hlength * 0.6 if gap : diff = cpv . scale ( normal , gap ) xyz1 = cpv . sub ( xyz1 , diff ) xyz2 = cpv . add ( xyz2 , diff ) xyz3 = cpv . add ( cpv . scale ( normal , hlength ) , xyz2 ) obj = [ cgo . CYLINDER ] + xyz1 + xyz3 + [ radius ] + color1 + color2 + [ cgo . CONE ] + xyz3 + xyz2 + [ hradius , 0.0 ] + color2 + color2 + [ 1.0 , 0.0 ] if not name : name = cmd . get_unused_name ( 'arrow' ) cmd . load_cgo ( obj , name )
Draw an arrow; borrows heavily from cgi arrows.
Draw an arrow ; borrows heavily from cgi arrows .
'''
Draw an arrow; borrows heavily from cgi arrows.
    '''
xyz1
xyz2
radius
gap
hlength
hradius
color
name