示例#1
0
def test_find_nn_triangles_point():
    r"""Test find natural neighbors for a point function."""
    x = list(range(10))
    y = list(range(10))
    gx, gy = np.meshgrid(x, y)
    pts = np.vstack([gx.ravel(), gy.ravel()]).T
    tri = Delaunay(pts)

    tri_match = tri.find_simplex([4.5, 4.5])

    truth = [62, 63]

    nn = find_nn_triangles_point(tri, tri_match, [4.5, 4.5])

    assert_array_almost_equal(truth, nn)
示例#2
0
def test_find_nn_triangles_point():
    r"""Test find natural neighbors for a point function."""
    x = list(range(10))
    y = list(range(10))
    gx, gy = np.meshgrid(x, y)
    pts = np.vstack([gx.ravel(), gy.ravel()]).T
    tri = Delaunay(pts)

    tri_match = tri.find_simplex([4.5, 4.5])

    truth = [62, 63]

    nn = find_nn_triangles_point(tri, tri_match, [4.5, 4.5])

    assert_array_almost_equal(truth, nn)
示例#3
0
def test_find_local_boundary():
    r"""Test find edges of natural neighbor triangle group function."""
    x = list(range(10))
    y = list(range(10))
    gx, gy = np.meshgrid(x, y)
    pts = np.vstack([gx.ravel(), gy.ravel()]).T
    tri = Delaunay(pts)

    tri_match = tri.find_simplex([4.5, 4.5])

    nn = find_nn_triangles_point(tri, tri_match, [4.5, 4.5])

    edges = find_local_boundary(tri, nn)

    truth = [(45, 55), (44, 45), (55, 54), (54, 44)]

    assert_array_almost_equal(truth, edges)
示例#4
0
def test_find_local_boundary():
    r"""Test find edges of natural neighbor triangle group function."""
    x = list(range(10))
    y = list(range(10))
    gx, gy = np.meshgrid(x, y)
    pts = np.vstack([gx.ravel(), gy.ravel()]).T
    tri = Delaunay(pts)

    tri_match = tri.find_simplex([4.5, 4.5])

    nn = find_nn_triangles_point(tri, tri_match, [4.5, 4.5])

    edges = find_local_boundary(tri, nn)

    truth = [(45, 55), (44, 45), (55, 54), (54, 44)]

    assert_array_almost_equal(truth, edges)