0
Hello.
I created the following array numpy
as below:
import numpy as np
x = [350, 500, 800, 900, 1000]
y = [1100, 900, 1250, 650, 1200]
z = [50, 150, 300, 200, 500]
arr_2d = np.array(list(zip(x, y)))
arr_2d
array([[ 350, 1100],
[ 500, 900],
[ 800, 1250],
[ 900, 650],
[1000, 1200]])
After processing this one array with scipy.spatial.Delaunay
I got the following:
from scipy.spatial import Delaunay
malha = Delaunay(arr_2d)
triangulos = arr_2d[malha.simplices]
triangulos
array([[[ 800, 1250],
[ 900, 650],
[1000, 1200]],
[[ 800, 1250],
[ 500, 900],
[ 900, 650]],
[[ 500, 900],
[ 800, 1250],
[ 350, 1100]]])
Now, I’d like to incorporate the values of z
at the array triangulos
so that the new array is equal to the following:
array([[[ 800, 1250, 300],
[ 900, 650, 200],
[1000, 1200, 500]],
[[ 800, 1250, 300],
[ 500, 900, 150],
[ 900, 650, 200]],
[[ 500, 900, 150],
[ 800, 1250, 300],
[ 350, 1100, 50]]])
I need to implement this to a data that has more than 11,000 lines. Any suggestions how to proceed? Any help will be very welcome. Thank you.