コード例 #1
0
def test_inside_rect4b():
    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 = PSuperCollider.has_rectangle_a_points_inside_rectangle_b(tr,
                                                                 tr2) == True
    tst(r)
コード例 #2
0
def test_outside_rect4b():
    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 = PSuperCollider.has_rectangle_a_points_inside_rectangle_b(tr,
                                                                 tr2) == False
    tst(r)
コード例 #3
0
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)
コード例 #4
0
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)
コード例 #5
0
def test_outside2c():
    dx = 0.01
    tr = TestRectangle(1, 0, 2, 1, 1, 2, 0, 1)
    r = PSuperCollider.is_point_inside_rectangle(1.5 + dx, 1.5, tr) == False
    tst(r)
コード例 #6
0
def test_outside4b():
    tr = TestRectangle(1, 1, 2, 1, 2, 3, 1, 3)
    r = PSuperCollider.is_point_inside_rectangle(1.5, 3.3, tr) == False
    tst(r)
コード例 #7
0
def test_outside4():
    tr = TestRectangle(1, 1, 2, 1, 2, 3, 1, 3)
    r = approx(
        PSuperCollider.how_far_is_point_inside_of_rectangle(1.5, 3.3, tr),
        -0.3)
    tst(r)
コード例 #8
0
def test_outside2():
    tr = TestRectangle(1, 1, 2, 1, 2, 3, 1, 3)
    r = approx(
        PSuperCollider.how_far_is_point_inside_of_rectangle(2.1, 1.1, tr),
        -0.1)
    tst(r)
コード例 #9
0
def test_inside3():
    tr = TestRectangle(1, 1, 2, 1, 2, 3, 1, 3)
    r = approx(
        PSuperCollider.how_far_is_point_inside_of_rectangle(1.5, 1.2, tr), 0.2)
    tst(r)
コード例 #10
0
def test_inside4c():
    dx = 0.01
    tr = TestRectangle(1, 0, 2, 1, 1, 2, 0, 1)
    r = PSuperCollider.is_point_inside_rectangle(0.5 + dx, 0.5, tr) == True
    tst(r)