Exemple #1
0
def test_scalar_projection_collinear():
    v1 = np.array([1., 2., 0.])
    v2 = np.array([4., 8., 0.])

    res = mm.scalar_projection(v1, v2)

    assert np.allclose(res, 20. / np.linalg.norm(v2))
Exemple #2
0
def test_scalar_projection_collinear():
    v1 = np.array([1., 2., 0.])
    v2 = np.array([4., 8., 0.])

    res = mm.scalar_projection(v1, v2)

    nt.assert_true(np.allclose(res, 20./np.linalg.norm(v2)))
Exemple #3
0
def test_scalar_projection_perpendicular():
    v1 = np.array([3., 0., 0.])
    v2 = np.array([0., 1.5, 0.])

    res = mm.scalar_projection(v1, v2)
    assert np.allclose(res, 0.)
Exemple #4
0
def test_scalar_projection():
    v1 = np.array([4., 1., 0.])
    v2 = np.array([2., 3., 0.])

    res = mm.scalar_projection(v1, v2)
    assert np.isclose(res, 3.0508510792387602)
Exemple #5
0
def test_scalar_projection_perpendicular():
    v1 = np.array([3., 0., 0.])
    v2 = np.array([0., 1.5, 0.])

    res = mm.scalar_projection(v1, v2)
    nt.assert_true(np.allclose(res, 0.))
Exemple #6
0
def test_scalar_projection():
    v1 = np.array([4., 1., 0.])
    v2 = np.array([2., 3., 0.])

    res = mm.scalar_projection(v1, v2)
    nt.assert_true(np.isclose(res, 3.0508510792387602))