I have two huge tables with 7241 and 1469620 rows (700KB, 141MB)
listData =
Import["https://www.dropbox.com/s/s2p7sozkjt67tii/listdata.csv?dl=1", "CSV"];
whitepositions =
Import["https://www.dropbox.com/s/03qkfszuvq0qbut/whitepositions.csv?dl=1", "CSV"];
I have a Do loop and it takes a long time for running.
dl = DelaunayMesh[listData];
cells = MeshCells[dl, 2];
cellcoord = Map[MeshCoordinates[dl][[#]] &, cells, {2}];
Do[{mf[i] = RegionMember[cellcoord[[i]]];
tf[i] = mf[i][whitepositions];
tf[i] = Length[Cases[tf[i], True]]}, {i, 1, Length[cellcoord]}]
listData is a data stream of many seed points to generate a Delaunay mesh.
whitepositions is the white pixel coordinates from a binary image.
Is there any way to boost the efficiency?
Thank you!
Nearestand test only that one. If the test point is inside, you can skip testing all the other triangles. If it's not inside (hopefully rare), test all of them. – Niki Estner May 20 '17 at 09:26