def subtract_weight(distance, const=1.0):
    """
    权重函数: 距离的截断.
    :param distance: 距离
    :type distance: float
    :param const: 常量
    :type const: float
    :return: 权重值
    """
    if distance > const:
        return 0
    else:
        return const - distance