def path_fraction_id_offset(points, fraction, relative_offset=False):
if not (<NUM_LIT:0.> <= fraction <= <NUM_LIT:1.0>):<EOL><INDENT>raise ValueError("<STR_LIT>" % fraction)<EOL><DEDENT>pts = np.array(points)[:, COLS.XYZ]<EOL>lengths = np.linalg.norm(np.diff(pts, axis=<NUM_LIT:0>), axis=<NUM_LIT:1>)<EOL>cum_lengths = np.cumsum(lengths)<EOL>offset = cum_lengths[-<NUM_LIT:1>] * fraction<EOL>seg_id = np.argmin(cum_lengths < offset)<EOL>if seg_id > <NUM_LIT:0>:<EOL><INDENT>offset -= cum_lengths[seg_id - <NUM_LIT:1>]<EOL><DEDENT>if relative_offset:<EOL><INDENT>offset /= lengths[seg_id]<EOL><DEDENT>return seg_id, offset<EOL>
Find the segment which corresponds to the fraction
    of the path length along the piecewise linear curve which
    is constructed from the set of points.

    Args:
        points: an iterable of indexable objects with indices
        0, 1, 2 correspoding to 3D cartesian coordinates
        fraction: path length fraction (0.0 <= fraction <= 1.0)
        relative_offset: return absolute or relative segment distance

    Returns:
        (segment ID, segment offset) pair.