def approx_segment_length2(segment):
    """
    calculate approximate squared segment length
    """

    pt1 = segment.points[0]
    pt2 = segment.points[-1]
    return (pt1.x - pt2.x)**2 + (pt1.y - pt2.y)**2