def intersect_line_ray(lineSeg, raySeg):
    """ Constructs a line from the start and end points of a given line 
    segment, and finds the intersection between that line and a ray 
    constructed from the start and end points of a given ray segment.
    
    If there is no intersection (i.e. the ray goes in the opposite direction 
    or the ray is parallel to the line), returns None.
    
    """
    
    lineStart, lineEnd = lineSeg
    rayStart, rayEnd = raySeg
    
    lineVector = (lineEnd[0] - lineStart[0], lineEnd[1] - lineStart[1])
    rayVector = (rayEnd[0] - rayStart[0], rayEnd[1] - rayStart[1])
    
    p1x, p1y = lineStart
    p2x, p2y = rayStart
    
    d1x, d1y = lineVector
    d2x, d2y = rayVector
    
    # Check if the ray is parallel to the line.
    parallel = (
        (d1x == 0 and d2x == 0)
        or ((d1x != 0 and d2x != 0) and
            (float(d1y) / d1x == float(d2y) / d2x))
    )
    
    intersection = None
    
    # Only non-parallel lines can ever intersect.
    if not parallel:
        # Parametrize the line and ray to find the intersection.
        parameter = (
            float(p2y * d1x - p1y * d1x - p2x * d1y + p1x * d1y)
            / (d2x * d1y - d1x * d2y)
        )
        
        # Only consider intersections that occur in front of the ray.
        if parameter >= 0:
            intersection = (
                p2x + parameter * d2x,
                p2y + parameter * d2y,
            )
            
    return intersection