示例#1
0
def test_x_translation():
    t = Transform()

    p = np.array([
        [0, 0, 0, 1],
    ], dtype="float64")

    expect_p = np.array([
        [1, 0, 0, 1],
    ], dtype="float64")

    t.set_translation(x=1)
    new_p = p @ t.view_matrix

    assert np.all(new_p == expect_p), "Translation for X axis does not correct"
示例#2
0
def test_all_translation():
    t = Transform()

    p = np.array([
        [0, 0, 0, 1],
    ], dtype="float64")

    expect_p = np.array([
        [100, 12, -2, 1],
    ], dtype="float64")

    t.set_translation(x=100, y=12, z=-2)
    new_p = p @ t.view_matrix

    assert np.all(
        new_p == expect_p), "Translation for ALL axis does not correct"