def rect_prism_tolerance(curr, zero, one):
    """Computes a reward if curr is inside a rectangluar prism region.

    The 3d points curr and zero specify 2 diagonal corners of a rectangular
    prism that represents the decreasing region.

    one represents the corner of the prism that has a reward of 1.
    zero represents the diagonal opposite corner of the prism that has a reward
        of 0.
    Curr is the point that the prism reward region is being applied for.

    Args:
        curr(np.ndarray): The point who's reward is being assessed.
            shape is (3,).
        zero(np.ndarray): One corner of the rectangular prism, with reward 0.
            shape is (3,)
        one(np.ndarray): The diagonal opposite corner of one, with reward 1.
            shape is (3,)
    """
    in_range = lambda a, b, c: float(b <= a <= c) if c >= b else float(c <= a
                                                                       <= b)
    in_prism = (in_range(curr[0], zero[0], one[0])
                and in_range(curr[1], zero[1], one[1])
                and in_range(curr[2], zero[2], one[2]))
    if in_prism:
        diff = one - zero
        x_scale = (curr[0] - zero[0]) / diff[0]
        y_scale = (curr[1] - zero[1]) / diff[1]
        z_scale = (curr[2] - zero[2]) / diff[2]
        return x_scale * y_scale * z_scale
        # return 0.01
    else:
        return 1.