Example #1
0
def test_intersect_lines_example_2():
    """
    This example tests the opposite direction cross product case.
    """
    p0, q0 = np.array([[5.0, 5.0, 4.0], [10.0, 10.0, -6.0]])
    p1, q1 = np.array([[5.0, 5.0, 5.0], [10.0, 10.0, -3.0]])
    np.testing.assert_array_equal(intersect_lines(p0, q0, p1, q1),
                                  [2.5, 2.5, 9])
Example #2
0
def test_intersect_lines_example_1():
    """
    This example tests the codirectional cross product case.
    """
    p0, q0 = np.array([[5.0, 5.0, 4.0], [10.0, 10.0, 6.0]])
    p1, q1 = np.array([[5.0, 5.0, 5.0], [10.0, 10.0, 3.0]])
    np.testing.assert_array_equal(intersect_lines(p0, q0, p1, q1),
                                  [25.0 / 4, 25.0 / 4, 9.0 / 2])
Example #3
0
def test_intersect_lines_example_3():
    p0, q0 = np.array([[6.0, 8.0, 4.0], [12.0, 15.0, 4.0]])
    p1, q1 = np.array([[6.0, 8.0, 2.0], [12.0, 15.0, 6.0]])
    np.testing.assert_array_equal(intersect_lines(p0, q0, p1, q1),
                                  [9.0, 23.0 / 2, 4.0])
Example #4
0
def test_intersect_lines_with_degenerate_input_q_2():
    p0, q0 = np.array([[0.0, 1.0, 2.0], [0.0, 10.0, 20.0]])
    p1, q1 = np.array([[0.0, 10.0, 20.0], [1.0, 2.0, 3.0]])
    np.testing.assert_array_equal(intersect_lines(p0, q0, p1, q1),
                                  [0.0, 10.0, 20.0])
Example #5
0
def test_intersect_lines_in_parallel_planes():
    p0, q0 = np.array([[0.0, 1.0, 0.0], [1.0, 0.0, 0.0]])
    p1, q1 = np.array([[0.0, 0.0, 1.0], [1.0, 1.0, 1.0]])
    assert intersect_lines(p0, q0, p1, q1) is None
Example #6
0
def test_intersect_lines_with_parallel_lines():
    p0, q0 = np.array([[0.0, 1.0, 2.0], [0.0, 10.0, 20.0]])
    p1, q1 = np.array([[1.0, 2.0, 3.0], [1.0, 11.0, 21.0]])
    assert intersect_lines(p0, q0, p1, q1) is None
Example #7
0
def test_intersect_lines_with_collinear_lines():
    p0, q0 = np.array([[0.0, 1.0, 2.0], [0.0, 10.0, 20.0]])
    p1, q1 = np.array([[0.0, 2.0, 4.0], [0.0, 4.0, 8.0]])
    assert intersect_lines(p0, q0, p1, q1) is None