Exemplo n.º 1
0
def test_vector_rotate():
    assert fp_vectors_equal(X.rotate(90, about=X), X)
    assert fp_vectors_equal(X.rotate(90, about=Y), -Z)
    assert fp_vectors_equal(X.rotate(90, about=Z), Y)
    assert fp_vectors_equal(X.rotate(90, about=-X), X)
    assert fp_vectors_equal(X.rotate(90, about=-Y), Z)
    assert fp_vectors_equal(X.rotate(90, about=-Z), -Y)
    assert fp_vectors_equal(X.rotate(180, about=X + Y), Y)
    assert fp_vectors_equal(O.rotate(180, about=Y, origin=Z), 2*Z)
Exemplo n.º 2
0
def test_vector_rotate():
    assert fp_vectors_equal(X.rotate(90, about=X), X)
    assert fp_vectors_equal(X.rotate(90, about=Y), -Z)
    assert fp_vectors_equal(X.rotate(90, about=Z), Y)
    assert fp_vectors_equal(X.rotate(90, about=-X), X)
    assert fp_vectors_equal(X.rotate(90, about=-Y), Z)
    assert fp_vectors_equal(X.rotate(90, about=-Z), -Y)
    assert fp_vectors_equal(X.rotate(180, about=X + Y), Y)
    assert fp_vectors_equal(O.rotate(180, about=Y, origin=Z), 2 * Z)
Exemplo n.º 3
0
def test_vector_project():
    assert fp_equal(X.project(X), 1.0)
    assert fp_equal(X.project(Y), 0.0)
    assert fp_equal(X.project(Z), 0.0)
    assert fp_equal(Vector(1, 2, 3).project(2 * Y), 2.0)
    assert fp_equal(Vector(3, 4, 5).project(Vector(3, 4, 0)), 5.0)
Exemplo n.º 4
0
def test_vector_angle_between():
    assert fp_equal(X.angle_between(Y), 90.0)
    assert fp_equal(Y.angle_between(Z), 90.0)
    assert fp_equal((X + Y).angle_between(X), 45.0)
Exemplo n.º 5
0
def test_vector_project():
    assert fp_equal(X.project(X), 1.0)
    assert fp_equal(X.project(Y), 0.0)
    assert fp_equal(X.project(Z), 0.0)
    assert fp_equal(Vector(1, 2, 3).project(2 * Y), 2.0)
    assert fp_equal(Vector(3, 4, 5).project(Vector(3, 4, 0)), 5.0)
Exemplo n.º 6
0
def test_vector_angle_between():
    assert fp_equal(X.angle_between(Y), 90.0)
    assert fp_equal(Y.angle_between(Z), 90.0)
    assert fp_equal((X + Y).angle_between(X), 45.0)