def segDistance(dr,k,len_a):
    """
    Computes the distance from dr to k on a segment a.
    
    Parameters
    ----------
    dr : (is_seg,sk or None,sin_theta or q-value)
        dist rep of segament B.
        
    k: k-value along segment a.
    
    len_a: length of segment a. 
    Returns
    ----------
    float
        The distance from dr to k on segment a.
        
    @author: megshithakur and Farouk
    """
    # check if segments are parallel
    if dr[1] == None:
        return dr[2] * len_a
    else: # normal case
        # segDistance formula
        segDist=abs((k-dr[1])*len_a*dr[2])
        return segDist