def test_inside_rect4(): offset_x = 1.9 offset_y = 1.9 tr = TestRectangle(-1, -1, 1, -1, 1, 1, -1, 1) tr2 = TestRectangle(-1 + offset_x, -1 + offset_y, 1 + offset_x, -1 + offset_y, 1 + offset_x, 1 + offset_y, -1 + offset_x, 1 + offset_y) r = approx( PSuperCollider.how_far_is_rectangle_a_inside_rectangle_b(tr, tr2), 0.1) tst(r)
def test_outside_rect4(): offset_x = -2.01 offset_y = 0.0 tr = TestRectangle(-1, -1, 1, -1, 1, 1, -1, 1) tr2 = TestRectangle(-1 + offset_x, -1 + offset_y, 1 + offset_x, -1 + offset_y, 1 + offset_x, 1 + offset_y, -1 + offset_x, 1 + offset_y) r = approx( PSuperCollider.how_far_is_rectangle_a_inside_rectangle_b(tr, tr2), -0.01) tst(r)