Пример #1
0
def i_segment_radial_dist(pos, tree):
    '''Return an iterator of radial distances of tree segments to a given point

    The radial distance is the euclidian distance between the mid-point of
    the segment and the point in question.

    Parameters:
        pos: origin to which disrances are measured. It must have at least 3
        components. The first 3 components are (x, y, z).

        tree: tree of raw data rows.

    '''
    return tr.imap_val(lambda s: mm.segment_radial_dist(s, pos), tr.isegment(tree))
Пример #2
0
def i_segment_radial_dist(pos, tree):
    '''Return an iterator of radial distances of tree segments to a given point

    The radial distance is the euclidian distance between the mid-point of
    the segment and the point in question.

    Parameters:
        pos: origin to which disrances are measured. It must have at least 3
        components. The first 3 components are (x, y, z).

        tree: tree of raw data rows.

    '''
    return tr.imap_val(lambda s: mm.segment_radial_dist(s, pos),
                       tr.isegment(tree))
Пример #3
0
def test_segment_radial_dist():
    seg = ((11,11,11), (33, 33, 33))
    nt.assert_almost_equal(segment_radial_dist(seg, (0,0,0)),
                           point_dist((0,0,0), (22,22,22)))
Пример #4
0
 def _rad_dist(segment):
     '''Capture pos and invoke radial distance calculation'''
     return mm.segment_radial_dist(segment, pos)