Jan-16-2021, 07:52 PM
Thank you so much for your kind help.
I tried the following code. it seems to work for huge number of points.
I appreciate your support for any further hints :-)
I tried the following code. it seems to work for huge number of points.
import numpy as np import matplotlib.pyplot as plt import matplotlib.tri as mtri np.random.seed(0) axes=plt.axes() x=np.random.random(10000) y=np.random.random(10000) axes.set_xlim([0,1]) axes.set_ylim([0,1]) plt.scatter(x,y) plt.show() # # Delanuay Triangulation method triang = mtri.Triangulation(x, y) #plt.triplot(triang, 'ro:') AZ=triang.neighbors print(AZ) # VerticesNodesNumbers = VNN VNN = triang.triangles print(VNN) a,b=VNN.shape print(a) #print("x\n{}\n".format(x)) #print("y\n{}\n".format(y)) Arealiste=[] # in order to calculate the area of each single triangle, we need to scann # the VNN 2D Array by the number of raws only. for i in range(a): t1=(x[VNN[i][0]])*((y[VNN[i][1]])-(y[VNN[i][2]])) t2=(x[VNN[i][1]])*((y[VNN[i][2]])-(y[VNN[i][0]])) t3=(x[VNN[i][2]])*((y[VNN[i][0]])-(y[VNN[i][1]])) Arealiste.append(abs((t1+t2+t3)/2)) #print(Arealiste) Areas=np.array(Arealiste) #print(Areas) print(np.sum(Areas)) k=(Areas/(np.sum(Areas)))*100 #print(k) # we can now plot the histogram of the area distribution of the triangles:-) plt.hist(k,1000) plt.show()Could you please check?
I appreciate your support for any further hints :-)